增加订单退货退款售后、原成本回料及跨日损益核算

This commit is contained in:
summer committed 2026-11-10 02:54:58 +08:00
1 parent b6a0213a0c
commit dab735423e
24 files changed
+1048 -82

No files matched your search

+1 -1
View File
@@ -198,7 +198,7 @@
if(!Array.isArray(allocations)||!allocations.length||allocations.some(item=>!['original','extra'].includes(item.source)||!['owner','assistant','assistant2'].includes(item.payer)||!Number.isSafeInteger(item.amount)||item.amount<0||!Number.isSafeInteger(item.quantity)||item.quantity<=0||!Number.isSafeInteger(item.rate)||item.rate<=0)||allocations.reduce((total,item)=>total+item.amount,0)!==part.amount)throw new Error('锁价分项料费记录无效');
for(const item of allocations)add({kind:'goods',component:'material',name:part.name,source:`商品 ${i+1} · ${line.name} · ${item.source==='original'?(item.weighted?'原锁日料池':'原锁价采购'):'补重采购'}`,amount:item.amount,payer:item.payer,excluded:goodsExcluded,
priceLockSource:item.source,...(item.poolId?{materialPoolId:item.poolId}:{}),calculation:{rate:item.rate,quantity:item.quantity,...(item.weighted?{weighted:true}:{} )}});
}else add({kind:'goods',name:part.name,source:`商品 ${i+1} · ${line.name}`,amount:part.amount,payer:payers?.[part.key]??line.payer,excluded:goodsExcluded,
}else add({kind:'goods',name:part.name,source:`商品 ${i+1} · ${line.name}`+(part.key==='labor'&&line.returnedStock?' · 退回现货继承工费':''),amount:part.amount,payer:payers?.[part.key]??line.payer,excluded:goodsExcluded,...(part.key==='labor'&&line.returnedStock?{inheritedStockCost:true,returnedStockId:line.returnedStockId}:{}),
calculation:part.key==='material'&&line.recovery_id&&line.costMaterial?.rate!==undefined?{rate:line.costMaterial.rate,quantity:line.recoveryMaterialMg}:part.key==='material'&&line.costMaterial?.mode==='gram'?{rate:line.costMaterial.rate,quantity:line.quantity}:part.key==='labor'&&line.costLabor?.mode==='gram'?{rate:line.costLabor.rate,quantity:line.quantity}:null});
}
}