feat(freight-rpa): 库存/收料改名在手/入站,报表归属RPA,类名统一FreightRpa
把 shipping 侧 inventory/receipt 词根迁到 onhand/inbound,29 张表与 枚举/权限/前端/i18n 同步改名;在手与入站报表配置及文件改由 freight_rpa 持有,发货与调拨仅按 source_code 消费;ORM 类加 FreightRpa 前缀, 上传动作改为 freight_rpa_upload。含类名与上传动作改名规格文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ffc0d4a430
commit
39fe3c05f2
453 files changed
+17945
-8646
No files matched your search
@@ -617,7 +617,7 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
waiting_system_start: '等待系统启动',
|
||||
waiting_to_start: '等待系统启动',
|
||||
order_creating: '等待系统启动',
|
||||
inventory_matching: '库存匹配',
|
||||
onhand_matching: '库存匹配',
|
||||
excel_generating: 'Excel 生成',
|
||||
},
|
||||
},
|
||||
@@ -731,7 +731,7 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
shippingProcessing: {
|
||||
stage: {
|
||||
order_creating: '创建正式订单',
|
||||
inventory_matching: '库存匹配',
|
||||
onhand_matching: '库存匹配',
|
||||
},
|
||||
stageLabel: {
|
||||
waiting_system_start: '等待系统启动',
|
||||
@@ -764,8 +764,8 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
actionCodes: {
|
||||
confirm_customer: '确认客户',
|
||||
resolve_field_conflicts: '处理字段冲突',
|
||||
retry_inventory_preparation: '重新获取库存',
|
||||
retry_inventory_matching: '重新匹配库存',
|
||||
retry_onhand_preparation: '重新获取库存',
|
||||
retry_onhand_matching: '重新匹配库存',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1545,11 +1545,11 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
};
|
||||
shippingProcessingProjection.value = {
|
||||
workItemType: 'order_task', workItemNo: 'SN-RPA-RECOVERY-PENDING',
|
||||
status: 'failed', userStatus: 'failed', stage: 'inventory_fetching',
|
||||
status: 'failed', userStatus: 'failed', stage: 'onhand_fetching',
|
||||
progressVersion: 7, currentGate: { status: 'blocked_retryable' },
|
||||
uiState: {
|
||||
status: 'failed', stage: 'inventory_fetching', lifecycleStage: 'fulfillment_prep',
|
||||
primary_action: { code: 'retry_inventory_preparation', i18n_key: 'workspace.shippingNotice.processGate.inventoryActions.retryInventoryPreparation' },
|
||||
status: 'failed', stage: 'onhand_fetching', lifecycleStage: 'fulfillment_prep',
|
||||
primary_action: { code: 'retry_onhand_preparation', i18n_key: 'workspace.shippingNotice.processGate.inventoryActions.retryInventoryPreparation' },
|
||||
secondary_actions: [],
|
||||
},
|
||||
} as any;
|
||||
@@ -1559,7 +1559,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
ui_state: {
|
||||
actions: {
|
||||
primary: {
|
||||
code: 'retry_inventory_preparation', kind: 'current_gate', enabled: true,
|
||||
code: 'retry_onhand_preparation', kind: 'current_gate', enabled: true,
|
||||
dispatch: 'mutation', requires_confirmation: false,
|
||||
},
|
||||
secondary: [],
|
||||
@@ -1579,7 +1579,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.get('[data-testid="review-current-task-status"]').text()).not.toContain('自动处理失败');
|
||||
});
|
||||
|
||||
it('submits retry_inventory_preparation from A even when B.actions lacks the code', async () => {
|
||||
it('submits retry_onhand_preparation from A even when B.actions lacks the code', async () => {
|
||||
// 回归:右卡只读 A.primary_action 展示「重新获取库存(RPA)」;若仍按 B.actions
|
||||
// 授权,会落到「未识别的动作」。A 展示即写路径授权;capabilities 可作 bypass。
|
||||
activeCase.value = {
|
||||
@@ -1589,11 +1589,11 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
};
|
||||
shippingProcessingProjection.value = {
|
||||
workItemType: 'order_task', workItemNo: 'SN-RPA-A-ONLY',
|
||||
status: 'failed', userStatus: 'retryable', stage: 'inventory_fetching',
|
||||
status: 'failed', userStatus: 'retryable', stage: 'onhand_fetching',
|
||||
progressVersion: 3, currentGate: { status: 'blocked_retryable' },
|
||||
uiState: {
|
||||
status: 'retryable', stage: 'inventory_fetching', lifecycleStage: 'fulfillment_prep',
|
||||
primary_action: { code: 'retry_inventory_preparation' },
|
||||
status: 'retryable', stage: 'onhand_fetching', lifecycleStage: 'fulfillment_prep',
|
||||
primary_action: { code: 'retry_onhand_preparation' },
|
||||
secondary_actions: [],
|
||||
},
|
||||
} as any;
|
||||
@@ -1606,17 +1606,17 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
process_gate: {
|
||||
execution_no: 'EXEC-RPA-A-ONLY',
|
||||
current_blocking_gate: {
|
||||
gate_code: 'inventory_preparation', evaluation_version: 2, status: 'blocked_retryable',
|
||||
gate_code: 'onhand_preparation', evaluation_version: 2, status: 'blocked_retryable',
|
||||
},
|
||||
allowed_actions: ['retry_inventory_preparation'],
|
||||
recovery_targets: [{ action_code: 'retry_inventory_preparation' }],
|
||||
allowed_actions: ['retry_onhand_preparation'],
|
||||
recovery_targets: [{ action_code: 'retry_onhand_preparation' }],
|
||||
},
|
||||
stage_context: {
|
||||
preparation: {
|
||||
status: 'blocked', source_locked: false, source_options: [{ source_code: 'DSV' }],
|
||||
capabilities: [{
|
||||
code: 'retry_inventory_preparation', scope: 'task',
|
||||
action_code: 'retry_inventory_preparation', enabled: true,
|
||||
code: 'retry_onhand_preparation', scope: 'task',
|
||||
action_code: 'retry_onhand_preparation', enabled: true,
|
||||
}],
|
||||
frozen_order_lines: [], lines: [],
|
||||
},
|
||||
@@ -1638,7 +1638,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(submitProcessGatePrimaryActionMock).toHaveBeenCalledWith(
|
||||
expect.any(Object),
|
||||
expect.objectContaining({
|
||||
actionCode: 'retry_inventory_preparation',
|
||||
actionCode: 'retry_onhand_preparation',
|
||||
stageCapabilityBypass: true,
|
||||
}),
|
||||
);
|
||||
@@ -1655,12 +1655,12 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
};
|
||||
shippingProcessingProjection.value = {
|
||||
workItemType: 'order_task', workItemNo: 'SN-RPA-CAP-DISABLED',
|
||||
status: 'failed', userStatus: 'retryable', stage: 'inventory_fetching',
|
||||
status: 'failed', userStatus: 'retryable', stage: 'onhand_fetching',
|
||||
progressVersion: 5, currentGate: { status: 'blocked_retryable' },
|
||||
uiState: {
|
||||
status: 'retryable', stage: 'inventory_fetching', lifecycleStage: 'fulfillment_prep',
|
||||
primary_action: { code: 'retry_inventory_matching' },
|
||||
secondary_actions: [{ code: 'retry_inventory_preparation', enabled: true }],
|
||||
status: 'retryable', stage: 'onhand_fetching', lifecycleStage: 'fulfillment_prep',
|
||||
primary_action: { code: 'retry_onhand_matching' },
|
||||
secondary_actions: [{ code: 'retry_onhand_preparation', enabled: true }],
|
||||
},
|
||||
} as any;
|
||||
const taskApi = await import('@/features/chat/api/shipping.api');
|
||||
@@ -1671,9 +1671,9 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
process_gate: {
|
||||
execution_no: 'EXEC-RPA-CAP-DISABLED',
|
||||
current_blocking_gate: {
|
||||
gate_code: 'inventory_preparation', evaluation_version: 2, status: 'blocked_retryable',
|
||||
gate_code: 'onhand_preparation', evaluation_version: 2, status: 'blocked_retryable',
|
||||
},
|
||||
allowed_actions: ['retry_inventory_matching', 'retry_inventory_preparation'],
|
||||
allowed_actions: ['retry_onhand_matching', 'retry_onhand_preparation'],
|
||||
},
|
||||
stage_context: {
|
||||
preparation: {
|
||||
@@ -1682,13 +1682,13 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
failed_source_codes: ['DSV'],
|
||||
capabilities: [
|
||||
{
|
||||
code: 'retry_inventory_matching', scope: 'task',
|
||||
action_code: 'retry_inventory_matching', enabled: false,
|
||||
code: 'retry_onhand_matching', scope: 'task',
|
||||
action_code: 'retry_onhand_matching', enabled: false,
|
||||
disabled_reason: 'no_match_result',
|
||||
},
|
||||
{
|
||||
code: 'retry_inventory_preparation', scope: 'task',
|
||||
action_code: 'retry_inventory_preparation', enabled: true,
|
||||
code: 'retry_onhand_preparation', scope: 'task',
|
||||
action_code: 'retry_onhand_preparation', enabled: true,
|
||||
disabled_reason: null,
|
||||
},
|
||||
],
|
||||
@@ -1710,7 +1710,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(primary.attributes('data-capability-disabled')).toBe('true');
|
||||
expect(primary.attributes('title')).toContain('暂无库存匹配结果');
|
||||
// 侧路按钮:能力 enabled → 保持可点,不受主按钮禁用影响。
|
||||
const recovery = wrapper.get('[data-testid="review-current-task-recovery-retry_inventory_preparation"]');
|
||||
const recovery = wrapper.get('[data-testid="review-current-task-recovery-retry_onhand_preparation"]');
|
||||
expect(recovery.attributes('disabled')).toBeUndefined();
|
||||
// 点击禁用按钮不得触发提交,也不得弹任何 info 提示(此前会弹未翻译 key)。
|
||||
await primary.trigger('click');
|
||||
@@ -1789,7 +1789,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
confirmed_task_no: 'SN-PROJECTION-PENDING',
|
||||
process_gate: {
|
||||
execution_no: 'EXEC-PROJECTION-PENDING', status: 'blocked_retryable', owner_type: 'human', technical_auto_only: false,
|
||||
current_blocking_gate: { gate_code: 'inventory_preparation', status: 'blocked_retryable' },
|
||||
current_blocking_gate: { gate_code: 'onhand_preparation', status: 'blocked_retryable' },
|
||||
primary_action: { code: 'retry', label_key: 'chat.shippingOrderReview.currentTask.actionRetry' },
|
||||
},
|
||||
automation: { status: 'failed', retryable: true, can_auto_create: false, can_build: true },
|
||||
@@ -1875,7 +1875,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
confirmed_task_id: 91,
|
||||
confirmed_task_no: 'SN-SINGLE-SOURCE-1',
|
||||
// 故意下发与投影分叉的 Case 阶段:单源后必须被无视。
|
||||
current_stage: { code: 'inventory_matching', label_key: 'inventory_matching', inconsistent: false },
|
||||
current_stage: { code: 'onhand_matching', label_key: 'onhand_matching', inconsistent: false },
|
||||
automation: { status: 'running', retryable: false, can_auto_create: false, can_build: true },
|
||||
};
|
||||
shippingProcessingProjection.value = null;
|
||||
@@ -2513,7 +2513,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
};
|
||||
const wrapper = await mountView({ lifecycle_stage: 'order_review' });
|
||||
shippingProcessingProjection.value = {
|
||||
stage: 'inventory_preparation', status: 'processing',
|
||||
stage: 'onhand_preparation', status: 'processing',
|
||||
uiState: {
|
||||
status: 'running', lifecycleStage: 'fulfillment_prep', lifecycleEntries: [],
|
||||
primary_action: null, secondary_actions: [],
|
||||
@@ -2700,10 +2700,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
// 而不是默认回退到订单复核。
|
||||
shippingProcessingProjection.value = {
|
||||
status: 'processing',
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
uiState: {
|
||||
status: 'processing',
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
lifecycleStage: 'fulfillment_prep',
|
||||
lifecycleEntries: [
|
||||
{ code: 'order_review', state: 'available', targetSurface: 'order_lifecycle_workbench' },
|
||||
@@ -2804,10 +2804,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
draft_line_id: 'line-frozen',
|
||||
snapshot_line_id: 1001,
|
||||
inventory_source: { code: 'DBS', label: 'DBS', status: 'resolved' },
|
||||
inventory_allowed_actions: ['retry_inventory_preparation', 'retry_inventory_matching'],
|
||||
line_allowed_actions: ['release_inventory_shortage'],
|
||||
inventory_allowed_actions: ['retry_onhand_preparation', 'retry_onhand_matching'],
|
||||
line_allowed_actions: ['release_onhand_shortage'],
|
||||
release_template_fields: [
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'inventory_snapshot', requires_manual: false },
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'onhand_snapshot', requires_manual: false },
|
||||
{ field_id: '102', display_name: '库位', value: null, value_source: 'manual_required', requires_manual: true },
|
||||
],
|
||||
release_required_fields: [{ field_id: '102', display_name: '库位' }],
|
||||
@@ -2827,10 +2827,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
ui_state: {
|
||||
process_gate: {
|
||||
execution_no: 'EXEC-FROZEN-LINE',
|
||||
current_blocking_gate: { gate_code: 'inventory_preparation', status: 'blocked_retryable' },
|
||||
current_blocking_gate: { gate_code: 'onhand_preparation', status: 'blocked_retryable' },
|
||||
},
|
||||
actions: {
|
||||
primary: { code: 'retry_inventory_preparation', enabled: true, dispatch: 'mutation' },
|
||||
primary: { code: 'retry_onhand_preparation', enabled: true, dispatch: 'mutation' },
|
||||
secondary: [],
|
||||
},
|
||||
lifecycle_stage: 'fulfillment_prep', lifecycle_entries: [{ code: 'fulfillment_prep', state: 'current' }],
|
||||
@@ -2847,10 +2847,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
required_qty: '6', available_qty: null, part_available_qty: '9', shortage_qty: null, source_code: 'DBS',
|
||||
inventory_file_no: 'SIF-LINE-DBS', status: 'shortage',
|
||||
draft_line_id: 'line-frozen',
|
||||
inventory_allowed_actions: ['retry_inventory_preparation', 'retry_inventory_matching'],
|
||||
line_allowed_actions: ['release_inventory_shortage'],
|
||||
inventory_allowed_actions: ['retry_onhand_preparation', 'retry_onhand_matching'],
|
||||
line_allowed_actions: ['release_onhand_shortage'],
|
||||
release_template_fields: [
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'inventory_snapshot', requires_manual: false },
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'onhand_snapshot', requires_manual: false },
|
||||
{ field_id: '102', display_name: '库位', value: null, value_source: 'manual_required', requires_manual: true },
|
||||
],
|
||||
release_required_fields: [{ field_id: '102', display_name: '库位' }],
|
||||
@@ -2886,26 +2886,26 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.find('[data-testid="review-fulfillment-frozen-order"]').exists()).toBe(false);
|
||||
// 展示态行级动作收纳进更多菜单(⋯):逐项断言授权动作入口存在,不再有常显按钮。
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-download_inventory_file-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_inventory_preparation-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_inventory_matching-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-release_inventory_shortage-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-download_onhand_file-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_onhand_preparation-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_onhand_matching-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-release_onhand_shortage-1001"]')).toBeTruthy();
|
||||
expect(workspace.text()).toContain('库存不足');
|
||||
await clickLineMenuItem(1001, 'download_inventory_file');
|
||||
await clickLineMenuItem(1001, 'download_onhand_file');
|
||||
expect(downloadWorkspaceShippingLineInventoryFileMock).toHaveBeenCalledWith('SN-FROZEN', 'SIF-LINE-DBS');
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
await clickLineMenuItem(1001, 'retry_inventory_preparation');
|
||||
await clickLineMenuItem(1001, 'retry_onhand_preparation');
|
||||
expect(submitProcessGatePrimaryActionMock).toHaveBeenCalledWith(
|
||||
expect.any(Object),
|
||||
expect.objectContaining({
|
||||
actionCode: 'retry_inventory_preparation',
|
||||
actionCode: 'retry_onhand_preparation',
|
||||
payload: { snapshot_line_id: 1001 },
|
||||
}),
|
||||
);
|
||||
// Gate 恢复受理后立即启动五阶段轮询,不依赖浏览器手动刷新。
|
||||
expect(startWorkflowProgressPollingMock).toHaveBeenCalledTimes(1);
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
await clickLineMenuItem(1001, 'release_inventory_shortage');
|
||||
await clickLineMenuItem(1001, 'release_onhand_shortage');
|
||||
expect(wrapper.get('[data-testid="review-release-inventory-dialog"]').text()).toContain('ODM ID');
|
||||
expect(wrapper.get('[data-testid="review-release-inventory-dialog"]').text()).toContain('ODM-001');
|
||||
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
|
||||
@@ -2933,9 +2933,9 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
draft_line_id: 'line-frozen',
|
||||
snapshot_line_id: 1001,
|
||||
inventory_source: { code: 'DBS', label: 'DBS', status: 'resolved' },
|
||||
line_allowed_actions: ['release_inventory_shortage'],
|
||||
line_allowed_actions: ['release_onhand_shortage'],
|
||||
release_template_fields: [
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'inventory_snapshot', requires_manual: false },
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'onhand_snapshot', requires_manual: false },
|
||||
{ field_id: '102', display_name: '库位', value: null, value_source: 'manual_required', requires_manual: true },
|
||||
],
|
||||
release_required_fields: [{ field_id: '102', display_name: '库位' }],
|
||||
@@ -2964,7 +2964,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
stage_context: releaseAccepted ? { upload: {} } : {
|
||||
preparation: {
|
||||
frozen_order_lines: [{ snapshot_line_id: 1001, line_no: 1, reservation_id: 'RSV-FROZEN', part_number: 'PN-FROZEN', required_qty: '6' }],
|
||||
lines: [{ snapshot_line_id: 1001, line_no: 1, reservation_id: 'RSV-FROZEN', part_number: 'PN-FROZEN', required_qty: '6', shortage_qty: '3', source_code: 'DBS', status: 'shortage', draft_line_id: 'line-frozen', line_allowed_actions: ['release_inventory_shortage'], release_required_fields: [{ field_id: '102', display_name: '库位' }] }],
|
||||
lines: [{ snapshot_line_id: 1001, line_no: 1, reservation_id: 'RSV-FROZEN', part_number: 'PN-FROZEN', required_qty: '6', shortage_qty: '3', source_code: 'DBS', status: 'shortage', draft_line_id: 'line-frozen', line_allowed_actions: ['release_onhand_shortage'], release_required_fields: [{ field_id: '102', display_name: '库位' }] }],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -2974,7 +2974,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
await flushPromises();
|
||||
// 缺字段短缺行:放行入口在更多菜单,必填补录在行内补录条完成(原因不再强制)。
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
await clickLineMenuItem(1001, 'release_inventory_shortage');
|
||||
await clickLineMenuItem(1001, 'release_onhand_shortage');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-input-1001-102"]').setValue('A-01');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1001"]').trigger('click');
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
||||
@@ -2997,9 +2997,9 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
draft_line_id: 'line-async',
|
||||
snapshot_line_id: 1002,
|
||||
inventory_source: { code: 'DBS', label: 'DBS', status: 'resolved' },
|
||||
line_allowed_actions: ['release_inventory_shortage'],
|
||||
line_allowed_actions: ['release_onhand_shortage'],
|
||||
release_template_fields: [
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'inventory_snapshot', requires_manual: false },
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'onhand_snapshot', requires_manual: false },
|
||||
{ field_id: '102', display_name: '库位', value: null, value_source: 'manual_required', requires_manual: true },
|
||||
],
|
||||
release_required_fields: [{ field_id: '102', display_name: '库位' }],
|
||||
@@ -3024,7 +3024,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
stage_context: advanceDone ? { upload: {} } : {
|
||||
preparation: {
|
||||
frozen_order_lines: [{ snapshot_line_id: 1002, line_no: 1, reservation_id: 'RSV-ASYNC', part_number: 'PN-ASYNC', required_qty: '6' }],
|
||||
lines: [{ snapshot_line_id: 1002, line_no: 1, reservation_id: 'RSV-ASYNC', part_number: 'PN-ASYNC', required_qty: '6', shortage_qty: '3', source_code: 'DBS', status: 'shortage', draft_line_id: 'line-async', line_allowed_actions: ['release_inventory_shortage'], release_required_fields: [{ field_id: '102', display_name: '库位' }] }],
|
||||
lines: [{ snapshot_line_id: 1002, line_no: 1, reservation_id: 'RSV-ASYNC', part_number: 'PN-ASYNC', required_qty: '6', shortage_qty: '3', source_code: 'DBS', status: 'shortage', draft_line_id: 'line-async', line_allowed_actions: ['release_onhand_shortage'], release_required_fields: [{ field_id: '102', display_name: '库位' }] }],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -3033,7 +3033,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
|
||||
await flushPromises();
|
||||
await openLineOverflowMenu(wrapper, 1002);
|
||||
await clickLineMenuItem(1002, 'release_inventory_shortage');
|
||||
await clickLineMenuItem(1002, 'release_onhand_shortage');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-input-1002-102"]').setValue('A-01');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1002"]').trigger('click');
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
||||
@@ -3071,9 +3071,9 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
draft_line_id: 'line-manual',
|
||||
snapshot_line_id: 1003,
|
||||
inventory_source: { code: 'DBS', label: 'DBS', status: 'resolved' },
|
||||
line_allowed_actions: ['release_inventory_shortage'],
|
||||
line_allowed_actions: ['release_onhand_shortage'],
|
||||
release_template_fields: [
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'inventory_snapshot', requires_manual: false },
|
||||
{ field_id: '101', display_name: 'ODM ID', value: 'ODM-001', value_source: 'onhand_snapshot', requires_manual: false },
|
||||
{ field_id: '102', display_name: '库位', value: null, value_source: 'manual_required', requires_manual: true },
|
||||
],
|
||||
release_required_fields: [{ field_id: '102', display_name: '库位' }],
|
||||
@@ -3092,7 +3092,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
stage_context: releaseAccepted ? { upload: {} } : {
|
||||
preparation: {
|
||||
frozen_order_lines: [{ snapshot_line_id: 1003, line_no: 1, reservation_id: 'RSV-MANUAL', part_number: 'PN-MANUAL', required_qty: '6' }],
|
||||
lines: [{ snapshot_line_id: 1003, line_no: 1, reservation_id: 'RSV-MANUAL', part_number: 'PN-MANUAL', required_qty: '6', shortage_qty: '3', source_code: 'DBS', status: 'shortage', draft_line_id: 'line-manual', line_allowed_actions: ['release_inventory_shortage'], release_required_fields: [{ field_id: '102', display_name: '库位' }] }],
|
||||
lines: [{ snapshot_line_id: 1003, line_no: 1, reservation_id: 'RSV-MANUAL', part_number: 'PN-MANUAL', required_qty: '6', shortage_qty: '3', source_code: 'DBS', status: 'shortage', draft_line_id: 'line-manual', line_allowed_actions: ['release_onhand_shortage'], release_required_fields: [{ field_id: '102', display_name: '库位' }] }],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -3108,7 +3108,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
|
||||
await openLineOverflowMenu(wrapper, 1003);
|
||||
await clickLineMenuItem(1003, 'release_inventory_shortage');
|
||||
await clickLineMenuItem(1003, 'release_onhand_shortage');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-input-1003-102"]').setValue('A-01');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1003"]').trigger('click');
|
||||
await wrapper.get('[data-testid="review-lifecycle-stage-fulfillment_prep"]').findAll('button')[1].trigger('click');
|
||||
@@ -3354,7 +3354,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
lifecycle_stage: 'fulfillment_prep', lifecycle_entries: [{ code: 'fulfillment_prep', state: 'current' }],
|
||||
process_gate: {
|
||||
gate_status: 'blocked_retryable', blocking_reason_code: 'inventory_file_missing',
|
||||
primary_action: { code: 'retry_inventory_preparation', label_key: 'retry_inventory_preparation' },
|
||||
primary_action: { code: 'retry_onhand_preparation', label_key: 'retry_onhand_preparation' },
|
||||
},
|
||||
},
|
||||
} as any);
|
||||
@@ -3710,7 +3710,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
primary: {
|
||||
code: 'regenerate_excel_artifact', kind: 'recovery', enabled: true,
|
||||
dispatch: 'mutation',
|
||||
target_surface: 'fulfillment_prep', target_anchor: 'inventory_matching',
|
||||
target_surface: 'fulfillment_prep', target_anchor: 'onhand_matching',
|
||||
requires_confirmation: false,
|
||||
},
|
||||
secondary: [],
|
||||
@@ -4340,7 +4340,7 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
shippingNoticeNo: 'SN-OT-WAITING-INVENTORY',
|
||||
retryable: true,
|
||||
userStatus: 'retryable',
|
||||
primaryAction: { code: 'retry_inventory_preparation' },
|
||||
primaryAction: { code: 'retry_onhand_preparation' },
|
||||
currentGate: { status: 'blocked_retryable' },
|
||||
inventoryPreparation: {
|
||||
activeAttemptCount: 1,
|
||||
@@ -4349,7 +4349,7 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
},
|
||||
uiState: {
|
||||
status: 'retryable',
|
||||
primary_action: { code: 'retry_inventory_preparation' },
|
||||
primary_action: { code: 'retry_onhand_preparation' },
|
||||
secondary_actions: [],
|
||||
},
|
||||
};
|
||||
@@ -4358,7 +4358,7 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
ui_state: {
|
||||
actions: {
|
||||
primary: {
|
||||
code: 'retry_inventory_preparation', kind: 'recovery', enabled: true,
|
||||
code: 'retry_onhand_preparation', kind: 'recovery', enabled: true,
|
||||
dispatch: 'mutation', requires_confirmation: false,
|
||||
},
|
||||
secondary: [],
|
||||
@@ -4366,7 +4366,7 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
process_gate: {
|
||||
execution_no: 'EXEC-INVENTORY-WAITING',
|
||||
current_blocking_gate: {
|
||||
gate_code: 'inventory_preparation', evaluation_version: 1,
|
||||
gate_code: 'onhand_preparation', evaluation_version: 1,
|
||||
},
|
||||
},
|
||||
summary: {}, steps: [],
|
||||
@@ -4418,8 +4418,8 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
confirmed_task_no: 'SN-WAIT-1',
|
||||
// 故意与 Progress 文案分叉:若宽屏仍直读 Case code,会显示「库存匹配」。
|
||||
current_stage: {
|
||||
code: 'inventory_matching',
|
||||
label_key: 'inventory_matching',
|
||||
code: 'onhand_matching',
|
||||
label_key: 'onhand_matching',
|
||||
inconsistent: false,
|
||||
},
|
||||
automation: {
|
||||
|
||||
@@ -850,7 +850,7 @@ const formalTaskActions = computed(() => {
|
||||
|
||||
/** 行级库存选源动作:只在表格逐行处理,禁止作为任务级按钮出现在右侧"当前任务"卡(避免与表格打勾重复)。 */
|
||||
const LINE_SCOPE_INVENTORY_ACTIONS = new Set([
|
||||
'override_line_inventory_source',
|
||||
'override_line_onhand_source',
|
||||
]);
|
||||
|
||||
/**
|
||||
@@ -1888,7 +1888,7 @@ async function executeFormalTaskAction(
|
||||
await nextTick();
|
||||
scrollWorkbenchAnchor('review-fulfillment-prep-workspace');
|
||||
},
|
||||
inventory_upload: () => scrollWorkbenchAnchor('review-formal-task-todo-panel'),
|
||||
onhand_upload: () => scrollWorkbenchAnchor('review-formal-task-todo-panel'),
|
||||
order_fields: () => scrollWorkbenchAnchor('review-order-lines-table'),
|
||||
reservation: () => scrollWorkbenchAnchor('review-order-lines-table'),
|
||||
duplicate_review: () => scrollWorkbenchAnchor('review-duplicate-panel'),
|
||||
@@ -2009,7 +2009,7 @@ async function handleCurrentTaskAction(
|
||||
await nextTick();
|
||||
scrollWorkbenchAnchor('review-formal-task-result-region');
|
||||
break;
|
||||
case 'open_inventory_match_review':
|
||||
case 'open_onhand_match_review':
|
||||
if (hasFormalOt.value) {
|
||||
// 正式 OT 后匹配/缺口语境的真实宿主是通知准备工作区;订单明细表不承载库存结果。
|
||||
scrollWorkbenchAnchor('review-fulfillment-prep-workspace');
|
||||
@@ -2043,7 +2043,7 @@ async function handleCurrentTaskAction(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'retry_inventory_matching': {
|
||||
case 'retry_onhand_matching': {
|
||||
const summary = displayCase.value?.process_gate;
|
||||
if (!summary) return;
|
||||
const result = await submitProcessGatePrimaryAction(summary, { actionCode: code });
|
||||
@@ -2740,13 +2740,13 @@ async function submitLineOdmChoice(line: { snapshot_line_id?: number | null }) {
|
||||
|
||||
function formalPreparationLineAllows(
|
||||
line: { snapshot_line_id?: number | null },
|
||||
action: 'retry_inventory_preparation' | 'retry_inventory_matching' | 'close_unfulfillable' | 'release_inventory_shortage',
|
||||
action: 'retry_onhand_preparation' | 'retry_onhand_matching' | 'close_unfulfillable' | 'release_onhand_shortage',
|
||||
): boolean {
|
||||
const fulfillment = formalPreparationLineFulfillment(line);
|
||||
if (action === 'close_unfulfillable' || action === 'release_inventory_shortage') {
|
||||
if (action === 'close_unfulfillable' || action === 'release_onhand_shortage') {
|
||||
return Boolean(
|
||||
fulfillment?.line_allowed_actions?.includes(action)
|
||||
&& (action !== 'release_inventory_shortage' || !fulfillment?.release_field_resolution_error),
|
||||
&& (action !== 'release_onhand_shortage' || !fulfillment?.release_field_resolution_error),
|
||||
);
|
||||
}
|
||||
return Boolean(fulfillment?.inventory_allowed_actions?.includes(action));
|
||||
@@ -2758,7 +2758,7 @@ function formalPreparationLineAllows(
|
||||
*/
|
||||
function formalPreparationLineStatusLabel(line: { snapshot_line_id?: number | null; status?: string | null; shortage_qty?: string | number | null }): string {
|
||||
const fulfillment = formalPreparationLineFulfillment(line);
|
||||
if (fulfillment?.decision?.decision_code === 'release_inventory_shortage') {
|
||||
if (fulfillment?.decision?.decision_code === 'release_onhand_shortage') {
|
||||
return t('chat.shippingOrderReview.lifecycle.prepare.releaseShortage');
|
||||
}
|
||||
const status = String(line.status || '').trim().toLowerCase();
|
||||
@@ -2807,7 +2807,7 @@ async function confirmReleaseInventoryShortage() {
|
||||
try {
|
||||
await decideWorkspaceShippingOrderReviewLineFulfillment(caseNo, {
|
||||
draft_line_id: String(line.draft_line_id || ''),
|
||||
decision_code: 'release_inventory_shortage',
|
||||
decision_code: 'release_onhand_shortage',
|
||||
reason,
|
||||
release_field_values: releaseInventoryFieldValues.value,
|
||||
expected_draft_version: activeCase.value?.draft?.draft_version,
|
||||
@@ -2896,7 +2896,7 @@ function releaseBarReadyFor(line: { snapshot_line_id?: number | null }): boolean
|
||||
const fulfillment = formalPreparationLineFulfillment(line);
|
||||
const required = releaseBarLineRequiredFields(line);
|
||||
return Boolean(
|
||||
fulfillment?.line_allowed_actions?.includes('release_inventory_shortage')
|
||||
fulfillment?.line_allowed_actions?.includes('release_onhand_shortage')
|
||||
&& required.every((field) => releaseBarValue(line, field).trim())
|
||||
&& !releaseBarBusy.value[releaseBarKey(line)],
|
||||
);
|
||||
@@ -2917,7 +2917,7 @@ async function confirmReleaseBar(line: { snapshot_line_id?: number | null }) {
|
||||
try {
|
||||
await decideWorkspaceShippingOrderReviewLineFulfillment(caseNo, {
|
||||
draft_line_id: String(fulfillment.draft_line_id || ''),
|
||||
decision_code: 'release_inventory_shortage',
|
||||
decision_code: 'release_onhand_shortage',
|
||||
reason: '',
|
||||
release_field_values: { ...(releaseBarValues.value[key] || {}) },
|
||||
expected_draft_version: activeCase.value?.draft?.draft_version,
|
||||
@@ -3011,7 +3011,7 @@ async function downloadFormalPreparationLineInventoryFile(line: {
|
||||
/** 行级恢复提交当前 Gate 的精确动作,使用冻结快照行身份。 */
|
||||
async function retryFormalPreparationLine(
|
||||
snapshotLineId: number | string,
|
||||
actionCode: 'retry_inventory_preparation' | 'retry_inventory_matching',
|
||||
actionCode: 'retry_onhand_preparation' | 'retry_onhand_matching',
|
||||
) {
|
||||
if (!snapshotLineId) return;
|
||||
await submitFormalGateAction(actionCode, { snapshot_line_id: Number(snapshotLineId) });
|
||||
@@ -3132,20 +3132,20 @@ function overflowItems(line: {
|
||||
shortage_qty?: string | number | null;
|
||||
}): Array<{ key: string; icon: Component; labelKey: string; run: () => void | Promise<void> }> {
|
||||
const items: Array<{ key: string; icon: Component; labelKey: string; run: () => void | Promise<void> }> = [];
|
||||
if (formalPreparationLineAllows(line, 'retry_inventory_matching')) {
|
||||
if (formalPreparationLineAllows(line, 'retry_onhand_matching')) {
|
||||
items.push({
|
||||
key: 'retry_inventory_matching',
|
||||
key: 'retry_onhand_matching',
|
||||
icon: RefreshCw,
|
||||
labelKey: inventoryActionLabelKey('retry_inventory_matching')!,
|
||||
run: () => retryFormalPreparationLine(Number(line.snapshot_line_id), 'retry_inventory_matching'),
|
||||
labelKey: inventoryActionLabelKey('retry_onhand_matching')!,
|
||||
run: () => retryFormalPreparationLine(Number(line.snapshot_line_id), 'retry_onhand_matching'),
|
||||
});
|
||||
}
|
||||
// 放行缺口:缺字段型短缺行 → 行内展开补录条(替代弹窗);仅缺原因的行 → 旧弹窗(原因已可选)。
|
||||
if (formalPreparationLineAllows(line, 'release_inventory_shortage')) {
|
||||
if (formalPreparationLineAllows(line, 'release_onhand_shortage')) {
|
||||
items.push({
|
||||
key: 'release_inventory_shortage',
|
||||
key: 'release_onhand_shortage',
|
||||
icon: Check,
|
||||
labelKey: inventoryActionLabelKey('release_inventory_shortage')!,
|
||||
labelKey: inventoryActionLabelKey('release_onhand_shortage')!,
|
||||
run: () => {
|
||||
if (releaseBarHasFields(line)) expandReleaseBar(line);
|
||||
else openReleaseInventoryShortage(line);
|
||||
@@ -3160,19 +3160,19 @@ function overflowItems(line: {
|
||||
run: () => openCloseLineDialog(line),
|
||||
});
|
||||
}
|
||||
if (formalPreparationLineAllows(line, 'retry_inventory_preparation')) {
|
||||
if (formalPreparationLineAllows(line, 'retry_onhand_preparation')) {
|
||||
items.push({
|
||||
key: 'retry_inventory_preparation',
|
||||
key: 'retry_onhand_preparation',
|
||||
icon: Bot,
|
||||
labelKey: inventoryActionLabelKey('retry_inventory_preparation')!,
|
||||
run: () => retryFormalPreparationLine(Number(line.snapshot_line_id), 'retry_inventory_preparation'),
|
||||
labelKey: inventoryActionLabelKey('retry_onhand_preparation')!,
|
||||
run: () => retryFormalPreparationLine(Number(line.snapshot_line_id), 'retry_onhand_preparation'),
|
||||
});
|
||||
}
|
||||
if (formalPreparationLineInventoryFileNo(line)) {
|
||||
items.push({
|
||||
key: 'download_inventory_file',
|
||||
key: 'download_onhand_file',
|
||||
icon: Download,
|
||||
labelKey: inventoryActionLabelKey('download_inventory_file') || 'chat.shippingOrderReview.lifecycle.prepare.downloadInventory',
|
||||
labelKey: inventoryActionLabelKey('download_onhand_file') || 'chat.shippingOrderReview.lifecycle.prepare.downloadInventory',
|
||||
run: () => downloadFormalPreparationLineInventoryFile(line),
|
||||
});
|
||||
}
|
||||
@@ -3246,7 +3246,7 @@ async function saveInlineEdit(line: {
|
||||
}
|
||||
// 库存源覆写沿用既有 Gate 动作(override_line_inventory_source),后端校验后仅重匹配该行。
|
||||
if (sourceChanged) {
|
||||
await submitFormalGateAction('override_line_inventory_source', {
|
||||
await submitFormalGateAction('override_line_onhand_source', {
|
||||
line_no: draft.line_no,
|
||||
source_code: nextSourceCode,
|
||||
});
|
||||
@@ -3778,7 +3778,7 @@ const preparationWaveSelectableLines = computed(() => formalPreparationLines.val
|
||||
if (!fulfillment) return false;
|
||||
if (['task_created', 'fulfilled', 'closed_unfulfillable'].includes(String(fulfillment.line_status || ''))) return false;
|
||||
return Boolean(fulfillment.can_fulfill_complete_line)
|
||||
|| fulfillment.decision?.decision_code === 'release_inventory_shortage';
|
||||
|| fulfillment.decision?.decision_code === 'release_onhand_shortage';
|
||||
}));
|
||||
const allPreparationWaveSelected = computed(() => (
|
||||
preparationWaveSelectableLines.value.length > 0
|
||||
|
||||
Reference in new issue
Block a user