feat(shipping-notice): 实现滚动履约功能,优化发货通知流程与代码清理

清理废弃的ShippingCase相关代码与依赖,统一使用ShippingNotice直接关联客户数据。调整库存网关依赖规则,支持仅对库存满足或已人工放行的订单行生成发货Excel,实现滚动履约逻辑。
This commit is contained in:
hugo committed 2026-08-26 02:47:07 +08:00
1 parent 7cfd5d167e
commit 1e5aedb9ed
235 files changed
+11394 -9613

No files matched your search

@@ -34,6 +34,7 @@ const ACTION_CODE_TO_INTENT: Record<string, ShippingProcessingActionIntent> = {
adjudicate_duplicate: 'adjudicate_duplicate',
open_inventory_match_review: 'open_inventory_match_review',
open_shortage_review: 'open_shortage_review',
reload_inventory_result: 'reload_inventory_result',
retry_inventory_preparation: 'retry_inventory_preparation',
retry_inventory_matching: 'retry_inventory_matching',
reparse_batch: 'reparse_batch',
@@ -85,6 +86,7 @@ const ACTION_CODE_TO_INTENT: Record<string, ShippingProcessingActionIntent> = {
const AUTOMATING_STATUSES = new Set(['processing', 'automating', 'queued']);
/** 需要在聊天/右侧展示精确恢复动作文案的正式 action_code。 */
const RECOVERY_ACTION_CODES = new Set([
'reload_inventory_result',
'retry_inventory_preparation', 'retry_inventory_matching', 'retry_parse',
'retry_failed_documents', 'retry_failed_attachments', 'retry_freight_upload_rpa',
'retry_order_extraction', 'retry_layout_parsing', 'rematerialize_document',
@@ -129,6 +131,7 @@ const INTERNAL_INVENTORY_ACTION_CODES = new Set([
export function inventoryActionLabelKey(code: string | null | undefined): string | null {
const normalized = String(code || '').trim().toLowerCase();
const keyByCode: Record<string, string> = {
reload_inventory_result: 'workspace.shippingNotice.processGate.inventoryActions.reloadInventoryResult',
retry_inventory_preparation: 'workspace.shippingNotice.processGate.inventoryActions.retryInventoryPreparation',
retry_inventory_matching: 'workspace.shippingNotice.processGate.inventoryActions.retryInventoryMatching',
open_inventory_match_review: 'workspace.shippingNotice.processGate.inventoryActions.openInventoryMatchReview',
@@ -154,6 +154,25 @@ describe('workbenchActionRegistry', () => {
expect(resolved?.todoActionCode).toBe('retry_inventory_matching');
});
it('routes reload inventory result through the formal Gate todo action', () => {
const result = resolveProcessingActionPresentation(projection({
uiState: {
status: 'retryable', stage: 'inventory_preparation', blocking_reason: null,
primary_action: { code: 'reload_inventory_result', label_key: 'x' }, secondary_actions: [],
},
currentGate: {
gateCode: 'inventory_preparation',
status: 'blocked_retryable',
nextActionCode: 'reload_inventory_result',
},
}), { surface: 'review' });
const resolved = resolveWorkbenchActionItem(result.primary!, { postCreate: true });
expect(result.primary?.intent).toBe('reload_inventory_result');
expect(resolved?.reviewBehavior).toBe('todo_panel');
expect(resolved?.todoActionCode).toBe('reload_inventory_result');
});
it('shows RPA upload retry instead of manual upload entries when Gate 19 is blocked', () => {
const result = resolveProcessingActionPresentation(projection({
stage: 'freight_uploading',
@@ -91,6 +91,12 @@ export const WORKBENCH_ACTION_REGISTRY: Record<string, WorkbenchActionRegistryEn
isWrite: false,
stageFamily: 'pre_create',
},
edit_reservation: {
intent: 'open_order_review',
reviewBehavior: 'hidden_on_review',
isWrite: false,
stageFamily: 'pre_create',
},
edit_formal_task: {
intent: 'edit_formal_task',
reviewBehavior: 'hidden_on_review',
@@ -156,6 +162,15 @@ export const WORKBENCH_ACTION_REGISTRY: Record<string, WorkbenchActionRegistryEn
stageFamily: 'post_create',
scrollTestId: 'review-formal-task-todo-panel',
},
reload_inventory_result: {
intent: 'reload_inventory_result',
reviewBehavior: 'todo_panel',
todoActionCode: 'reload_inventory_result',
requiresFormalTask: true,
isWrite: true,
stageFamily: 'post_create',
scrollTestId: 'review-formal-task-todo-panel',
},
open_shortage_review: {
intent: 'open_shortage_review',
reviewBehavior: 'focus_inventory_issues',