Files
SupplierSystem/server/tests/inventoryPartialSoftDeduct.test.ts
T
Ubuntu 05b81348c4
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
feat(配送/分拣): 早期任务、全状态发车与库存抵扣闭环
- 下单即建分拣/配送,待取货/散客/独立进货守卫
- 30/40/45 直接发车/分拣,入库与分拣二选一
- 分拣完成补上游、清理 pending 验收,直接配送补分拣
- 库存抵扣/计划/实收 FIFO,软扣部分扣减,并发出库串行
- 结束配送不被库存不足/待入库残留阻断
- 待验收并发唯一索引(含 name-only),finalize 共享连接修复
- 售后自动绑定订单明细、客户取货/采购并发修复
- 仓库表格自适应、弹窗滚动锁闪烁修复
2026-10-26 16:42:53 +08:00

19 lines
849 B
TypeScript

import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
const svc = readFileSync(new URL('../src/services/inventoryOutboundService.ts', import.meta.url), 'utf8');
describe('软扣允许部分扣减', () => {
it('软扣传 allowPartial;可用>0 时先扣可用,不因缺口提前抛错', () => {
expect(svc).toContain('allowPartial?: boolean');
expect(svc).toContain('allowPartial: softInventory');
expect(svc).toContain('!input.allowPartial || claimable <= 1e-9');
});
it('部分扣减也标记 deductedAny,尾差记 softSkipped;硬扣仍走原错误', () => {
expect(svc).toContain('deductedAny = true;');
expect(svc).toContain("reason: softSkipped.length ? 'partial_soft_skip'");
expect(svc).toContain("if (softInventory && (error?.code === 'inventory_outbound'");
});
});