锁价支持手动料价和当日加权料池预留

This commit is contained in:
summer committed 2026-11-02 19:30:28 +08:00
1 parent 4e5a04a34e
commit 9893ecf037
22 files changed
+622 -94

No files matched your search

+2
View File
@@ -3,6 +3,7 @@
const {randomUUID}=require('node:crypto');
const TeamMembers=require('./team-members');
const TeamFunds=require('./team-funds');
const LockPoolApprovals=require('./price-lock-pool-approvals');
const hash=require('./order-snapshot-hash');
const PENDING_REASON='本单有待审批归属申请,请先由麦麦同意或驳回后再改动';
function active(actor,env){if(!actor||!['owner','assistant'].includes(actor.role))env.fail('请使用麦麦或助理账号处理订单归属',403);}
@@ -65,6 +66,7 @@ function snapshot(ledger,id){return ledger.scope(null,()=>{
data.usageParties=ledger.rows('SELECT p.* FROM material_usage_parties p JOIN material_pool_usages u ON u.id=p.usage_id WHERE u.order_id=? ORDER BY p.rowid',id);
data.corrections=ledger.rows('SELECT * FROM corrections WHERE target IN (SELECT id FROM payments WHERE order_id=? UNION SELECT id FROM expenses WHERE order_id=? UNION SELECT id FROM settlements WHERE order_id=?) ORDER BY rowid',id,id,id);
data.lockEvents=relations.lock?ledger.rows('SELECT * FROM price_lock_events WHERE price_lock_id=? ORDER BY rowid',relations.lock.id):[];
if(relations.lock)Object.assign(data,LockPoolApprovals.snapshot(ledger,{priceLockId:relations.lock.id}));
data.fundSources=ledger.rows("SELECT * FROM team_fund_sources WHERE (kind='order' AND source_id=?) OR (kind='price_lock' AND source_id=?) ORDER BY kind,source_id",id,relations.lock?.id??'');
data.fundingClaims=ledger.rows("SELECT * FROM team_fund_claim_uses WHERE source_kind='order' AND source_id=? ORDER BY component",id);
return data;