x
This commit is contained in:
@@ -204,7 +204,12 @@ async def _issue_materials_for_order_creation(
|
||||
warehouse = await _get_default_warehouse(db_session)
|
||||
plan_items, planned_material_cost = await _build_material_plan(db_session, order)
|
||||
if not plan_items:
|
||||
raise HTTPException(status_code=400, detail="销售单产品未配置物料BOM,无法自动扣减物料")
|
||||
order.production_no = order.production_no or generate_order_no("WO")
|
||||
order.production_status = "bom_missing"
|
||||
order.planned_material_cost = 0
|
||||
order.actual_material_cost = 0
|
||||
order.status = "manufacturing"
|
||||
return 0, 0, 0
|
||||
shortage_items = [item for item in plan_items if item.shortage_quantity > 0]
|
||||
if shortage_items:
|
||||
shortage_text = ",".join([f"{item.material_name} 缺 {item.shortage_quantity}" for item in shortage_items])
|
||||
@@ -252,7 +257,7 @@ async def _issue_materials_for_order_creation(
|
||||
order.production_status = "material_issued"
|
||||
order.planned_material_cost = round(float(planned_material_cost), 4)
|
||||
order.actual_material_cost = round(float(actual_material_cost), 4)
|
||||
order.status = "pending"
|
||||
order.status = "manufacturing"
|
||||
|
||||
return movement_count, planned_material_cost, actual_material_cost
|
||||
|
||||
|
||||
Reference in New Issue
Block a user