feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码

This commit is contained in:
hugo committed 2026-08-23 00:27:18 +08:00
1 parent 935bf26fa6
commit 7cfd5d167e
230 files changed
+9337 -10989

No files matched your search

@@ -82,7 +82,7 @@ describe('normalizeShippingProcessingProjection', () => {
expect(normalized!.sourceSummary.filename).toBe('a.pdf');
expect(normalized!.sourceSummary.documentId).toBe(17);
expect(normalized!.sourceSummary.assetStatus).toBe('ready');
expect(normalized!.availableActions).toEqual(['open_review']);
expect(normalized!.availableActions).toEqual(['resolve_field_conflicts', 'view_details']);
expect(normalized!.uiState).toMatchObject({
status: 'waiting_human',
stage: 'order_review',
@@ -108,6 +108,35 @@ describe('normalizeShippingProcessingProjection', () => {
expect(normalized?.stageNodes?.[1]?.absoluteIndex).toBe(2);
});
it('保留后端五阶段生命周期入口,包括 freight_upload', () => {
const normalized = normalizeShippingProcessingProjection({
work_item_no: 'OT-LIFECYCLE-5',
work_item_type: 'order_task',
status: 'waiting_review',
stage: 'freight_uploading',
ui_state: {
status: 'waiting_human',
stage: 'freight_uploading',
lifecycle_stage: 'freight_upload',
lifecycle_entries: [
{ code: 'intake_parse', state: 'available', target_surface: 'order_lifecycle_workbench' },
{ code: 'order_review', state: 'available', target_surface: 'order_lifecycle_workbench' },
{ code: 'fulfillment_prep', state: 'available', target_surface: 'order_lifecycle_workbench' },
{ code: 'freight_upload', state: 'current', target_surface: 'order_lifecycle_workbench' },
{ code: 'upload_complete', state: 'unavailable', target_surface: 'order_lifecycle_workbench' },
],
},
});
expect(normalized?.uiState?.lifecycleEntries).toEqual([
{ code: 'intake_parse', state: 'available', targetSurface: 'order_lifecycle_workbench', disabledReasonKey: null },
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench', disabledReasonKey: null },
{ code: 'fulfillment_prep', state: 'available', targetSurface: 'order_lifecycle_workbench', disabledReasonKey: null },
{ code: 'freight_upload', state: 'current', targetSurface: 'order_lifecycle_workbench', disabledReasonKey: null },
{ code: 'upload_complete', state: 'unavailable', targetSurface: 'order_lifecycle_workbench', disabledReasonKey: null },
]);
});
it('normalizes structured inventory candidate facts', () => {
const projection = normalizeShippingProcessingProjection({
work_item_no: 'SN-001',