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

W136: Remove item from work order

Deletes an output line and its input snapshot. Triggered from the Work Order edit modal.

Steps

  1. Assert editable. 409 when any receipt exists against the WO.
  2. Delete the line's ledger rows FIRST. Hard delete: call deleteBySource for wo_item (the line's FG ORDER) and wo_input (its snapshot inputs' DEMAND/ALLOCATE) on both ledgers, removing the rows outright — once the line and its inputs are deleted their source ids never reach a reconcile again, so this has to happen first.
  3. Delete the item. WorkOrders.removeItem; the work_order_inputs rows cascade via the L1 FK.

Returns

Nothing (L4 echoes { deletedId }).

Business rules

  • Delete-before-remove is load-bearing: the ledger rows must go before the line and its inputs, or they strand. Removing a line physically deletes its rows (it never happened); cancelling the WO is the append-only path that reverses instead.

Errors

ConditionError
WO item not foundnot_found
Receipt existsconflict