feat(shipping-notice): 升级货代发货流程为五阶段,完善业务校验
将货代发货流程从四阶段扩展为五阶段,拆分上传相关逻辑至独立的货代上传阶段; 统一多语言文案修正客户状态语义,将"客户尚未识别"调整为符合业务的"客户尚未确认"; 新增严格的上传成功验证谓词,需同时满足任务状态、全部预约单上传成功、存在有效成功上传尝试三个条件方可标记为完成; 新增坐标取值模型配置,支持Legacy冻结绝对坐标和锚点框架受限平移两种模式; 更新全链路相关文档、前端组件、后端服务与测试用例,确保业务逻辑对齐新业务规则。
This commit is contained in:
1 parent
1b6483a4ea
commit
935bf26fa6
86 files changed
+2743
-311
No files matched your search
@@ -1235,7 +1235,9 @@ describe('conversationProcessingProjection — normalize & semantic & stabilize'
|
||||
}],
|
||||
waiting_human: [], processing: [], completed: [], cancelled: [], archived: [],
|
||||
},
|
||||
four_stage_nodes: [{ code: 'intake_parse', label_key: 'shipping.stage.intake', status: 'blocked' }],
|
||||
lifecycle_nodes: [{ code: 'intake_parse', label_key: 'shipping.stage.intake', status: 'blocked' }],
|
||||
// 兼容字段故意给出不同值,验证适配层优先消费 lifecycle_nodes。
|
||||
four_stage_nodes: [{ code: 'upload_complete', label_key: 'shipping.stage.complete', status: 'passed' }],
|
||||
output_artifacts: [{ order_task_no: 'OT-API-1', filename: 'shipping.xlsx', type: 'excel', status: 'ready', action: { code: 'download_excel', enabled: true } }],
|
||||
} as unknown as ConversationProcessingProjection;
|
||||
|
||||
@@ -1247,9 +1249,10 @@ describe('conversationProcessingProjection — normalize & semantic & stabilize'
|
||||
expect(eml.uiState?.primary_action?.i18nKey).toBe('shipping.retry');
|
||||
expect(eml.aggregateChildren?.[0]?.uiState?.primary_action?.code).toBe('retry');
|
||||
expect(eml.aggregateChildren?.[0]?.sourceSummary.filename).toBe('a.pdf');
|
||||
// 批次统计、四阶段与产物均是后端事实,适配时不得从附件重算或丢失。
|
||||
// 批次统计、五阶段与产物均是后端事实,适配时不得从附件重算或丢失。
|
||||
expect(normalized.summary.total_files).toBe(7);
|
||||
expect(normalized.four_stage_nodes).toEqual([{ code: 'intake_parse', label_key: 'shipping.stage.intake', status: 'blocked' }]);
|
||||
expect(normalized.lifecycle_nodes).toEqual([{ code: 'intake_parse', label_key: 'shipping.stage.intake', status: 'blocked' }]);
|
||||
expect(normalized.four_stage_nodes).toEqual([{ code: 'upload_complete', label_key: 'shipping.stage.complete', status: 'passed' }]);
|
||||
expect(normalized.output_artifacts?.[0]?.action.enabled).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -946,7 +946,7 @@ export function resolveConversationProcessingFromUnified(
|
||||
stabilizer?: { hasSeenOrderTaskBefore?(conversationId?: string | null): boolean; markSeen?(conversationId?: string | null): void; reset?(conversationId?: string | null): void; conversationId?: string | null },
|
||||
): ConversationProcessingProjection | null {
|
||||
const items = Array.isArray(workItems) ? workItems : [];
|
||||
// [AUTHORITY] conversation_processing.status_groups 与 four_stage_nodes / ui_state
|
||||
// [AUTHORITY] conversation_processing.status_groups 与 lifecycle_nodes / ui_state
|
||||
// 同属后端一次裁决。即使顶层 work_items 非空,也不得前端二次聚合或用旧快照覆盖。
|
||||
if (embedded && typeof embedded === 'object' && embedded.status_groups) {
|
||||
return normalizeConversationProcessingProjection(embedded);
|
||||
@@ -1035,11 +1035,11 @@ export function normalizeConversationProcessingProjection(
|
||||
: null)
|
||||
),
|
||||
targetLifecycleStage: (
|
||||
['intake_parse', 'order_review', 'fulfillment_prep', 'upload_complete'].includes(
|
||||
['intake_parse', 'order_review', 'fulfillment_prep', 'freight_upload', 'upload_complete'].includes(
|
||||
String(rawAction.targetLifecycleStage),
|
||||
)
|
||||
? rawAction.targetLifecycleStage
|
||||
: (['intake_parse', 'order_review', 'fulfillment_prep', 'upload_complete'].includes(
|
||||
: (['intake_parse', 'order_review', 'fulfillment_prep', 'freight_upload', 'upload_complete'].includes(
|
||||
String(rawAction.target_lifecycle_stage),
|
||||
)
|
||||
? rawAction.target_lifecycle_stage
|
||||
@@ -1192,7 +1192,8 @@ export function normalizeConversationProcessingProjection(
|
||||
completed,
|
||||
history,
|
||||
status_groups: normalizedGroups || projection.status_groups,
|
||||
four_stage_nodes: projection.four_stage_nodes || [],
|
||||
lifecycle_nodes: projection.lifecycle_nodes || projection.four_stage_nodes || [],
|
||||
four_stage_nodes: projection.four_stage_nodes || projection.lifecycle_nodes || [],
|
||||
unclassified_summary: projection.unclassified_summary || { count: 0 },
|
||||
ui_state: projection.ui_state || undefined,
|
||||
output_artifacts: projection.output_artifacts || [],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* features/chat/shipping/shippingStepper.spec.ts
|
||||
* 用途:验证发货通知四阶段 Stepper 只消费后端 UI State 投影。
|
||||
* 用途:验证发货通知五阶段 Stepper 只消费后端 UI State 投影。
|
||||
* 依赖:shippingStepper 纯函数、vitest。
|
||||
* 逻辑:后端 UI State 缺失时,前端仍需把关键人工介入态渲染为 blocked。
|
||||
*/
|
||||
@@ -12,19 +12,20 @@ import {
|
||||
} from './shippingStepper';
|
||||
|
||||
describe('shippingStepper', () => {
|
||||
it('renders exactly four stages from backend ui_state', () => {
|
||||
it('renders exactly five stages from backend ui_state', () => {
|
||||
const steps = resolveShippingWorkflowSteps({
|
||||
ui_state: {
|
||||
steps: [
|
||||
{ id: 'shipping-stage-1', code: 'intake_parse', label: '接收解析', status: 'completed' },
|
||||
{ id: 'shipping-stage-2', code: 'order_review', label: '订单复核', status: 'completed' },
|
||||
{ id: 'shipping-stage-3', code: 'fulfillment_prep', label: '通知准备', status: 'blocked' },
|
||||
{ id: 'shipping-stage-4', code: 'upload_complete', label: '通知完成', status: 'pending' },
|
||||
{ id: 'shipping-stage-4', code: 'freight_upload', label: '货代上传', status: 'pending' },
|
||||
{ id: 'shipping-stage-5', code: 'upload_complete', label: '通知完成', status: 'pending' },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
expect(steps).toHaveLength(4);
|
||||
expect(steps).toHaveLength(5);
|
||||
expect(steps[2]?.status).toBe('blocked');
|
||||
});
|
||||
|
||||
@@ -33,17 +34,18 @@ describe('shippingStepper', () => {
|
||||
expect(normalizeShippingWorkflowSteps(null)).toEqual([]);
|
||||
});
|
||||
|
||||
it('maps technical processing stages into the four business stages', () => {
|
||||
it('maps technical processing stages into the five business stages', () => {
|
||||
const base = normalizeShippingWorkflowSteps([
|
||||
{ code: 'intake_parse', status: 'pending' },
|
||||
{ code: 'order_review', status: 'pending' },
|
||||
{ code: 'fulfillment_prep', status: 'pending' },
|
||||
{ code: 'freight_upload', status: 'pending' },
|
||||
{ code: 'upload_complete', status: 'pending' },
|
||||
]);
|
||||
const steps = applyShippingProcessingStageToSteps(base, {
|
||||
stage: 'inventory_matching',
|
||||
status: 'running',
|
||||
});
|
||||
expect(steps.map((step) => step.status)).toEqual(['completed', 'completed', 'current', 'pending']);
|
||||
expect(steps.map((step) => step.status)).toEqual(['completed', 'completed', 'current', 'pending', 'pending']);
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/chat/shipping/shippingStepper.ts
|
||||
* 用途:基于后端 ui_state 投影渲染四阶段业务 Stepper。
|
||||
* 用途:基于后端 ui_state 投影渲染五阶段业务 Stepper。
|
||||
* 依赖:ShippingProcessingProjection(可选叠加)、shippingProcessingFulfillment;ShippingWorkflowStepper.vue 消费输出。
|
||||
* 逻辑:只消费后端 ui_state.steps 四阶段投影;缺失投影时 fail-closed。
|
||||
* 逻辑:只消费后端 ui_state.steps 五阶段投影;缺失投影时 fail-closed。
|
||||
*/
|
||||
import {
|
||||
FULFILLMENT_PROGRESS_NODES,
|
||||
@@ -32,6 +32,7 @@ export const SHIPPING_WORKFLOW_STEP_LABELS = [
|
||||
'chat.shippingNoticeUi.stage.intakeParse',
|
||||
'chat.shippingNoticeUi.stage.orderReview',
|
||||
'chat.shippingNoticeUi.stage.fulfillmentPrep',
|
||||
'chat.shippingNoticeUi.stage.freightUpload',
|
||||
'chat.shippingNoticeUi.stage.uploadComplete',
|
||||
] as const;
|
||||
|
||||
@@ -90,7 +91,7 @@ const PROCESSING_STAGE_INDEX_MAP: Record<string, number> = {
|
||||
inventory_matching: 2,
|
||||
excel_generating: 2,
|
||||
freight_uploading: 3,
|
||||
completed: 3,
|
||||
completed: 4,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user