支持直接修改已生成订单并重算成本库存与利润

This commit is contained in:
summer committed 2026-10-22 17:06:32 +08:00
1 parent 3bf9e8d82d
commit 34781b6cd1
14 files changed
+718 -31

No files matched your search

+9 -2
View File
@@ -50,8 +50,15 @@ function event(ledger,lock,values,actor,env){
lock.number,lock.customer,lock.line.name,actor.name,env.now());
return id;
}
function editableCustomerNote(lock,value){
const remark=`锁价单 ${lock.number};按原锁定金价 ${yuan(lock.sell_rate)}元/克结算`;
let note=String(value??'').trim();
// 来源说明由系统保存;编辑客户备注时剥离旧后缀,避免遗漏或重复拼接。
while(note.endsWith(remark))note=note.slice(0,-remark.length).replace(/;\s*$/,'').trim();
return note;
}
function customerNote(lock,value,env){
const note=env.text(value===undefined?lock.note:value,'客户单备注',240,true);
const note=env.text(editableCustomerNote(lock,value===undefined?lock.note:value),'客户单备注',240,true);
const remark=`锁价单 ${lock.number};按原锁定金价 ${yuan(lock.sell_rate)}元/克结算`;
const final=[note,remark].filter(Boolean).join(';');
if(final.length>240)env.fail(`客户备注请控制在${240-remark.length-1}字以内,需为锁价说明预留位置`);
@@ -154,4 +161,4 @@ function reporting(ledger,query,env){
.map(row=>({...row,kind:'fee',component:'fee',product:JSON.parse(ledger.one('SELECT line FROM price_locks WHERE id=?',row.price_lock_id).line).name}));
return {from,to,customerCash,materialOutlays,directOutlays};
}
module.exports={initialize,create,deliver,detail,list,inheritedPayments,reporting};
module.exports={initialize,create,deliver,detail,list,inheritedPayments,reporting,customerNote,editableCustomerNote};