feat(in-transit-transfer): 自动调拨支持收料日期范围并收归排程通用通知
- 自动调拨任务新增收料日期范围动态参数(receipt_date_from/to):缩小匹配面便于测试与排障,非法范围由匹配层校验拒绝 - 排程动态参数表单支持占位文案 key 与空值归 null,日期筛选直达任务配置 - 执行结果通知统一走排程「启用通知」通用企微通知,任务不再自建领域通知 - 门禁契约澄清 retry_inventory_matching 语义:复用已抓库存重匹配不重抓;STP 多候选无匹配时阶段能力禁用、不隐式触发 RPA - 同步匹配/自动调拨/排程测试、四语言文案与文档
This commit is contained in:
1 parent
34c3bfb254
commit
a8d721e793
35 files changed
+863
-138
No files matched your search
@@ -10,7 +10,7 @@ import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import TransferMatchCard from './TransferMatchCard.vue';
|
||||
import type { TransferMatchingSummary, TransferSourceProgress } from '../../types/transfer.types';
|
||||
import type { TransferMatchingItem, TransferMatchingSummary, TransferSourceProgress } from '../../types/transfer.types';
|
||||
|
||||
/** 最小合法匹配摘要(TransferMatchingSummary 全必填字段齐备,计数为 0) */
|
||||
function buildSummary(): TransferMatchingSummary {
|
||||
@@ -70,3 +70,81 @@ describe('TransferMatchCard 来源失败顶栏', () => {
|
||||
expect(wrapper.find('[data-testid="transfer-match-failed-sources"]').exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
/** [2026-10-12 单据数口径修正] 预计 ERP 单据数按执行建单五元组去重。
|
||||
* 行分组键 = (external_org, source_code, receipt_date, from_warehouse,
|
||||
* to_warehouse),与后端 execution_service.prepare_execution 同口径:
|
||||
* 同组多行执行期合并一张 ERP 单,预估数不得等于可执行行数。 */
|
||||
function buildItem(overrides: Partial<TransferMatchingItem>): TransferMatchingItem {
|
||||
return {
|
||||
item_id: 1,
|
||||
source_code: 'DBS-AWSBI',
|
||||
material_no: 'MAT-001',
|
||||
material_name: '连接器组件',
|
||||
specification: 'A 型',
|
||||
invoice_no: 'HOM-001',
|
||||
receipt_date: '2026-08-05',
|
||||
from_warehouse: 'DBS-TRANSIT',
|
||||
from_quantity: '100',
|
||||
to_warehouse: 'HUB-CN01',
|
||||
to_quantity: '100',
|
||||
result: 'executable',
|
||||
external_org: 'HX-CN01',
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
/** 计数卡第 5 格 = 预计 ERP 单据(可执行/未成熟/阻断/数量/单据/待查/失效)。 */
|
||||
function estimateCardText(wrapper: ReturnType<typeof mount>): string {
|
||||
const cells = wrapper.find('[data-testid="transfer-match-counts"]').findAll('div.rounded-lg');
|
||||
return cells[4]?.text() ?? '';
|
||||
}
|
||||
|
||||
describe('TransferMatchCard 预计 ERP 单据数(五元组去重)', () => {
|
||||
const sameGroupA = buildItem({ item_id: 1, invoice_no: 'HOM-001' });
|
||||
const sameGroupB = buildItem({ item_id: 2, invoice_no: 'HOX-002' });
|
||||
const crossDate = buildItem({ item_id: 3, invoice_no: 'HOM-003', receipt_date: '2026-08-04' });
|
||||
|
||||
it('计数卡:同组两行 + 跨日一行 → 预估 2(不等于可执行行数 3)', () => {
|
||||
// [断言意图] 锁定五元组去重口径:receipt_date 入键,同组合并、跨组拆分,
|
||||
// 历史快照旧口径(=行数)持久值不再上屏。
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: {
|
||||
summary: buildSummary(),
|
||||
items: [sameGroupA, sameGroupB, crossDate],
|
||||
selected: new Set<number>(),
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(estimateCardText(wrapper).replace(/\D/g, '')).toBe('2');
|
||||
});
|
||||
|
||||
it('生成按钮旁预估随勾选联动:勾选同组两行仍为 1,跨组勾选后为 2', async () => {
|
||||
// [断言意图] 底部预估回答「点生成会出几张单」:仅统计勾选的可执行行并
|
||||
// 按五元组分组;同组两行勾选=1 张(合并),追加跨日行勾选=2 张。
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: {
|
||||
summary: buildSummary(),
|
||||
items: [sameGroupA, sameGroupB, crossDate],
|
||||
selected: new Set<number>([1, 2]),
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(wrapper.find('[data-testid="transfer-estimate-selected"]').text()).toContain(':1');
|
||||
await wrapper.setProps({ selected: new Set<number>([1, 2, 3]) });
|
||||
expect(wrapper.find('[data-testid="transfer-estimate-selected"]').text()).toContain(':2');
|
||||
});
|
||||
|
||||
it('阻断行不参与预估:勾选阻断行不改变单据数', () => {
|
||||
const blocked = buildItem({ item_id: 4, invoice_no: 'HOM-BLOCKED', result: 'blocked_quantity_mismatch' });
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: {
|
||||
summary: buildSummary(),
|
||||
items: [sameGroupA, blocked],
|
||||
selected: new Set<number>([1, 4]),
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(wrapper.find('[data-testid="transfer-estimate-selected"]').text()).toContain(':1');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user