feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
84a881b554
commit
74270adc22
149 files changed
+20111
-3871
No files matched your search
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/chat/shipping/useShippingProcessingWorkItem.ts
|
||||
* 用途:按 work_item_type + work_item_no 轮询统一 ShippingProcessingProjection。
|
||||
* 依赖:shipping.api getWorkspaceShippingProcessingWorkItem、normalizeShippingProcessing。
|
||||
* 逻辑:复核台 / 任务中心双读接入;404 或权威 OT 缺失时保持 null,不打断旧进度 UI。
|
||||
* 依赖:shipping.api、normalizeShippingProcessing、mergeWorkbenchProcessingProjection。
|
||||
* 逻辑:复核台 / 任务中心双读;工作台可启用 monotonicProgressVersion;404 时保持 null。
|
||||
*/
|
||||
|
||||
import {
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
toValue,
|
||||
} from 'vue';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { mergeWorkbenchProcessingProjection } from '@/features/shipping-progress/mergeProcessingProjection';
|
||||
import { getWorkspaceShippingProcessingWorkItem } from '../api/shipping.api';
|
||||
import type { ShippingProcessingProjection } from '../types/shipping.api.types';
|
||||
import { normalizeShippingProcessingProjection } from './normalizeShippingProcessing';
|
||||
@@ -33,7 +34,8 @@ export type ShippingProcessingWorkItemTypeArg = 'order_intake' | 'order_task';
|
||||
*
|
||||
* @param workItemType - order_intake | order_task
|
||||
* @param workItemNo - Intake 编号或 OT 编号(MaybeRef)
|
||||
* @param options.enabled - 是否启用;options.pollMs - 轮询间隔
|
||||
* @param options.enabled - 是否启用;options.pollMs - 轮询间隔;
|
||||
* options.monotonicProgressVersion - 仅工作台:旧 progress_version 不覆盖本地
|
||||
* @returns projection / loading / error / refresh / stop
|
||||
*/
|
||||
export function useShippingProcessingWorkItem(
|
||||
@@ -42,6 +44,8 @@ export function useShippingProcessingWorkItem(
|
||||
options: {
|
||||
enabled?: MaybeRefOrGetter<boolean>;
|
||||
pollMs?: number;
|
||||
/** 仅订单处理工作台开启;任务中心保持默认 false。 */
|
||||
monotonicProgressVersion?: boolean;
|
||||
} = {},
|
||||
): {
|
||||
projection: Ref<ShippingProcessingProjection | null>;
|
||||
@@ -57,6 +61,7 @@ export function useShippingProcessingWorkItem(
|
||||
let generation = 0;
|
||||
let stopped = false;
|
||||
const pollMs = options.pollMs ?? DEFAULT_POLL_MS;
|
||||
const monotonic = Boolean(options.monotonicProgressVersion);
|
||||
|
||||
/**
|
||||
* 清除轮询定时器。
|
||||
@@ -95,10 +100,14 @@ export function useShippingProcessingWorkItem(
|
||||
const raw = await getWorkspaceShippingProcessingWorkItem(workItemType, no);
|
||||
if (stopped || gen !== generation) return;
|
||||
const normalized = normalizeShippingProcessingProjection(raw);
|
||||
projection.value = normalized;
|
||||
// [STEP] 工作台单调合并:旧包丢弃;新包整包替换;同版本浅合并。任务中心不启用。
|
||||
projection.value = monotonic
|
||||
? mergeWorkbenchProcessingProjection(projection.value, normalized)
|
||||
: normalized;
|
||||
error.value = null;
|
||||
clearTimer();
|
||||
if (normalized && !TERMINAL_STATUSES.has(normalized.status) && !stopped) {
|
||||
const next = projection.value;
|
||||
if (next && !TERMINAL_STATUSES.has(next.status) && !stopped) {
|
||||
timer = window.setTimeout(() => {
|
||||
void refresh();
|
||||
}, pollMs);
|
||||
|
||||
Reference in new issue
Block a user