完善逐件置换的旧料、折旧、补金与独立成本结算

This commit is contained in:
summer committed 2026-11-24 21:56:05 +08:00
1 parent 2e4e7dad55
commit d0809d61a7
9 files changed
+248 -23

No files matched your search

@@ -111,3 +111,9 @@ test('多商品修改回填第一件与后续明细,外配不回退现货,
h.context.__multi=inputs({exchange:{...x,products}});const draft=h.json('recoveryEditDraft(__multi)');assert.equal(draft.pocket,'');assert.equal(draft.new_quantity,'6');assert.equal(draft.labor_rate,'30');assert.equal(draft.extra_products[0].new_quantity,'14');assert.equal(draft.extra_products[0].labor_payer,'assistant2');
h.context.__draft={...draft,verified:true};const input=h.json('recoveryInput(__draft)');assert.deepEqual(input.exchange.products,products);h.context.__request=request({before:inputs(),after:input});const html=h.run('recoveryChangeComparisonHTML(__request)');assert.match(html,/逐件置换商品/);assert.match(html,/足金第二件/);assert.match(html,/外配/);assert.match(html,/小昊/);
});
test('逐件完整置换修改回填保留每件旧料、折旧、补金及独立料费来源',()=>{
const h=harness(),original=inputs(),x=original.exchange;
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,'');
});