Manufacturing Orders
List Manufacturing Orders
Paginated list of Manufacturing Orders. Supports Spatie QueryBuilder filters, sorts, and pagination.
Create Manufacturing Order
Create a draft MO from a BOM. Hydrates component + output + operation snapshot lines from the BOM.
Get Manufacturing Order
Return the full Manufacturing Order with its BOM, component/output lines, operations, warehouses, and events.
Update Manufacturing Order
Update Manufacturing Order
Delete Manufacturing Order
Only draft MOs may be deleted.
Confirm Manufacturing Order
Draft -> Confirmed. Reserves components. Optionally lock in FIFO layer picks keyed by mo_component_line_id.
Preview Manufacturing Order Confirmation
Dry run of Confirm for a Draft manufacturing order. Computes per-component shortages and the largest planned quantity current inventory could support end-to-end, without changing any state. For orders that are no longer Draft, the response contains empty shortages and a reason explaining that the preview only applies before confirmation.
Unconfirm Manufacturing Order
Reverse a Confirm: moves the order from Confirmed back to Draft, releases its component inventory allocations, and discards the BOM-derived component lines, output lines, and operations. Operations added manually after confirmation are kept.
Start Manufacturing Order
Confirmed -> In Progress.
Record Production
Record actual component consumption, output produced, and operation actuals for an in-progress MO. Posts inventory movements (consumption + receipts) and creates FIFO layers for outputs.
Complete Manufacturing Order
In Progress -> Completed. Finalizes variance calculations.
Cancel Manufacturing Order
Cancel a manufacturing order. Transitions any non-closed status → Cancelled and releases any inventory reservations.
Close Manufacturing Order
Completed -> Closed. Locks the MO from further changes.
Reopen Manufacturing Order
Closed -> Partially Completed (or Completed if completed_quantity >= planned_quantity). Required reason (string, max 2000) is captured in the Reopened event payload.
Generate Accounting Transaction (MO)
Generate (or rebuild) the WIP-routed GL journals for this MO — ONE journal per production iteration, each dated to that iteration's production date (so multi-day / multi-period production is period-accurate). Conversion costs (labor + overhead + outsourced service) are capitalized into finished goods through Work In Process:
MO Events (Audit Log)
Returns audit log of every status transition and significant action on the MO.
List MO Inventory Movements
Paginated list of inventory movements created by this Manufacturing Order. Includes movements linked to the MO itself, to any of its component lines (consumption + scrap) and to any of its output lines (production output).
List MO FIFO Layers
Paginated list of FIFO layers CREATED by this Manufacturing Order (production output layers). Layers consumed by this MO are surfaced on each layer's own detail view.
Get Manufacturing Order Output Line
Show a single Manufacturing Output line — the canonical detail view used by the standalone Manufacturing Output page.
Get Manufacturing Order Component Line
Show a single Manufacturing Consumption (component) line — the detail view used by the standalone Manufacturing Consumption page.
List Output Line Inventory Movements
Paginated inventory movements scoped to a single MO output line — every movement that touches the FIFO layer this output produced. Includes the production-output movement itself and any downstream consumption of the batch (sales, transfers, further manufacturing). Backs the Movements tab on the Manufacturing Output detail page.
List Output Line FIFO Layers
Paginated FIFO layers scoped to a single MO output line. Always returns at most one row — the layer this output produced — but shapes the response as a paginated collection so the frontend can reuse the same list view contract as the MO-scoped equivalent.
List MO Production Iterations
Paginated list of production iterations for this Manufacturing Order. Each iteration is one call to Record Production; includes restore-cost information and a reversibility flag.
Get Production Iteration
Returns a single production iteration with all relations eagerly loaded (manufacturing order, created_by user, reversed_by user) plus the output FIFO layer expanded. Backs the standalone Production Iteration detail page.
List Production Iteration Inventory Movements
Paginated inventory movements scoped to a single production iteration — every movement created by the underlying Record Production call (component consumption, scrap, and output). Scope is `inventory_movements.production_iteration_id = {iteration.id}`. Backs the Movements tab on the Production Iteration detail page.
List Production Iteration FIFO Layers
Paginated FIFO layers scoped to a single production iteration — every layer (output + any auxiliary) created by the underlying Record Production call. Scope is `fifo_layers.production_iteration_id = {iteration.id}`. Mirrors the MO-output-line FIFO-layers endpoint so the frontend list view can reuse the same contract.
Reverse Production Iteration
Reverses a production iteration: restores input FIFO layers, deletes the output layer (if not yet drawn from), rolls back actuals on the component/output lines, decrements `completed_quantity` on the MO, and writes a `production_reversed` audit event. Refuses with 422 if already reversed, mismatched MO, or downstream-drawn.
Get MO Cost Allocation Breakdown
Get the cumulative cost-allocation breakdown across all posted production for this manufacturing order: the allocation method in use, each output's basis value, share percent, allocated cost, and unit cost, plus byproduct valuations. Always returns a usable shape - has_production is false when no production has been recorded yet.
Download Work Order PDF
Download a printable work order PDF for the manufacturing order (returned inline with Content-Type application/pdf). For Draft orders that have not been confirmed yet, component and output rows fall back to the BOM definition.
Preview Reverse Production Iteration Impact
Read-only preview of the allocation-demotion impact of reversing this production iteration. Because reversing it removes the stock it added, this behaves like a manual negative adjustment and returns one row per affected product: how much of the removed quantity is unallocated vs soft-allocated vs hard-allocated, plus every sales-order allocation and fulfillment (printed shipping label) the removal would disturb. Use it to decide which fulfillments to authorize voiding via `void_confirmations` on the reversing call. Nothing is mutated. A removal that only re-adds stock returns an empty `data` array.
Preview Record Production Release Impact
Read-only preview of which back-ordered sales orders the proposed produced quantities would release finished-good stock to, returned one row per output product. Nothing is mutated — post the outputs you intend to record and get the release picture before committing.