feat(logistique) : WeighingTicketProvider + Processor — numérotation, contrepartie, net, normalisation (ERP-185) #135
Reference in New Issue
Block a user
Delete Branch "feat/erp-185-provider-processor-weighingticket"
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?
M5 · ERP-185 (1.5) — Provider + Processor WeighingTicket
Logique métier d'écriture (Processor) et de lecture (Provider) du ticket de pesée. Stack M5, basé sur ERP-184.
Processor
WeighingTicketProcessor(POST/PATCH)CurrentSiteProviderInterface(400 si aucun site sélectionné).{siteCode}-TP-{NNNN}(RG-5.02) attribué à la création viaWeighingTicketNumberAllocator(compteurweighing_ticket_counter,SELECT … FOR UPDATE,%04d). Numéro + site immuables au PATCH (RG-5.09).counterpartyType(la présence du champ requis reste validée par l'Assert\Callbackde l'entité ; ici on évite la 500 des CHECK Postgres).XX-000-XXhors « Tout format » ; 422 inline surimmatriculationsi invalide (consommableuseFormErrors).DsdAllocator(verrou) pour les pesées AUTO ; les pesées MANUEL conservent leur DSD (déjà alloué par l'endpoint de pesée).Provider
WeighingTicketProvider(GET)PaginatorORM — règle ABSOLUE n°13, jamais d'array brut).SiteScopedQueryExtension, on réplique donc sa logique (bypass_scope / site null = no-op).?search=(number, nom client/fournisseur, other_label, immatriculation) ; tri?order[displayDate](COALESCE full/empty), défautnumber DESC.client/supplier/site(ManyToOne).Vérifications
make testvert (811 tests), suite Architecture verte (CollectionsArePaginatedTestOK).make php-cs-fixer-allow-riskypropre.AB-123-CD, rejet 422, free format) + format numéro86-TP-0002validés.Logique métier d'écriture et de lecture du ticket de pesée (M5). Processor (POST/PATCH) : - résolution du site courant (CurrentSiteProvider) + attribution du numéro {siteCode}-TP-{NNNN} à la création, immuables ensuite (RG-5.02 / RG-5.09) ; - exclusivité de la contrepartie CLIENT/FOURNISSEUR/AUTRE — null-ification des champs hors-branche (RG-5.03, garde-fou CHECK Postgres) ; - normalisation immatriculation trim/UPPER + masque XX-000-XX hors « Tout format », 422 inline sur le champ si invalide (RG-5.01 / RG-5.10) ; - DSD autoritaire pour les pesées AUTO via DsdAllocator (verrou), MANUEL conservé (RG-5.04) ; - poids net = plein − vide recalculé (RG-5.05). Provider (GET) : liste paginée (Paginator ORM, règle n°13), recherche ?search=, tri ?order[displayDate], cloisonnement par site courant appliqué dans le provider (le SiteScopedQueryExtension ne traverse pas un provider custom), fetch-join client/supplier/site anti-N+1, 404 hors périmètre / soft-delete. Ajouts : WeighingTicketNumberAllocator (compteur weighing_ticket_counter, SELECT FOR UPDATE), WeighingTicketFieldNormalizer, InvalidImmatriculationException + alias DI. make test vert (811), Architecture vert (CollectionsArePaginatedTest).