W131: Get work order detail
Returns a single WO with everything the detail page needs: header, items (with received-quantity rollup), recipe snapshot, referenced catalog rows, and the derived material status. Triggered by clicking a WO in the list.
Steps
-
Load the WO header. Call
WorkOrders.getWoById. Includes work-site location name. -
Load items with received rollup. Call
WorkOrders.listItemsByWo. Each item carriesreceivedQuantitysummed across all receipts so the page can show line-level progress. -
Load the recipe snapshot. Call
WorkOrders.listInputsByWoto return every snapshot row (material id XOR input SKU id, per-unit quantity, total quantity at WO level, currentunitCost). -
Hydrate catalog references. Output SKUs from
Products.getSkusByIds; input materials fromMaterials.getMaterialsByIds; input SKUs fromProducts.getSkusByIds. -
Derive
materialStatus. Same computation as W130 step 3, scoped to this WO.
Returns
The WO header (with work-site location name) plus items (with receivedQuantity), recipe snapshot (with per-input current unitCost), referenced catalog rows, and materialStatus.
Business rules
- Recipe snapshot, not live BOM. The detail view shows what this WO will actually consume; the frozen snapshot rules. The live BOM may differ if it has been edited since WO creation.
materialStatusreflects current ledger state. Unlike snapshot quantities (frozen), the status is recomputed on every read against current inventory positions.
Errors
NotFoundError. The WO was not found.