补齐固定旧版的浏览器逐笔写入对照并记录账务差异
This commit is contained in:
1 parent
e77588b337
commit
7d2007955f
39 files changed
+3653
-41
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { section } from './operations-helpers.mjs';
|
||||
|
||||
export default async function recoveryQuote(ctx) {
|
||||
const { day, session } = ctx;
|
||||
await session.post('owner', '/api/recoveries', {
|
||||
date: day,
|
||||
mode: 'direct',
|
||||
customer: '个人回收料来源',
|
||||
member: 'owner',
|
||||
salesperson: '麦麦',
|
||||
old_lines: [{ name: '旧料', incoming_weight: '0.400', melted_weight: '0.400', purity: '100' }],
|
||||
buy_rate: '800',
|
||||
payer: 'owner',
|
||||
payment_account: '麦麦微信',
|
||||
verified: true,
|
||||
});
|
||||
await session.post('owner', '/api/material-purchases', {
|
||||
date: day,
|
||||
grams: '8',
|
||||
total: '7200',
|
||||
payer: 'owner',
|
||||
note: '公共料来源',
|
||||
});
|
||||
assert.deepEqual(session.problems, []);
|
||||
const owner = await ctx.pageFor('owner');
|
||||
await section(owner, ctx, 'recoveries');
|
||||
await owner.locator('[data-action=recovery-mode][data-mode=exchange]').click();
|
||||
const form = owner.locator('#recovery-form');
|
||||
const field = name => form.locator('[name="' + name + '"]');
|
||||
await ctx.step('置换试算列出个人和公共料各自的用量、成本与前后余额', async () => {
|
||||
await field('customer').fill('核对两种扣料来源');
|
||||
await form.locator('[name=customer_type][value=new]').check();
|
||||
await field('incoming_weight').fill('2');
|
||||
await field('new_quantity').fill('3');
|
||||
await field('gold_price').fill('920');
|
||||
await field('cost_labor_value').fill('15');
|
||||
await field('labor_rate').fill('20');
|
||||
await field('material_source').selectOption('pool');
|
||||
await field('material_pool_id').selectOption(day);
|
||||
await owner
|
||||
.locator('#recovery-quote-status')
|
||||
.getByText(/结算已核对/)
|
||||
.waitFor();
|
||||
const shown = await owner.locator('#recovery-material-note').innerText();
|
||||
const expected = [
|
||||
'麦麦个人回收料 0.400g · ¥320.00(加权约 ¥800.00/克)',
|
||||
'公共料 0.600g · ¥540.00(加权约 ¥900.00/克)',
|
||||
'本次前可用:个人 0.400g,公共 8.000g',
|
||||
'本次后余:个人回收料 0.000g,公共料 7.400g',
|
||||
];
|
||||
assert.deepEqual(
|
||||
expected.filter(part => !shown.includes(part)),
|
||||
[],
|
||||
'实际置换料池试算:' + shown,
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user