新增回收置换记账及打印,完善订单标志和购料单价

This commit is contained in:
summer committed 2026-10-26 14:44:07 +08:00
1 parent 844a1fa860
commit 505110ab0e
26 files changed
+1201 -64

No files matched your search

+2 -2
View File
@@ -190,7 +190,7 @@
add({kind:'goods',component:'material',name:part.name,source:`商品 ${i+1} · ${line.name} · ${line.costMaterial.poolId}日购料待补`,amount:null,payer:payers?.material??line.payer,excluded:goodsExcluded,materialPoolId:line.costMaterial.poolId,materialPoolRevision:pool?.revision,poolPending:true,calculation:null});
}else{
if(!Array.isArray(allocations)||allocations.some(item=>!['owner','assistant','assistant2'].includes(item.payer)||!Number.isSafeInteger(item.amount)||item.amount<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} · ${line.costMaterial.poolId}日购料`,amount:item.amount,payer:item.payer,excluded:goodsExcluded,materialPoolId:line.costMaterial.poolId,materialPoolRevision:pool?.revision,calculation:{rate:pool.averageRate,quantity:line.quantity,weighted:true}});
for(const item of allocations)add({kind:'goods',component:'material',name:part.name,source:`商品 ${i+1} · ${line.name} · ${line.costMaterial.poolId}日购料`,amount:item.amount,payer:item.payer,excluded:goodsExcluded,materialPoolId:line.costMaterial.poolId,materialPoolRevision:pool?.revision,calculation:{rate:pool.averageRate,quantity:pool.quantity??line.quantity,weighted:true}});
}
}else if(part.key==='material'&&line.materialAllocations){
const allocations=line.materialAllocations;
@@ -198,7 +198,7 @@
for(const item of allocations)add({kind:'goods',component:'material',name:part.name,source:`商品 ${i+1} · ${line.name} · ${item.source==='original'?'原锁价采购':'补重采购'}`,amount:item.amount,payer:item.payer,excluded:goodsExcluded,
priceLockSource:item.source,calculation:{rate:item.rate,quantity:item.quantity}});
}else add({kind:'goods',name:part.name,source:`商品 ${i+1} · ${line.name}`,amount:part.amount,payer:payers?.[part.key]??line.payer,excluded:goodsExcluded,
calculation: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});
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});
}
}
// 原费用与冲回行成对抵消,只列最新有效支出,保留原流水供追溯。