锁价交付补重支持当日料池,内部备注移至客户名旁

This commit is contained in:
summer committed 2026-11-30 16:40:30 +08:00
1 parent ac9073471d
commit c5883351c1
20 files changed
+196 -66

No files matched your search

+2 -2
View File
@@ -185,7 +185,7 @@
const payers=costPayers(line.costPayers);
const parts=line.costParts?Object.entries(costLabels).map(([key,name])=>({key,name,amount:line.costParts[key]??null})):[{key:'total',name:'货品成本(原单未分项)',amount:line.cost??null}];
for(const part of parts){
if(part.key==='material'&&line.priceLockPool&&part.amount===null){add({kind:'goods',component:'material',name:part.name,source:'锁价料池成本待补',amount:null,payer:payers?.material??line.payer,excluded:goodsExcluded,materialPoolId:line.priceLockPool.poolId,poolPending:true,calculation:null});
if(part.key==='material'&&(line.priceLockPool||line.priceLockExtraPool)&&part.amount===null){add({kind:'goods',component:'material',name:part.name,source:'锁价料池成本待补',amount:null,payer:payers?.material??line.payer,excluded:goodsExcluded,materialPoolId:(line.priceLockExtraPool?.amount===null?line.priceLockExtraPool:line.priceLockPool||line.priceLockExtraPool).poolId,poolPending:true,calculation:null});
}else if(part.key==='material'&&line.costMaterial?.mode==='pool'){
const pool=line.materialPool,allocations=pool?.allocations;
if(part.amount===null||!allocations?.length){
@@ -197,7 +197,7 @@
}else if(part.key==='material'&&line.materialAllocations){
const allocations=line.materialAllocations;
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,
for(const item of allocations)add({kind:'goods',component:'material',name:part.name,source:`商品 ${i+1} · ${line.name} · ${item.source==='original'?(item.weighted?'原锁日料池':'原锁价采购'):(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}`+(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});