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
@@ -9,7 +9,7 @@ import { describe, expect, it } from 'vitest';
|
||||
|
||||
describe('shipping API runtime entrypoints', () => {
|
||||
it('does not expose direct inventory match or Excel generation actions', () => {
|
||||
expect(Object.prototype.hasOwnProperty.call(shippingApi, 'matchWorkspaceShippingInventory')).toBe(false);
|
||||
expect(Object.prototype.hasOwnProperty.call(shippingApi, 'matchWorkspaceShippingOnhand')).toBe(false);
|
||||
expect(Object.prototype.hasOwnProperty.call(shippingApi, 'generateWorkspaceShippingExcel')).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -60,7 +60,7 @@ import type {
|
||||
ShippingOrderReviewLlmSuggestionResponse,
|
||||
ShippingOrderReviewReparseResponse,
|
||||
ShippingOrderReviewRun,
|
||||
ShippingTaskInventoryCandidatesResponse,
|
||||
ShippingTaskOnhandCandidatesResponse,
|
||||
ShippingTaskUiState,
|
||||
} from '../types/shipping.api.types';
|
||||
|
||||
@@ -205,7 +205,7 @@ export const workspaceShippingNoticeExportUrl = (businessNo: string) =>
|
||||
`/api/workspace/shipping-notices/${encodeURIComponent(businessNo)}/export`;
|
||||
|
||||
/** 当前任务已关联库存快照的受控下载 URL;后端会再次校验任务归属与活动 link。 */
|
||||
export const workspaceShippingInventoryFileUrl = (taskNo: string) =>
|
||||
export const workspaceShippingOnhandFileUrl = (taskNo: string) =>
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/inventory-file`;
|
||||
|
||||
/** 当前任务指定明细匹配快照的受控下载 URL;文件号必须由行级投影提供。 */
|
||||
@@ -622,7 +622,7 @@ export const getWorkspaceTaskInventoryCandidates = (
|
||||
if (options?.version != null) params.set('version', String(options.version));
|
||||
if (options?.includeHistory != null) params.set('include_history', String(options.includeHistory));
|
||||
const query = params.toString();
|
||||
return requestJson<ShippingTaskInventoryCandidatesResponse>(
|
||||
return requestJson<ShippingTaskOnhandCandidatesResponse>(
|
||||
`/api/workspace/shipping-notice/tasks/${encodeURIComponent(taskNo)}/inventory-candidates${query ? `?${query}` : ''}`,
|
||||
);
|
||||
};
|
||||
@@ -1348,7 +1348,7 @@ export async function removeWorkspaceShippingNoticeLine(
|
||||
* @param file - 已按库存源发布方案导出的 xls/xlsx/csv 文件
|
||||
* @returns 库存解析与后续匹配结果
|
||||
*/
|
||||
export async function uploadWorkspaceShippingInventory(taskNo: string, file: File) {
|
||||
export async function uploadWorkspaceShippingOnhand(taskNo: string, file: File) {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
|
||||
@@ -672,7 +672,7 @@ watch(() => page.currentAgentId, () => {
|
||||
|
||||
@add-remote-url="page.addRemoteUrlAttachment"
|
||||
|
||||
@shipping-inventory-selected="page.handleShippingInventorySelected"
|
||||
@shipping-inventory-selected="page.handleShippingOnhandSelected"
|
||||
|
||||
@use-shipping-suggested-prompt="page.useShippingSuggestedPrompt"
|
||||
|
||||
|
||||
+22
-22
@@ -15,13 +15,13 @@ const i18n = createI18n({
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching': '重新库存匹配',
|
||||
'chat.shippingOrderReview.processGate.actionCodes.retry_onhand_matching': '重新库存匹配',
|
||||
workspace: {
|
||||
shippingNotice: {
|
||||
processGate: {
|
||||
actionCodes: {
|
||||
reload_inventory_result: '重新读取库存结果',
|
||||
retry_inventory_preparation: '重新获取库存',
|
||||
reload_onhand_result: '重新读取库存结果',
|
||||
retry_onhand_preparation: '重新获取库存',
|
||||
confirm_customer: '确认客户',
|
||||
},
|
||||
inventoryActions: {
|
||||
@@ -76,7 +76,7 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
it('hides a legacy primary action while inventory preparation is running', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_preparation',
|
||||
stageCode: 'onhand_preparation',
|
||||
userStatus: 'running',
|
||||
primaryAction: { code: 'edit_formal_task', i18nKey: 'edit_formal_task' },
|
||||
},
|
||||
@@ -90,8 +90,8 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
it('keeps the retry action for retryable states', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_preparation', userStatus: 'retryable', retryable: true,
|
||||
primaryAction: { code: 'retry_inventory_preparation', i18nKey: 'workspace.shippingNotice.processGate.inventoryActions.retryInventoryPreparation' },
|
||||
stageCode: 'onhand_preparation', userStatus: 'retryable', retryable: true,
|
||||
primaryAction: { code: 'retry_onhand_preparation', i18nKey: 'workspace.shippingNotice.processGate.inventoryActions.retryInventoryPreparation' },
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
@@ -105,8 +105,8 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
// 此用例用 reload_inventory_result(仍为写契约有效码)验证卡片对库存动作文案的渲染。
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_preparation', userStatus: 'retryable', retryable: true,
|
||||
primaryAction: { code: 'reload_inventory_result' },
|
||||
stageCode: 'onhand_preparation', userStatus: 'retryable', retryable: true,
|
||||
primaryAction: { code: 'reload_onhand_result' },
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
@@ -131,11 +131,11 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
it('renders Gate label_key for every primary action presentation', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_matching',
|
||||
stageCode: 'onhand_matching',
|
||||
userStatus: 'waiting_human',
|
||||
primaryAction: {
|
||||
code: 'retry_inventory_matching',
|
||||
label_key: 'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching',
|
||||
code: 'retry_onhand_matching',
|
||||
label_key: 'chat.shippingOrderReview.processGate.actionCodes.retry_onhand_matching',
|
||||
} as any,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
@@ -220,7 +220,7 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
it('renders a localized reason instead of an internal blocking code in the next step', () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_matching',
|
||||
stageCode: 'onhand_matching',
|
||||
userStatus: 'waiting_human',
|
||||
blockingReason: { code: 'inventory_shortage_review_required' },
|
||||
},
|
||||
@@ -235,18 +235,18 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
it('hides internal inventory recovery targets while retaining the stable primary action', async () => {
|
||||
const wrapper = mount(ReviewCurrentProcessingCard, {
|
||||
props: {
|
||||
stageCode: 'inventory_matching',
|
||||
stageCode: 'onhand_matching',
|
||||
userStatus: 'waiting_human',
|
||||
primaryAction: { code: 'retry_inventory_matching', i18nKey: 'retry_inventory_matching' },
|
||||
primaryAction: { code: 'retry_onhand_matching', i18nKey: 'retry_onhand_matching' },
|
||||
recoveryActions: [{
|
||||
code: 'retry_inventory_from_preparation',
|
||||
i18nKey: 'chat.shippingOrderReview.processGate.actionCodes.retry_inventory_matching',
|
||||
code: 'retry_onhand_from_preparation',
|
||||
i18nKey: 'chat.shippingOrderReview.processGate.actionCodes.retry_onhand_matching',
|
||||
}],
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
expect(wrapper.find('[data-testid="review-current-task-recovery-retry_inventory_from_preparation"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-current-task-recovery-retry_onhand_from_preparation"]').exists()).toBe(false);
|
||||
expect(wrapper.findAll('button').length).toBe(1);
|
||||
});
|
||||
|
||||
@@ -255,19 +255,19 @@ describe('ReviewCurrentProcessingCard', () => {
|
||||
props: {
|
||||
stageCode: 'fulfillment_prep',
|
||||
userStatus: 'waiting_human',
|
||||
primaryAction: { code: 'retry_inventory_matching' },
|
||||
recoveryActions: [{ code: 'retry_inventory_preparation' }],
|
||||
primaryAction: { code: 'retry_onhand_matching' },
|
||||
recoveryActions: [{ code: 'retry_onhand_preparation' }],
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
await wrapper.get('[data-testid="review-current-processing-retry"]').trigger('click');
|
||||
await wrapper.get('[data-testid="review-current-task-recovery-retry_inventory_preparation"]').trigger('click');
|
||||
await wrapper.get('[data-testid="review-current-task-recovery-retry_onhand_preparation"]').trigger('click');
|
||||
|
||||
// 两个稳定 action 码分别进入 Gate API:重匹配不可误触 RPA,重新获取库存才会触发 RPA。
|
||||
expect(wrapper.emitted('action')).toEqual([
|
||||
['retry_inventory_matching', {}],
|
||||
['retry_inventory_preparation', {}],
|
||||
['retry_onhand_matching', {}],
|
||||
['retry_onhand_preparation', {}],
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -317,7 +317,7 @@ const businessActionTitle = computed(() => {
|
||||
});
|
||||
|
||||
const actionIsRetry = computed(() => String(props.primaryAction?.code || '').trim().startsWith('retry_'));
|
||||
const actionIsInventoryRpa = computed(() => String(props.primaryAction?.code || '').trim() === 'retry_inventory_preparation');
|
||||
const actionIsInventoryRpa = computed(() => String(props.primaryAction?.code || '').trim() === 'retry_onhand_preparation');
|
||||
|
||||
/**
|
||||
* 阶段能力禁用态裁决:与视图层 submitFormalGateAction 的点击拦截同源(展示=执行同源)。
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ const { t, te } = useI18n();
|
||||
|
||||
const visible = computed(() => {
|
||||
const actions = props.fallback?.allowed_actions || [];
|
||||
return Boolean(props.fallback && actions.includes('retry_inventory_preparation'));
|
||||
return Boolean(props.fallback && actions.includes('retry_onhand_preparation'));
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ const reasonLabel = computed(() => {
|
||||
:disabled="busy"
|
||||
@click="emit('retry-preparation')"
|
||||
>
|
||||
{{ t(inventoryActionLabelKey('retry_inventory_preparation')!) }}
|
||||
{{ t(inventoryActionLabelKey('retry_onhand_preparation')!) }}
|
||||
</button>
|
||||
</section>
|
||||
</template>
|
||||
+1
-1
@@ -55,7 +55,7 @@ describe('ReviewLineInventoryOps', () => {
|
||||
it('keeps inventory actions out of the line even when present', () => {
|
||||
const wrapper = mountOps({
|
||||
retryable: false,
|
||||
inventory_allowed_actions: ['retry_inventory_preparation', 'retry_inventory_matching'],
|
||||
inventory_allowed_actions: ['retry_onhand_preparation', 'retry_onhand_matching'],
|
||||
line_allowed_actions: ['close_unfulfillable'],
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-line-retry"]').exists()).toBe(false);
|
||||
|
||||
+7
-7
@@ -474,7 +474,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
customerName: null, poNumber: 'PO-FIRST',
|
||||
},
|
||||
childOrderTasks: [{
|
||||
orderTaskNo: 'OT-EML-WITH-CHILD-OT-C1', status: 'blocked', stage: 'inventory_matching',
|
||||
orderTaskNo: 'OT-EML-WITH-CHILD-OT-C1', status: 'blocked', stage: 'onhand_matching',
|
||||
customerName: null, poNumber: 'PO-SECOND', lastActivityAt: null,
|
||||
}],
|
||||
});
|
||||
@@ -976,23 +976,23 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
status: 'waiting_review',
|
||||
stage: 'waiting_review',
|
||||
currentGate: {
|
||||
gateCode: 'inventory_matching',
|
||||
nextActionCode: 'open_inventory_match_review',
|
||||
gateCode: 'onhand_matching',
|
||||
nextActionCode: 'open_onhand_match_review',
|
||||
blockingReasonCode: 'inventory_match_not_ready',
|
||||
},
|
||||
availableActions: ['open_inventory_match_review'],
|
||||
availableActions: ['open_onhand_match_review'],
|
||||
uiState: {
|
||||
status: 'waiting_human',
|
||||
stage: 'waiting_review',
|
||||
lifecycleStage: 'order_review',
|
||||
lifecycleEntries: [],
|
||||
blocking_reason: { code: 'inventory_match_not_ready' },
|
||||
primary_action: { code: 'open_inventory_match_review', i18nKey: null, parameters: {}, executionMode: 'immediate' },
|
||||
primary_action: { code: 'open_onhand_match_review', i18nKey: null, parameters: {}, executionMode: 'immediate' },
|
||||
secondary_actions: [],
|
||||
},
|
||||
}),
|
||||
buildWorkItem('OT-PROC', {
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
}),
|
||||
],
|
||||
},
|
||||
@@ -1006,7 +1006,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
expect(wrapper.findAll('[data-testid="shipping-processing-task-actions"]')).toHaveLength(0);
|
||||
const task = wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]');
|
||||
expect(task.find('[data-testid="unified-action-primary"]').exists()).toBe(true);
|
||||
expect(task.find('[data-testid="unified-action-primary"]').text()).toContain('open_inventory_match_review');
|
||||
expect(task.find('[data-testid="unified-action-primary"]').text()).toContain('open_onhand_match_review');
|
||||
|
||||
await task.find('button').trigger('click');
|
||||
await flushPromises();
|
||||
|
||||
+1
-1
@@ -775,7 +775,7 @@ function currentNeedLabel(task: ConversationProcessingUserTask): string {
|
||||
const labels: Record<string, string> = {
|
||||
confirm_customer: 'chat.shippingProcessing.currentNeed.confirmCustomer',
|
||||
resolve_field_conflicts: 'chat.shippingProcessing.currentNeed.resolveFieldConflicts',
|
||||
open_inventory_match_review: 'chat.shippingProcessing.currentNeed.inventoryMatch',
|
||||
open_onhand_match_review: 'chat.shippingProcessing.currentNeed.inventoryMatch',
|
||||
open_order_processing: 'chat.shippingProcessing.currentNeed.orderDraft',
|
||||
retry: 'chat.shippingProcessing.currentNeed.retry',
|
||||
retry_parse: 'chat.shippingProcessing.currentNeed.retry',
|
||||
|
||||
@@ -280,7 +280,7 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
it('uses the clicked secondary action lifecycle target instead of falling back to view-result handling', async () => {
|
||||
const file = fileProjection({
|
||||
uiState: {
|
||||
status: 'waiting_human', stage: 'inventory_matching', lifecycleStage: 'fulfillment_prep',
|
||||
status: 'waiting_human', stage: 'onhand_matching', lifecycleStage: 'fulfillment_prep',
|
||||
lifecycleEntries: [], blocking_reason: null, primary_action: null,
|
||||
secondary_actions: [{
|
||||
code: 'view_result', enabled: true, executionMode: 'navigate',
|
||||
|
||||
@@ -459,7 +459,7 @@ export function useChatPage() {
|
||||
const leaveMessageHandlers = createLeaveMessageHandlers(leave);
|
||||
const shippingMessageHandlers = createShippingMessageHandlers(shipping);
|
||||
const trainingHandlers = createTrainingHandlers(training);
|
||||
const shippingPickerRefHolder = markRaw(createShippingPickerRefHolder(shipping.shippingInventoryPickerRef));
|
||||
const shippingPickerRefHolder = markRaw(createShippingPickerRefHolder(shipping.shippingOnhandPickerRef));
|
||||
const shippingNoticePickerRefHolder = markRaw(createShippingPickerRefHolder(shipping.shippingNoticePickerRef));
|
||||
|
||||
const showChatRating = ref(false);
|
||||
@@ -627,13 +627,13 @@ export function useChatPage() {
|
||||
bumpWorkflowRefresh: shipping.bumpWorkflowRefresh,
|
||||
focusedConversationTaskNo: shipping.focusedConversationTaskNo,
|
||||
setFocusedConversationTaskNo: shipping.setFocusedConversationTaskNo,
|
||||
shippingInventorySelectionActive: shipping.shippingInventorySelectionActive,
|
||||
shippingInventorySelectionTaskId: shipping.shippingInventorySelectionTaskId,
|
||||
shippingOnhandSelectionActive: shipping.shippingOnhandSelectionActive,
|
||||
shippingOnhandSelectionTaskId: shipping.shippingOnhandSelectionTaskId,
|
||||
queryShippingShortageDetails: shipping.queryShippingShortageDetails,
|
||||
selectShippingInventoryUploadTask: shipping.selectShippingInventoryUploadTask,
|
||||
cancelShippingInventoryTaskSelection: shipping.cancelShippingInventoryTaskSelection,
|
||||
selectShippingOnhandUploadTask: shipping.selectShippingOnhandUploadTask,
|
||||
cancelShippingOnhandTaskSelection: shipping.cancelShippingOnhandTaskSelection,
|
||||
shippingSuggestedPrompt: shipping.shippingSuggestedPrompt,
|
||||
handleShippingInventorySelected: shipping.handleShippingInventorySelected,
|
||||
handleShippingOnhandSelected: shipping.handleShippingOnhandSelected,
|
||||
useShippingSuggestedPrompt: shipping.useShippingSuggestedPrompt,
|
||||
handleSidebarNewChat,
|
||||
goToWorkspace: routeSync.goToWorkspace,
|
||||
|
||||
@@ -187,13 +187,13 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
() => isShippingNoticeAgent.value && attachments.value.length > 0,
|
||||
);
|
||||
const shippingAutoFlowRequested = ref(false);
|
||||
const shippingInventoryPickerRef = ref<HTMLInputElement | null>(null);
|
||||
const shippingOnhandPickerRef = ref<HTMLInputElement | null>(null);
|
||||
const shippingNoticePickerRef = ref<HTMLInputElement | null>(null);
|
||||
const pendingShippingUploadTaskId = ref('');
|
||||
const pendingShippingNoticeTaskId = ref('');
|
||||
const pendingShippingInventoryFile = ref<File | null>(null);
|
||||
const shippingInventorySelectionActive = ref(false);
|
||||
const shippingInventorySelectionTaskId = ref('');
|
||||
const pendingShippingOnhandFile = ref<File | null>(null);
|
||||
const shippingOnhandSelectionActive = ref(false);
|
||||
const shippingOnhandSelectionTaskId = ref('');
|
||||
|
||||
const prepareMarkdownDisplayText = (text: string) => {
|
||||
return sanitizeShippingConversationText(stripReasoningPrelude(text), isShippingNoticeAgent.value);
|
||||
@@ -264,9 +264,9 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
shippingAutoFlowRequested.value = false;
|
||||
pendingShippingUploadTaskId.value = '';
|
||||
pendingShippingNoticeTaskId.value = '';
|
||||
pendingShippingInventoryFile.value = null;
|
||||
shippingInventorySelectionActive.value = false;
|
||||
shippingInventorySelectionTaskId.value = '';
|
||||
pendingShippingOnhandFile.value = null;
|
||||
shippingOnhandSelectionActive.value = false;
|
||||
shippingOnhandSelectionTaskId.value = '';
|
||||
resolvedShippingTaskId.value = '';
|
||||
activeShippingTaskDetail.value = null;
|
||||
lastConversationSyncKey.value = '';
|
||||
@@ -667,11 +667,11 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
const {
|
||||
handleShippingAutoUploadFile,
|
||||
handleShippingAutoUploadNoticeBatch,
|
||||
openShippingInventoryPicker,
|
||||
openShippingOnhandPicker,
|
||||
openShippingNoticePicker,
|
||||
selectShippingInventoryUploadTask,
|
||||
cancelShippingInventoryTaskSelection,
|
||||
handleShippingInventorySelected,
|
||||
selectShippingOnhandUploadTask,
|
||||
cancelShippingOnhandTaskSelection,
|
||||
handleShippingOnhandSelected,
|
||||
shippingSuggestedPrompt,
|
||||
useShippingSuggestedPrompt,
|
||||
isShippingNoticeBatchSubmitting,
|
||||
@@ -681,14 +681,14 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
attachments,
|
||||
input,
|
||||
shippingAutoFlowRequested,
|
||||
shippingInventoryPickerRef,
|
||||
shippingOnhandPickerRef,
|
||||
shippingNoticePickerRef,
|
||||
pendingShippingUploadTaskId,
|
||||
pendingShippingNoticeTaskId,
|
||||
pendingShippingInventoryFile,
|
||||
pendingShippingOnhandFile,
|
||||
resolvedShippingTaskId,
|
||||
shippingInventorySelectionActive,
|
||||
shippingInventorySelectionTaskId,
|
||||
shippingOnhandSelectionActive,
|
||||
shippingOnhandSelectionTaskId,
|
||||
getActiveShippingTaskId,
|
||||
startChatTurn,
|
||||
refreshShippingActions,
|
||||
@@ -716,7 +716,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
getActiveShippingTaskId,
|
||||
messages,
|
||||
sendShippingMenuMessage,
|
||||
openShippingInventoryPicker,
|
||||
openShippingOnhandPicker,
|
||||
openShippingNoticePicker,
|
||||
openShippingCustomerDialog,
|
||||
executeShippingDecision,
|
||||
@@ -943,11 +943,11 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
isShippingNoticeAgent,
|
||||
prepareMarkdownDisplayText,
|
||||
shippingAutoFlowRequested,
|
||||
shippingInventoryPickerRef,
|
||||
shippingOnhandPickerRef,
|
||||
shippingNoticePickerRef,
|
||||
pendingShippingUploadTaskId,
|
||||
shippingInventorySelectionActive,
|
||||
shippingInventorySelectionTaskId,
|
||||
shippingOnhandSelectionActive,
|
||||
shippingOnhandSelectionTaskId,
|
||||
allowsSendWithAttachmentsOnly,
|
||||
shippingTaskIdFromQuery,
|
||||
isShippingActionBusy,
|
||||
@@ -963,10 +963,10 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
addShippingParseReviewLine,
|
||||
removeShippingParseReviewLine,
|
||||
handleShippingActionClick,
|
||||
handleShippingInventorySelected,
|
||||
handleShippingOnhandSelected,
|
||||
finalizeShippingAssistantMessage,
|
||||
selectShippingInventoryUploadTask,
|
||||
cancelShippingInventoryTaskSelection,
|
||||
selectShippingOnhandUploadTask,
|
||||
cancelShippingOnhandTaskSelection,
|
||||
shippingSuggestedPrompt,
|
||||
useShippingSuggestedPrompt,
|
||||
enqueueShippingNoticeFiles: shippingIntakes.enqueueNoticeFiles,
|
||||
|
||||
@@ -77,14 +77,14 @@ const createUploadContext = (
|
||||
attachments: ref([]),
|
||||
input: ref(''),
|
||||
shippingAutoFlowRequested: ref(false),
|
||||
shippingInventoryPickerRef: ref({ click: vi.fn() } as unknown as HTMLInputElement),
|
||||
shippingOnhandPickerRef: ref({ click: vi.fn() } as unknown as HTMLInputElement),
|
||||
shippingNoticePickerRef: ref({ click: vi.fn() } as unknown as HTMLInputElement),
|
||||
pendingShippingUploadTaskId: ref(''),
|
||||
pendingShippingNoticeTaskId: ref(''),
|
||||
pendingShippingInventoryFile: ref(null),
|
||||
pendingShippingOnhandFile: ref(null),
|
||||
resolvedShippingTaskId: ref(''),
|
||||
shippingInventorySelectionActive: ref(false),
|
||||
shippingInventorySelectionTaskId: ref(''),
|
||||
shippingOnhandSelectionActive: ref(false),
|
||||
shippingOnhandSelectionTaskId: ref(''),
|
||||
getActiveShippingTaskId: () => '',
|
||||
startChatTurn: vi.fn(async () => true),
|
||||
refreshShippingActions: vi.fn(async () => undefined),
|
||||
|
||||
@@ -244,7 +244,7 @@ describe('useShippingOrderReview historical readonly', () => {
|
||||
it('maps confirmed case to non-closed lifecycle for post-confirm automation', () => {
|
||||
// 关键断言:confirmed 不得映射 closed,否则统一进度轨道会被误判为终态。
|
||||
expect(mapReviewContextLifecycleStatus('confirmed', null)).toBe('building_order');
|
||||
expect(mapReviewContextLifecycleStatus('confirmed', 'inventory_matching')).toBe('inventory_matching');
|
||||
expect(mapReviewContextLifecycleStatus('confirmed', 'onhand_matching')).toBe('onhand_matching');
|
||||
expect(mapReviewContextLifecycleStatus('closed', null)).toBe('closed');
|
||||
expect(mapReviewContextLifecycleStatus('quality_issue', null)).toBe('closed');
|
||||
});
|
||||
@@ -518,7 +518,7 @@ describe('useShippingOrderReview build eligibility writes', () => {
|
||||
});
|
||||
api.getExtractionRun.mockResolvedValue({ run_no: 'RUN-1', status: 'completed' });
|
||||
api.getProcessingWorkItem.mockResolvedValue({
|
||||
work_item_no: 'OT-1', status: 'processing', stage: 'inventory_preparation',
|
||||
work_item_no: 'OT-1', status: 'processing', stage: 'onhand_preparation',
|
||||
});
|
||||
|
||||
const review = useShippingOrderReview();
|
||||
@@ -1222,8 +1222,8 @@ describe('useShippingOrderReview build eligibility writes', () => {
|
||||
workItemNo: 'OT-1',
|
||||
status: 'waiting_human',
|
||||
userStatus: 'waiting_human',
|
||||
stage: 'inventory_matching',
|
||||
currentGate: { gateCode: 'inventory_matching', status: 'blocked_manual' },
|
||||
stage: 'onhand_matching',
|
||||
currentGate: { gateCode: 'onhand_matching', status: 'blocked_manual' },
|
||||
uiState: {
|
||||
status: 'waiting_human',
|
||||
lifecycleStage: 'fulfillment_prep',
|
||||
@@ -1278,8 +1278,8 @@ describe('useShippingOrderReview build eligibility writes', () => {
|
||||
});
|
||||
api.getEvidence.mockResolvedValue({ items: [] });
|
||||
api.getProcessingWorkItem.mockResolvedValue({
|
||||
work_item_no: 'OT-1', status: 'processing', stage: 'inventory_preparation',
|
||||
currentGate: { gateCode: 'inventory_preparation', status: 'running' },
|
||||
work_item_no: 'OT-1', status: 'processing', stage: 'onhand_preparation',
|
||||
currentGate: { gateCode: 'onhand_preparation', status: 'running' },
|
||||
});
|
||||
api.confirmCase.mockResolvedValue({
|
||||
task_no: 'SN-1', order_task_no: 'OT-1', shipping_notice_no: 'SN-1', idempotent_replay: false,
|
||||
|
||||
@@ -229,7 +229,7 @@ export function mapReviewContextLifecycleStatus(
|
||||
if (cs === 'closed') return 'closed';
|
||||
// [UI-05] confirmed ? closed
|
||||
if (cs === 'confirmed') {
|
||||
if (['building_order', 'inventory_matching', 'generating_excel'].includes(rs)) return rs;
|
||||
if (['building_order', 'onhand_matching', 'generating_excel'].includes(rs)) return rs;
|
||||
if (['manual_upload_pending', 'upload_rpa_pending', 'upload_rpa_running'].includes(rs)) return rs;
|
||||
return 'building_order';
|
||||
}
|
||||
@@ -240,7 +240,7 @@ export function mapReviewContextLifecycleStatus(
|
||||
if (['layout_parsing', 'waiting_layout'].includes(rs)) return 'layout_parsing';
|
||||
if (['routing', 'matching_profile', 'extracting', 'merging_supplement'].includes(rs)) return 'extracting';
|
||||
if (['review_required', 'partially_completed', 'candidate_ready'].includes(rs)) return 'pending_review';
|
||||
if (['building_order', 'inventory_matching', 'generating_excel'].includes(rs)) return rs;
|
||||
if (['building_order', 'onhand_matching', 'generating_excel'].includes(rs)) return rs;
|
||||
if (['draft', 'ready', 'unreviewed', 'superseded'].includes(cs)) return 'pending_review';
|
||||
return 'pending_review';
|
||||
}
|
||||
|
||||
@@ -296,8 +296,8 @@ export function normalizeLifecycleStatus(
|
||||
const HUMAN_ACTION_CODES = new Set([
|
||||
'confirm_customer', 'resolve_field_conflicts', 'adjudicate_duplicate',
|
||||
'open_order_review', 'open_order_processing', 'enter_manual_review',
|
||||
'open_inventory_match_review', 'rematch', 'match_inventory',
|
||||
'open_shortage_review', 'upload_inventory_file', 'open_manual_upload',
|
||||
'open_onhand_match_review', 'rematch', 'match_inventory',
|
||||
'open_shortage_review', 'upload_onhand_file', 'open_manual_upload',
|
||||
'wait_manual_upload', 'retry', 'retry_parse', 'retry_failed_documents',
|
||||
'retry_failed_attachments', 'open_profile_review',
|
||||
]);
|
||||
@@ -308,7 +308,7 @@ const PROCESSING_LIFECYCLES = new Set([
|
||||
'layout_parsing',
|
||||
'extracting',
|
||||
'building_order',
|
||||
'inventory_matching',
|
||||
'onhand_matching',
|
||||
'generating_excel',
|
||||
'upload_rpa_pending',
|
||||
'upload_rpa_running',
|
||||
@@ -337,7 +337,7 @@ export function mapLifecycleToNodeStatus(
|
||||
status === 'layout_parsing'
|
||||
|| status === 'extracting'
|
||||
|| status === 'building_order'
|
||||
|| status === 'inventory_matching'
|
||||
|| status === 'onhand_matching'
|
||||
|| status === 'generating_excel'
|
||||
) {
|
||||
return 'running';
|
||||
|
||||
@@ -34,15 +34,15 @@ describe('normalizeShippingProcessingProjection', () => {
|
||||
process_gate: {
|
||||
execution_no: 'EXE-1',
|
||||
status: 'blocked',
|
||||
current_gate_code: 'inventory_preparation',
|
||||
current_gate_code: 'onhand_preparation',
|
||||
expected_gate_version: 3,
|
||||
current_blocking_gate: {
|
||||
gate_code: 'inventory_preparation',
|
||||
gate_code: 'onhand_preparation',
|
||||
status: 'blocked_manual',
|
||||
evaluation_version: 3,
|
||||
},
|
||||
next_action_code: 'retry_inventory_preparation',
|
||||
allowed_actions: ['retry_inventory_preparation', 'upload_inventory_file'],
|
||||
next_action_code: 'retry_onhand_preparation',
|
||||
allowed_actions: ['retry_onhand_preparation', 'upload_onhand_file'],
|
||||
},
|
||||
available_actions: ['open_review'],
|
||||
ui_state: {
|
||||
@@ -75,9 +75,9 @@ describe('normalizeShippingProcessingProjection', () => {
|
||||
expect(normalized!.currentGate?.attemptNo).toBe(1);
|
||||
expect(normalized!.processGate).toMatchObject({
|
||||
execution_no: 'EXE-1',
|
||||
current_gate_code: 'inventory_preparation',
|
||||
current_gate_code: 'onhand_preparation',
|
||||
expected_gate_version: 3,
|
||||
next_action_code: 'retry_inventory_preparation',
|
||||
next_action_code: 'retry_onhand_preparation',
|
||||
});
|
||||
expect(normalized!.sourceSummary.filename).toBe('a.pdf');
|
||||
expect(normalized!.sourceSummary.documentId).toBe(17);
|
||||
@@ -199,7 +199,7 @@ describe('normalizeShippingProcessingProjection', () => {
|
||||
submission_no: 'SUB-1',
|
||||
intake_no: 'INT-1',
|
||||
status: 'processing',
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
progress_version: 2,
|
||||
last_activity_at: '2026-08-08T22:00:00',
|
||||
source_summary: {},
|
||||
@@ -259,7 +259,7 @@ describe('normalizeShippingProcessingProjection', () => {
|
||||
workItemNo: 'OT-1',
|
||||
workItemType: 'order_task',
|
||||
status: 'waiting_review',
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
userStatus: 'waiting_human',
|
||||
uiState: { status: 'waiting_human', lifecycleStage: 'fulfillment_prep' },
|
||||
})).toBeNull();
|
||||
|
||||
@@ -9,8 +9,8 @@ import type {
|
||||
ConversationProcessingUiState,
|
||||
OrderIntakeSourceType,
|
||||
ProcessGateSummary,
|
||||
ShippingInventoryPerSourceAttempt,
|
||||
ShippingInventoryPreparationSummary,
|
||||
ShippingOnhandPerSourceAttempt,
|
||||
ShippingOnhandPreparationSummary,
|
||||
ShippingOrderTaskSummary,
|
||||
ShippingProcessingBlockingReason,
|
||||
ShippingProcessingFacts,
|
||||
@@ -304,7 +304,7 @@ function normalizeAggregateSummary(
|
||||
* 题4A:规范 inventory_preparation 结构化字段(snake_case → camelCase)。
|
||||
* 注意:只投影当前准备结果;失败后由具体 Gate 动作决定下一步。
|
||||
*/
|
||||
function normalizeInventoryPreparation(raw: unknown): ShippingInventoryPreparationSummary | null {
|
||||
function normalizeInventoryPreparation(raw: unknown): ShippingOnhandPreparationSummary | null {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const item = raw as Record<string, unknown>;
|
||||
const toStrArr = (value: unknown): string[] => {
|
||||
@@ -322,7 +322,7 @@ function normalizeInventoryPreparation(raw: unknown): ShippingInventoryPreparati
|
||||
const activeAttemptCount = Number(item.active_attempt_count ?? item.activeAttemptCount ?? 0) || 0;
|
||||
const gateAttemptActive = Boolean(item.gate_attempt_active ?? item.gateAttemptActive ?? false);
|
||||
const latestRaw = (item.latest_attempts ?? item.latestAttempts) as Record<string, unknown> | undefined;
|
||||
const latestAttempts: Record<string, ShippingInventoryPerSourceAttempt> = {};
|
||||
const latestAttempts: Record<string, ShippingOnhandPerSourceAttempt> = {};
|
||||
if (latestRaw && typeof latestRaw === 'object') {
|
||||
for (const [key, val] of Object.entries(latestRaw)) {
|
||||
if (!val || typeof val !== 'object') continue;
|
||||
@@ -331,7 +331,7 @@ function normalizeInventoryPreparation(raw: unknown): ShippingInventoryPreparati
|
||||
if (!sourceCode) continue;
|
||||
const attemptNo = Number(row.attempt_no ?? row.attemptNo ?? 0) || 0;
|
||||
const status = String(row.status || '').trim().toLowerCase() || 'unknown';
|
||||
const entry: ShippingInventoryPerSourceAttempt = {
|
||||
const entry: ShippingOnhandPerSourceAttempt = {
|
||||
sourceCode,
|
||||
attemptNo,
|
||||
status,
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
downloadWorkspaceShippingExportArchive as requestShippingExportArchive,
|
||||
workspaceShippingNoticeExportUrl,
|
||||
workspaceShippingExportUrl,
|
||||
workspaceShippingInventoryFileUrl,
|
||||
workspaceShippingOnhandFileUrl,
|
||||
workspaceShippingLineInventoryFileUrl,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
@@ -31,8 +31,8 @@ export async function downloadWorkspaceShippingNoticeExcelFile(businessNo: strin
|
||||
* @param taskId - 正式发货任务号,必须来自当前详情快照。
|
||||
* @returns 下载完成后解析并触发浏览器保存。
|
||||
*/
|
||||
export async function downloadWorkspaceShippingInventoryFile(taskId: string): Promise<void> {
|
||||
await downloadWorkspaceShippingFile(workspaceShippingInventoryFileUrl(taskId), `${taskId}-inventory.xlsx`);
|
||||
export async function downloadWorkspaceShippingOnhandFile(taskId: string): Promise<void> {
|
||||
await downloadWorkspaceShippingFile(workspaceShippingOnhandFileUrl(taskId), `${taskId}-inventory.xlsx`);
|
||||
}
|
||||
|
||||
/** 下载某订单行实际匹配的库存快照;后端复核该文件号是否为当前行事实。 */
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
* features/chat/shipping/shippingMapping.ts
|
||||
* 用途:库存列映射消息 payload 读取与字段对齐 Markdown 生成。
|
||||
* 依赖:shippingText.normalizeShippingHeaderForDisplay、chat.types、shipping.types、vue-i18n。
|
||||
* 逻辑:ShippingInventoryMappingMessage 与 useChatShippingMappingForm 读取 mapping 消息数据。
|
||||
* 逻辑:ShippingOnhandMappingFormPayload 与 useChatShippingMappingForm 读取 mapping 消息数据。
|
||||
*/
|
||||
import i18n from '@/i18n';
|
||||
import { normalizeShippingHeaderForDisplay } from './shippingText';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
import type { ShippingInventoryMappingFormPayload } from '../types/shipping.types';
|
||||
import type { ShippingOnhandMappingFormPayload } from '../types/shipping.types';
|
||||
|
||||
const tt = (key: string, params?: Record<string, unknown>) =>
|
||||
String(params ? i18n.global.t(key, params) : i18n.global.t(key));
|
||||
@@ -15,24 +15,24 @@ const tt = (key: string, params?: Record<string, unknown>) =>
|
||||
/**
|
||||
* 从 shipping-inventory-mapping 类型消息中提取 taskId、schema_preview 与 form。
|
||||
*/
|
||||
export function getShippingInventoryMappingPayload(chatMsg: ChatMessage): ShippingInventoryMappingFormPayload | null {
|
||||
export function getShippingOnhandMappingPayload(chatMsg: ChatMessage): ShippingOnhandMappingFormPayload | null {
|
||||
if (!chatMsg || chatMsg.type !== 'shipping-inventory-mapping') return null;
|
||||
const payload = chatMsg.payload;
|
||||
if (!payload || typeof payload !== 'object') return null;
|
||||
const taskId = String((payload as ShippingInventoryMappingFormPayload).taskId || '').trim();
|
||||
const schemaPreview = (payload as ShippingInventoryMappingFormPayload).schema_preview;
|
||||
const form = (payload as ShippingInventoryMappingFormPayload).form;
|
||||
const taskId = String((payload as ShippingOnhandMappingFormPayload).taskId || '').trim();
|
||||
const schemaPreview = (payload as ShippingOnhandMappingFormPayload).schema_preview;
|
||||
const form = (payload as ShippingOnhandMappingFormPayload).form;
|
||||
if (!taskId || !schemaPreview || !form) return null;
|
||||
return payload as ShippingInventoryMappingFormPayload;
|
||||
return payload as ShippingOnhandMappingFormPayload;
|
||||
}
|
||||
|
||||
export function hasShippingInventorySampleRows(chatMsg: ChatMessage): boolean {
|
||||
const rows = getShippingInventoryMappingPayload(chatMsg)?.schema_preview?.sample_rows;
|
||||
export function hasShippingOnhandSampleRows(chatMsg: ChatMessage): boolean {
|
||||
const rows = getShippingOnhandMappingPayload(chatMsg)?.schema_preview?.sample_rows;
|
||||
return Array.isArray(rows) && rows.length > 0;
|
||||
}
|
||||
|
||||
export function getShippingInventorySampleRowText(chatMsg: ChatMessage): string {
|
||||
const row = getShippingInventoryMappingPayload(chatMsg)?.schema_preview?.sample_rows?.[0];
|
||||
export function getShippingOnhandSampleRowText(chatMsg: ChatMessage): string {
|
||||
const row = getShippingOnhandMappingPayload(chatMsg)?.schema_preview?.sample_rows?.[0];
|
||||
return Array.isArray(row) ? row.map((cell) => String(cell)).join(' | ') : '';
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
/** 复核/任务台共用的履约四节点 stage 键。 */
|
||||
export const FULFILLMENT_PROGRESS_NODES = [
|
||||
'building_order',
|
||||
'inventory_matching',
|
||||
'onhand_matching',
|
||||
'generating_excel',
|
||||
'freight_uploading',
|
||||
] as const;
|
||||
@@ -116,7 +116,7 @@ export function fulfillmentNodeIndexFromStage(
|
||||
if (st === 'completed' || s === 'completed') return 3;
|
||||
if (s === 'freight_uploading' || st === 'automating') return 3;
|
||||
if (s === 'excel_generating' || s === 'generating_excel') return 2;
|
||||
if (s === 'inventory_matching' || s.startsWith('inventory_')) return 1;
|
||||
if (s === 'onhand_matching' || s.startsWith('inventory_')) return 1;
|
||||
if (
|
||||
s === 'building_order'
|
||||
|| s === 'order_creating'
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('shippingStepper', () => {
|
||||
{ code: 'upload_complete', status: 'pending' },
|
||||
]);
|
||||
const steps = applyShippingProcessingStageToSteps(base, {
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
status: 'running',
|
||||
});
|
||||
expect(steps.map((step) => step.status)).toEqual(['completed', 'completed', 'current', 'pending', 'pending']);
|
||||
|
||||
@@ -86,9 +86,9 @@ const PROCESSING_STAGE_INDEX_MAP: Record<string, number> = {
|
||||
duplicate_checking: 1,
|
||||
waiting_review: 1,
|
||||
order_creating: 1,
|
||||
inventory_source_resolving: 2,
|
||||
inventory_fetching: 2,
|
||||
inventory_matching: 2,
|
||||
onhand_source_resolving: 2,
|
||||
onhand_fetching: 2,
|
||||
onhand_matching: 2,
|
||||
excel_generating: 2,
|
||||
freight_uploading: 3,
|
||||
completed: 4,
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
import { nextTick } from 'vue';
|
||||
import { getWorkspaceShippingTask } from '@/features/chat/api/shipping.api';
|
||||
import { buildShippingApplyMappingTurn } from './shippingTurnActions';
|
||||
import { getShippingInventoryMappingPayload } from './shippingMapping';
|
||||
import { getShippingOnhandMappingPayload } from './shippingMapping';
|
||||
import type { StartChatTurnOptions } from '../types/chat-turn.types';
|
||||
import type { ChatMessage } from '../types/chat.types';
|
||||
import type { ShippingInventoryMappingFormPayload } from '../types/shipping.types';
|
||||
import type { ShippingOnhandMappingFormPayload } from '../types/shipping.types';
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
export interface ShippingMappingFormContext {
|
||||
messages: Ref<ChatMessage[]>;
|
||||
chatScrollContainer: Ref<HTMLElement | null>;
|
||||
shippingInventorySchemaPreviewCache: Ref<Record<string, unknown>>;
|
||||
shippingInventoryPickerRef: Ref<HTMLInputElement | null>;
|
||||
shippingOnhandSchemaPreviewCache: Ref<Record<string, unknown>>;
|
||||
shippingOnhandPickerRef: Ref<HTMLInputElement | null>;
|
||||
pendingShippingUploadTaskId: Ref<string>;
|
||||
resolvedShippingTaskId: Ref<string>;
|
||||
newLocalMessageId: (prefix: string) => string;
|
||||
@@ -37,7 +37,7 @@ export interface ShippingMappingFormContext {
|
||||
* @returns 打开、应用和重传库存映射表单的处理函数
|
||||
*/
|
||||
export function createShippingMappingFormHandlers(ctx: ShippingMappingFormContext) {
|
||||
const scrollToLastShippingInventoryMapping = async (): Promise<boolean> => {
|
||||
const scrollToLastShippingOnhandMapping = async (): Promise<boolean> => {
|
||||
const container = ctx.chatScrollContainer.value;
|
||||
if (!container) return false;
|
||||
let idx = -1;
|
||||
@@ -56,22 +56,22 @@ export function createShippingMappingFormHandlers(ctx: ShippingMappingFormContex
|
||||
return true;
|
||||
};
|
||||
|
||||
const openShippingInventoryMappingFormForTask = async (taskId: string): Promise<boolean> => {
|
||||
const openShippingOnhandMappingFormForTask = async (taskId: string): Promise<boolean> => {
|
||||
const id = String(taskId || '').trim().toUpperCase();
|
||||
if (!id) return false;
|
||||
const existingIdx = (() => {
|
||||
for (let i = ctx.messages.value.length - 1; i >= 0; i -= 1) {
|
||||
const chatMsg = ctx.messages.value[i] as ChatMessage;
|
||||
if (chatMsg?.type !== 'shipping-inventory-mapping') continue;
|
||||
const payload = getShippingInventoryMappingPayload(chatMsg);
|
||||
const payload = getShippingOnhandMappingPayload(chatMsg);
|
||||
if (payload?.taskId?.trim().toUpperCase() === id) return i;
|
||||
}
|
||||
return -1;
|
||||
})();
|
||||
if (existingIdx >= 0) {
|
||||
return scrollToLastShippingInventoryMapping();
|
||||
return scrollToLastShippingOnhandMapping();
|
||||
}
|
||||
const schemaPreview = ctx.shippingInventorySchemaPreviewCache.value[id];
|
||||
const schemaPreview = ctx.shippingOnhandSchemaPreviewCache.value[id];
|
||||
if (!schemaPreview || typeof schemaPreview !== 'object') {
|
||||
ctx.msg.warning(ctx.t('chat.shippingNoticeToast.schemaPreviewMissing'));
|
||||
return false;
|
||||
@@ -101,18 +101,18 @@ export function createShippingMappingFormHandlers(ctx: ShippingMappingFormContex
|
||||
reservation_id: String(suggested?.reservation_id || '').trim(),
|
||||
},
|
||||
applying: false,
|
||||
} as ShippingInventoryMappingFormPayload,
|
||||
} as ShippingOnhandMappingFormPayload,
|
||||
local_id: ctx.newLocalMessageId('shipping-assistant'),
|
||||
local_only: true,
|
||||
};
|
||||
ctx.messages.value.push(mappingMsg);
|
||||
await ctx.saveLocalMessageToBackend(mappingMsg);
|
||||
await scrollToLastShippingInventoryMapping();
|
||||
await scrollToLastShippingOnhandMapping();
|
||||
return true;
|
||||
};
|
||||
|
||||
const applyShippingInventoryMappingForm = async (msgObj: ChatMessage) => {
|
||||
const payload = getShippingInventoryMappingPayload(msgObj);
|
||||
const applyShippingOnhandMappingForm = async (msgObj: ChatMessage) => {
|
||||
const payload = getShippingOnhandMappingPayload(msgObj);
|
||||
if (!payload) return;
|
||||
if (payload.applying) return;
|
||||
const taskId = String(payload.taskId || '').trim();
|
||||
@@ -159,18 +159,18 @@ export function createShippingMappingFormHandlers(ctx: ShippingMappingFormContex
|
||||
}
|
||||
};
|
||||
|
||||
const reuploadShippingInventoryFromMappingForm = (msgObj: ChatMessage) => {
|
||||
const payload = getShippingInventoryMappingPayload(msgObj);
|
||||
const reuploadShippingOnhandFromMappingForm = (msgObj: ChatMessage) => {
|
||||
const payload = getShippingOnhandMappingPayload(msgObj);
|
||||
if (!payload) return;
|
||||
const taskId = String(payload.taskId || '').trim();
|
||||
if (!taskId) return;
|
||||
ctx.pendingShippingUploadTaskId.value = taskId;
|
||||
ctx.shippingInventoryPickerRef.value?.click();
|
||||
ctx.shippingOnhandPickerRef.value?.click();
|
||||
};
|
||||
|
||||
return {
|
||||
openShippingInventoryMappingFormForTask,
|
||||
applyShippingInventoryMappingForm,
|
||||
reuploadShippingInventoryFromMappingForm,
|
||||
openShippingOnhandMappingFormForTask,
|
||||
applyShippingOnhandMappingForm,
|
||||
reuploadShippingOnhandFromMappingForm,
|
||||
};
|
||||
}
|
||||
@@ -24,7 +24,7 @@ const createContext = (
|
||||
getActiveShippingTaskId: () => 'SN-ACTIVE-001',
|
||||
messages: ref([]),
|
||||
sendShippingMenuMessage: vi.fn(async () => undefined),
|
||||
openShippingInventoryPicker: vi.fn((_taskId?: string) => true),
|
||||
openShippingOnhandPicker: vi.fn((_taskId?: string) => true),
|
||||
openShippingNoticePicker: vi.fn((_taskId?: string) => true),
|
||||
executeShippingDecision: vi.fn(async () => true),
|
||||
executeShippingManualUpload: vi.fn(async () => true),
|
||||
@@ -103,12 +103,12 @@ describe('useChatShippingMenuHandler', () => {
|
||||
const { handleShippingMenuAction } = createShippingMenuHandlers(ctx);
|
||||
|
||||
await handleShippingMenuAction(
|
||||
{ id: 'upload_inventory_file', label: '上传库存文件', message: '请上传库存文件' },
|
||||
{ id: 'upload_onhand_file', label: '上传库存文件', message: '请上传库存文件' },
|
||||
undefined,
|
||||
{ taskId: 'sn-picker-123' },
|
||||
);
|
||||
|
||||
expect(ctx.openShippingInventoryPicker).toHaveBeenCalledWith('SN-PICKER-123');
|
||||
expect(ctx.openShippingOnhandPicker).toHaveBeenCalledWith('SN-PICKER-123');
|
||||
});
|
||||
|
||||
it('passes explicit taskId into notice picker actions', async () => {
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface ShippingMenuHandlerContext {
|
||||
getActiveShippingTaskId: () => string;
|
||||
messages: Ref<ChatMessage[]>;
|
||||
sendShippingMenuMessage: (message: string) => Promise<void>;
|
||||
openShippingInventoryPicker: (taskId?: string) => boolean;
|
||||
openShippingOnhandPicker: (taskId?: string) => boolean;
|
||||
openShippingNoticePicker: (taskId?: string) => boolean;
|
||||
openShippingCustomerDialog: (taskId: string) => Promise<void>;
|
||||
executeShippingDecision: (
|
||||
@@ -77,8 +77,8 @@ export function createShippingMenuHandlers(ctx: ShippingMenuHandlerContext) {
|
||||
ctx.openShippingNoticePicker(resolveTaskId());
|
||||
return;
|
||||
}
|
||||
if (action.id === 'upload_inventory_file') {
|
||||
ctx.openShippingInventoryPicker(resolveTaskId());
|
||||
if (action.id === 'upload_onhand_file') {
|
||||
ctx.openShippingOnhandPicker(resolveTaskId());
|
||||
return;
|
||||
}
|
||||
if (action.id && [
|
||||
|
||||
@@ -30,7 +30,7 @@ const createContext = (
|
||||
loadHistory: vi.fn(async () => undefined),
|
||||
sendShippingMenuMessage: vi.fn(async () => undefined),
|
||||
startChatTurn: vi.fn(async () => true),
|
||||
openShippingInventoryPicker: vi.fn(() => true),
|
||||
openShippingOnhandPicker: vi.fn(() => true),
|
||||
executeShippingDecision: vi.fn(async () => true),
|
||||
executeShippingManualUpload: vi.fn(async () => true),
|
||||
handleShippingMenuAction: vi.fn(async () => undefined),
|
||||
|
||||
@@ -39,14 +39,14 @@ const createContext = (
|
||||
attachments: ref([]),
|
||||
input: ref(''),
|
||||
shippingAutoFlowRequested: ref(false),
|
||||
shippingInventoryPickerRef: ref({ click: vi.fn() } as unknown as HTMLInputElement),
|
||||
shippingOnhandPickerRef: ref({ click: vi.fn() } as unknown as HTMLInputElement),
|
||||
shippingNoticePickerRef: ref({ click: vi.fn() } as unknown as HTMLInputElement),
|
||||
pendingShippingUploadTaskId: ref(''),
|
||||
pendingShippingNoticeTaskId: ref(''),
|
||||
pendingShippingInventoryFile: ref(null),
|
||||
pendingShippingOnhandFile: ref(null),
|
||||
resolvedShippingTaskId: ref(''),
|
||||
shippingInventorySelectionActive: ref(false),
|
||||
shippingInventorySelectionTaskId: ref(''),
|
||||
shippingOnhandSelectionActive: ref(false),
|
||||
shippingOnhandSelectionTaskId: ref(''),
|
||||
getActiveShippingTaskId: () => 'SN-ACTIVE-001',
|
||||
startChatTurn: vi.fn(async () => true),
|
||||
refreshShippingActions: vi.fn(async () => undefined),
|
||||
@@ -100,11 +100,11 @@ describe('useChatShippingUploadHandler', () => {
|
||||
it('opens inventory picker for explicit taskId instead of current active task', () => {
|
||||
const inventoryClick = vi.fn();
|
||||
const ctx = createContext({
|
||||
shippingInventoryPickerRef: ref({ click: inventoryClick } as unknown as HTMLInputElement),
|
||||
shippingOnhandPickerRef: ref({ click: inventoryClick } as unknown as HTMLInputElement),
|
||||
});
|
||||
const { openShippingInventoryPicker } = createShippingUploadHandlers(ctx);
|
||||
const { openShippingOnhandPicker } = createShippingUploadHandlers(ctx);
|
||||
|
||||
const ok = openShippingInventoryPicker('sn-target-100');
|
||||
const ok = openShippingOnhandPicker('sn-target-100');
|
||||
|
||||
expect(ok).toBe(true);
|
||||
expect(ctx.pendingShippingUploadTaskId.value).toBe('SN-TARGET-100');
|
||||
@@ -113,11 +113,11 @@ describe('useChatShippingUploadHandler', () => {
|
||||
|
||||
it('uploads a task-selected inventory file through the formal task Chat Turn, not the temporary path', async () => {
|
||||
const ctx = createContext({ pendingShippingUploadTaskId: ref('SN-TASK-001') });
|
||||
const { handleShippingInventorySelected } = createShippingUploadHandlers(ctx);
|
||||
const { handleShippingOnhandSelected } = createShippingUploadHandlers(ctx);
|
||||
const file = new File(['inventory'], 'task-inventory.xls', { type: 'application/vnd.ms-excel' });
|
||||
const event = { target: { files: [file], value: 'chosen' } } as unknown as Event;
|
||||
|
||||
await handleShippingInventorySelected(event);
|
||||
await handleShippingOnhandSelected(event);
|
||||
|
||||
expect(ctx.startChatTurn).toHaveBeenCalledWith(expect.objectContaining({
|
||||
actionType: 'shipping.upload_inventory',
|
||||
|
||||
@@ -35,14 +35,14 @@ export interface ShippingUploadHandlerContext {
|
||||
attachments: Ref<PendingAttachment[]>;
|
||||
input: Ref<string>;
|
||||
shippingAutoFlowRequested: Ref<boolean>;
|
||||
shippingInventoryPickerRef: Ref<HTMLInputElement | null>;
|
||||
shippingOnhandPickerRef: Ref<HTMLInputElement | null>;
|
||||
shippingNoticePickerRef: Ref<HTMLInputElement | null>;
|
||||
pendingShippingUploadTaskId: Ref<string>;
|
||||
pendingShippingNoticeTaskId: Ref<string>;
|
||||
pendingShippingInventoryFile: Ref<File | null>;
|
||||
pendingShippingOnhandFile: Ref<File | null>;
|
||||
resolvedShippingTaskId: Ref<string>;
|
||||
shippingInventorySelectionActive: Ref<boolean>;
|
||||
shippingInventorySelectionTaskId: Ref<string>;
|
||||
shippingOnhandSelectionActive: Ref<boolean>;
|
||||
shippingOnhandSelectionTaskId: Ref<string>;
|
||||
getActiveShippingTaskId: () => string;
|
||||
startChatTurn: (options: StartChatTurnOptions) => Promise<boolean>;
|
||||
refreshShippingActions: () => Promise<void>;
|
||||
@@ -72,8 +72,8 @@ export interface ShippingUploadHandlerContext {
|
||||
*/
|
||||
export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext) {
|
||||
const resetInventoryTaskSelection = () => {
|
||||
ctx.shippingInventorySelectionActive.value = false;
|
||||
ctx.shippingInventorySelectionTaskId.value = '';
|
||||
ctx.shippingOnhandSelectionActive.value = false;
|
||||
ctx.shippingOnhandSelectionTaskId.value = '';
|
||||
};
|
||||
|
||||
const runInventoryUploadChatTurn = async (taskId: string, file: File) => {
|
||||
@@ -93,7 +93,7 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!ok) ctx.msg.warning(ctx.t('chat.shippingInventoryUploadFailed'));
|
||||
if (!ok) ctx.msg.warning(ctx.t('chat.shippingOnhandUploadFailed'));
|
||||
return ok;
|
||||
};
|
||||
|
||||
@@ -102,34 +102,34 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
await runInventoryUploadChatTurn(taskId, file);
|
||||
};
|
||||
|
||||
const selectShippingInventoryUploadTask = (taskId: string): boolean => {
|
||||
const selectShippingOnhandUploadTask = (taskId: string): boolean => {
|
||||
const normalizedTaskId = String(taskId || '').trim().toUpperCase();
|
||||
if (!normalizedTaskId) {
|
||||
ctx.msg.warning(ctx.t('chat.shippingNoticeMissingTaskId'));
|
||||
return false;
|
||||
}
|
||||
ctx.resolvedShippingTaskId.value = normalizedTaskId;
|
||||
ctx.shippingInventorySelectionTaskId.value = normalizedTaskId;
|
||||
ctx.shippingOnhandSelectionTaskId.value = normalizedTaskId;
|
||||
ctx.pendingShippingUploadTaskId.value = normalizedTaskId;
|
||||
ctx.shippingInventorySelectionActive.value = false;
|
||||
ctx.shippingOnhandSelectionActive.value = false;
|
||||
|
||||
const pendingFile = ctx.pendingShippingInventoryFile.value;
|
||||
const pendingFile = ctx.pendingShippingOnhandFile.value;
|
||||
if (pendingFile) {
|
||||
ctx.pendingShippingInventoryFile.value = null;
|
||||
ctx.pendingShippingOnhandFile.value = null;
|
||||
ctx.pendingShippingUploadTaskId.value = '';
|
||||
void uploadInventoryForTask(normalizedTaskId, pendingFile).catch((e: unknown) => {
|
||||
const errorMessage = e instanceof Error ? e.message : ctx.t('chat.shippingInventoryUploadFailed');
|
||||
const errorMessage = e instanceof Error ? e.message : ctx.t('chat.shippingOnhandUploadFailed');
|
||||
ctx.msg.warning(errorMessage);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
ctx.shippingInventoryPickerRef.value?.click();
|
||||
ctx.shippingOnhandPickerRef.value?.click();
|
||||
return true;
|
||||
};
|
||||
|
||||
const cancelShippingInventoryTaskSelection = () => {
|
||||
ctx.pendingShippingInventoryFile.value = null;
|
||||
const cancelShippingOnhandTaskSelection = () => {
|
||||
ctx.pendingShippingOnhandFile.value = null;
|
||||
ctx.pendingShippingUploadTaskId.value = '';
|
||||
resetInventoryTaskSelection();
|
||||
};
|
||||
@@ -258,13 +258,13 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
await runNoticeBatchChatTurn(noticeFiles);
|
||||
};
|
||||
|
||||
const openShippingInventoryPicker = (taskId?: string): boolean => {
|
||||
const openShippingOnhandPicker = (taskId?: string): boolean => {
|
||||
const resolvedTaskId = String(taskId || ctx.getActiveShippingTaskId() || '').trim().toUpperCase();
|
||||
if (!resolvedTaskId) {
|
||||
ctx.msg.warning(ctx.t('chat.shippingNoticeMissingTaskId'));
|
||||
return false;
|
||||
}
|
||||
return selectShippingInventoryUploadTask(resolvedTaskId);
|
||||
return selectShippingOnhandUploadTask(resolvedTaskId);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -284,23 +284,23 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
return true;
|
||||
};
|
||||
|
||||
const handleShippingInventorySelected = async (event: Event) => {
|
||||
const handleShippingOnhandSelected = async (event: Event) => {
|
||||
const fileInput = event.target as HTMLInputElement;
|
||||
const file = fileInput.files?.[0];
|
||||
fileInput.value = '';
|
||||
const taskId = ctx.pendingShippingUploadTaskId.value;
|
||||
ctx.pendingShippingUploadTaskId.value = '';
|
||||
if (!file || !taskId) {
|
||||
ctx.shippingInventorySelectionTaskId.value = '';
|
||||
ctx.shippingOnhandSelectionTaskId.value = '';
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await uploadInventoryForTask(taskId, file);
|
||||
} catch (e: unknown) {
|
||||
const errorMessage = e instanceof Error ? e.message : ctx.t('chat.shippingInventoryUploadFailed');
|
||||
const errorMessage = e instanceof Error ? e.message : ctx.t('chat.shippingOnhandUploadFailed');
|
||||
ctx.msg.warning(errorMessage);
|
||||
} finally {
|
||||
ctx.shippingInventorySelectionTaskId.value = '';
|
||||
ctx.shippingOnhandSelectionTaskId.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -325,11 +325,11 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
return {
|
||||
handleShippingAutoUploadFile,
|
||||
handleShippingAutoUploadNoticeBatch,
|
||||
openShippingInventoryPicker,
|
||||
openShippingOnhandPicker,
|
||||
openShippingNoticePicker,
|
||||
selectShippingInventoryUploadTask,
|
||||
cancelShippingInventoryTaskSelection,
|
||||
handleShippingInventorySelected,
|
||||
selectShippingOnhandUploadTask,
|
||||
cancelShippingOnhandTaskSelection,
|
||||
handleShippingOnhandSelected,
|
||||
shippingSuggestedPrompt,
|
||||
useShippingSuggestedPrompt,
|
||||
isShippingNoticeBatchSubmitting,
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('useShippingProcessingWorkItem', () => {
|
||||
workItemNo: 'OT-20260905-DAC55F90',
|
||||
sourceType: 'eml',
|
||||
status: 'waiting_review',
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
progressVersion: 24,
|
||||
lastActivityAt: '2026-09-05T11:25:45Z',
|
||||
submissionNo: 'SOS-1',
|
||||
@@ -43,11 +43,11 @@ describe('useShippingProcessingWorkItem', () => {
|
||||
userStatus: 'waiting_human',
|
||||
uiState: {
|
||||
status: 'waiting_human',
|
||||
stage: 'inventory_matching',
|
||||
stage: 'onhand_matching',
|
||||
lifecycleStage: 'fulfillment_prep',
|
||||
lifecycleEntries: [],
|
||||
blocking_reason: { code: 'inventory_shortage_review_required' },
|
||||
primary_action: { code: 'retry_inventory_matching' },
|
||||
primary_action: { code: 'retry_onhand_matching' },
|
||||
secondary_actions: [],
|
||||
},
|
||||
sourceSummary: {
|
||||
@@ -87,7 +87,7 @@ describe('useShippingProcessingWorkItem', () => {
|
||||
expect(api!.projection.value?.workItemNo).toBe('OT-20260905-DAC55F90');
|
||||
expect(api!.projection.value?.userStatus).toBe('waiting_human');
|
||||
expect(api!.projection.value?.uiState?.lifecycleStage).toBe('fulfillment_prep');
|
||||
expect(api!.projection.value?.uiState?.primary_action?.code).toBe('retry_inventory_matching');
|
||||
expect(api!.projection.value?.uiState?.primary_action?.code).toBe('retry_onhand_matching');
|
||||
expect(api!.error.value).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -50,11 +50,11 @@ export type ShippingProcessingStage =
|
||||
| 'candidate_creating'
|
||||
| 'customer_resolving'
|
||||
| 'duplicate_checking'
|
||||
| 'inventory_source_resolving'
|
||||
| 'onhand_source_resolving'
|
||||
| 'waiting_review'
|
||||
| 'order_creating'
|
||||
| 'inventory_fetching'
|
||||
| 'inventory_matching'
|
||||
| 'onhand_fetching'
|
||||
| 'onhand_matching'
|
||||
| 'excel_generating'
|
||||
| 'freight_uploading'
|
||||
| 'completed';
|
||||
@@ -86,12 +86,12 @@ export type ShippingProcessingActionIntent =
|
||||
| 'confirm_customer'
|
||||
| 'resolve_field_conflicts'
|
||||
| 'adjudicate_duplicate'
|
||||
| 'open_inventory_match_review'
|
||||
| 'open_onhand_match_review'
|
||||
| 'open_shortage_review'
|
||||
| 'upload_inventory_file'
|
||||
| 'reload_inventory_result'
|
||||
| 'retry_inventory_preparation'
|
||||
| 'retry_inventory_matching'
|
||||
| 'upload_onhand_file'
|
||||
| 'reload_onhand_result'
|
||||
| 'retry_onhand_preparation'
|
||||
| 'retry_onhand_matching'
|
||||
| 'retry_parse'
|
||||
| 'retry_failed_documents'
|
||||
| 'retry_failed_attachments'
|
||||
@@ -106,8 +106,8 @@ export type ShippingProcessingActionIntent =
|
||||
| 'retry_with_latest_rules'
|
||||
| 'recheck_freeze_readiness'
|
||||
| 'retry_task_creation'
|
||||
| 'retry_inventory_field_mapping'
|
||||
| 'recheck_inventory_sufficiency'
|
||||
| 'retry_onhand_field_mapping'
|
||||
| 'recheck_onhand_sufficiency'
|
||||
| 'recheck_excel_readiness'
|
||||
| 'retry_stp_auto_create'
|
||||
| 'reparse'
|
||||
@@ -128,11 +128,11 @@ export const SHIPPING_PROCESSING_STAGES: readonly ShippingProcessingStage[] = [
|
||||
'candidate_creating',
|
||||
'customer_resolving',
|
||||
'duplicate_checking',
|
||||
'inventory_source_resolving',
|
||||
'onhand_source_resolving',
|
||||
'waiting_review',
|
||||
'order_creating',
|
||||
'inventory_fetching',
|
||||
'inventory_matching',
|
||||
'onhand_fetching',
|
||||
'onhand_matching',
|
||||
'excel_generating',
|
||||
'freight_uploading',
|
||||
'completed',
|
||||
@@ -252,7 +252,7 @@ export interface ShippingProcessingFacts {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryCandidateSetSummary {
|
||||
export interface ShippingOnhandCandidateSetSummary {
|
||||
id: number;
|
||||
version: number;
|
||||
status: 'draft' | 'frozen' | 'superseded' | 'invalidated';
|
||||
@@ -262,7 +262,7 @@ export interface ShippingInventoryCandidateSetSummary {
|
||||
manifestSnapshotSha256?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryCandidateSourceDetail {
|
||||
export interface ShippingOnhandCandidateSourceDetail {
|
||||
id: number;
|
||||
candidateSetId: number;
|
||||
sourceCode: string;
|
||||
@@ -273,7 +273,7 @@ export interface ShippingInventoryCandidateSourceDetail {
|
||||
sourceConfigVersion?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryCandidateLineDetail {
|
||||
export interface ShippingOnhandCandidateLineDetail {
|
||||
candidateLineId: number;
|
||||
candidateSetId: number;
|
||||
lineNo: number;
|
||||
@@ -283,12 +283,12 @@ export interface ShippingInventoryCandidateLineDetail {
|
||||
allowedSourceCodes: string[];
|
||||
}
|
||||
|
||||
export interface ShippingTaskInventoryCandidatesResponse {
|
||||
export interface ShippingTaskOnhandCandidatesResponse {
|
||||
taskNo: string;
|
||||
currentSet: ShippingInventoryCandidateSetSummary | null;
|
||||
sources: ShippingInventoryCandidateSourceDetail[];
|
||||
lines: ShippingInventoryCandidateLineDetail[];
|
||||
history: ShippingInventoryCandidateSetSummary[];
|
||||
currentSet: ShippingOnhandCandidateSetSummary | null;
|
||||
sources: ShippingOnhandCandidateSourceDetail[];
|
||||
lines: ShippingOnhandCandidateLineDetail[];
|
||||
history: ShippingOnhandCandidateSetSummary[];
|
||||
blockingReason?: ShippingProcessingBlockingReason | null;
|
||||
primaryAction?: ShippingProcessingPrimaryAction | null;
|
||||
}
|
||||
@@ -400,15 +400,15 @@ export interface ShippingProcessingProjection {
|
||||
* 权威事实源:summarize_inventory_rpa_latest_attempts();
|
||||
* 前端按钮禁用/重试文案/状态徽章全部直接读本对象,禁止继续拼接旧字段合成 running。
|
||||
*/
|
||||
inventoryPreparation?: ShippingInventoryPreparationSummary | null;
|
||||
inventoryPreparation?: ShippingOnhandPreparationSummary | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 题4A & 7A:逐源 inventory 准备状态(ShippingProcessingProjection.inventoryPreparation)。
|
||||
* 按实际冻结源 required_sources 为基准分类并暴露当前成功、等待和失败事实。
|
||||
*/
|
||||
export interface ShippingInventoryPreparationSummary {
|
||||
/** 实际任务级冻结源(task.task_frozen_inventory_source_codes),顺序以冻结记录为准。 */
|
||||
export interface ShippingOnhandPreparationSummary {
|
||||
/** 实际任务级冻结源(task.task_frozen_onhand_source_codes),顺序以冻结记录为准。 */
|
||||
requiredSources: string[];
|
||||
/** 已就绪:有 prepared 状态 Attempt,且存在有效的 InventoryFile / TaskInventoryLink。 */
|
||||
preparedSources: string[];
|
||||
@@ -424,14 +424,14 @@ export interface ShippingInventoryPreparationSummary {
|
||||
* 按冻结源逐源最近 Attempt 摘要(source_code → 结构化记录)。
|
||||
* 用于 UI tooltip/详情;按钮禁用不直接读本字典,读上面的 required/prepared/pending/failed 集合。
|
||||
*/
|
||||
latestAttempts?: Record<string, ShippingInventoryPerSourceAttempt>;
|
||||
latestAttempts?: Record<string, ShippingOnhandPerSourceAttempt>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逐源最近一次 Inventory RPA Attempt 摘要(inventoryPreparation.latestAttempts[sourceCode])。
|
||||
* 仅用于 UI 展示;业务判定必须走顶层 *_sources 集合。
|
||||
*/
|
||||
export interface ShippingInventoryPerSourceAttempt {
|
||||
export interface ShippingOnhandPerSourceAttempt {
|
||||
sourceCode: string;
|
||||
attemptNo: number;
|
||||
/** queued | running | consumed | failed | skipped */
|
||||
@@ -795,7 +795,7 @@ export type InventorySourceMethod =
|
||||
| 'rule_evaluation_freeze'
|
||||
| 'legacy_migrated';
|
||||
|
||||
export interface ShippingInventorySourceCandidate {
|
||||
export interface ShippingOnhandSourceCandidate {
|
||||
source_code: string;
|
||||
display_name?: string | null;
|
||||
warehouse_id?: string | null;
|
||||
@@ -804,12 +804,12 @@ export interface ShippingInventorySourceCandidate {
|
||||
matched_by?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingInventorySourceResolution {
|
||||
export interface ShippingOnhandSourceResolution {
|
||||
status?: InventorySourceStatus | null;
|
||||
method?: InventorySourceMethod | null;
|
||||
reason?: string | null;
|
||||
release_field_values?: Record<string, string>;
|
||||
candidates?: ShippingInventorySourceCandidate[];
|
||||
candidates?: ShippingOnhandSourceCandidate[];
|
||||
destination_candidates?: string[];
|
||||
evidence?: Record<string, unknown>[];
|
||||
conflicts?: string[];
|
||||
@@ -817,7 +817,7 @@ export interface ShippingInventorySourceResolution {
|
||||
routing_fingerprint?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingInventorySnapshot {
|
||||
export interface ShippingOnhandSnapshot {
|
||||
inventory_file_no?: string | null;
|
||||
source_code?: string | null;
|
||||
warehouse_id?: string | null;
|
||||
@@ -893,7 +893,7 @@ export interface ShippingTaskSummary {
|
||||
};
|
||||
rpa_runtime?: ShippingRpaRuntime | null;
|
||||
rpa_inventory_source?: Record<string, unknown> | null;
|
||||
inventory_source_resolution?: ShippingInventorySourceResolution | null;
|
||||
inventory_source_resolution?: ShippingOnhandSourceResolution | null;
|
||||
destination_code?: string | null;
|
||||
destination_city?: string | null;
|
||||
destination_country?: string | null;
|
||||
@@ -904,7 +904,7 @@ export interface ShippingTaskSummary {
|
||||
inventory_source_method?: InventorySourceMethod | null;
|
||||
inventory_source_config_version?: string | null;
|
||||
inventory_routing_fingerprint?: string | null;
|
||||
inventory_snapshot?: ShippingInventorySnapshot | null;
|
||||
onhand_snapshot?: ShippingOnhandSnapshot | null;
|
||||
created_at?: string | null;
|
||||
updated_at?: string | null;
|
||||
ui_state?: ShippingTaskUiState;
|
||||
@@ -1033,13 +1033,13 @@ export type ShippingProcessGateCode =
|
||||
| 'customer_resolution'
|
||||
| 'duplicate_detection'
|
||||
| 'field_conflict_resolution'
|
||||
| 'inventory_source_routing'
|
||||
| 'onhand_source_routing'
|
||||
| 'order_freeze_readiness'
|
||||
| 'task_creation'
|
||||
| 'inventory_preparation'
|
||||
| 'inventory_field_mapping'
|
||||
| 'inventory_matching'
|
||||
| 'inventory_sufficiency'
|
||||
| 'onhand_preparation'
|
||||
| 'onhand_field_mapping'
|
||||
| 'onhand_matching'
|
||||
| 'onhand_sufficiency'
|
||||
| 'excel_readiness'
|
||||
| 'artifact_generation'
|
||||
| 'freight_upload_rpa'
|
||||
@@ -1080,17 +1080,17 @@ export type ShippingProcessGateActionCode =
|
||||
| 'retry_with_latest_rules'
|
||||
| 'recheck_freeze_readiness'
|
||||
| 'retry_task_creation'
|
||||
| 'reload_inventory_result'
|
||||
| 'retry_inventory_preparation'
|
||||
| 'poll_inventory_preparation'
|
||||
| 'upload_inventory_file'
|
||||
| 'retry_inventory_field_mapping'
|
||||
| 'retry_inventory_matching'
|
||||
| 'retry_inventory_from_preparation'
|
||||
| 'retry_inventory_from_field_mapping'
|
||||
| 'retry_inventory_from_matching'
|
||||
| 'open_inventory_match_review'
|
||||
| 'recheck_inventory_sufficiency'
|
||||
| 'reload_onhand_result'
|
||||
| 'retry_onhand_preparation'
|
||||
| 'poll_onhand_preparation'
|
||||
| 'upload_onhand_file'
|
||||
| 'retry_onhand_field_mapping'
|
||||
| 'retry_onhand_matching'
|
||||
| 'retry_onhand_from_preparation'
|
||||
| 'retry_onhand_from_field_mapping'
|
||||
| 'retry_onhand_from_matching'
|
||||
| 'open_onhand_match_review'
|
||||
| 'recheck_onhand_sufficiency'
|
||||
| 'open_shortage_review'
|
||||
| 'recheck_excel_readiness'
|
||||
| 'regenerate_excel_artifact'
|
||||
@@ -1354,7 +1354,7 @@ export interface ShippingTaskDetail extends ShippingTaskSummary {
|
||||
order_snapshot_id?: number | null;
|
||||
order_data_version?: number | null;
|
||||
field_conflicts?: ShippingFieldConflict[] | null;
|
||||
inventory_verifications?: ShippingInventoryVerification[];
|
||||
inventory_verifications?: ShippingOnhandVerification[];
|
||||
export_artifacts?: ShippingExportArtifact[];
|
||||
upload_attempts?: ShippingUploadAttempt[];
|
||||
events: ShippingTaskEvent[];
|
||||
@@ -1685,7 +1685,7 @@ export interface ShippingFreightNoticeGroupsResponse {
|
||||
reason?: 'po_missing' | 'no_business_notice' | string | null;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryUploadResponse {
|
||||
export interface ShippingOnhandUploadResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
task_id?: string;
|
||||
@@ -1779,20 +1779,20 @@ export interface ShippingNoticeLayoutSummary {
|
||||
unsupported: number;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryVerificationLine {
|
||||
export interface ShippingOnhandVerificationLine {
|
||||
reservation_id: string;
|
||||
required_qty: string;
|
||||
available_qty: string;
|
||||
status: 'available' | 'shortage' | 'invalid' | string;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryVerification {
|
||||
export interface ShippingOnhandVerification {
|
||||
id: number;
|
||||
status: string;
|
||||
inventory_snapshot_id?: number | null;
|
||||
source_config_version?: string | null;
|
||||
created_at?: string | null;
|
||||
lines: ShippingInventoryVerificationLine[];
|
||||
lines: ShippingOnhandVerificationLine[];
|
||||
}
|
||||
|
||||
export interface ShippingExportArtifact {
|
||||
@@ -2413,7 +2413,7 @@ export interface ShippingOrderReviewInventoryMatchedRule {
|
||||
* 库存源单源不可用原因码(unavailable_reasons 的值)。
|
||||
* 与 backend error_explainability_contract.INVENTORY_SOURCE_UNAVAILABLE_REASON_CODES_EMITTED 对齐。
|
||||
*/
|
||||
export type ShippingInventorySourceUnavailableReasonCode =
|
||||
export type ShippingOnhandSourceUnavailableReasonCode =
|
||||
| 'source_not_found'
|
||||
| 'source_disabled'
|
||||
| 'source_runtime_unavailable'
|
||||
@@ -2427,7 +2427,7 @@ export type ShippingInventorySourceUnavailableReasonCode =
|
||||
* 特别区分:no_inventory_source_candidates(规则未命中)≠
|
||||
* inventory_source_unavailable(命中但源不可用)≠ require_manual_review(冲突)。
|
||||
*/
|
||||
export type ShippingInventorySourceLineBlockReasonCode =
|
||||
export type ShippingOnhandSourceLineBlockReasonCode =
|
||||
| 'no_inventory_source_candidates'
|
||||
| 'inventory_source_unavailable'
|
||||
| 'require_manual_review'
|
||||
@@ -2435,7 +2435,7 @@ export type ShippingInventorySourceLineBlockReasonCode =
|
||||
| 'manual_inventory_source_invalid'
|
||||
| 'inventory_source_conflicted'
|
||||
| 'inventory_source_changed'
|
||||
| 'inventory_source_identity_mismatch'
|
||||
| 'onhand_source_identity_mismatch'
|
||||
| string;
|
||||
|
||||
/**
|
||||
@@ -2457,7 +2457,7 @@ export interface ShippingOrderReviewInventoryRuleSuggestion {
|
||||
raw_source_codes?: string[];
|
||||
unavailable_source_codes?: string[];
|
||||
/** 不可用源编码 → 稳定原因码(非文案) */
|
||||
unavailable_reasons?: Record<string, ShippingInventorySourceUnavailableReasonCode>;
|
||||
unavailable_reasons?: Record<string, ShippingOnhandSourceUnavailableReasonCode>;
|
||||
routing_status?: string;
|
||||
rule_versions?: ShippingOrderReviewInventoryRuleVersion[];
|
||||
matched_rule_ids?: number[];
|
||||
@@ -2479,7 +2479,7 @@ export interface ShippingOrderReviewBuildEligibilityLineProjection {
|
||||
/** 规则命中但当前不可用的源 */
|
||||
unavailable_source_codes?: string[];
|
||||
/** 不可用源编码 → 稳定原因码(非文案;前端用 i18n 渲染) */
|
||||
unavailable_reasons?: Record<string, ShippingInventorySourceUnavailableReasonCode>;
|
||||
unavailable_reasons?: Record<string, ShippingOnhandSourceUnavailableReasonCode>;
|
||||
matched_rule_ids?: number[];
|
||||
matched_rules?: ShippingOrderReviewInventoryMatchedRule[];
|
||||
rule_versions?: ShippingOrderReviewInventoryRuleVersion[];
|
||||
@@ -2490,7 +2490,7 @@ export interface ShippingOrderReviewBuildEligibilityLineProjection {
|
||||
rule_source_codes?: string[];
|
||||
routing_status?: string;
|
||||
can_build?: boolean;
|
||||
block_reason?: ShippingInventorySourceLineBlockReasonCode | null;
|
||||
block_reason?: ShippingOnhandSourceLineBlockReasonCode | null;
|
||||
selection_mode?: string;
|
||||
manual_reason?: string;
|
||||
}
|
||||
@@ -2510,7 +2510,7 @@ export interface ShippingOrderReviewBuildEligibilityIssue {
|
||||
raw_rule_source_codes?: string[];
|
||||
message?: string | null;
|
||||
unavailable_source_codes?: string[];
|
||||
unavailable_reasons?: Record<string, ShippingInventorySourceUnavailableReasonCode>;
|
||||
unavailable_reasons?: Record<string, ShippingOnhandSourceUnavailableReasonCode>;
|
||||
explainability?: ShippingExplainabilityReason | null;
|
||||
low_confidence_fields?: Array<{
|
||||
field_code: string;
|
||||
@@ -3134,13 +3134,13 @@ export interface ShippingOrderReviewLineFulfillmentDecision {
|
||||
|
||||
/** 行级履约决定码(与后端 ALLOWED_DECISIONS 对齐)。 */
|
||||
export type ShippingOrderReviewLineFulfillmentDecisionCode =
|
||||
| 'wait_inventory'
|
||||
| 'wait_onhand'
|
||||
| 'fulfill_complete_line_now'
|
||||
| 'close_unfulfillable'
|
||||
| 'reopen'
|
||||
| 'use_new_inventory_file'
|
||||
| 'change_inventory_source'
|
||||
| 'release_inventory_shortage';
|
||||
| 'release_onhand_shortage';
|
||||
|
||||
/** 行级履约与库存缺口投影行(含 OT 匹配事实与 allowed_actions)。 */
|
||||
export interface ShippingOrderReviewLineFulfillmentLine {
|
||||
@@ -3195,7 +3195,7 @@ export interface ShippingOrderReviewLineFulfillmentLine {
|
||||
field_id: string;
|
||||
display_name: string;
|
||||
value?: string | null;
|
||||
value_source?: 'inventory_snapshot' | 'manual_required' | string;
|
||||
value_source?: 'onhand_snapshot' | 'manual_required' | string;
|
||||
requires_manual?: boolean;
|
||||
}>;
|
||||
/** 字段无法受控解析时的稳定错误码;UI 必须隐藏放行入口。 */
|
||||
@@ -3300,7 +3300,7 @@ export type ShippingWorkflowItemLifecycleStatus =
|
||||
| 'layout_parsing'
|
||||
| 'extracting'
|
||||
| 'building_order'
|
||||
| 'inventory_matching'
|
||||
| 'onhand_matching'
|
||||
| 'generating_excel'
|
||||
| 'pending_review'
|
||||
| 'reparse_failed'
|
||||
|
||||
@@ -272,7 +272,7 @@ export interface ShippingActionButton {
|
||||
source_code?: string;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryMappingFormPayload {
|
||||
export interface ShippingOnhandMappingFormPayload {
|
||||
taskId: string;
|
||||
schema_preview: {
|
||||
sample_rows?: unknown[][];
|
||||
|
||||
@@ -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