支持多商品锁价及待交付修改作废审批

This commit is contained in:
summer committed 2026-11-08 02:22:58 +08:00
1 parent 1cbcdc728c
commit 337b2a709f
28 files changed
+1187 -344

No files matched your search

+1 -1
View File
@@ -182,6 +182,6 @@ test('HTTP锁价要求登录与CSRF,双方可登记交付,操作幂等并发
const deliveryKey=randomUUID(),deliveries=await Promise.all([call('/api/price-locks/'+lock.id+'/deliver',delivery(),deliveryKey),call('/api/price-locks/'+lock.id+'/deliver',delivery(),deliveryKey)]);assert.deepEqual(deliveries.map(response=>response.status),[200,200]);const result=await deliveries[0].json();assert.deepEqual(await deliveries[1].json(),result);
const publicOrder=await (await call('/api/orders/'+result.id+'/public')).json();assert.match(publicOrder.note,/按原锁定金价/);for(const field of ['buy_rate','buy_payer','materialAllocations','leftover_cost','costParts','price_lock_id'])assert.ok(!JSON.stringify(publicOrder).includes('"'+field+'"'));
const asset=await call('/price-locks-ui.js');assert.equal(asset.status,200);assert.match(asset.headers.get('content-type'),/javascript/);assert.match(await asset.text(),/priceLock/);
assert.equal((await call('/api/price-locks/'+lock.id+'/deliver',delivery())).status,409);assert.equal((await call('/api/price-locks/'+lock.id+'/cancel',{})).status,404);assert.equal(app.ledger.rows('SELECT * FROM orders').length,1);
assert.equal((await call('/api/price-locks/'+lock.id+'/deliver',delivery())).status,409);assert.equal((await call('/api/price-locks/'+lock.id+'/cancel',{revision:app.ledger.priceLockDetail(lock.id).revision,reason:'合成误操作',verified:true})).status,409);assert.equal(app.ledger.rows('SELECT * FROM orders').length,1);
const backup=path.join(dir,'backup.sqlite');await app.ledger.backupTo(backup);const reopened=new Ledger(backup);try{assert.equal(reopened.priceLockDetail(lock.id).final_order_id,result.id);assert.equal(reopened.detail(result.id).netReceived,296000);assert.equal(reopened.one('PRAGMA integrity_check').integrity_check,'ok');assert.equal(reopened.rows('PRAGMA foreign_key_check').length,0);}finally{reopened.close();}
});