Skip to main content
Version: v1.0.0(int)

W134: Add item to work order

Appends an output-SKU line post-creation and snapshots its BOM inputs — the same per-item logic W129 runs at create (shared helper). Triggered from the Work Order edit modal.

Steps

  1. Assert editable. 409 when any receipt exists against the WO (items are locked once production has been received).
  2. Validate. WO + SKU must exist; the SKU must not already be on this WO (409).
  3. Insert the item. WorkOrders.addItem.
  4. Snapshot the BOM. BOM.getBomForSku scaled by quantity → WorkOrders.addInputsForItem (no-op for a BOM-less SKU).
  5. Project the new line. Run the status → ledger reconciliation projector for just this line: Entered onward books FG ORDER + input DEMAND, Production onward adds input ALLOCATE, Draft books nothing.

Returns

{ item, inputs } — the line plus its snapshotted recipe.

Business rules

  • One line per SKU per WO.
  • The snapshot is taken from the live BOM at the moment of the add, scaled by the item quantity — identical semantics to creation-time snapshotting.
  • Items are locked once a receipt exists (consistent with PO items, W117/W120/W121).

Errors

ConditionError
WO or SKU not foundnot_found
Receipt exists / duplicate SKUconflict