置换余料支持寄存暂不结算及修改取消联动

This commit is contained in:
summer committed 2026-11-26 01:15:41 +08:00
1 parent 1f1e6dd402
commit b070da1e3d
9 files changed
+110 -36

No files matched your search

+8
View File
@@ -155,3 +155,11 @@ test('寄存料按使用克重生成置换旧料,独立商品可混合本次
assert.equal(input.old_source,undefined);assert.equal(input.exchange.items[0].deposit_weight,'1');assert.equal(input.exchange.items[0].old_lines[0].melted_weight,'1');assert.equal(input.exchange.items[1].old_source,undefined);assert.equal(h.calculate(input).oldMg,1500);h.context.__input=input;assert.doesNotThrow(()=>h.run('validateRecoveryInput(__input)'));
h.context.__draft=h.draft({...swap,independent_products:true});const html=h.run('recoveryFormHTML(__draft)');assert.match(html,/寄存,暂不结算/);assert.match(html,/name="old_source"/);assert.match(html,/name="deposit_id"/);assert.match(html,/name="deposit_weight"/);
});
test('余料处理可选寄存,取消隐藏旧回收款;每件独立选择,不继承第一件寄存',()=>{
const h=harness(),draft={...swap,incoming_weight:'10',melted_weight:'10',new_quantity:'8.561',surplus_mode:'deposit',surplus_memo:'袋B',buy_rate:'',buy_total:'1100.40',buy_total_manual:true};
const input=h.input(draft),q=h.calculate(input);assert.equal(q.depositMg,1439);assert.equal(q.purchaseMg,0);assert.equal(q.purchaseAmount,0);assert.equal(q.netSettlement,q.receivable);assert.equal(input.surplus_memo,'袋B');h.context.__q=q;h.context.__input=input;assert.match(h.run('recoverySettlementHTML(__q,__input)'),/余料寄存:1.439g/);
h.context.__draft=h.draft({...draft,independent_products:true,extra_products:[h.draft({...swap,incoming_weight:'3',melted_weight:'3',new_quantity:'2',buy_rate:'850'})]});
const mixed=h.json('recoveryInput(__draft)'),total=h.calculate(mixed);assert.equal(mixed.exchange.items[1].surplus_mode,undefined);assert.equal(total.depositMg,1439);assert.equal(total.purchaseMg,1000);assert.equal(total.purchaseAmount,85000);
const html=h.run('recoveryFormHTML(__draft)');assert.match(html,/name="surplus_mode"/);assert.match(html,/name="extra_surplus_mode"/);assert.match(html,/添加到寄存料,暂不结算/);assert.match(html,/data-surplus-buy/);
});