- 下单即建分拣/配送,待取货/散客/独立进货守卫 - 30/40/45 直接发车/分拣,入库与分拣二选一 - 分拣完成补上游、清理 pending 验收,直接配送补分拣 - 库存抵扣/计划/实收 FIFO,软扣部分扣减,并发出库串行 - 结束配送不被库存不足/待入库残留阻断 - 待验收并发唯一索引(含 name-only),finalize 共享连接修复 - 售后自动绑定订单明细、客户取货/采购并发修复 - 仓库表格自适应、弹窗滚动锁闪烁修复
29 lines
1.4 KiB
TypeScript
29 lines
1.4 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
||
import { describe, expect, it } from 'vitest';
|
||
|
||
const svc = readFileSync(new URL('../src/services/orderWorkflowFulfillmentService.ts', import.meta.url), 'utf8');
|
||
|
||
describe('结束配送库存口径', () => {
|
||
it('读取 marker/inbound/outbound;30/40 跳过,45 已扣跳过/未扣软扣,无入库普通单跳过', () => {
|
||
const start = svc.indexOf('const settleCtx = await db.query(');
|
||
const end = svc.indexOf('const now = new Date();', start);
|
||
const fn = svc.slice(start, end);
|
||
expect(fn).toContain('auto_advanced_from_status');
|
||
expect(fn).toContain('has_inbound');
|
||
expect(fn).toContain('has_outbound');
|
||
expect(fn).toContain('(marker === 30 || marker === 40) && !hasStockCover');
|
||
expect(fn).toContain('has_stock_cover');
|
||
expect(fn).toContain('marker === 45');
|
||
expect(fn).toContain('fallbackToRequiredQty = true');
|
||
expect(fn).toContain('else if (!hasInbound && !hasStockCover)');
|
||
});
|
||
|
||
it('结案扣库必须软扣,不能因库存不足阻断置 90', () => {
|
||
const start = svc.indexOf('const settleCtx = await db.query(');
|
||
const end = svc.indexOf('const now = new Date();', start);
|
||
const fn = svc.slice(start, end);
|
||
expect(fn).toContain('options?.softInventorySettle === true || !hasInbound || marker === 45');
|
||
expect(fn).toContain('fallbackToRequiredQty');
|
||
});
|
||
});
|