Merge branch 'hugo-shipping-notice' into dev

# Conflicts:
#	docs/features/shipping-notice/process-gate-recovery-contract.md
This commit is contained in:
hugo committed 2026-08-12 14:12:24 +08:00
commit e6449c5535
12 files changed
+639 -77

No files matched your search

@@ -3776,6 +3776,7 @@ watch(
:summary="displayCase.process_gate"
:can-handle="workbenchActionsExecutable"
:navigation-context="reviewGateNavigationContext"
inventory-upload-mode="local"
:field-labels="reviewFieldLabels"
@refreshed="reloadLatestDraft"
@refresh-needed="reloadLatestDraft"
@@ -166,4 +166,52 @@ describe('ProcessGateRecoveryCard', () => {
expect(wrapper.find('[data-testid="process-gate-recovery-targets"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="process-gate-recovery-primary"]').exists()).toBe(true);
});
it('shows inventory upload as a secondary entry beside retrying inventory retrieval', async () => {
const wrapper = mount(ProcessGateRecoveryCard, {
props: {
summary: baseSummary({
current_blocking_gate: {
...baseSummary().current_blocking_gate!,
gate_code: 'inventory_preparation',
next_action_code: 'retry_inventory_preparation',
},
next_action_code: 'retry_inventory_preparation',
allowed_actions: ['retry_inventory_preparation', 'upload_inventory_file'],
task_no: 'SN-TEST-001',
}),
canHandle: true,
},
global: { plugins: [i18n] },
});
const upload = wrapper.get('[data-testid="process-gate-inventory-upload"]');
expect(upload.text()).toContain('上传库存文件');
await upload.trigger('click');
expect(wrapper.emitted('navigate')).toHaveLength(1);
});
it('opens local upload registration when requested by the order review workbench', async () => {
const wrapper = mount(ProcessGateRecoveryCard, {
props: {
summary: baseSummary({
current_blocking_gate: {
...baseSummary().current_blocking_gate!,
gate_code: 'inventory_preparation',
next_action_code: 'retry_inventory_preparation',
},
next_action_code: 'retry_inventory_preparation',
allowed_actions: ['retry_inventory_preparation', 'upload_inventory_file'],
task_no: 'SN-TEST-001',
}),
canHandle: true,
inventoryUploadMode: 'local',
},
global: { plugins: [i18n] },
});
await wrapper.get('[data-testid="process-gate-inventory-upload"]').trigger('click');
expect(wrapper.emitted('manualUpload')).toHaveLength(1);
expect(wrapper.emitted('navigate')).toBeUndefined();
});
});
@@ -22,6 +22,8 @@ const props = defineProps<{
summary: ShippingProcessGateUserSummary | null | undefined;
canHandle: boolean;
navigationContext?: ProcessGateNavigationContext;
/** 复核工作台直接打开人工上传登记;任务中心默认仍导航到任务详情。 */
inventoryUploadMode?: 'navigate' | 'local';
/** 复核 Schema 的 field_code/field_id 到业务字段名映射。 */
fieldLabels?: Record<string, string>;
}>();
@@ -47,6 +49,11 @@ const showManualUploadAction = computed(() => (
String(blockingGate.value?.gate_code || '').trim().toLowerCase() === 'manual_upload_handoff'
&& nextActionCode.value === 'retry_freight_upload_rpa'
));
const showInventoryUploadAction = computed(() => (
String(blockingGate.value?.gate_code || '').trim().toLowerCase() === 'inventory_preparation'
&& nextActionCode.value === 'retry_inventory_preparation'
&& (props.summary?.allowed_actions || []).includes('upload_inventory_file')
));
/**
* 是否对业务用户展示「待处理事项」。
@@ -142,6 +149,19 @@ async function runPrimaryAction() {
}
}
async function runInventoryUpload() {
if (!props.summary || !props.canHandle || busy.value) return;
if (props.inventoryUploadMode === 'local') {
emit('manualUpload');
return;
}
const result = await submitPrimaryAction(props.summary, {
actionCode: 'upload_inventory_file',
navigationContext: props.navigationContext,
});
if (result.outcome === 'navigated') emit('navigate');
}
</script>
<template>
@@ -182,6 +202,15 @@ async function runPrimaryAction() {
>
{{ busy ? $t('workspace.shippingNotice.processGate.submitting') : actionLabel }}
</button>
<button
v-if="showInventoryUploadAction && canHandle"
type="button"
class="inline-flex min-h-8 items-center rounded-md border border-default bg-surface px-3 py-1.5 text-xs font-semibold text-secondary shadow-sm transition hover:bg-surface-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2"
data-testid="process-gate-inventory-upload"
@click="runInventoryUpload"
>
{{ $t('workspace.shippingNotice.processGate.actionCodes.upload_inventory_file') }}
</button>
<button
v-if="showManualUploadAction && canHandle"
type="button"
@@ -116,7 +116,8 @@ export function useShippingProcessGateRecovery() {
const requestedAction = String(options?.actionCode || '').trim();
const serverRecoveryAction = (summary.recovery_targets || [])
.find((target) => String(target.action_code || '').trim() === requestedAction)
?.action_code;
?.action_code
|| (summary.allowed_actions || []).find((code) => String(code).trim() === requestedAction);
if (requestedAction && !serverRecoveryAction) {
msg.warning(t('workspace.shippingNotice.processGate.noAction'));
return { outcome: 'noop' };