Files
edr-platform/apps
hager c2fb320709 feat(warehouses): receive an arrival from multiple trucks
A customer's containers routinely arrive together on several trucks, but
bulk receive accepted one truck per operation: a single truckEntrance and
a flat containerNumbers list capped at two boxes. Receiving a six-container
arrival meant six separate operations.

Model the arrival as a list of trucks instead. Each entry carries its own
truckEntrance, its own containers and, optionally, its own bookingIds,
defaulting to the operation's. The receive loop iterates trucks, so every
per-truck invariant is preserved rather than pooled: the physical capacity
check (one 40ft or up to two 20ft), the container-to-plate assignment
check, the GRN batch number and the capacity assertions all still apply
per truck.

Callers sending the existing truckEntrance and containerNumbers fields
collapse to a one-element list and behave exactly as before.

Reject a container listed on more than one truck up front. The per-booking
check only catches this once a unit is marked received, so a duplicate
would otherwise surface from whichever truck happened to be processed
second and read as a duplicate gate entry rather than a data-entry slip.

Verified: freight-api type-check passes; all 13 warehouse suites pass
(73 tests).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-06 19:42:59 +00:00
..