feat(shipping-notice): 人工重取库存前置候选刷新并放开行级库存源下拉

- 人工重试库存准备前置幂等重判:任务级整单重路由、行级定向重评目标行,复用裁决与冻结链路,零新动作码零契约变更
- 新版候选集 supersede 时内置失效旧库存事实,导出归档与查询服务同步适配
- 行级「库存源」下拉抽纯函数合并选项:歧义行候选置顶 + 全部已启用源去重兜底,任一已启用源可人工指定
- 库存源门禁归一 Notice→OT 身份解析;任务中心抽屉与表格接入行级重取入口
- 同步四语言文案、技术文档与实施计划
This commit is contained in:
hugo committed 2026-10-13 15:04:40 +08:00
1 parent e38e5a63fe
commit ea94fb28db
35 files changed
+2675 -83

No files matched your search

@@ -90,6 +90,13 @@ export const REVIEW_BUILD_ELIGIBILITY_BLOCKED = 'SHIPPING.REVIEW_BUILD_ELIGIBILI
*/
export const PROGRESS_POLL_MS = 5000;
/**
* waiting_human / failed 的降频保活间隔。两者不是不可逆终态:自愈回收、
* RPA 回调仍会把任务继续推进(历史缺陷:一帧停死令界面永久冻结在旧阶段),
* 降频而非停转,状态回到活跃态自动恢复基础间隔。
*/
export const PROGRESS_POLL_IDLE_MS = 15000;
/** / Case */
export type DraftVersionConflict = {
localVersion: number;
@@ -449,6 +456,7 @@ export function useShippingOrderReview(options: {
// 浏览器端 window.setInterval 返回 number;勿用 ReturnType<typeof window.setInterval>,
// 其在 @types/node 与 DOM lib 混用时会解析为 NodeJS.Timeout 导致 TS2322。
let progressPollTimer: number | null = null;
let progressPollIntervalMs = PROGRESS_POLL_MS;
let stpCreatePollTimer: number | null = null;
let reparseCaseRefreshTimer: number | null = null;
@@ -639,15 +647,17 @@ export function useShippingOrderReview(options: {
if (!authoritativeOrderTaskNo.value && !targetRunNo) return;
showWorkflowProgress.value = true;
workflowProgressPolling.value = true;
// RPA 超时、可重试失败和人工复核都可能被后续回调推进,页面留存期间持续读取 Projection。
// 等待人工(waiting_human,即“中断”)视为线性终态:结果不会自行变化,继续轮询浪费资源。
// 注意:统一投影的用户态值是 waiting_human(旧字段是 needs_human),若沿用旧的
// needs_human 会让已中断任务永远匹配不到终态、一直空转轮询;failed 同理是停止状态。
// 可重试失败(retryable)不在此列,需保留轮询以便后续成功回调自动刷新工作流。
const UNIFIED_TERMINAL = new Set(['completed', 'cancelled', 'waiting_human', 'failed']);
// RPA 超时、可重试失败、人工复核与自愈回收都可能被后续回调推进,页面留存期间持续
// 读取 Projection。completed/cancelled 是不可逆终态,命中即停;waiting_human/failed
// 不是终态(自愈回收、回调仍会推进),历史缺陷是一帧停死令界面永久冻结在旧阶段——
// 改为降频保活,状态回到活跃态自动恢复基础间隔。
const WORKFLOW_STOP_STATUSES = new Set(['completed', 'cancelled']);
const WORKFLOW_SLOW_STATUSES = new Set(['waiting_human', 'failed']);
let lastUnifiedStatus = '';
let lastLifecycleFingerprint = '';
const RUN_TERMINAL = new Set(['completed', 'partially_completed', 'failed', 'cancelled']);
// Run 级 partially_completed 只代表解析阶段收尾,OT 随后仍会被 STP 建单产出;
// 命中即停会令提交订单后的轮询在 OT 诞生前死亡(历史缺陷),同样只降频不停转。
const RUN_STOP_STATUSES = new Set(['completed', 'cancelled']);
const tick = async () => {
// 页面不可见时暂停轮询(返回前台后下一拍自动恢复),避免后台标签持续占用服务端。
if (typeof document !== 'undefined' && document.hidden) return;
@@ -677,10 +687,13 @@ export function useShippingOrderReview(options: {
// 否则提交订单后秒级阻断时五阶段条卡在订单复核、自动跳转永不触发。
await refreshActiveAutomationLifecycle();
}
if (UNIFIED_TERMINAL.has(unifiedStatus)) {
if (WORKFLOW_STOP_STATUSES.has(unifiedStatus)) {
stopWorkflowProgressPolling();
return;
}
ensureWorkflowProgressInterval(
WORKFLOW_SLOW_STATUSES.has(unifiedStatus) ? PROGRESS_POLL_IDLE_MS : PROGRESS_POLL_MS,
);
return;
}
if (targetRunNo) {
@@ -695,15 +708,26 @@ export function useShippingOrderReview(options: {
userTaskNo: reviewProgressContext.value?.user_task_no,
});
if (synthesized) reviewProgressContext.value = synthesized;
if (RUN_TERMINAL.has(String(run.status || '').trim())) {
const runStatus = String(run.status || '').trim();
if (RUN_STOP_STATUSES.has(runStatus)) {
stopWorkflowProgressPolling();
return;
}
ensureWorkflowProgressInterval(runStatus === 'failed' ? PROGRESS_POLL_IDLE_MS : PROGRESS_POLL_MS);
}
} catch {
/* */
}
};
// 状态分级轮询:活跃态基础间隔;waiting_human/failed 降频保活。间隔变化才重建定时器。
const ensureWorkflowProgressInterval = (intervalMs: number) => {
if (progressPollTimer != null && progressPollIntervalMs === intervalMs) return;
if (progressPollTimer != null) window.clearInterval(progressPollTimer);
progressPollIntervalMs = intervalMs;
progressPollTimer = window.setInterval(() => { void tick(); }, intervalMs);
};
void tick();
progressPollIntervalMs = PROGRESS_POLL_MS;
progressPollTimer = window.setInterval(() => { void tick(); }, PROGRESS_POLL_MS);
};