feat(logistique) : pesée pont bascule stub + DSD + endpoint (ERP-184) #134
Reference in New Issue
Block a user
Delete Branch "feat/erp-184-pesee-pont-bascule"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ERP-184 (M5 · 1.4) — Pesée pont bascule (stub + DSD + endpoint)
Spec :
docs/specs/M5-tickets-pesee/spec-back.md(§ 2.6, § 2.7, § 4.2). Prérequis : ERP-182/183.Contenu
WeighbridgeReaderInterface(contrat domaine) +RandomWeighbridgeReader: stub du pont (aucune liaison matérielle), poids aléatoire ∈ [10000,50000] kg (RG-5.06). Driver réel = hors périmètre (HP-M5-02), substituable derrière l'interface.WeighbridgeUnavailableException(domaine pure) → traduite en HTTP 503 par le Processor.DsdAllocator: compteur DSD par site (weighbridge_dsd_counter), incrément sous verrou ligneSELECT ... FOR UPDATEen transaction (RG-5.04). AUTO et MANUAL =dernier + 1.POST /api/weighbridge_readings: ressource virtuelleWeighbridgeReadingResource+WeighbridgeReadingProcessor(pas de controller, statut 200).{mode: AUTO}→{weight, dsd, mode}(site courant viaCurrentSiteProviderInterface).{mode: MANUAL, weight, manualNumber}→{weight, dsd, manualNumber, mode}.is_granted('logistique.weighing_tickets.manage').dsdrenvoyé est prévisionnel : attribution autoritaire refaite à la création du ticket (ERP-185).Tests (
make test✅ 811 tests OK)WeighbridgeReaderStubTest: poids borné [10000,50000], DSD délégué.DsdAllocatorTest: incrément séquentiel + isolation par site (DBAL réel).WeighbridgeReadingProcessorTest: AUTO / MANUAL / 503 / 400 (sans site courant).WeighbridgeReadingApiTest: RBAC (403 sansmanage), AUTO/MANUAL 200, 422 (mode invalide / poids manquant en manuel).make php-cs-fixer-allow-risky✅- WeighbridgeReaderInterface (contrat) + RandomWeighbridgeReader (stub, poids aléatoire ∈ [10000,50000] kg, RG-5.06) + WeighbridgeUnavailableException - DsdAllocator : compteur DSD par site (weighbridge_dsd_counter) incrémenté sous verrou ligne SELECT ... FOR UPDATE (RG-5.04, § 2.7) - endpoint POST /api/weighbridge_readings : ressource virtuelle WeighbridgeReadingResource + WeighbridgeReadingProcessor (pas de controller) - AUTO -> {weight, dsd, mode} ; MANUAL -> {weight, dsd, manualNumber, mode} - WeighbridgeUnavailableException -> HTTP 503 explicite (RG-5.06) - site courant via CurrentSiteProviderInterface (contrat Sites) - is_granted('logistique.weighing_tickets.manage') - dsd renvoyé prévisionnel : attribution autoritaire refaite à la création du ticket (ERP-185) - tests : WeighbridgeReaderStubTest, DsdAllocatorTest, processor (503/400), WeighbridgeReadingApiTest (RBAC + AUTO/MANUAL + 422)