W090: Update BOM
Replaces the full composition for an output SKU's BOM. Triggered from BOM Detail. The replacement is atomic; partial intermediate states are never visible.
Steps
-
Load the BOM. Call
BOM.getBomById. -
Validate input rows. For each row, confirm the referenced material or input SKU exists and respects the XOR invariant.
-
Replace the composition. Call
BOM.replaceBomItems. Atomic delete-then-insert at the L2 layer.
Returns
The updated BOM with its items.
Business rules
- Replacement is atomic. Readers never see a partial composition during the update.
- No retroactive cost cascade. Existing WOs keep their frozen recipe snapshot; only WOs created after the edit pick up the new recipe and roll-up costs.
Errors
NotFoundError. The BOM or a referenced input was not found.ValidationError. An input row violates the XOR invariant.