日购料垫款按采购先后扣减并迁移历史归属

This commit is contained in:
summer committed 2026-10-23 00:14:29 +08:00
1 parent 34781b6cd1
commit 499b84a7a6
13 files changed
+608 -90

No files matched your search

+1 -1
View File
@@ -145,7 +145,7 @@ function edit(ledger,id,input,actor,env){return atomic(ledger,()=>{
}
if(!Array.isArray(input.fee_items))env.fail('请完整带入本单所有实际费用后再修改,不能遗漏额外费用');
if(input.lines?.some(line=>line.materialAllocations!==undefined))env.fail('普通订单不能带入锁价采购分配');
const date=env.day(input.date),lines=ledger.validateLines(input.lines,order.lines,date),discount=env.money(input.discount??'0','整单优惠');
const date=env.day(input.date),lines=ledger.validateLines(input.lines,order.lines,date,{orderId:id}),discount=env.money(input.discount??'0','整单优惠');
const rounding=input.rounding_mode??order.rounding_mode,total=Calc.orderTotal(lines.map(line=>line.sale),discount,rounding).total;
const fees=ledger.validateFees(input.fee_items.map(fee=>({...fee,status:'estimated'})));
ledger.validateCompletedCosts(lines,fees);