置换默认一份旧料换多件新货,统一结算差重与寄存

This commit is contained in:
summer committed 2026-11-27 15:48:37 +08:00
1 parent b070da1e3d
commit 9186480118
5 files changed
+35 -14

No files matched your search

@@ -117,3 +117,9 @@ test('逐件完整置换修改回填保留每件旧料、折旧、补金及独
h.context.__individual={...original,exchange:{...x,items:[{old_lines:original.old_lines,old_pocket:'找金',buy_rate:'850',buy_total:'0',exchange:{...x,quantity:'15',gold_price:'1000',depreciation_weight:'10',depreciation_rate:'10',cost_material:{mode:'pool',poolId:D}}},{old_lines:[{name:'第二份旧料',incoming_weight:'20',melted_weight:'20',purity:'99'}],old_pocket:'回收旧料',buy_rate:'860',buy_total:'6708',exchange:{...x,name:'第二件',quantity:'12',pocket:'',gold_price:'1100',depreciation_weight:'12',depreciation_rate:'5',cost_material:{mode:'gram',rate:'800'},cost_material_payer:'assistant2'}}]}};
const draft=h.json('recoveryEditDraft(__individual)');assert.equal(draft.independent_products,true);assert.equal(draft.old_pocket,'找金');assert.equal(draft.material_source,'pool');assert.equal(draft.extra_products[0].incoming_weight,'20');assert.equal(draft.extra_products[0].depreciation_rate,'5');assert.equal(draft.extra_products[0].material_rate,'800');assert.equal(draft.extra_products[0].material_payer,'assistant2');assert.equal(draft.extra_products[0].pocket,'');
});
test('历史单件逐件单编辑转为共用旧料,可添加多件新货且保留原费用和寄存选择',()=>{
const h=harness(),original=inputs(),item={old_lines:[{name:'Au旧料',incoming_weight:'10',melted_weight:'10',purity:'100'}],old_pocket:'回收旧料',surplus_mode:'deposit',surplus_memo:'原寄存备忘',buy_rate:'0',buy_total:'0',exchange:{...original.exchange,quantity:'8',depreciation_weight:'8'}};
h.context.__single={...original,exchange:{...original.exchange,items:[item]}};const draft=h.json('recoveryEditDraft(__single)');assert.equal(draft.independent_products,false);assert.equal(draft.incoming_weight,'10');assert.equal(draft.surplus_mode,'deposit');assert.equal(draft.surplus_memo,'原寄存备忘');assert.equal(draft.extra_products.length,0);assert.equal(draft.charges.length,2);assert.equal(draft.fee_items.length,2);
h.context.__draft={...draft,verified:true};const input=h.json('recoveryInput(__draft)');assert.equal(input.exchange.items,undefined);assert.equal(input.old_lines.length,1);assert.equal(input.exchange.quantity,'8');assert.equal(input.surplus_mode,'deposit');
});