1.6 KiB
Finished-goods receipt (Phase 2Q)
Once a production batch is completed, packaging is recorded, and both production and packaging materials have been posted to stock, receive the batch's good quantity into a chosen warehouse. Rejected pieces never enter finished-goods stock. The receipt creates the variant's warehouse stock item when needed and appends a PRODUCTION_OUTPUT entry to the existing finished-goods stock ledger.
| Method | Path | Permission |
|---|---|---|
| GET | /api/v1/production-batches/:batchId/finished-goods-receipt |
inventory.read |
| POST | /api/v1/production-batches/:batchId/finished-goods-receipt |
inventory.manage |
POST body: { "warehouseId": "<uuid>", "idempotencyKey": "<uuid>" }. A batch can be received once. A retry with the same key and warehouse returns the original receipt; a changed retry returns FINISHED_GOODS_REPLAY_CONFLICT. A new key for an already received batch returns FINISHED_GOODS_ALREADY_POSTED.
The response includes batch, variant, warehouse, stock-item and ledger-entry IDs plus the received quantity. The database independently verifies the completed batch and good quantity, both material-stock postings, source variant and warehouse. The ledger insert updates on-hand stock in the same transaction, with a capacity bound. Receipt and ledger records are immutable. Existing inventory availability and reservation endpoints then include the newly received units.