W098: Complete in-transit transfer
Records the inbound leg of an in-transit transfer, closing the pair. Triggered from the Materials Inventory Transfers page, "Mark complete" on an in-transit row.
Steps
-
Confirm the transfer is in transit. Call
MaterialsInventory.listEntriesByRef(ref). The outbound TRANSFER row must exist; no matching RECEIVE row may exist yet. -
Write the paired RECEIVE row. Call
MaterialsInventory.recordReceipt({ materialId, locationId: to_location_id (from outbound), quantity, ref, eventDate, notes }). Reuses the samerefas the outbound row so the two are paired. The RECEIVE row does not needto_location_id; the destination is encoded as itslocation_id. Quantity is positive per the L1 schema invariant; RECEIVE means inflow.
Returns
The inbound RECEIVE row.
Business rules
- Destination comes from the outbound row. The TRANSFER row's
to_location_idis the truth; the completion does not let the user pick a different destination. - No undo in v1. Completing a transfer is treated as the goods physically arriving. If reversal is needed later, future tooling can write a corresponding REVERSE_RECEIVE row alongside.
Errors
NotFoundError. The ref is unknown.InvalidTransitionError. The transfer has already been completed (a RECEIVE row with thisrefalready exists).