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
@@ -1,12 +1,14 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferBacklogSummaryCard.vue
|
||||
用途:待处理异常卡(可恢复/已关闭/结果未知三组)——列与匹配窗口一致,
|
||||
支持关键字/结果筛选、多选批量操作(重查/恢复处理/标记无需处理)与行级快捷操作。
|
||||
支持关键字/结果筛选、多选批量操作(重查/恢复/关闭)与行级快捷操作。
|
||||
依赖:props.items、i18n chat.transfer.*、transferBatch.deriveBatchNo、transferFormat.formatQuantity。
|
||||
逻辑:仅 blocked_recoverable 可勾选与操作;result_unknown / manually_closed 只读;
|
||||
可恢复行按 result_code 细分徽标(blocked_file_removed=文件已移除);
|
||||
blocked_file_removed 行行内仅留「标记无需继续处理」(重查不可恢复——消失证据
|
||||
blocked_file_removed 行行内仅留「关闭」(重查不可恢复——消失证据
|
||||
无法由重查翻回,唯一出口=人工关闭或等文件重新同步);
|
||||
批量按钮与行内按钮同用短文案键(重查/恢复/关闭,2026-10-12 文案一致化,
|
||||
完整语义经 title 悬浮),勾选计数保留;
|
||||
勾选集合为卡片本地态,操作经 emit 交父组件调用批量端点并刷新。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
@@ -157,18 +159,22 @@ function resultLabelKey(item: TransferBacklogItem): string {
|
||||
class="rounded-lg border border-brand-200 bg-brand-50 px-3 py-1 text-xs font-bold text-brand-700 transition hover:bg-brand-100 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-backlog-batch-resume"
|
||||
:disabled="busy"
|
||||
:title="$t('chat.transfer.resumeAction')"
|
||||
@click="emit('resume', selectedActionableIds)"
|
||||
>
|
||||
{{ $t('chat.transfer.resumeAction') }}({{ selectedActionableIds.length }})
|
||||
<!-- [2026-10-12 文案一致化] 批量按钮与行内按钮同用短文案键(恢复/关闭),
|
||||
勾选计数保留;完整语义经 title 悬浮透出(与行内按钮同模式) -->
|
||||
{{ $t('chat.transfer.resumeActionShort') }}({{ selectedActionableIds.length }})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-red-200 bg-red-50 px-3 py-1 text-xs font-bold text-red-600 transition hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-backlog-batch-close"
|
||||
:disabled="busy"
|
||||
:title="$t('chat.transfer.manualClose')"
|
||||
@click="emit('batchClose', selectedActionableIds)"
|
||||
>
|
||||
{{ $t('chat.transfer.manualClose') }}({{ selectedActionableIds.length }})
|
||||
{{ $t('chat.transfer.manualCloseShort') }}({{ selectedActionableIds.length }})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
@@ -15,7 +15,12 @@
|
||||
emit execute(itemIds);来源级解析/文件失败经 sources.error_code 透出
|
||||
(防"安静全 0"),但路由未解析失败(TRANSFER.ROUTE_NOT_RESOLVED)不进顶栏
|
||||
——路由失败保持行级(result=blocked_route_not_resolved 行内展示),
|
||||
顶栏按 error_code 客户端排除,历史卡片回放同样生效。
|
||||
顶栏按 error_code 客户端排除,历史卡片回放同样生效;
|
||||
[2026-10-12 单据数口径修正] 预计 ERP 单据数(计数卡=全部可执行行、
|
||||
生成按钮旁=勾选可执行行)按执行建单五元组 (external_org, source_code,
|
||||
receipt_date, from_warehouse, to_warehouse) 去重实时计算(与后端
|
||||
execution_service 同键),同组多行合并一张单——原「=可执行行数」口径
|
||||
高估单据数误导用户。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
@@ -144,6 +149,34 @@ const executableCheckedItemIds = computed(() =>
|
||||
props.items.filter((item) => isSelectable(item) && isChecked(item)).map((item) => item.item_id as number),
|
||||
);
|
||||
|
||||
/** [2026-10-12 单据数口径修正] 执行建单五元组键(与后端 execution_service.
|
||||
* prepare_execution 分组建单同键同 .trim() 规范化):(external_org, source_code,
|
||||
* receipt_date, from_warehouse, to_warehouse),同组多行执行期合并一张 ERP 单。
|
||||
* 老卡片行缺 external_org 按 '' 参与(分组退化为四元组,仅跨组织同仓库配置下有差异)。 */
|
||||
function documentGroupKey(item: TransferMatchingItem): string {
|
||||
return [
|
||||
(item.external_org ?? '').trim(),
|
||||
(item.source_code ?? '').trim(),
|
||||
(item.receipt_date ?? '').trim(),
|
||||
(item.from_warehouse ?? '').trim(),
|
||||
(item.to_warehouse ?? '').trim(),
|
||||
].join('\u001f');
|
||||
}
|
||||
|
||||
/** 预计 ERP 单据数(计数卡):全部可执行行按五元组去重的组数。客户端实时计算,
|
||||
* 使历史快照中旧口径(=可执行行数)的持久化估计值不再上屏误导。 */
|
||||
const estimatedDocumentCountAll = computed(
|
||||
() => new Set(props.items.filter((item) => item.result === 'executable').map(documentGroupKey)).size,
|
||||
);
|
||||
|
||||
/** 预计 ERP 单据数(生成按钮旁):按当前勾选的可执行行分组计数,回答
|
||||
* 「点生成会出几张单」;未勾选为 0。 */
|
||||
const estimatedDocumentCountSelected = computed(
|
||||
() => new Set(
|
||||
props.items.filter((item) => item.result === 'executable' && isChecked(item)).map(documentGroupKey),
|
||||
).size,
|
||||
);
|
||||
|
||||
/**
|
||||
* 库存查询时刻小字(HH:mm);后端 naive ISO 按 UTC 解析后转浏览器本地时区
|
||||
* (仓库约定 parseApiUtcDate,2026-09-29 修复 UTC+8 展示异常);
|
||||
@@ -220,7 +253,9 @@ function reasonTitle(item: TransferMatchingItem): string | undefined {
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedQuantity') }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-surface-soft p-2 text-center">
|
||||
<div class="text-lg font-black text-brand-600">{{ summary.estimated_external_write_count }}</div>
|
||||
<!-- [2026-10-12 单据数口径修正] 按执行建单五元组去重(客户端计算),
|
||||
不再透传旧口径持久值(=可执行行数)——同组多行合并一张 ERP 单 -->
|
||||
<div class="text-lg font-black text-brand-600">{{ estimatedDocumentCountAll }}</div>
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedExternalWrites') }}</div>
|
||||
</div>
|
||||
<!-- 待查库存:文件已落地、尚未查过 ERP 库存的行数(历史回放缺省 0) -->
|
||||
@@ -393,9 +428,10 @@ function reasonTitle(item: TransferMatchingItem): string | undefined {
|
||||
</div>
|
||||
|
||||
<div class="mt-3 flex items-center justify-end gap-3 border-t border-subtle pt-3">
|
||||
<span class="text-xs text-muted">
|
||||
<span class="text-xs text-muted" data-testid="transfer-estimate-selected">
|
||||
{{ $t('chat.transfer.selectedCount', { count: selectedCount }) }} ·
|
||||
{{ $t('chat.transfer.estimatedExternalWrites') }}:{{ summary.estimated_external_write_count }}
|
||||
<!-- [2026-10-12 单据数口径修正] 随勾选联动:按勾选可执行行五元组分组计数 -->
|
||||
{{ $t('chat.transfer.estimatedExternalWrites') }}:{{ estimatedDocumentCountSelected }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in new issue
Block a user