feat(in-transit-transfer): 自动调拨联动收料就绪并分层来源错误

- 调度整合:退役 in_transit_receipt_file_job,收料归档收敛 shipping_receipt_rpa_archive,排程注册表统一
- 自动调拨 Job:调拨前确保各来源当日收料文件就绪(缺失自动触发收料 RPA),严格等量匹配后生成 ERP 调拨单
- worker 手动唤醒:排程工作台支持手动唤醒与 runs 透视,heartbeat 协议同步
- 收料缺失幸存 T2:parse_failed 状态落库(迁移 q4c5)
- 来源错误分层与 stale 时钟换源:改挂 inventory_checked_at 库存查得时刻,展示阈值与执行门禁解耦(迁移 t5a6)
- 新增 wecom_sender 企微通知:每非空 Run 汇总一条,通知失败不影响 ERP 结果
- 同步排程工作台/调拨卡片前端、chat/admin 文案四语言、RPA 脚本与测试全家
This commit is contained in:
hugo committed 2026-09-30 00:20:06 +08:00
1 parent 993e581135
commit abf3d48927
144 files changed
+10161 -2132

No files matched your search

@@ -0,0 +1,72 @@
/**
* features/chat/components/messages/TransferMatchCard.spec.ts
* 用途:匹配卡顶栏「来源失败」横幅过滤——路由未解析失败只行内展示,不进顶栏。
* 依赖:@vue/test-utils、i18n。
* 逻辑:来源失败顶栏(sources[].error_code/error_message)防止“安静全 0”;
* 后端分层后路由失败保持行级(result=blocked_route_not_resolved),
* 顶栏需按 error_code 客户端排除(历史卡片回放同样生效)。
*/
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';
/** 最小合法匹配摘要(TransferMatchingSummary 全必填字段齐备,计数为 0) */
function buildSummary(): TransferMatchingSummary {
return {
matching_id: 'MTG-T',
status: 'completed',
business_date: '2026-08-06',
eligible_receipt_date_to: '2026-08-06',
expires_at: '2026-08-06T23:59:59',
counts: {
file_invoice_count: 0,
not_matured_count: 0,
matched_count: 0,
executable_count: 0,
blocked_count: 0,
pending_stock_check_count: 0,
invalid_count: 0,
},
estimated_transfer_quantity: '0',
estimated_external_write_count: 0,
matching_hash: 'hash-test',
};
}
function mountCard(sources: TransferSourceProgress[]) {
return mount(TransferMatchCard, {
props: {
summary: buildSummary(),
items: [],
selected: new Set<number>(),
sources,
},
global: { plugins: [i18n] },
});
}
describe('TransferMatchCard 来源失败顶栏', () => {
it('顶栏不展示 ROUTE_NOT_RESOLVED 来源失败(路由只行内)', () => {
// [断言意图] 路由失败不再升级为来源级 failed(后端分层),顶栏排除
// TRANSFER.ROUTE_NOT_RESOLVED(客户端按 error_code 过滤,历史回放同样生效);
// 其余来源级失败(如文件 schema 无效)仍必须在顶栏可见。
const wrapper = mountCard([
{ source_code: 'A', stage: 'failed', error_code: 'TRANSFER.ROUTE_NOT_RESOLVED', error_message: 'route not resolved' },
{ source_code: 'B', stage: 'failed', error_code: 'TRANSFER_FILE_SCHEMA_INVALID', error_message: 'schema' },
]);
const banner = wrapper.find('[data-testid="transfer-match-failed-sources"]');
expect(banner.exists()).toBe(true);
expect(banner.text()).not.toContain('route not resolved');
expect(banner.text()).toContain('schema');
});
it('仅路由失败时顶栏不渲染', () => {
// [断言意图] 唯一失败来源为路由未解析时,顶栏整体不出现(避免空横幅/全 0 误导)。
const wrapper = mountCard([
{ source_code: 'A', stage: 'blocked_route', error_code: 'TRANSFER.ROUTE_NOT_RESOLVED', error_message: 'route not resolved' },
]);
expect(wrapper.find('[data-testid="transfer-match-failed-sources"]').exists()).toBe(false);
});
});