- 下单即建分拣/配送,待取货/散客/独立进货守卫 - 30/40/45 直接发车/分拣,入库与分拣二选一 - 分拣完成补上游、清理 pending 验收,直接配送补分拣 - 库存抵扣/计划/实收 FIFO,软扣部分扣减,并发出库串行 - 结束配送不被库存不足/待入库残留阻断 - 待验收并发唯一索引(含 name-only),finalize 共享连接修复 - 售后自动绑定订单明细、客户取货/采购并发修复 - 仓库表格自适应、弹窗滚动锁闪烁修复
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
const service = readFileSync(new URL('../src/services/v9CompletionService.ts', import.meta.url), 'utf8');
|
|
|
|
describe('售后处理自动绑定订单明细', () => {
|
|
it('优先 sku+order;唯一未退货行自动回写 after_sales.order_item_id', () => {
|
|
const start = service.indexOf("if (!orderItemId) {");
|
|
const end = service.indexOf('const itemOutcome =', start);
|
|
const fn = service.slice(start, end);
|
|
expect(fn).toContain('FROM order_items');
|
|
expect(fn).toContain('COALESCE(is_returned, false) = false');
|
|
expect(fn).toContain('row.sku_code');
|
|
expect(fn).toContain('UPDATE after_sales SET order_item_id');
|
|
});
|
|
|
|
it('多条歧义/零候选都不猜行,返回明确错误', () => {
|
|
const start = service.indexOf("if (!orderItemId) {");
|
|
const end = service.indexOf('const itemOutcome =', start);
|
|
const fn = service.slice(start, end);
|
|
expect(fn).toContain('candidatePool.length === 1');
|
|
expect(fn).toContain('存在多条可选明细');
|
|
expect(fn).toContain('没有可绑定的未退货明细');
|
|
expect(fn).toContain("code: 'after_sale_item_ambiguous'");
|
|
});
|
|
});
|