E137: Create receipt against work order
POST /api/work-orders/:id/receipts
Records production output from a work order. Triggered from Work Order Detail receipts section. The WO equivalent of the PO receipt: consumes inputs from both ledgers using the recipe snapshot and produces finished goods into the FG ledger, all in one transaction.
Authentication
Standard tenant route. Requires Authorization: Bearer <firebase-id-token> and X-Org-Id: <org-id>. Access: Member.
Request
{
"receiptDate": "2026-05-25",
"notes": "...",
"items": [ { "skuId": "uuid", "quantity": 100, "unitCost": 5.62 } ]
}
Each line targets an output SKU already on the WO. Posts CONSUME entries on the input ledgers (per the recipe snapshot, scaled by received quantity) and PRODUCE entries on the FG ledger at the work site, and advances WO status to Partial / Received. Atomic across both ledgers; FIFO consume costing and the cost cascade are a v1 gap — see W137.
Response — 201 Created
{
"workOrder": { "id": "uuid", "woNumber": "WO-2026-0017", "status": "Received", "...": "..." },
"receipt": { "id": "uuid", "workOrderId": "uuid", "receiptDate": "2026-05-25", "...": "..." },
"receiptItems": [ { "id": "uuid", "receiptId": "uuid", "skuId": "uuid", "quantity": 100, "...": "..." } ]
}
Errors
| HTTP | code | Condition |
|---|---|---|
| 404 | not_found | No such WO. |
| 409 | invalid_transition | WO is Cancelled. |
| 422 | validation_failed | Shape invalid, or a receipt line references a SKU that is not on this WO. |