Preview Simple Assemble / Disassemble (Dry-Run)
POST/api/manufacturing/simple-assemble/preview
U25: Dry-run preview that returns the BOM-derived components (action=assemble) or the kit itself (action=disassemble) along with required and live on-hand quantities at the chosen warehouse. Does NOT create an MO or consume inventory — used to render a shortage warning beneath the Simple Mode form before submit.
Body fields (same validation as POST /simple-assemble):
kit_product_id(int, required) — product to assemble or disassemblequantity(numeric, required, >0)warehouse_id(int, required)warehouse_location_id(int, optional)action_date(date, required)action(string, optional) —assemble(default) ordisassemble
Each line is also valued: unit_cost is the weighted-average cost of the product's available FIFO layers at the chosen warehouse (catalog cost when out of stock), and extended_cost = unit_cost × required_quantity. total_input_cost sums the line values. For action=assemble, output carries the expected manufactured product valued at the full component spend (total_cost = total_input_cost, unit_cost = total_cost / quantity); for action=disassemble, output is null.
Response shape:
{
"data": {
"action": "assemble",
"has_shortage": true,
"total_input_cost": 36,
"output": {
"product_id": 42,
"sku": "KIT-001",
"name": "Sample Kit",
"quantity": 3,
"total_cost": 36,
"unit_cost": 12
},
"lines": [
{
"product_id": 91,
"sku": "COMP-A",
"name": "Component A",
"required_quantity": 6,
"available_quantity": 5,
"uom": "EACH",
"unit_cost": 5,
"extended_cost": 30,
"shortage": true
}
]
}
}
Request
Responses
- 200
- 422
OK
Response Headers
Unprocessable Entity