feat(shipping-notice): 升级货代发货流程为五阶段,完善业务校验
将货代发货流程从四阶段扩展为五阶段,拆分上传相关逻辑至独立的货代上传阶段; 统一多语言文案修正客户状态语义,将"客户尚未识别"调整为符合业务的"客户尚未确认"; 新增严格的上传成功验证谓词,需同时满足任务状态、全部预约单上传成功、存在有效成功上传尝试三个条件方可标记为完成; 新增坐标取值模型配置,支持Legacy冻结绝对坐标和锚点框架受限平移两种模式; 更新全链路相关文档、前端组件、后端服务与测试用例,确保业务逻辑对齐新业务规则。
This commit is contained in:
1 parent
1b6483a4ea
commit
935bf26fa6
86 files changed
+2743
-311
No files matched your search
@@ -21,6 +21,7 @@ import {
|
||||
retryWorkspaceShippingOrderStpAutoCreate,
|
||||
retryWorkspaceShippingTask,
|
||||
retryWorkspaceShippingTaskLine,
|
||||
retryShippingNoticeIntake,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
|
||||
const { downloadWorkspaceShippingLineInventoryFileMock } = vi.hoisted(() => ({
|
||||
@@ -111,6 +112,7 @@ const shippingProcessingProjection = ref<Record<string, any> | null>(null);
|
||||
/** 正式任务投影的请求中状态;用于覆盖 Case 先到、Projection 后到的过渡窗口。 */
|
||||
const shippingProcessingLoading = ref(false);
|
||||
const intakeParseContext = ref<Record<string, any> | null>(null);
|
||||
const requestedCaseNo = ref<string | null>(null);
|
||||
|
||||
/** 每个用例必须从独立的 Case 图快照开始,避免嵌套 schema/draft 被浅拷贝污染。 */
|
||||
function createActiveCaseFixture() {
|
||||
@@ -177,6 +179,7 @@ vi.mock('@/features/chat/api/shipping.api', async (importOriginal) => {
|
||||
job_id: 901,
|
||||
case: null,
|
||||
}),
|
||||
retryShippingNoticeIntake: vi.fn().mockResolvedValue({ intake_no: 'SNI-RETRY-1', parse_status: 'queued' }),
|
||||
getWorkspaceShippingTask: vi.fn().mockResolvedValue({
|
||||
task_no: 'SN-MOCK',
|
||||
status: 'created',
|
||||
@@ -229,7 +232,7 @@ function createReviewComposableMock() {
|
||||
loadFailed: ref(false),
|
||||
caseSwitchLoading: ref(false),
|
||||
caseSwitchFailed: ref(false),
|
||||
requestedCaseNo: ref(null),
|
||||
requestedCaseNo,
|
||||
saving: ref(false),
|
||||
validationInProgress: ref(false),
|
||||
saveFailed: ref(false),
|
||||
@@ -587,6 +590,7 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
intake_parse: '接收解析',
|
||||
order_review: '订单复核',
|
||||
fulfillment_prep: '通知准备',
|
||||
freight_upload: '货代上传',
|
||||
upload_complete: '通知完成',
|
||||
},
|
||||
prepare: {
|
||||
@@ -665,6 +669,7 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
/** 将共享 Case fixture 恢复为可编辑草稿,避免跨用例污染确认恢复态。 */
|
||||
function resetActiveCaseFixture() {
|
||||
activeCase.value = createActiveCaseFixture();
|
||||
requestedCaseNo.value = null;
|
||||
shippingProcessingProjection.value = null;
|
||||
shippingProcessingLoading.value = false;
|
||||
intakeParseContext.value = null;
|
||||
@@ -679,6 +684,20 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
reviewProgressContext.value = null;
|
||||
});
|
||||
|
||||
it('keeps the requested replacement Case when the loaded Run updates the URL', async () => {
|
||||
// 关键断言:新版 Run 先到而旧 URL Case 仍在时,不能拼出 RUN-NEW + CASE-OLD。
|
||||
const wrapper = await mountView({ case_no: 'CASE-OLD' });
|
||||
requestedCaseNo.value = 'CASE-NEW';
|
||||
reviewRun.value = {
|
||||
...reviewRun.value,
|
||||
run_no: 'RUN-NEW',
|
||||
};
|
||||
await flushPromises();
|
||||
|
||||
expect((wrapper.vm as any).$route.query.run_no).toBe('RUN-NEW');
|
||||
expect((wrapper.vm as any).$route.query.case_no).toBe('CASE-NEW');
|
||||
});
|
||||
|
||||
it('uses the current-task card as the only Gate action entry for every formal-OT Gate', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
@@ -1031,7 +1050,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
const shell = wrapper.get('[data-testid="review-workbench-ot-shell"]');
|
||||
const navigation = wrapper.get('[data-testid="review-document-navigation"]');
|
||||
|
||||
// 2–4 文件不浪费一列宽度,但必须在四阶段前完成文件选择。
|
||||
// 2–4 文件不浪费一列宽度,但必须在五阶段前完成文件选择。
|
||||
expect(navigation.attributes('data-nav-mode')).toBe('tabs');
|
||||
expect(shell.classes()).toContain('contents');
|
||||
expect(wrapper.html().indexOf('review-document-navigation'))
|
||||
@@ -1082,6 +1101,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
lifecycleEntries: [
|
||||
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
},
|
||||
@@ -1115,7 +1135,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
const wrapper = await mountView({ lifecycle_stage: 'order_review' });
|
||||
await flushPromises();
|
||||
|
||||
for (const code of ['order_review', 'fulfillment_prep', 'upload_complete']) {
|
||||
for (const code of ['order_review', 'fulfillment_prep', 'freight_upload', 'upload_complete']) {
|
||||
const stage = wrapper.get(`[data-testid="review-lifecycle-stage-${code}"]`);
|
||||
expect(stage.findAll('button')[1].attributes('disabled')).toBeDefined();
|
||||
}
|
||||
@@ -1136,6 +1156,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
}],
|
||||
@@ -1151,6 +1172,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
}],
|
||||
@@ -1178,6 +1200,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
}],
|
||||
@@ -1193,6 +1216,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
}],
|
||||
@@ -1236,6 +1260,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
}],
|
||||
@@ -1322,6 +1347,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
},
|
||||
@@ -1506,6 +1532,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
lifecycleEntries: [
|
||||
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
blocking_reason: null,
|
||||
@@ -1587,7 +1614,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.get('[data-testid="review-lifecycle-fulfillment-prep"]').text()).toContain('3');
|
||||
expect(wrapper.find('[data-testid="review-fulfillment-prep-workspace"]').exists()).toBe(true);
|
||||
expect(messageMocks.warning).not.toHaveBeenCalledWith('处理结果尚未生成');
|
||||
// 通知准备工作区必须属于四阶段导航的下方主区,不能仍停留在导航之前的状态摘要区。
|
||||
// 通知准备工作区必须属于五阶段导航的下方主区,不能仍停留在导航之前的状态摘要区。
|
||||
expect(wrapper.html().indexOf('review-lifecycle-workbench-header'))
|
||||
.toBeLessThan(wrapper.html().indexOf('review-fulfillment-prep-workspace'));
|
||||
});
|
||||
@@ -1760,6 +1787,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
lifecycle_entries: [
|
||||
{ code: 'order_review', state: 'available', target_surface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'current', target_surface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', target_surface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', target_surface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
},
|
||||
@@ -1802,7 +1830,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.get('[data-testid="review-footer-actions"]').text()).toContain('保存订单并校验');
|
||||
});
|
||||
|
||||
it('keeps backend-authorized manual upload registration out of the upload main area', async () => {
|
||||
it('keeps notification completion read-only even when an obsolete manual-upload action arrives', async () => {
|
||||
const originalQueue = reviewQueue.value;
|
||||
try {
|
||||
activeCase.value = {
|
||||
@@ -1817,6 +1845,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
}],
|
||||
@@ -1836,7 +1865,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
actions: {
|
||||
primary: {
|
||||
code: 'mark_manual_uploaded', kind: 'forward', enabled: true,
|
||||
target_surface: 'upload_complete',
|
||||
target_surface: 'freight_upload',
|
||||
target_anchor: 'manual_upload',
|
||||
requires_confirmation: false,
|
||||
},
|
||||
@@ -1847,8 +1876,9 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
} as any);
|
||||
const withAuthorization = await mountView({ lifecycle_stage: 'upload_complete' });
|
||||
await flushPromises();
|
||||
// Gate 写操作只在右侧“当前任务”显示;主区只保留上传事实与审计摘要。
|
||||
// 完成面必须屏蔽迟到的 Gate 写操作;主区只保留验证成功事实与审计摘要。
|
||||
expect(withAuthorization.find('[data-testid="review-lifecycle-upload-manual"]').exists()).toBe(false);
|
||||
expect(withAuthorization.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(false);
|
||||
// 正式动作直接提交当前 Gate,不允许无界面 TaskTodoPanel 作为隐藏执行器。
|
||||
expect((withAuthorization.vm as { formalTodoPanelRef?: unknown }).formalTodoPanelRef).toBeUndefined();
|
||||
} finally {
|
||||
@@ -1856,7 +1886,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('opens the page-level evidence dialog when the authorized current-task action is manual upload', async () => {
|
||||
it('opens the page-level evidence dialog from freight upload when the current-task action is manual upload', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
status: 'confirmed', confirmed_task_no: 'SN-UPLOAD-DIALOG', confirmed_task_id: 19, has_formal_ot: true,
|
||||
@@ -1869,7 +1899,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
primary: {
|
||||
code: 'mark_manual_uploaded', kind: 'forward', enabled: true,
|
||||
dispatch: 'dialog', ui_handler: 'manual_upload_evidence',
|
||||
target_surface: 'upload_complete', target_anchor: 'manual_upload',
|
||||
target_surface: 'freight_upload', target_anchor: 'manual_upload',
|
||||
requires_confirmation: false,
|
||||
},
|
||||
secondary: [],
|
||||
@@ -1878,7 +1908,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
},
|
||||
} as any);
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'upload_complete' });
|
||||
const wrapper = await mountView({ lifecycle_stage: 'freight_upload' });
|
||||
await flushPromises();
|
||||
await wrapper.get('[data-testid="review-current-task-primary-action"]').trigger('click');
|
||||
await flushPromises();
|
||||
@@ -1886,7 +1916,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.find('[data-testid="manual-upload-evidence-dialog"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('renders the authorized Excel download in every upload-complete order line instead of the task rail', async () => {
|
||||
it('renders the authorized Excel download in every freight-upload order line instead of the task rail', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
status: 'confirmed', confirmed_task_no: 'SN-DOWNLOAD-DISPATCH', confirmed_task_id: 20, has_formal_ot: true,
|
||||
@@ -1926,26 +1956,26 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
secondary: [{
|
||||
code: 'download_excel', label: '下载 Excel', kind: 'view', enabled: true,
|
||||
dispatch: 'view', ui_handler: 'excel_download',
|
||||
target_surface: 'upload_complete', target_anchor: 'excel_artifact',
|
||||
target_surface: 'freight_upload', target_anchor: 'excel_artifact',
|
||||
requires_confirmation: false,
|
||||
}],
|
||||
},
|
||||
lifecycle_stage: 'upload_complete',
|
||||
lifecycle_entries: [{ code: 'upload_complete', state: 'current' }],
|
||||
lifecycle_stage: 'freight_upload',
|
||||
lifecycle_entries: [{ code: 'freight_upload', state: 'current' }],
|
||||
process_gate: { execution_no: 'EXEC-DOWNLOAD-DISPATCH' }, summary: {}, steps: [],
|
||||
},
|
||||
} as any);
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'upload_complete' });
|
||||
const wrapper = await mountView({ lifecycle_stage: 'freight_upload' });
|
||||
await flushPromises();
|
||||
|
||||
const rows = wrapper.findAll('[data-testid="review-upload-complete-line"]');
|
||||
const rows = wrapper.findAll('[data-testid="review-freight-upload-line"]');
|
||||
expect(rows).toHaveLength(2);
|
||||
expect(rows[0].text()).toContain('PN-ONE');
|
||||
expect(rows[1].text()).toContain('PN-TWO');
|
||||
expect(wrapper.find('[data-testid="review-current-task-recovery-download_excel"]').exists()).toBe(false);
|
||||
|
||||
await wrapper.get('[data-testid="review-upload-complete-download-LINE-1"]').trigger('click');
|
||||
await wrapper.get('[data-testid="review-freight-upload-download-LINE-1"]').trigger('click');
|
||||
await flushPromises();
|
||||
|
||||
// 下载是 Artifact 只读操作;订单行不按 PO 聚合,且不得伪装成 Gate mutation。
|
||||
@@ -1969,6 +1999,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'fulfillment_prep', state: 'current', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'freight_upload', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench' },
|
||||
],
|
||||
}],
|
||||
@@ -2103,6 +2134,104 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.find('[data-testid="review-lifecycle-upload-download"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('retries the server-authorized failed Intake from the current lifecycle card and refreshes projections', async () => {
|
||||
const originalQueue = reviewQueue.value;
|
||||
try {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
available_actions: ['retry_parse'],
|
||||
intake_no: 'SNI-RETRY-1',
|
||||
};
|
||||
reviewQueue.value = {
|
||||
...reviewQueue.value,
|
||||
items: [{
|
||||
...reviewQueue.value.items[0],
|
||||
lifecycle_stage: 'intake_parse',
|
||||
lifecycle_entries: [],
|
||||
intake_parse_authorized: true,
|
||||
available_actions: ['retry_parse'],
|
||||
intake_no: 'SNI-RETRY-1',
|
||||
}],
|
||||
};
|
||||
const wrapper = await mountView({ lifecycle_stage: 'intake_parse' });
|
||||
|
||||
// 关键断言:已发送 EML 的恢复从当前阶段卡执行,并且使用服务端下发的原 SNI。
|
||||
await wrapper.get('[data-testid="review-lifecycle-stage-retry-parse"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(retryShippingNoticeIntake).toHaveBeenCalledWith('SNI-RETRY-1');
|
||||
expect(reloadLatestDraftMock).toHaveBeenCalled();
|
||||
expect(refreshShippingProcessingMock).toHaveBeenCalled();
|
||||
} finally {
|
||||
reviewQueue.value = originalQueue;
|
||||
}
|
||||
});
|
||||
|
||||
it('does not show intake retry while parsing or after cancellation', async () => {
|
||||
const originalQueue = reviewQueue.value;
|
||||
try {
|
||||
reviewQueue.value = {
|
||||
...reviewQueue.value,
|
||||
items: [{
|
||||
...reviewQueue.value.items[0], lifecycle_stage: 'intake_parse', lifecycle_entries: [], intake_parse_authorized: true,
|
||||
}],
|
||||
};
|
||||
for (const status of ['parsing', 'cancelled']) {
|
||||
activeCase.value = { ...activeCase.value, status, available_actions: [], intake_no: null };
|
||||
const wrapper = await mountView({ lifecycle_stage: 'intake_parse' });
|
||||
// 关键断言:运行中等待超时回收,取消态不可复活,均无 retry_parse 入口。
|
||||
expect(wrapper.find('[data-testid="review-lifecycle-stage-retry-parse"]').exists()).toBe(false);
|
||||
}
|
||||
} finally {
|
||||
reviewQueue.value = originalQueue;
|
||||
}
|
||||
});
|
||||
|
||||
it('renders completion evidence only from the verified succeeded attempt', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
status: 'confirmed', confirmed_task_no: 'SN-VERIFIED-EVIDENCE', confirmed_task_id: 22, has_formal_ot: true,
|
||||
};
|
||||
const taskApi = await import('@/features/chat/api/shipping.api');
|
||||
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
|
||||
task_no: 'SN-VERIFIED-EVIDENCE', status: 'completed', upload_status: 'uploaded', lines: [], events: [],
|
||||
ui_state: {
|
||||
lifecycle_stage: 'upload_complete',
|
||||
lifecycle_entries: [
|
||||
{ code: 'intake_parse', state: 'available' },
|
||||
{ code: 'order_review', state: 'available' },
|
||||
{ code: 'fulfillment_prep', state: 'available' },
|
||||
{ code: 'freight_upload', state: 'available' },
|
||||
{ code: 'upload_complete', state: 'current' },
|
||||
],
|
||||
actions: {
|
||||
primary: {
|
||||
code: 'mark_manual_uploaded', kind: 'forward', enabled: true,
|
||||
dispatch: 'dialog', ui_handler: 'manual_upload_evidence',
|
||||
},
|
||||
secondary: [],
|
||||
},
|
||||
stage_context: {
|
||||
upload: {
|
||||
latest_attempt: { status: 'failed', mode: 'rpa', freight_ref_no: 'LATEST-FAILED' },
|
||||
succeeded_attempt: { status: 'succeeded', mode: 'manual', freight_ref_no: 'VERIFIED-REF' },
|
||||
},
|
||||
},
|
||||
summary: {}, steps: [],
|
||||
},
|
||||
} as any);
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'upload_complete' });
|
||||
await flushPromises();
|
||||
|
||||
const evidence = wrapper.get('[data-testid="review-lifecycle-upload-complete"]');
|
||||
expect(evidence.text()).toContain('VERIFIED-REF');
|
||||
expect(evidence.text()).toContain('succeeded');
|
||||
expect(evidence.text()).not.toContain('LATEST-FAILED');
|
||||
expect(evidence.text()).not.toContain('failed');
|
||||
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('renders empty optional schema fields as editable line columns', async () => {
|
||||
const wrapper = await mountView();
|
||||
const inputs = wrapper.findAll('[data-testid="review-line-field-input"]');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!--
|
||||
features/chat/views/ShippingOrderReviewView.vue
|
||||
用途:建单前/正式任务「订单生命周期工作台」(主编辑区 + 四阶段导航 + 工作台侧栏 + workbenchMode)。
|
||||
用途:建单前/正式任务「订单生命周期工作台」(主编辑区 + 五阶段导航 + 工作台侧栏 + workbenchMode)。
|
||||
依赖:路由参数、useShippingOrderReview、ReviewWorkbenchHeader/Footer、ReviewDocumentNavigation、
|
||||
ReviewProcessDetailDrawer、ReviewUnsavedSwitchDialog、
|
||||
ReviewWorkbenchModeToggle、ReviewDocumentEvidenceDrawer、ReviewVersionHistoryDrawer、
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
retryWorkspaceShippingOrderStpAutoCreate,
|
||||
retryWorkspaceShippingTask,
|
||||
retryWorkspaceShippingTaskLine,
|
||||
retryShippingNoticeIntake,
|
||||
decideWorkspaceShippingOrderReviewLineFulfillment,
|
||||
viewWorkspaceShippingOrderReviewHighlightDiagnostic,
|
||||
} from '../api/shipping.api';
|
||||
@@ -217,6 +218,7 @@ const LIFECYCLE_STAGE_CODES: ReviewLifecycleStageCode[] = [
|
||||
'intake_parse',
|
||||
'order_review',
|
||||
'fulfillment_prep',
|
||||
'freight_upload',
|
||||
'upload_complete',
|
||||
];
|
||||
|
||||
@@ -322,7 +324,40 @@ const isLifecycleIntakeParse = computed(() => (
|
||||
lifecycleActiveStageCode.value === 'intake_parse' && intakeParseContextAuthorized.value
|
||||
));
|
||||
const isLifecycleFulfillmentPrep = computed(() => lifecycleActiveStageCode.value === 'fulfillment_prep');
|
||||
const isLifecycleFreightUpload = computed(() => lifecycleActiveStageCode.value === 'freight_upload');
|
||||
const isLifecycleUploadComplete = computed(() => lifecycleActiveStageCode.value === 'upload_complete');
|
||||
/** 当前阶段重试只取 Case 的服务端授权,不从输入框附件卡或本地状态推断。 */
|
||||
const intakeParseRetryAvailable = computed(() => (
|
||||
isLifecycleIntakeParse.value
|
||||
&& (activeCase.value?.available_actions || []).includes('retry_parse')
|
||||
&& Boolean(String(activeCase.value?.intake_no || '').trim())
|
||||
));
|
||||
const intakeParseRetrying = ref(false);
|
||||
|
||||
/**
|
||||
* 对已发送文件重投原 Intake 的解析任务。
|
||||
* 成功后同步 Case、统一处理投影并重新读取 Intake 上下文;后端状态会转为 queued,
|
||||
* 原有 polling 会继续推进,运行中不再展示 retry_parse。
|
||||
*/
|
||||
async function retryCurrentIntakeParse(): Promise<void> {
|
||||
const intakeNo = String(activeCase.value?.intake_no || '').trim();
|
||||
if (!intakeParseRetryAvailable.value || !intakeNo || intakeParseRetrying.value) return;
|
||||
intakeParseRetrying.value = true;
|
||||
try {
|
||||
await retryShippingNoticeIntake(intakeNo);
|
||||
await Promise.all([
|
||||
reloadLatestDraft(),
|
||||
refreshShippingProcessing(),
|
||||
activeCase.value?.case_no
|
||||
? ensureIntakeParseContextLoaded(activeCase.value.case_no)
|
||||
: Promise.resolve(false),
|
||||
]);
|
||||
} catch (error) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingNoticeRetryParse'));
|
||||
} finally {
|
||||
intakeParseRetrying.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 只切换前端工作面并同步可分享深链;禁止在导航点击中修改任何订单生命周期字段。
|
||||
@@ -508,10 +543,10 @@ const formalTaskActions = computed(() => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 通知完成明细的只读 Excel 动作。
|
||||
* 货代上传工作面的 Excel 下载动作。
|
||||
*
|
||||
* Artifact 下载由后端 ui_state.actions 授权;它属于订单行结果表的行内操作,
|
||||
* 不与右侧当前任务的 Gate 动作混排。每个行入口下载同一正式任务已校验的 Excel。
|
||||
* Artifact 下载由后端 ui_state.actions 授权;它属于货代上传工作面,
|
||||
* 不与只读成功证据或右侧当前任务 Gate 动作混排。
|
||||
*/
|
||||
const uploadCompletionExcelDownloadAction = computed(() => formalTaskActions.value.find((action) => (
|
||||
action.enabled
|
||||
@@ -573,6 +608,22 @@ const currentTaskRecoveryActions = computed(() => {
|
||||
})).filter((action) => action.code)
|
||||
});
|
||||
|
||||
/**
|
||||
* 已验证的通知完成面只展示成功证据,不能因迟到或历史 Gate 动作再次提供写入口。
|
||||
* 核心逻辑:货代上传工作面仍原样消费后端授权动作;完成面只把动作降为只读,
|
||||
* 不修改服务端授权,也不根据客户端状态推导新的操作。
|
||||
* @returns 当前工作面允许交给 ReviewCurrentProcessingCard 展示的动作。
|
||||
*/
|
||||
const visibleCurrentTaskPrimaryAction = computed(() => (
|
||||
isLifecycleUploadComplete.value ? null : currentTaskPrimaryAction.value
|
||||
));
|
||||
const visibleCurrentTaskRecoveryActions = computed(() => (
|
||||
isLifecycleUploadComplete.value ? [] : currentTaskRecoveryActions.value
|
||||
));
|
||||
const visibleCurrentTaskRetryable = computed(() => (
|
||||
isLifecycleUploadComplete.value ? false : currentTaskRetryable.value
|
||||
));
|
||||
|
||||
/** 管理员诊断:后端 technical_progress / automation.technical 仅 admin 投影。 */
|
||||
const showAdminTaskMissingDiagnosis = computed(() => (
|
||||
Boolean(displayCase.value?.task_missing)
|
||||
@@ -1898,7 +1949,7 @@ const showWorkbenchGrid = computed(
|
||||
const headerSchemaFields = computed(() => (displayCase.value?.schema.fields || []).filter((field) => field.scope === 'header'));
|
||||
const lineSchemaFields = computed(() => (displayCase.value?.schema.fields || []).filter((field) => field.scope === 'line'));
|
||||
|
||||
/** 通知完成仅展示订单行的核心识别字段,字段值始终按当前行的 line_key 读取。 */
|
||||
/** 货代上传仅展示订单行的核心识别字段,字段值始终按当前行的 line_key 读取。 */
|
||||
const uploadCompletionLineFields = computed(() => {
|
||||
const codes = ['line_no', 'part_number', 'quantity'];
|
||||
return codes.map((code) => lineSchemaFields.value.find((field) => field.field_code === code))
|
||||
@@ -2106,7 +2157,7 @@ async function retryFormalPreparationLine(lineKey: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工上传登记是后端 Gate 的受控写动作;仅进入「通知完成」工作面不构成授权。
|
||||
* 人工上传登记是后端 Gate 的受控写动作;仅进入「货代上传」工作面不构成授权。
|
||||
* 任务详情与批次中心共用 ui_state.actions,避免页面按上传状态或生命周期自行放行。
|
||||
*/
|
||||
const manualUploadRegistrationAuthorized = computed(() => {
|
||||
@@ -3308,6 +3359,7 @@ watch(
|
||||
if (resolvedRunNo && resolvedRunNo !== runNo.value) {
|
||||
const resolvedCaseNo = String(
|
||||
pendingCrossRunCaseNo.value
|
||||
|| requestedCaseNo.value
|
||||
|| route.query.case_no
|
||||
|| route.query.case
|
||||
|| activeCase.value?.case_no
|
||||
@@ -3464,8 +3516,11 @@ watch(
|
||||
<ReviewLifecycleStageNavigation
|
||||
:stages="lifecycleStageItems"
|
||||
:active-code="lifecycleActiveStageCode"
|
||||
:available-actions="activeCase?.available_actions || []"
|
||||
:retrying="intakeParseRetrying"
|
||||
@select="(code) => { void selectLifecycleStage(code); }"
|
||||
@open-detail="() => { processDetailOpen = true; }"
|
||||
@retry-parse="() => void retryCurrentIntakeParse()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3543,11 +3598,11 @@ watch(
|
||||
:automation="displayCase?.automation"
|
||||
:show-retry="showObjectRetryOnRail"
|
||||
:user-status="currentTaskUserStatus"
|
||||
:retryable="currentTaskRetryable"
|
||||
:retryable="visibleCurrentTaskRetryable"
|
||||
:blocking-reason="currentTaskBlockingReason"
|
||||
:gate-status="currentTaskGateStatus"
|
||||
:primary-action="currentTaskPrimaryAction"
|
||||
:recovery-actions="currentTaskRecoveryActions"
|
||||
:primary-action="visibleCurrentTaskPrimaryAction"
|
||||
:recovery-actions="visibleCurrentTaskRecoveryActions"
|
||||
:retrying="taskRetryButtonDisabled || progressRetrying || caseSwitchLoading"
|
||||
:loading="caseContentSkeleton || formalTaskProjectionPending"
|
||||
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
|
||||
@@ -3642,14 +3697,14 @@ watch(
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="hasCreatedShippingTask && formalTaskDetail && isLifecycleUploadComplete"
|
||||
v-if="hasCreatedShippingTask && formalTaskDetail && isLifecycleFreightUpload"
|
||||
class="rounded-xl border border-default bg-surface p-3"
|
||||
data-testid="review-lifecycle-upload-complete"
|
||||
data-testid="review-lifecycle-freight-upload"
|
||||
>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold text-primary">{{ t('chat.shippingOrderReview.lifecycle.upload.title') }}</h2>
|
||||
<p class="mt-1 text-xs text-secondary">{{ t('chat.shippingOrderReview.lifecycle.upload.subtitle') }}</p>
|
||||
<h2 class="text-sm font-semibold text-primary">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.title') }}</h2>
|
||||
<p class="mt-1 text-xs text-secondary">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.subtitle') }}</p>
|
||||
</div>
|
||||
<span class="rounded-full bg-surface-muted px-2 py-1 text-xs text-secondary">{{ formalTaskDetail.upload_status || '-' }}</span>
|
||||
</div>
|
||||
@@ -3658,7 +3713,7 @@ watch(
|
||||
<p v-if="formalTaskDetail.ui_state?.stage_context?.upload?.latest_attempt" class="mt-1">{{ t('chat.shippingOrderReview.lifecycle.upload.attempt', { status: formalTaskDetail.ui_state.stage_context.upload.latest_attempt.status || '-', mode: formalTaskDetail.ui_state.stage_context.upload.latest_attempt.mode || '-' }) }}</p>
|
||||
<p v-if="formalTaskDetail.ui_state?.stage_context?.upload?.latest_attempt?.error_code" class="mt-1 text-rose-700 dark:text-rose-300">{{ formalTaskDetail.ui_state.stage_context.upload.latest_attempt.error_code }}</p>
|
||||
</div>
|
||||
<div v-if="displayDraftLines.length" class="mt-3 overflow-x-auto" data-testid="review-upload-complete-lines">
|
||||
<div v-if="displayDraftLines.length" class="mt-3 overflow-x-auto" data-testid="review-freight-upload-lines">
|
||||
<table class="min-w-full text-left text-xs">
|
||||
<thead class="border-b border-default bg-surface-muted/50 text-secondary">
|
||||
<tr>
|
||||
@@ -3673,7 +3728,7 @@ watch(
|
||||
v-for="line in displayDraftLines"
|
||||
:key="String(line.line_key)"
|
||||
class="border-b border-default last:border-0"
|
||||
data-testid="review-upload-complete-line"
|
||||
data-testid="review-freight-upload-line"
|
||||
>
|
||||
<td class="px-3 py-2 font-medium text-primary">{{ processDetailPoNumber || '—' }}</td>
|
||||
<td v-for="field in uploadCompletionLineFields" :key="field.field_id" class="px-3 py-2">{{ lineFieldDisplayValue(line, field) || '—' }}</td>
|
||||
@@ -3683,7 +3738,7 @@ watch(
|
||||
v-if="uploadCompletionExcelDownloadAction"
|
||||
type="button"
|
||||
class="rounded border border-brand-200 px-2 py-1 font-medium text-brand-700 hover:bg-brand-50 disabled:opacity-50 dark:border-brand-800 dark:text-brand-200 dark:hover:bg-brand-950/40"
|
||||
:data-testid="`review-upload-complete-download-${line.line_key}`"
|
||||
:data-testid="`review-freight-upload-download-${line.line_key}`"
|
||||
:disabled="saving"
|
||||
@click="void executeFormalTaskAction(uploadCompletionExcelDownloadAction, {})"
|
||||
>
|
||||
@@ -3696,6 +3751,19 @@ watch(
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="hasCreatedShippingTask && formalTaskDetail && isLifecycleUploadComplete"
|
||||
class="rounded-xl border border-emerald-200 bg-emerald-50/40 p-3 dark:border-emerald-900 dark:bg-emerald-950/20"
|
||||
data-testid="review-lifecycle-upload-complete"
|
||||
>
|
||||
<h2 class="text-sm font-semibold text-primary">{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.title') }}</h2>
|
||||
<p class="mt-1 text-xs text-secondary">{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.subtitle') }}</p>
|
||||
<div class="mt-3 rounded-lg border border-emerald-200 bg-surface/70 p-3 text-xs text-secondary dark:border-emerald-900">
|
||||
<p>{{ t('chat.shippingOrderReview.lifecycle.upload.receipt', { value: formalTaskDetail.ui_state?.stage_context?.upload?.succeeded_attempt?.freight_ref_no || '-' }) }}</p>
|
||||
<p v-if="formalTaskDetail.ui_state?.stage_context?.upload?.succeeded_attempt" class="mt-1">{{ t('chat.shippingOrderReview.lifecycle.upload.attempt', { status: formalTaskDetail.ui_state.stage_context.upload.succeeded_attempt.status || '-', mode: formalTaskDetail.ui_state.stage_context.upload.succeeded_attempt.mode || '-' }) }}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<ReviewIntakeParsePanel
|
||||
v-if="isLifecycleIntakeParse"
|
||||
:context="intakeParseContext"
|
||||
@@ -4138,11 +4206,11 @@ watch(
|
||||
:has-formal-ot="shippingProcessingProjection?.hasFormalOt ?? hasFormalOt"
|
||||
:shipping-notice-no="shippingProcessingProjection?.shippingNoticeNo ?? confirmedNoticeTaskNo"
|
||||
:user-status="currentTaskUserStatus"
|
||||
:retryable="currentTaskRetryable"
|
||||
:retryable="visibleCurrentTaskRetryable"
|
||||
:blocking-reason="currentTaskBlockingReason"
|
||||
:gate-status="currentTaskGateStatus"
|
||||
:primary-action="currentTaskPrimaryAction"
|
||||
:recovery-actions="currentTaskRecoveryActions"
|
||||
:primary-action="visibleCurrentTaskPrimaryAction"
|
||||
:recovery-actions="visibleCurrentTaskRecoveryActions"
|
||||
:retrying="taskRetryButtonDisabled || progressRetrying || caseSwitchLoading"
|
||||
:loading="caseContentSkeleton || formalTaskProjectionPending"
|
||||
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
|
||||
|
||||
Reference in new issue
Block a user