Work Orders
Workflows for work orders, their output-SKU lines, the per-WO recipe snapshot, and receipts. Work orders convert materials into finished goods at a work site. Each WO output line carries two cost components: materialUnitCost (rolled up from the BOM and current material averages) and conversionCost (labour, overhead). On receipt completion, the workflow consumes materials from the materials ledger and produces finished goods into the FG ledger in the same transaction.
The recipe snapshot (work_order_inputs) is the WO's frozen copy of the BOM at creation time. Later BOM edits do not affect in-flight WOs; their inputs are locked.
Components composed across this domain: WorkOrders, MaterialsInventory, FinishedGoodsInventory, BOM, Materials, Products, Locations.
Status values are the L1 ENUM org.wo_status — Draft, Entered, Placed, Production, In Transit, Partial, Received, Completed, Cancelled — not user-editable. Header updates (W132) patch status directly; a validated manual-transition map is a v1 gap. Partial and Received are computed by the receipt workflow (W137), which rejects receipts against Cancelled WOs with a 409.
Ledger side-effects: every create (W129) and status update (W132) runs the status → ledger reconciliation projector, which seeds FG ORDER per output line and DEMAND per recipe input once status leaves Draft, and ALLOCATE per input from Production onwards — emitting REVERSE_* on backward or Cancelled transitions. Receipts (W137) write CONSUME on the input ledgers (materials and FG sub-assemblies, per the recipe snapshot) and PRODUCE on the FG ledger for output SKUs; those stay receipt-driven.
Writes
- W129 Create work order
- W132 Update work order
- W133 Delete work order
- W134 Add item to work order
- W135 Update work order item
- W136 Remove item from work order
- W143 Bulk-import work orders
- W137 Create receipt against work order
- W140 Update receipt
- W141 Delete receipt