支持回收单修改取消、按归属人优先用料及锁价交付改单

This commit is contained in:
summer committed 2026-11-04 22:18:56 +08:00
1 parent 0e146739bc
commit 19b1b0263c
41 files changed
+1814 -203

No files matched your search

+1 -1
View File
@@ -227,7 +227,7 @@ function orderBook(ledger,query,{today,validateDay,accounts,pockets}){
});
const afterSales=!pocket&&['all','after_sale'].includes(status)?ledger.visibleRows('after_sale',ledger.rows("SELECT s.*,COALESCE(v.revision,1) AS revision,s.rowid AS position,(SELECT MIN(a.id) FROM audit a WHERE a.entity='after-sale:'||s.id AND a.action='登记售后') AS creation_sequence FROM after_sales s LEFT JOIN after_sale_revisions v ON v.after_sale_id=s.id WHERE s.date>=? AND s.date<=? ORDER BY s.date DESC,s.created DESC,s.id",from,date))
.filter(record=>matchesText([record.project,record.customer,record.actor,'售后'])):[];
const recoveries=!pocket&&['all','recovery'].includes(status)?ledger.visibleRows('recovery',ledger.rows("SELECT r.*,r.rowid AS position,(SELECT MIN(a.id) FROM audit a WHERE a.entity='recovery:'||r.id AND a.action='登记直接回收') AS creation_sequence FROM recoveries r WHERE r.mode='direct' AND r.date>=? AND r.date<=? ORDER BY r.created,r.rowid",from,date))
const recoveries=!pocket&&['all','recovery'].includes(status)?ledger.visibleRows('recovery',ledger.rows("SELECT r.*,r.rowid AS position,(SELECT MIN(a.id) FROM audit a WHERE a.entity='recovery:'||r.id AND a.action='登记直接回收') AS creation_sequence FROM recoveries r WHERE r.mode='direct' AND r.status='active' AND r.date>=? AND r.date<=? ORDER BY r.created,r.rowid",from,date))
.filter(record=>{const lines=JSON.parse(record.old_lines);return matchesWeight(weight,lines.map(line=>line.foldedMg),JSON.parse(record.data).oldMg)||matchesText([record.number,record.customer,record.salesperson,record.note,'直接回收',...lines.map(line=>line.name)]);}):[];
// 同毫秒创建的记录按原创建审计编号排序;没有旧审计时以原表插入次序稳定回退。
const displayed=[...orders.map(order=>({row:orderRow(order),sequence:positions.get(order.id)})),