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:
1 parent
993e581135
commit
abf3d48927
144 files changed
+10161
-2132
No files matched your search
@@ -10,7 +10,9 @@
|
||||
* 4s 轮询 GET /sources 直至全部脱离 fetching(ready/failed/expired/none);
|
||||
* 勾选集合以明细行 item_id 为键(历史回放行无 item_id 不可选);
|
||||
* 恢复处理 = 按明细 id 重查库存(batch-requery 是唯一后端);
|
||||
* 防重复点击(busy);错误统一 useMessage 展示 BusinessError。
|
||||
* 防重复点击(busy);错误统一 useMessage 展示 BusinessError;
|
||||
* 首页看板支持会话引导期预取(prefetchTransferHomeBoard 单飞,
|
||||
* loadBacklogSummary/loadExecutableItems 挂载时消费同一 Promise)。
|
||||
*/
|
||||
import { computed, getCurrentScope, onScopeDispose, ref, type Ref } from 'vue';
|
||||
import i18n from '@/i18n';
|
||||
@@ -59,6 +61,29 @@ const SOURCE_POLL_INTERVAL_MS = 4000;
|
||||
/** 来源轮询连续失败停止上限(口径同 Run 轮询):防后端持续不可用时无限空转 */
|
||||
const SOURCE_POLL_MAX_CONSECUTIVE_FAILURES = 3;
|
||||
|
||||
/**
|
||||
* 首页看板预取(模块级单飞,consume-once):看板卡原先等会话消息返回、
|
||||
* TransferHomePanel 挂载后才发请求(串行白等会话引导 ~1.5s);ChatMessageList
|
||||
* 识别到「在途调拨 Agent 且当前无消息」即预取,挂载后的 loadBacklogSummary /
|
||||
* loadExecutableItems 命中同一 Promise——会话引导与看板数据并行。
|
||||
* 已知降级(无正确性影响):预取后看板未挂载(如会话实为历史消息)时槽位滞留
|
||||
* 已决 Promise,后续进入首页不再预取、回落挂载时现发,仅损失一次预取机会。
|
||||
*/
|
||||
let homeBoardPrefetchSummary: Promise<TransferBacklogSummary> | null = null;
|
||||
let homeBoardPrefetchExecutable: ReturnType<typeof listExecutableTransferItems> | null = null;
|
||||
|
||||
/** 提前发起首页看板两请求(幂等:任一槽位在途/未消费时不重复发)。 */
|
||||
export function prefetchTransferHomeBoard(): void {
|
||||
if (homeBoardPrefetchSummary || homeBoardPrefetchExecutable) return;
|
||||
const summary = getTransferBacklogSummary();
|
||||
const executable = listExecutableTransferItems();
|
||||
// 浮空兜底:预取无人消费时 rejection 不产生 unhandledrejection;消费方仍从原 Promise 拿真实错误
|
||||
void summary.catch(() => undefined);
|
||||
void executable.catch(() => undefined);
|
||||
homeBoardPrefetchSummary = summary;
|
||||
homeBoardPrefetchExecutable = executable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run 轮询终态集合(口径对齐后端 status.py RUN_TRANSITIONS 收尾):
|
||||
* executing 只流向 success / partial_failed / failed / cancelled——
|
||||
@@ -424,7 +449,8 @@ export function useChatTransfer() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 对指定来源重新触发收料 RPA 抓取,并刷新来源状态(触发后 202 + fetching,
|
||||
/** 对指定来源重试收料,并刷新来源状态(解析失败分层:parse_failed 先本地重解析
|
||||
* 返回 200——ready/parse_failed,无轮询;其余状态仍触发收料 RPA 返回 202 + fetching,
|
||||
* loadSources 观察到 fetching 即自动开始来源轮询,RPA 回调收口后状态自动刷新) */
|
||||
async function retrySourceRpa(sourceCode: string) {
|
||||
const status = await retryTransferSourceRpa(sourceCode);
|
||||
@@ -440,9 +466,21 @@ export function useChatTransfer() {
|
||||
return { items, summary };
|
||||
}
|
||||
|
||||
/** 加载可调拨明细(全局可执行行队列;恢复后的行会出现在这里) */
|
||||
/** 首页看板计数(仅汇总,不拉全量列表——列表延迟到切片子视图加载);
|
||||
* 命中首页预取则复用在途请求,否则现发 */
|
||||
async function loadBacklogSummary() {
|
||||
const pending = homeBoardPrefetchSummary;
|
||||
homeBoardPrefetchSummary = null;
|
||||
const summary = await (pending ?? getTransferBacklogSummary());
|
||||
backlogSummary.value = summary;
|
||||
return summary;
|
||||
}
|
||||
|
||||
/** 加载可调拨明细(全局可执行行队列;恢复后的行会出现在这里);命中首页预取则复用在途请求 */
|
||||
async function loadExecutableItems() {
|
||||
const payload = await listExecutableTransferItems();
|
||||
const pending = homeBoardPrefetchExecutable;
|
||||
homeBoardPrefetchExecutable = null;
|
||||
const payload = await (pending ?? listExecutableTransferItems());
|
||||
executableItems.value = payload.items;
|
||||
return executableItems.value;
|
||||
}
|
||||
@@ -522,6 +560,7 @@ export function useChatTransfer() {
|
||||
loadSources,
|
||||
retrySourceRpa,
|
||||
loadBacklog,
|
||||
loadBacklogSummary,
|
||||
loadExecutableItems,
|
||||
batchRequery,
|
||||
resume,
|
||||
|
||||
Reference in new issue
Block a user