refactor(shipping-notice): 重构货代发货通知状态管理,移除废弃的process_status字段
统一货代发货通知的业务阶段为四个标准阶段:接收解析、订单复核、发货准备、上传完成 设置 ui_state 为前端唯一状态数据源,不再依赖 process_status 驱动业务流程 删除 shipping_notices 表的废弃 process_status 列及对应复合索引,新增数据库迁移脚本 替换全栈代码中所有对 process_status 的引用为生命周期、上传状态等领域字段 更新相关文档、测试用例与前端展示逻辑适配新的状态管理规则
This commit is contained in:
1 parent
6684e7181a
commit
5ef8329bd8
178 files changed
+5091
-1734
No files matched your search
@@ -5,8 +5,8 @@
|
||||
* useShippingTodoBadge、useMessage、shippingProcessingLabels。
|
||||
* 逻辑:选中项展示入口卡 + 统一进度紧凑摘要(UI-03);主按钮深链「订单处理工作台」;
|
||||
* review_case 在 failed/manual_fallback 时提供「重试自动推进」(与底栏同一 API/幂等键);
|
||||
* 不内嵌 ShippingTaskWorkbench;轮询依据 shipping_processing_status /
|
||||
* process_status / Intake parse_status。
|
||||
* 不内嵌 ShippingTaskWorkbench;业务阶段和主进度只依据 ui_state.stage/steps,
|
||||
* Intake parse_status 仅用于解析任务轮询。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
@@ -33,14 +33,8 @@ import {
|
||||
IN_PROGRESS_PROCESSING_STATUSES,
|
||||
TERMINAL_PROCESSING_STATUSES,
|
||||
} from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
import {
|
||||
resolveShippingProcessingStatusLabel,
|
||||
shippingProcessingStageKey,
|
||||
} from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
import { stageAbsoluteIndex } from '@/features/shipping-progress/progressWindow';
|
||||
import { resolveGateReasonLabel } from '@/features/shipping-progress/gateReasonLabel';
|
||||
import {
|
||||
IN_PROGRESS_PROCESS,
|
||||
isShippingTodoListItemInProgress,
|
||||
} from './shippingTaskCenterPolling';
|
||||
import ShippingRunProgressTable from './ShippingRunProgressTable.vue';
|
||||
@@ -54,18 +48,18 @@ const BACKGROUND_POLL_MS = 8000;
|
||||
|
||||
/**
|
||||
* 判断详情是否仍处于进行中。
|
||||
* 核心逻辑:与列表同源——优先 shipping_processing_status;缺失时回退 process_status;
|
||||
* 不回退 WorkflowItem lifecycle(UI-03)。
|
||||
* 核心逻辑:优先统一 ui_state.stage;技术 processing status 仅用于轮询,不用于业务阶段展示。
|
||||
*/
|
||||
function isDetailInProgress(task: ShippingTaskDetail | null): boolean {
|
||||
if (!task) return false;
|
||||
const stage = String(task.ui_state?.stage?.code || '').trim();
|
||||
if (stage) return stage !== 'upload_complete';
|
||||
const unified = String(task.shipping_processing_status || '').trim().toLowerCase();
|
||||
if (unified) {
|
||||
if (TERMINAL_PROCESSING_STATUSES.has(unified)) return false;
|
||||
return IN_PROGRESS_PROCESSING_STATUSES.has(unified);
|
||||
}
|
||||
const process = String(task.process_status || '').trim();
|
||||
return IN_PROGRESS_PROCESS.has(process);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,31 +134,20 @@ const entryItem = computed((): ShippingTaskSummary | ShippingTaskDetail | null =
|
||||
});
|
||||
|
||||
/**
|
||||
* 任务中心选中项的统一进度紧凑摘要(UI-03):阶段 · n/15 + 阻断文案。
|
||||
* 任务中心选中项的统一进度紧凑摘要:只展示后端阶段与阻断原因。
|
||||
* 15 节点只属于订单详情进度条,任务中心不得重复显示。
|
||||
*/
|
||||
const entryProgressSummary = computed(() => {
|
||||
const item = entryItem.value;
|
||||
if (!item) return null;
|
||||
const stage = String(
|
||||
('shipping_processing_stage' in item ? item.shipping_processing_stage : null)
|
||||
|| '',
|
||||
).trim();
|
||||
const status = String(item.shipping_processing_status || '').trim();
|
||||
if (!stage && !status) return null;
|
||||
const stageKey = shippingProcessingStageKey(stage || '');
|
||||
const stageLabel = stage && te(stageKey) ? t(stageKey) : (stage || resolveShippingProcessingStatusLabel(status, te, t));
|
||||
const index = stage ? stageAbsoluteIndex(stage) + 1 : 0;
|
||||
const gateCode = String(
|
||||
item.ui_state?.process_gate?.current_blocking_gate?.blocking_reason_code
|
||||
|| item.ui_state?.process_gate?.blocking_reason_code
|
||||
|| '',
|
||||
).trim();
|
||||
const blocker = resolveGateReasonLabel(gateCode, { t, te });
|
||||
const stageCode = String(item.ui_state?.stage?.code || '').trim();
|
||||
const stageLabel = String(item.ui_state?.stage?.label || '').trim();
|
||||
if (!stageCode && !stageLabel) return null;
|
||||
const reason = item.ui_state?.reason;
|
||||
const blocker = String(reason?.message || '').trim()
|
||||
|| resolveGateReasonLabel(String(reason?.code || '').trim(), { t, te });
|
||||
return {
|
||||
stageLabel,
|
||||
index,
|
||||
total: 15,
|
||||
statusLabel: resolveShippingProcessingStatusLabel(status, te, t),
|
||||
stageLabel: stageLabel || stageCode,
|
||||
blocker,
|
||||
poNumber: String(item.po_number || '').trim() || null,
|
||||
customerName: String(item.customer_name || '').trim() || null,
|
||||
@@ -198,7 +181,7 @@ function todoDisplayNo(item: ShippingTaskSummary): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否应继续自动轮询:processing 桶、进行中直链详情,或 runs 面;列表项按统一投影 / process_status。
|
||||
* 是否应继续自动轮询:processing 桶、进行中直链详情,或 runs 面;列表项按统一投影。
|
||||
*/
|
||||
const shouldAutoRefresh = computed(() => {
|
||||
if (surface.value === 'runs') return true;
|
||||
@@ -397,8 +380,10 @@ function canRetryStpAutoCreate(item: ShippingTaskSummary | ShippingTaskDetail |
|
||||
const caseNo = String(item.review_case_no || '').trim();
|
||||
if (!caseNo) return false;
|
||||
const summaryActions = item.ui_state?.summary?.allowed_actions || [];
|
||||
const buttons = (item.ui_state?.action_buttons || []).map((action) => String(action));
|
||||
return summaryActions.includes('retry_stp_auto_create') || buttons.includes('retry_stp_auto_create');
|
||||
const actions = [item.ui_state?.actions?.primary, ...(item.ui_state?.actions?.secondary || [])]
|
||||
.filter(Boolean)
|
||||
.map((action) => String(action?.code || ''));
|
||||
return summaryActions.includes('retry_stp_auto_create') || actions.includes('retry_stp_auto_create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -730,7 +715,7 @@ onBeforeUnmount(() => {
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-1 truncate text-sm text-secondary">
|
||||
{{ item.ui_state?.summary?.current_todo || item.ui_state?.summary?.title || item.process_status }}
|
||||
{{ item.ui_state?.todo?.title || item.ui_state?.summary?.current_todo || item.ui_state?.summary?.title || item.ui_state?.stage?.label || '—' }}
|
||||
</div>
|
||||
<div class="mt-1 truncate text-xs text-muted">
|
||||
{{ item.customer_name || item.source_file_name || item.review_run_no || '—' }}
|
||||
@@ -838,8 +823,6 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.progressSummary', {
|
||||
stage: entryProgressSummary.stageLabel,
|
||||
current: entryProgressSummary.index || '—',
|
||||
total: entryProgressSummary.total,
|
||||
}) }}
|
||||
</p>
|
||||
<p
|
||||
|
||||
Reference in new issue
Block a user