feat(shipping-notice): 完善订单解析、模板管理与库存 RPA 流程

- 优化订单文档解析、补充合并与坐标重建
- 完善订单模板校验、发布及前端管理界面
- 改进库存 RPA 下载回退与工作流处理
- 补充后端、前端及 RPA 自动化测试
- 更新 Shipping Notice 技术文档与四语言文案
This commit is contained in:
hugo committed 2026-09-09 09:10:10 +08:00
1 parent c4a27324c8
commit 8f2f568f92
46 files changed
+1745 -265

No files matched your search

@@ -1068,29 +1068,54 @@ describe('useShippingOrderReview build eligibility writes', () => {
build_eligibility: { can_build: true, status: 'ready', line_projections: [] },
},
});
api.getCase.mockResolvedValue(readyCase);
const confirmedCase = {
...readyCase,
status: 'confirmed',
confirmed_task_no: 'OT-1',
order_task_no: 'OT-1',
has_formal_ot: true,
};
api.getCase.mockResolvedValue(confirmedCase);
api.getRun.mockResolvedValue({
run_no: 'RUN-1', summary: {},
items: [{ case_no: 'CASE-1', document_id: 1, status: 'ready', available_actions: ['confirm'] }],
});
api.getQueue.mockResolvedValue({
summary: { total: 1, needs_action: 1, processing: 0, completed: 0 },
items: [{
case_no: 'CASE-1', document_id: 1, source_run_no: 'RUN-1', status: 'confirmed',
lifecycle_stage: 'fulfillment_prep',
lifecycle_entries: [{ code: 'fulfillment_prep', state: 'current' }],
}],
});
api.getEvidence.mockResolvedValue({ items: [] });
api.getPreview.mockResolvedValue({ preview_url: '' });
api.getProcessingWorkItem.mockResolvedValue({
work_item_no: 'OT-1', status: 'blocked', user_status: 'waiting_human',
workItemNo: 'OT-1',
status: 'waiting_human',
userStatus: 'waiting_human',
stage: 'inventory_matching',
currentGate: { gateCode: 'inventory_matching', status: 'blocked_manual' },
uiState: {
status: 'waiting_human',
lifecycleStage: 'fulfillment_prep',
lifecycleEntries: [{ code: 'fulfillment_prep', state: 'current' }],
},
});
api.confirmCase.mockResolvedValue({
task_no: 'SN-1', order_task_no: 'OT-1', shipping_notice_no: 'SN-1', idempotent_replay: false,
case: { ...readyCase, status: 'confirmed', order_task_no: 'OT-1' }, auto_progress_started: true,
case: confirmedCase, auto_progress_started: true,
});
const review = useShippingOrderReview();
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1', itemNo: 'WFI-1' });
const queueCallsBeforeConfirm = api.getQueue.mock.calls.length;
await review.confirm();
await vi.advanceTimersByTimeAsync(0);
await vi.advanceTimersByTimeAsync(PROGRESS_POLL_MS + 100);
await Promise.resolve();
// 中断(waiting_human,即“等待人工处理”)视为线性终态:结果不会自行变化,必须停止轮询。
// 中断(waiting_human)停轮询前须刷新 Case/Queue,否则自动跳阶段拿不到 lifecycle。
expect(api.getQueue.mock.calls.length).toBeGreaterThan(queueCallsBeforeConfirm);
expect(review.workflowProgressPolling.value).toBe(false);
review.stopWorkflowProgressPolling();