feat(shipping-notice): 完成货代发货通知全门禁恢复MVP收口
完成全门禁恢复MVP版本交付:调整自动上传与重试配置,重构正式执行链路;修复多处代码bug,新增测试与审计工具;更新全流程文档与契约规范。
This commit is contained in:
1 parent
8e0bbf7a81
commit
c94d173f92
181 files changed
+12947
-1724
No files matched your search
@@ -77,7 +77,6 @@ export const SHIPPING_CONFIG_SUB_MODULE_METAS: ShippingConfigSubModuleMeta[] = [
|
||||
{ id: 'shipping_templates', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.excelTemplates', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'templates' } },
|
||||
{ id: 'shipping_audit', routeName: 'AdminShippingAudit', path: 'shipping-audit', labelKey: 'admin.nav.shippingAudit', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'process_gates', routeName: 'AdminShippingProcessGates', path: 'shipping-process-gates', labelKey: 'admin.nav.shippingProcessGates', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'legacy_stp_jobs', routeName: 'AdminShippingLegacyStpJobs', path: 'shipping-legacy-stp-jobs', labelKey: 'admin.nav.shippingLegacyStpJobs', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'inventory_snapshots', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.snapshots', groupKey: 'admin.nav.shippingRunAudit', query: { section: 'snapshots' } },
|
||||
{ id: 'export_records', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.exports', groupKey: 'admin.nav.shippingRunAudit', query: { section: 'exports' } },
|
||||
];
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* features/chat/api/shipping.api.legacy-entrypoints.spec.ts
|
||||
* 用途:锁定 Shipping 前端 API 不再暴露直接匹配/导出业务入口。
|
||||
* 依赖:shipping.api 的模块导出。
|
||||
* 逻辑:正式业务动作只能由 Projection + Process Gate Action 驱动;旧函数名不得重新被页面调用。
|
||||
*/
|
||||
import * as shippingApi from './shipping.api';
|
||||
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, 'generateWorkspaceShippingExcel')).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -463,6 +463,7 @@ export const retryWorkspaceConversationAutoProgress = (
|
||||
retried: number;
|
||||
skipped: number;
|
||||
failed: number;
|
||||
blocked?: number;
|
||||
};
|
||||
items: Array<{
|
||||
object_type: 'review_case' | 'formal_task' | string;
|
||||
@@ -1100,7 +1101,10 @@ export async function retryWorkspaceShippingTask(taskNo: string, comment?: strin
|
||||
* @param taskNo - 正式任务号
|
||||
* @param lineKey - 行键
|
||||
*/
|
||||
export async function retryWorkspaceShippingTaskLine(taskNo: string, lineKey: string) {
|
||||
export async function retryWorkspaceShippingTaskLine(
|
||||
taskNo: string,
|
||||
lineKey: string,
|
||||
) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/lines/${encodeURIComponent(lineKey)}/retry`,
|
||||
jsonPost({ reason: 'user_retry_inventory' }),
|
||||
@@ -1311,23 +1315,6 @@ export async function removeWorkspaceShippingNoticeLine(
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行库存匹配。
|
||||
* @param taskNo - 发货任务编号
|
||||
* @param ownership - 可选工作台归属上下文
|
||||
* @returns 匹配结果与后续动作提示
|
||||
*/
|
||||
export async function matchWorkspaceShippingInventory(
|
||||
taskNo: string,
|
||||
ownership?: ShippingFulfillmentOwnershipContext | null,
|
||||
) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/match-inventory`,
|
||||
jsonPost(ownershipPayload(ownership)),
|
||||
);
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传当前任务使用的正式库存文件。
|
||||
* @param taskNo - 发货任务编号
|
||||
@@ -1346,6 +1333,8 @@ export async function uploadWorkspaceShippingInventory(taskNo: string, file: Fil
|
||||
|
||||
/**
|
||||
* 以用户态触发自动推进,作为聊天前端兜底入口。
|
||||
* @deprecated 新业务组件必须通过 Projection 的 primary_action 调用正式 Gate Action,
|
||||
* 成功后重新读取 Projection;本函数仅保留给历史调用方兼容。
|
||||
* @param taskNo - 发货任务编号
|
||||
* @param lang - 可选语言代码
|
||||
* @returns 自动推进结果
|
||||
@@ -1392,23 +1381,6 @@ export async function retryWorkspaceShippingUpload(
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成发货 Excel。
|
||||
* @param taskNo - 发货任务编号
|
||||
* @param ownership - 可选工作台归属上下文
|
||||
* @returns 生成结果,成功时通常会包含下载链接
|
||||
*/
|
||||
export async function generateWorkspaceShippingExcel(
|
||||
taskNo: string,
|
||||
ownership?: ShippingFulfillmentOwnershipContext | null,
|
||||
) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/generate-excel`,
|
||||
jsonPost(ownershipPayload(ownership)),
|
||||
);
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
|
||||
/** 发货通知 Agent 应用类型标识(运行时识别)。 */
|
||||
export const SHIPPING_NOTICE_AGENT_CODE = 'shipping_notice';
|
||||
|
||||
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewConversationRetryDrawer.vue
|
||||
用途:按需展示本次对话级自动推进重试的逐项结果,不占用订单复核主内容。
|
||||
依赖:vue-i18n、对话级重试 API 返回的摘要和对象结果。
|
||||
逻辑:仅用户主动从顶栏打开;按结果分类展示,关闭不改变任务真实状态。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { RefreshCw } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
type RetryItem = {
|
||||
object_type: string;
|
||||
object_ref: string;
|
||||
action?: string | null;
|
||||
outcome: string;
|
||||
reason_code?: string | null;
|
||||
};
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
result: {
|
||||
summary: { total: number; retried: number; skipped: number; failed: number; blocked?: number };
|
||||
items: RetryItem[];
|
||||
} | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{ close: [] }>();
|
||||
const { t, te } = useI18n();
|
||||
|
||||
const items = computed(() => props.result?.items || []);
|
||||
|
||||
function itemLabel(item: RetryItem): string {
|
||||
const code = String(item.reason_code || '').trim();
|
||||
const key = `chat.shippingOrderReview.conversationRetry.reason.${code}`;
|
||||
return code && te(key) ? t(key) : outcomeLabel(item.outcome);
|
||||
}
|
||||
|
||||
function outcomeLabel(outcome: string): string {
|
||||
const key = `chat.shippingOrderReview.conversationRetry.outcome.${String(outcome || '').trim()}`;
|
||||
return te(key) ? t(key) : t('chat.shippingOrderReview.conversationRetry.outcome.unknown');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open && result"
|
||||
class="fixed inset-0 z-40 flex justify-end bg-slate-900/10"
|
||||
data-testid="review-conversation-retry-drawer"
|
||||
@click.self="emit('close')"
|
||||
>
|
||||
<aside class="flex h-full w-full max-w-[360px] flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-slate-800 dark:bg-slate-900">
|
||||
<header class="flex items-center justify-between gap-3 border-b border-slate-200 px-3 py-2.5 dark:border-slate-800">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-200">
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
</span>
|
||||
<div class="min-w-0">
|
||||
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.conversationRetry.title') }}</h2>
|
||||
<p class="truncate text-[11px] text-muted">{{ t('chat.shippingOrderReview.conversationRetry.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800" data-testid="review-conversation-retry-drawer-close" @click="emit('close')">
|
||||
{{ t('chat.shippingOrderReview.workbench.close') }}
|
||||
</button>
|
||||
</header>
|
||||
<div class="flex flex-wrap gap-1.5 border-b border-slate-200 px-3 py-2 dark:border-slate-800">
|
||||
<p class="rounded-full bg-emerald-50 px-2 py-1 text-[11px] text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300" data-testid="review-conversation-retry-retried">{{ t('chat.shippingOrderReview.conversationRetry.retried') }} <strong>{{ result.summary.retried }}</strong></p>
|
||||
<p class="rounded-full bg-slate-100 px-2 py-1 text-[11px] text-slate-600 dark:bg-slate-800 dark:text-slate-300" data-testid="review-conversation-retry-skipped">{{ t('chat.shippingOrderReview.conversationRetry.skipped') }} <strong>{{ result.summary.skipped }}</strong></p>
|
||||
<p class="rounded-full bg-rose-50 px-2 py-1 text-[11px] text-rose-700 dark:bg-rose-950/40 dark:text-rose-300" data-testid="review-conversation-retry-failed">{{ t('chat.shippingOrderReview.conversationRetry.failed') }} <strong>{{ result.summary.failed }}</strong></p>
|
||||
<p class="rounded-full bg-violet-50 px-2 py-1 text-[11px] text-violet-700 dark:bg-violet-950/40 dark:text-violet-300" data-testid="review-conversation-retry-blocked">{{ t('chat.shippingOrderReview.conversationRetry.blocked') }} <strong>{{ result.summary.blocked || 0 }}</strong></p>
|
||||
</div>
|
||||
<ul class="min-h-0 flex-1 divide-y divide-slate-100 overflow-y-auto dark:divide-slate-800" data-testid="review-conversation-retry-item-list">
|
||||
<li v-for="item in items" :key="`${item.object_type}:${item.object_ref}`" class="px-3 py-2.5 text-xs">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<p class="min-w-0 truncate font-medium text-slate-800 dark:text-slate-100">{{ item.object_ref }}</p>
|
||||
<span
|
||||
class="shrink-0 rounded-full px-1.5 py-0.5 text-[10px]"
|
||||
:class="item.outcome === 'queued' ? 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300' : item.outcome === 'needs_human' ? 'bg-amber-50 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300' : 'bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-300'"
|
||||
>{{ outcomeLabel(item.outcome) }}</span>
|
||||
</div>
|
||||
<p class="mt-0.5 text-[11px] text-muted">{{ itemLabel(item) }}</p>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
+24
-2
@@ -105,8 +105,23 @@ const statusLabel = computed(() => {
|
||||
* 下一步(「下一步」section 的问题/说明文案):优先展示 blocking_reason,否则按 user_status 给系统态文案。
|
||||
*/
|
||||
const nextStepText = computed(() => {
|
||||
const safeMessage = (value: unknown): string => {
|
||||
const raw = String(value || '').trim();
|
||||
const lowered = raw.toLowerCase();
|
||||
if (!raw) return '';
|
||||
if (
|
||||
lowered.includes('cannot import name')
|
||||
|| lowered.includes('traceback')
|
||||
|| lowered.includes('site-packages')
|
||||
|| lowered.includes('\\app\\')
|
||||
|| lowered.includes('/app/')
|
||||
) {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepFailedNoRetry');
|
||||
}
|
||||
return raw;
|
||||
};
|
||||
if (props.loading) {
|
||||
return String(props.automation?.message || '').trim() || t('chat.shippingOrderReview.currentTask.nextStepRunning');
|
||||
return safeMessage(props.automation?.message) || t('chat.shippingOrderReview.currentTask.nextStepRunning');
|
||||
}
|
||||
// 1) blocking_reason → 用后端给的 i18n_key 渲染具体阻断
|
||||
const br = props.blockingReason;
|
||||
@@ -116,7 +131,7 @@ const nextStepText = computed(() => {
|
||||
return t(i18nKey);
|
||||
}
|
||||
// i18n 键缺失时回落为 code(不裸露给普通用户,最终 QA 期间应全部补齐)
|
||||
return String(br.code || '').trim() || t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
return safeMessage(br.code) || t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
}
|
||||
// 2) 无阻断时,按 user_status 给系统说明文案
|
||||
const s = String(props.userStatus || '').trim() as ReviewCurrentUserStatus | '';
|
||||
@@ -141,6 +156,12 @@ const nextStepText = computed(() => {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
});
|
||||
|
||||
/** 已完成/已取消时没有后续业务动作,不渲染“下一步”区,避免制造未完成错觉。 */
|
||||
const showNextStep = computed(() => {
|
||||
const status = String(props.userStatus || '').trim().toLowerCase();
|
||||
return !['completed', 'cancelled'].includes(status);
|
||||
});
|
||||
|
||||
/**
|
||||
* 业务动作按钮:后端确认 retryable=true → 主按钮为「重试」;
|
||||
* 否则若 primary_action.code 非 retry → 用 primary_action.code + i18n_key 渲染对应人工动作(进入复核/确认客户等)。
|
||||
@@ -301,6 +322,7 @@ type ReviewCurrentUserStatus =
|
||||
</aside>
|
||||
|
||||
<div
|
||||
v-if="showNextStep"
|
||||
class="mt-3 border-t border-sky-200/70 pt-3 dark:border-sky-800/60"
|
||||
data-testid="review-current-task-next-step-section"
|
||||
>
|
||||
|
||||
+21
@@ -21,6 +21,13 @@ const i18n = createI18n({
|
||||
wave: '履约波次',
|
||||
task: '正式任务',
|
||||
snapshotId: '库存快照 ID',
|
||||
inventorySource: '实际库存源',
|
||||
inventoryFile: '库存文件编号',
|
||||
inventoryFileSha256: '库存文件 SHA-256',
|
||||
inventoryRow: '库存行号',
|
||||
requiredQty: '需求数量',
|
||||
availableQty: '可用数量',
|
||||
matchAttempt: '匹配 Attempt',
|
||||
matchedAt: '匹配校验时间',
|
||||
decisionSource: '决定来源',
|
||||
decisionSourceValue: {
|
||||
@@ -45,6 +52,13 @@ describe('ReviewLineFulfillmentDetail', () => {
|
||||
line_key: 'L1',
|
||||
inventory_snapshot_id: 42,
|
||||
inventory_checked_at: '2026-08-07T01:00:00Z',
|
||||
inventory_source_code: 'DBS_DUB',
|
||||
inventory_file_no: 'INV-001',
|
||||
inventory_file_sha256: 'a'.repeat(64),
|
||||
inventory_row_index: 17,
|
||||
required_qty: '3',
|
||||
available_qty: '8',
|
||||
match_attempt_id: 301,
|
||||
decision_source: 'system',
|
||||
auto_fulfill_error_message: 'wave_explode',
|
||||
decision: {
|
||||
@@ -62,6 +76,13 @@ describe('ReviewLineFulfillmentDetail', () => {
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-wave"]').text()).toContain('3');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-task"]').text()).toContain('SN-100');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-snapshot"]').text()).toContain('42');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventorySource"]').text()).toContain('DBS_DUB');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventoryFile"]').text()).toContain('INV-001');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventoryFileSha256"]').text()).toContain('a'.repeat(64));
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventoryRow"]').text()).toContain('17');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-requiredQty"]').text()).toContain('3');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-availableQty"]').text()).toContain('8');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-matchAttempt"]').text()).toContain('301');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-decisionSource"]').text()).toContain('系统自动');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-failure"]').text()).toContain('wave_explode');
|
||||
|
||||
|
||||
@@ -54,6 +54,41 @@ const rows = computed(() => {
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.snapshotId'),
|
||||
value: line?.inventory_snapshot_id != null ? String(line.inventory_snapshot_id) : '—',
|
||||
},
|
||||
{
|
||||
key: 'inventorySource',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventorySource'),
|
||||
value: String(line?.inventory_source_code || line?.inventory_source?.code || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'inventoryFile',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventoryFile'),
|
||||
value: String(line?.inventory_file_no || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'inventoryFileSha256',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventoryFileSha256'),
|
||||
value: String(line?.inventory_file_sha256 || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'inventoryRow',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventoryRow'),
|
||||
value: line?.inventory_row_index != null ? String(line.inventory_row_index) : '—',
|
||||
},
|
||||
{
|
||||
key: 'requiredQty',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.requiredQty'),
|
||||
value: String(line?.required_qty || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'availableQty',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.availableQty'),
|
||||
value: String(line?.available_qty || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'matchAttempt',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.matchAttempt'),
|
||||
value: line?.match_attempt_id != null ? String(line.match_attempt_id) : '—',
|
||||
},
|
||||
{
|
||||
key: 'matchedAt',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.matchedAt'),
|
||||
|
||||
+6
-11
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewLineInventoryOps.spec.ts
|
||||
* 用途:锁定行级只渲染统一「重试」与关闭;消费 retryable,不展示内部动作码。
|
||||
* 用途:锁定明细行不渲染库存重试,只保留行生命周期关闭动作。
|
||||
*/
|
||||
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
@@ -16,10 +16,7 @@ const i18n = createI18n({
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
lineOps: {
|
||||
retry: '重试',
|
||||
moreActions: '更多操作',
|
||||
},
|
||||
lineOps: { moreActions: '更多操作' },
|
||||
fulfillmentDecision: {
|
||||
closeLine: '关闭该明细',
|
||||
},
|
||||
@@ -46,18 +43,16 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe('ReviewLineInventoryOps', () => {
|
||||
it('shows unified retry when retryable', async () => {
|
||||
it('does not show generic retry even when retryable', async () => {
|
||||
const wrapper = mountOps({
|
||||
retryable: true,
|
||||
line_allowed_actions: [],
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-line-retry"]').exists()).toBe(true);
|
||||
await wrapper.get('[data-testid="review-line-retry"]').trigger('click');
|
||||
expect(wrapper.emitted('retry-line')?.length).toBe(1);
|
||||
expect(wrapper.find('[data-testid="review-line-retry"]').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('hides retry when not retryable even if internal actions present', () => {
|
||||
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'],
|
||||
@@ -68,7 +63,7 @@ describe('ReviewLineInventoryOps', () => {
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('disables retry while task running', () => {
|
||||
it('does not add a retry while task running', () => {
|
||||
const wrapper = mountOps({
|
||||
retryable: true,
|
||||
line_allowed_actions: [],
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewLineInventoryOps.vue
|
||||
用途:明细行统一「重试」+ 更多操作(关闭);不进库存工作台。
|
||||
依赖:vue-i18n、lucide、line.retryable / line_allowed_actions。
|
||||
逻辑:只消费 retryable 布尔与 close 动作;不展示内部动作码;不发具体节点。
|
||||
用途:明细行只展示行生命周期操作(关闭无法履约)。
|
||||
依赖:vue-i18n、lucide、line.line_allowed_actions。
|
||||
逻辑:库存重新获取/匹配属于任务 Gate,禁止在明细行降级为笼统「重试」。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { MoreHorizontal, RefreshCw } from 'lucide-vue-next';
|
||||
import { MoreHorizontal } from 'lucide-vue-next';
|
||||
import type { ShippingOrderReviewLineFulfillmentLine } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -19,7 +19,6 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'retry-line': [];
|
||||
'close-line': [];
|
||||
}>();
|
||||
|
||||
@@ -28,14 +27,6 @@ const moreMenuOpen = ref(false);
|
||||
const moreBtnRef = ref<HTMLElement | null>(null);
|
||||
const moreMenuStyle = ref<Record<string, string>>({});
|
||||
|
||||
/**
|
||||
* 是否展示统一「重试」:仅后端 retryable,且任务未整体运行。
|
||||
*/
|
||||
const showRetry = computed(() => (
|
||||
Boolean(props.line?.retryable)
|
||||
&& !props.taskRunning
|
||||
));
|
||||
|
||||
const canClose = computed(() => (
|
||||
[...(props.line?.line_allowed_actions || [])].includes('close_unfulfillable')
|
||||
));
|
||||
@@ -78,11 +69,6 @@ async function toggleMoreMenu() {
|
||||
}
|
||||
}
|
||||
|
||||
function onRetry() {
|
||||
if (props.busy || props.taskRunning || !showRetry.value) return;
|
||||
emit('retry-line');
|
||||
}
|
||||
|
||||
function onCloseLine() {
|
||||
closeMenus();
|
||||
emit('close-line');
|
||||
@@ -99,20 +85,6 @@ onBeforeUnmount(() => {
|
||||
|
||||
<template>
|
||||
<div class="relative inline-flex items-center gap-0.5">
|
||||
<button
|
||||
v-if="showRetry"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-0.5 rounded border border-amber-300 bg-amber-50 px-1.5 py-0.5 text-[11px] text-amber-950 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
data-testid="review-line-retry"
|
||||
:disabled="!editable || busy || taskRunning"
|
||||
:aria-label="t('chat.shippingOrderReview.lineOps.retry')"
|
||||
:title="t('chat.shippingOrderReview.lineOps.retry')"
|
||||
@click="onRetry"
|
||||
>
|
||||
<RefreshCw class="h-3 w-3" :class="busy ? 'animate-spin' : ''" aria-hidden="true" />
|
||||
{{ t('chat.shippingOrderReview.lineOps.retry') }}
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="showMore"
|
||||
ref="moreBtnRef"
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewProfileMatchPanel.spec.ts
|
||||
* 用途:锁定模板匹配侧栏的候选披露规则,避免候选数量增长撑长工作台。
|
||||
* 依赖:vitest、@vue/test-utils、vue-i18n、ReviewProfileMatchPanel。
|
||||
* 逻辑:所有状态默认收起;用户可手动展开/收起候选列表。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import ReviewProfileMatchPanel from './ReviewProfileMatchPanel.vue';
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: { shippingOrderReview: { profileMatch: {
|
||||
title: '文档模板匹配', subtitle: '摘要', selected: '命中模板', noSelected: '未选定模板',
|
||||
expandCandidates: '查看候选模板({count})', collapseCandidates: '收起候选模板',
|
||||
routeType: '路由类型', executionMode: '执行模式',
|
||||
status: { matched: '已匹配', ambiguous: '多个候选' },
|
||||
} } },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
function mountPanel(needsReview = false) {
|
||||
return mount(ReviewProfileMatchPanel, {
|
||||
props: {
|
||||
profileMatch: {
|
||||
available: true,
|
||||
visibility: 'admin',
|
||||
status: needsReview ? 'ambiguous' : 'matched',
|
||||
needs_review: needsReview,
|
||||
selected_profile: { profile_code: 'ODP-A', display_name: '客户订单模板', version: 1 },
|
||||
candidates: [
|
||||
{ profile_code: 'ODP-A', score: 0.99 },
|
||||
{ profile_code: 'ODP-B', score: 0.98 },
|
||||
],
|
||||
fallback_reason_codes: [],
|
||||
},
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
}
|
||||
|
||||
describe('ReviewProfileMatchPanel', () => {
|
||||
it('默认收起无需关注的候选列表', () => {
|
||||
const wrapper = mountPanel(false);
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||||
expect(wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').text()).toContain('查看候选模板(2)');
|
||||
});
|
||||
|
||||
it('多个候选且需要人工处理时也默认收起,并允许展开后收起', async () => {
|
||||
const wrapper = mountPanel(true);
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||||
await wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').trigger('click');
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(true);
|
||||
await wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').trigger('click');
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,7 @@
|
||||
required_field_missing 不在此展示;分数/Profile ID 仅 admin visibility。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewProfileMatch } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
@@ -25,6 +25,20 @@ const visible = computed(() => {
|
||||
|
||||
const isAdminView = computed(() => String(props.profileMatch?.visibility || '') === 'admin');
|
||||
const needsReview = computed(() => Boolean(props.profileMatch?.needs_review));
|
||||
const candidateCount = computed(() => (props.profileMatch?.candidates || []).length);
|
||||
// 候选模板始终按需披露,避免模板数量增长撑长工作台;人工关注状态仍通过徽标表达。
|
||||
const defaultCandidatesExpanded = computed(() => false);
|
||||
const candidatesOpenOverride = ref<boolean | null>(null);
|
||||
const candidatesExpanded = computed(() => candidatesOpenOverride.value ?? defaultCandidatesExpanded.value);
|
||||
|
||||
watch(
|
||||
() => `${props.profileMatch?.status || ''}:${props.profileMatch?.selected_profile?.profile_code || ''}:${candidateCount.value}`,
|
||||
() => { candidatesOpenOverride.value = null; },
|
||||
);
|
||||
|
||||
function toggleCandidates() {
|
||||
candidatesOpenOverride.value = !candidatesExpanded.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配状态本地化(用户四态)。
|
||||
@@ -81,8 +95,21 @@ const selectedLabel = computed(() => {
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<template v-if="isAdminView">
|
||||
<dl class="mt-2 space-y-1 text-xs text-secondary">
|
||||
<template v-if="isAdminView && candidateCount">
|
||||
<button
|
||||
type="button"
|
||||
class="mt-3 flex w-full items-center justify-between rounded-lg border border-default bg-surface-soft px-2.5 py-2 text-left text-xs font-medium text-secondary transition-colors hover:bg-slate-50 dark:hover:bg-slate-800"
|
||||
data-testid="review-profile-match-candidates-toggle"
|
||||
:aria-expanded="candidatesExpanded"
|
||||
@click="toggleCandidates"
|
||||
>
|
||||
<span>{{ candidatesExpanded
|
||||
? t('chat.shippingOrderReview.profileMatch.collapseCandidates')
|
||||
: t('chat.shippingOrderReview.profileMatch.expandCandidates', { count: candidateCount }) }}</span>
|
||||
<span aria-hidden="true" class="text-muted">{{ candidatesExpanded ? '−' : '+' }}</span>
|
||||
</button>
|
||||
<div v-if="candidatesExpanded" data-testid="review-profile-match-details">
|
||||
<dl class="mt-2 space-y-1 text-xs text-secondary">
|
||||
<div v-if="profileMatch?.route_type" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.routeType') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.route_type }}</dd>
|
||||
@@ -91,12 +118,11 @@ const selectedLabel = computed(() => {
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.executionMode') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.execution_mode }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<ul
|
||||
v-if="(profileMatch?.candidates || []).length"
|
||||
class="mt-2 space-y-1.5"
|
||||
</dl>
|
||||
<ul
|
||||
class="mt-2 max-h-48 space-y-1.5 overflow-y-auto pr-1"
|
||||
data-testid="review-profile-match-candidates"
|
||||
>
|
||||
>
|
||||
<li
|
||||
v-for="(item, idx) in profileMatch?.candidates || []"
|
||||
:key="`${item.profile_code}-${item.version}-${idx}`"
|
||||
@@ -105,7 +131,8 @@ const selectedLabel = computed(() => {
|
||||
<span class="font-mono">{{ item.profile_code }}</span>
|
||||
<span v-if="item.score != null" class="ml-2 text-muted">{{ item.score }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
@@ -25,6 +25,7 @@ const props = defineProps<{
|
||||
conversationRetryEligibleCount?: number;
|
||||
conversationRetrying?: boolean;
|
||||
conversationRetryDisabled?: boolean;
|
||||
hasConversationRetryResult?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -32,6 +33,7 @@ const emit = defineEmits<{
|
||||
'open-version-history': [];
|
||||
'open-audit-trail': [];
|
||||
'retry-conversation-auto-progress': [];
|
||||
'open-conversation-retry-result': [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -81,12 +83,22 @@ const showRetry = computed(() => (
|
||||
class="h-3.5 w-3.5"
|
||||
:class="conversationRetrying ? 'animate-spin' : ''"
|
||||
/>
|
||||
{{ t('chat.shippingOrderReview.autoProgress.retry') }}
|
||||
{{ conversationRetrying ? t('chat.shippingOrderReview.conversationRetry.retrying') : t('chat.shippingOrderReview.autoProgress.retry') }}
|
||||
<span
|
||||
v-if="conversationRetryEligibleCount"
|
||||
class="rounded bg-amber-200/80 px-1 text-[10px] dark:bg-amber-900/60"
|
||||
>{{ conversationRetryEligibleCount }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="hasConversationRetryResult"
|
||||
type="button"
|
||||
class="relative rounded border border-slate-200 px-2.5 py-1.5 text-xs hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
|
||||
data-testid="review-open-conversation-retry-result"
|
||||
@click="emit('open-conversation-retry-result')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.conversationRetry.viewResult') }}
|
||||
<span class="absolute -right-1 -top-1 h-2 w-2 rounded-full bg-rose-500" />
|
||||
</button>
|
||||
<button
|
||||
v-if="showAuditTrail"
|
||||
type="button"
|
||||
|
||||
@@ -23,6 +23,7 @@ const props = defineProps<{
|
||||
item: ShippingReviewProgressContext | null;
|
||||
taskNo?: string | null;
|
||||
polling?: boolean;
|
||||
refreshing?: boolean;
|
||||
/** 统一进度投影:节点与文案的权威来源。 */
|
||||
processingProjection?: ShippingProcessingProjection | null;
|
||||
/** 正式 OT 已创建;抑制确认建单类「当前需要」。 */
|
||||
@@ -65,6 +66,7 @@ const showTaskWorkbenchLink = computed(() => {
|
||||
v-else-if="processingProjection"
|
||||
:projection="processingProjection"
|
||||
:polling="polling"
|
||||
:refreshing="refreshing"
|
||||
:has-formal-ot="hasFormalOt || String(taskNo || '').trim().startsWith('OT-')"
|
||||
@open-process-details="emit('open-process-details')"
|
||||
@refresh="emit('refresh')"
|
||||
|
||||
+53
-8
@@ -3,7 +3,7 @@
|
||||
* 用途:验收右侧任务分组卡——needs_action / processing / 处理记录三子段与动作层级。
|
||||
* 依赖:Vitest、Vue Test Utils、vue-i18n、ShippingConversationProcessingCard。
|
||||
* 逻辑:构造 ConversationProcessingProjection;断言分组文案、处理记录折叠与三类子段、
|
||||
* UI-02 单一详情入口、UI-03 history 截断角标、有 workItem 时无任务级主/次按钮。
|
||||
* UI-02 单一详情入口、UI-03 history 截断角标、人工 Gate 按钮常驻且不依赖任务焦点。
|
||||
*/
|
||||
import { mount, flushPromises } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
@@ -336,18 +336,50 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
expect(wrapper.text()).not.toContain('20260803-A13F95D2');
|
||||
});
|
||||
|
||||
it('emits focus only when selecting a task (not viewed)', async () => {
|
||||
it('selects a task locally without writing focus or viewed events', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: { projection: buildProjection() },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] button').trigger('click');
|
||||
expect(wrapper.emitted('focus')?.[0]).toEqual(['OT-NEED']);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').attributes('data-focused')).toBe('1');
|
||||
expect(wrapper.emitted('focus')).toBeUndefined();
|
||||
expect(wrapper.emitted('viewed')).toBeUndefined();
|
||||
expect(wrapper.emitted('expandFiles')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('opens local task details without emitting a viewed write event', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
projection: {
|
||||
summary: { total_tasks: 1, processing: 0, needs_action: 0, completed: 1, history: 0 },
|
||||
focused_task_no: null,
|
||||
recent_task_no: null,
|
||||
needs_action: [],
|
||||
completed: [{
|
||||
user_task_no: 'OT-DETAIL', group: 'completed', status_label: 'completed',
|
||||
file_count: 1, run_no: 'RUN-DETAIL', can_append: false,
|
||||
available_actions: ['view_details'],
|
||||
}],
|
||||
processing: [], history: [],
|
||||
},
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
await wrapper.find('[data-testid="shipping-processing-history-toggle"]').trigger('click');
|
||||
|
||||
await wrapper.find('[data-testid="shipping-processing-action-view_result"]').trigger('click');
|
||||
|
||||
expect(wrapper.emitted('taskAction')?.[0]?.[0]).toMatchObject({
|
||||
task: { user_task_no: 'OT-DETAIL' },
|
||||
action: 'view_result',
|
||||
});
|
||||
expect(wrapper.emitted('viewed')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('applies visible focus ring on needs_action card when focused', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
@@ -464,7 +496,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('hides task-level primary/secondary when workItem exists but keeps expand-files entry', async () => {
|
||||
it('keeps a human Gate action visible before and after selecting its task', async () => {
|
||||
const projection = buildProjection();
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
@@ -473,6 +505,12 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
buildWorkItem('OT-NEED', {
|
||||
status: 'waiting_review',
|
||||
stage: 'waiting_review',
|
||||
currentGate: {
|
||||
gateCode: 'inventory_matching',
|
||||
nextActionCode: 'open_inventory_match_review',
|
||||
blockingReasonCode: 'inventory_match_not_ready',
|
||||
},
|
||||
availableActions: ['open_inventory_match_review'],
|
||||
}),
|
||||
buildWorkItem('OT-PROC', {
|
||||
stage: 'inventory_matching',
|
||||
@@ -483,13 +521,20 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(1);
|
||||
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(2);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').text()).toContain('待复核');
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-PROC"]').text()).toContain('库存匹配');
|
||||
expect(wrapper.findAll('[data-testid="shipping-processing-task-actions"]')).toHaveLength(0);
|
||||
// UI-02:有 workItem 时仍保留展开文件详情(OT-NEED 为多文件)。
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] [data-testid="shipping-processing-expand-files"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] [data-testid="shipping-processing-action-view_details"]').exists()).toBe(false);
|
||||
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('库存');
|
||||
|
||||
await task.find('button').trigger('click');
|
||||
await flushPromises();
|
||||
|
||||
// 点击仅改变焦点;同一 Gate 的恢复入口必须继续可见。
|
||||
expect(task.attributes('data-focused')).toBe('1');
|
||||
expect(task.find('[data-testid="unified-action-primary"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('maps internal review_case_draft status to a user-facing review label', async () => {
|
||||
|
||||
+10
-17
@@ -6,7 +6,8 @@
|
||||
* 逻辑:由 ShippingWorkflowTimeline 嵌入;只消费统一 projection / workItems;
|
||||
* 统一「订单识别任务」+ 主文件副标题;处理记录默认折叠(已完成/历史版本/已取消);
|
||||
* UI-02:有文件对象时次要入口仅为「展开文件详情」,无文件对象时才「查看详情」;
|
||||
* 有 workItem 时不渲染任务级主/次按钮,仍可保留展开文件入口;
|
||||
* 有 workItem 时由其统一 Gate / Action 投影常驻渲染人工恢复按钮;
|
||||
* 点击/展开任务只更新本地焦点与详情,不写服务端 viewed/focus 审计,不得改变同一 Gate 的按钮可见性;
|
||||
* UI-03:history 截断时折叠标题显示「还有 N 条」,展开底部显示明细截断文案。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -22,7 +23,6 @@ import { getPrimaryDocumentName } from '@/features/chat/shipping/conversationPro
|
||||
import {
|
||||
createConversationProcessingUiState,
|
||||
focusTaskManually,
|
||||
markTaskViewed,
|
||||
resetConversationProcessingUiState,
|
||||
resolveFocusedTask,
|
||||
shouldExpandTaskDetails,
|
||||
@@ -49,8 +49,6 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
focus: [taskNo: string];
|
||||
viewed: [taskNo: string];
|
||||
/** 请求展开某任务下的文件列表(由 Timeline 按 OT objects 合成) */
|
||||
expandFiles: [task: ConversationProcessingUserTask];
|
||||
/** 收起文件详情:父级应清空过滤并隐藏文件列表 */
|
||||
@@ -143,26 +141,23 @@ watch(
|
||||
);
|
||||
|
||||
/**
|
||||
* 点击任务卡:只聚焦,不标记正式 viewed、不强制展开文件。
|
||||
* 非权威任务号仅更新本地 UI 焦点,不向后端 focus 写接口。
|
||||
* 点击任务卡:仅本地聚焦,不标记正式 viewed、不强制展开文件、也不写 focus 审计。
|
||||
*/
|
||||
function onSelectTask(task: ConversationProcessingUserTask) {
|
||||
const taskNo = String(task.user_task_no || '').trim();
|
||||
if (!taskNo) return;
|
||||
focusTaskManually(uiState, taskNo, { expandDetails: false });
|
||||
if (task.user_task_authoritative === false) return;
|
||||
emit('focus', taskNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换文件详情展开;展开时通知父级过滤,收起时清空过滤。
|
||||
* viewed 会回写 Run.seen_at 并重算业务投影,右侧纯展示不得调用。
|
||||
*/
|
||||
function onToggleDetails(task: ConversationProcessingUserTask) {
|
||||
const taskNo = String(task.user_task_no || '').trim();
|
||||
if (!taskNo) return;
|
||||
toggleTaskDetails(uiState, taskNo);
|
||||
if (uiState.expandedDetailTaskNo === taskNo) {
|
||||
markTaskViewed(uiState, taskNo);
|
||||
emit('expandFiles', task);
|
||||
} else {
|
||||
emit('collapseFiles');
|
||||
@@ -188,12 +183,15 @@ function canExpandFileDetails(task: ConversationProcessingUserTask): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* 活跃卡进度:聚焦全量 / 未聚焦紧凑;处理记录(completed/history)永不展实时进度。
|
||||
* 活跃卡进度:人工待办始终完整展示 Gate 动作;处理中聚焦全量 / 未聚焦紧凑;
|
||||
* 处理记录(completed/history)永不展实时进度。
|
||||
*/
|
||||
function progressModeForTask(task: ConversationProcessingUserTask): 'full' | 'compact' | 'hidden' {
|
||||
if (!projectionForTask(task)) return 'hidden';
|
||||
const group = String(task.group || '').trim();
|
||||
if (group === 'completed' || group === 'history') return 'hidden';
|
||||
// [STEP] 人工 Gate 的动作必须由门禁状态决定,不能因用户尚未点击任务而隐藏。
|
||||
if (group === 'needs_action') return 'full';
|
||||
const focused = focusedTaskNo.value === task.user_task_no;
|
||||
if (focused) return 'full';
|
||||
return 'compact';
|
||||
@@ -371,7 +369,7 @@ function presentationActionLabel(task: ConversationProcessingUserTask, item: Act
|
||||
|
||||
/**
|
||||
* 执行任务级动作:view_details / focus_task 本地聚焦;其余交给父级。
|
||||
* 非权威任务号禁止向后端 focus/viewed 写接口。
|
||||
* focus / view_details 仅影响右侧 UI;禁止写 viewed 审计,避免重算任务分组。
|
||||
*/
|
||||
function onTaskAction(task: ConversationProcessingUserTask, action: string) {
|
||||
const code = String(action || '').trim();
|
||||
@@ -379,13 +377,8 @@ function onTaskAction(task: ConversationProcessingUserTask, action: string) {
|
||||
if (code === 'view_details' || code === 'focus_task') {
|
||||
focusTaskManually(uiState, task.user_task_no, { expandDetails: code === 'view_details' });
|
||||
if (code === 'view_details') {
|
||||
markTaskViewed(uiState, task.user_task_no);
|
||||
emit('expandFiles', task);
|
||||
}
|
||||
if (task.user_task_authoritative !== false) {
|
||||
emit('focus', task.user_task_no);
|
||||
if (code === 'view_details') emit('viewed', task.user_task_no);
|
||||
}
|
||||
return;
|
||||
}
|
||||
emit('taskAction', { task, action: code });
|
||||
@@ -610,7 +603,7 @@ function onIntakeAction(item: ShippingProcessingProjection, action: string) {
|
||||
{{ t('chat.shippingProcessing.progress.currentNeedLabel') }}{{ currentNeedLabel(task) }}
|
||||
</div>
|
||||
<SidebarProgressInline
|
||||
v-if="task.group === 'processing' && progressModeForTask(task) !== 'hidden' && projectionForTask(task)"
|
||||
v-if="progressModeForTask(task) !== 'hidden' && projectionForTask(task)"
|
||||
class="mt-1.5 border-t border-current/10 pt-1.5"
|
||||
:projection="projectionForTask(task)!"
|
||||
:compact="progressModeForTask(task) === 'compact'"
|
||||
|
||||
@@ -52,14 +52,15 @@ const events = computed((): ShippingWorkflowEvent[] => (
|
||||
|
||||
const canCancel = computed(() => {
|
||||
const actions = props.item?.available_actions;
|
||||
if (Array.isArray(actions)) return actions.includes('cancel');
|
||||
if (Array.isArray(actions)) return actions.includes('cancel') || Boolean(props.item);
|
||||
const status = String(props.item?.lifecycle_status || '').trim();
|
||||
return Boolean(props.item) && !['closed', 'cancelled'].includes(status);
|
||||
});
|
||||
|
||||
const canReparse = computed(() => {
|
||||
const actions = props.item?.available_actions;
|
||||
if (Array.isArray(actions)) return actions.includes('reparse');
|
||||
if (Array.isArray(actions)) return actions.includes('reparse')
|
||||
|| ['failed', 'reparse_failed'].includes(String(props.item?.lifecycle_status || '').trim());
|
||||
// 无契约时 fail-closed,禁止仅凭 pending_review 展示。
|
||||
return false;
|
||||
});
|
||||
@@ -75,7 +76,11 @@ const canOpenReview = computed(() => {
|
||||
if (!props.item) return false;
|
||||
const actions = props.item.available_actions;
|
||||
const status = String(props.item.lifecycle_status || '').trim();
|
||||
if (Array.isArray(actions)) return actions.includes('view_details') || actions.includes('enter_manual_review');
|
||||
if (Array.isArray(actions)) {
|
||||
return actions.includes('view_details')
|
||||
|| actions.includes('enter_manual_review')
|
||||
|| status === 'pending_review';
|
||||
}
|
||||
return status === 'pending_review';
|
||||
});
|
||||
|
||||
|
||||
@@ -399,6 +399,7 @@ async function openDetailsDrawer(
|
||||
|
||||
|
||||
const mountOptions = {
|
||||
attachTo: document.body,
|
||||
|
||||
global: {
|
||||
|
||||
@@ -623,7 +624,7 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
expect(reasonInput).not.toBeNull();
|
||||
expect(reasonConfirm).not.toBeNull();
|
||||
|
||||
(reasonInput as HTMLInputElement | null)?.setAttribute('value', 'cancel reason');
|
||||
if (reasonInput) (reasonInput as HTMLTextAreaElement).value = 'cancel reason';
|
||||
(reasonInput as HTMLInputElement | null)?.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
|
||||
reasonConfirm?.dispatchEvent(new Event('click', { bubbles: true }));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* 逻辑:顶层以 OT / ShippingProcessing 为主路径;面板摘要为双行「N 任务 · M 文件」+
|
||||
* 「待我处理 / 系统处理中」;截断时展示 has_more 提示;
|
||||
* mapUserTaskObjectsToFileRows 合成文件行;取消/重识别走 Run API;
|
||||
* 路由 focus_task_no / 服务端 focused_task_no 驱动选中卡;
|
||||
* 路由 focus_task_no / 服务端 focused_task_no 驱动本地选中卡;
|
||||
* 详情抽屉仅用列表投影,不再请求 WorkflowItem 详情 API。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -284,22 +284,14 @@ const counts = computed(() => ({
|
||||
}));
|
||||
|
||||
/**
|
||||
* 任务卡已查看:空号或非权威号不写后端。
|
||||
*/
|
||||
async function onProcessingViewed(taskNo: string) {
|
||||
const normalized = String(taskNo || '').trim();
|
||||
if (!normalized) return;
|
||||
await ctl.value.markConversationTaskViewed?.(normalized);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务卡聚焦:写审计、同步页面焦点,并按 run 过滤文件列表。
|
||||
* 任务卡聚焦:仅同步页面本地焦点,并按 run 过滤文件列表。
|
||||
* 右侧选中是展示状态,不能因普通点击反复写 conversation-task focus 审计。
|
||||
*/
|
||||
async function onProcessingFocus(taskNo: string) {
|
||||
const normalized = String(taskNo || '').trim();
|
||||
if (!normalized) return;
|
||||
chatPage?.setFocusedConversationTaskNo?.(normalized);
|
||||
await ctl.value.focusConversationTask?.(normalized);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,14 +312,7 @@ async function onExpandTaskFiles(task: ConversationProcessingUserTask) {
|
||||
detailOpen.value = true;
|
||||
}
|
||||
}
|
||||
// 走原有工作台入口,保持与「继续处理」按钮一致;失败则静默(仍保留本地聚焦)。
|
||||
if (runNo) {
|
||||
try {
|
||||
await openReviewFromTask(task);
|
||||
} catch {
|
||||
/* 路由失败不阻塞,交由上层统一错误处理。 */
|
||||
}
|
||||
}
|
||||
// 仅展开本地详情;进入订单处理工作台由抽屉中的显式「打开复核」动作触发。
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,6 +351,7 @@ async function onProcessingIntakeAction(payload: {
|
||||
|
||||
/**
|
||||
* 任务级权威操作:查看详情 / 复核 / 取消 / 重试失败文件。
|
||||
* 查看详情仅打开本地抽屉,禁止写 viewed 后重算右侧业务投影。
|
||||
*/
|
||||
async function onProcessingTaskAction(payload: {
|
||||
task: ConversationProcessingUserTask;
|
||||
@@ -376,9 +362,6 @@ async function onProcessingTaskAction(payload: {
|
||||
const runNo = String(task.run_no || '').trim();
|
||||
if (action === 'view_details') {
|
||||
onExpandTaskFiles(task);
|
||||
if (task.user_task_authoritative !== false) {
|
||||
await onProcessingViewed(String(task.user_task_no || '').trim());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
@@ -599,9 +582,6 @@ async function onTaskProjectionAction(payload: {
|
||||
if (task) {
|
||||
await onProcessingFocus(taskNo);
|
||||
await onExpandTaskFiles(task);
|
||||
if (task.user_task_authoritative !== false) {
|
||||
await onProcessingViewed(taskNo);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -764,8 +744,6 @@ watch(
|
||||
:work-items="processingWorkItems"
|
||||
:conversation-id="conversationId"
|
||||
:has-more-history="Boolean(displayProcessing?.summary?.has_more_history)"
|
||||
@focus="(taskNo) => void onProcessingFocus(taskNo)"
|
||||
@viewed="(taskNo) => void onProcessingViewed(taskNo)"
|
||||
@expand-files="onExpandTaskFiles"
|
||||
@collapse-files="onCollapseTaskFiles"
|
||||
@task-action="(payload) => void onProcessingTaskAction(payload)"
|
||||
|
||||
@@ -457,7 +457,8 @@ describe('useShippingOrderReview build eligibility writes', () => {
|
||||
|
||||
const pending = review.selectCase('CASE-NEW');
|
||||
expect(review.caseSwitchLoading.value).toBe(true);
|
||||
expect(review.activeCase.value).toBeNull();
|
||||
// 切换期间保留已确认快照,避免整个工作台清空。
|
||||
expect(review.activeCase.value?.case_no).toBe('CASE-OLD');
|
||||
expect(review.requestedCaseNo.value).toBe('CASE-NEW');
|
||||
|
||||
resolveCase?.(caseNew);
|
||||
@@ -477,7 +478,8 @@ describe('useShippingOrderReview build eligibility writes', () => {
|
||||
api.getEvidence.mockRejectedValueOnce(new Error('boom'));
|
||||
await review.selectCase('CASE-FAIL');
|
||||
expect(review.caseSwitchFailed.value).toBe(true);
|
||||
expect(review.activeCase.value).toBeNull();
|
||||
// 新请求失败时仍保留最近一次稳定 Case,避免白屏。
|
||||
expect(review.activeCase.value?.case_no).toBe('CASE-OLD');
|
||||
expect(review.requestedCaseNo.value).toBe('CASE-FAIL');
|
||||
});
|
||||
|
||||
|
||||
@@ -947,8 +947,6 @@ export function useShippingOrderReview() {
|
||||
requestedCaseNo.value = target;
|
||||
caseSwitchLoading.value = true;
|
||||
caseSwitchFailed.value = false;
|
||||
// [STEP 1] 清空完整业务 Case 与瞬态,禁止旧字段/Gate/issues 继续渲染。
|
||||
resetCaseTransientState();
|
||||
try {
|
||||
const [detail, result] = await Promise.all([
|
||||
getWorkspaceShippingOrderReviewCase(target),
|
||||
@@ -957,18 +955,24 @@ export function useShippingOrderReview() {
|
||||
// [STEP 2] 代次与目标 Case 双校验;过期响应一律丢弃。
|
||||
if (generation !== caseLoadGeneration) return;
|
||||
if (requestedCaseNo.value !== target) return;
|
||||
// [STEP 1] 目标快照到齐后一次性替换,切换期间保留旧内容,避免工作台白屏/大骨架闪烁。
|
||||
clearPreview();
|
||||
applyCaseSnapshot(detail);
|
||||
evidence.value = result.items;
|
||||
focusedFieldId.value = null;
|
||||
focusedLineKey.value = null;
|
||||
evidenceDrawerFocus.value = null;
|
||||
draftConflict.value = null;
|
||||
saveFailed.value = false;
|
||||
loadFailed.value = false;
|
||||
statusMessage.value = null;
|
||||
// Case 切换后必须按新 Candidate/Child OT 重建进度上下文,不能继续沿用首个 PDF 的 OT。
|
||||
await refreshWorkItemContext();
|
||||
refreshStatusMessage();
|
||||
} catch {
|
||||
if (generation !== caseLoadGeneration) return;
|
||||
if (requestedCaseNo.value !== target) return;
|
||||
// [STEP 3] 失败保持空骨架,禁止回显切换前 Case。
|
||||
activeCase.value = null;
|
||||
caseProjectionVersion.value = null;
|
||||
caseLoadingContext.value = null;
|
||||
evidence.value = [];
|
||||
llmSuggestions.value = [];
|
||||
// [STEP 3] 失败保留上一份稳定快照,用户仍可继续查看/编辑,不回退成空白工作台。
|
||||
caseSwitchFailed.value = true;
|
||||
} finally {
|
||||
if (generation === caseLoadGeneration) {
|
||||
|
||||
@@ -94,6 +94,12 @@ describe('normalizeShippingProcessingProjection', () => {
|
||||
i18n_key: 'workspace.shippingNotice.processGate.reasons.inventory_candidates_missing',
|
||||
},
|
||||
facts: {
|
||||
inventory_milestones: {
|
||||
candidates_calculated: 'completed',
|
||||
candidates_frozen: 'completed',
|
||||
snapshots_ready: 'pending',
|
||||
matched: 'pending',
|
||||
},
|
||||
candidate_set_id: 12,
|
||||
candidate_set_version: 3,
|
||||
candidate_set_status: 'frozen',
|
||||
@@ -117,6 +123,12 @@ describe('normalizeShippingProcessingProjection', () => {
|
||||
expect(projection?.facts?.sourceAttempts).toEqual({
|
||||
DBS_DUB: { status: 'consumed', attempt_no: 1 },
|
||||
});
|
||||
expect(projection?.facts?.inventoryMilestones).toEqual({
|
||||
candidatesCalculated: 'completed',
|
||||
candidatesFrozen: 'completed',
|
||||
snapshotsReady: 'pending',
|
||||
matched: 'pending',
|
||||
});
|
||||
expect(projection?.blockingReason?.code).toBe('inventory_candidates_missing');
|
||||
});
|
||||
|
||||
|
||||
@@ -162,6 +162,19 @@ function normalizeFacts(raw: unknown): ShippingProcessingFacts | undefined {
|
||||
? String(item.inventorySourceStatus)
|
||||
: null;
|
||||
}
|
||||
if ('inventory_milestones' in item || 'inventoryMilestones' in item) {
|
||||
const rawMilestones = item.inventory_milestones ?? item.inventoryMilestones;
|
||||
if (rawMilestones && typeof rawMilestones === 'object') {
|
||||
const milestones = rawMilestones as Record<string, unknown>;
|
||||
const state = (value: unknown): 'pending' | 'completed' => value === 'completed' ? 'completed' : 'pending';
|
||||
out.inventoryMilestones = {
|
||||
candidatesCalculated: state(milestones.candidates_calculated ?? milestones.candidatesCalculated),
|
||||
candidatesFrozen: state(milestones.candidates_frozen ?? milestones.candidatesFrozen),
|
||||
snapshotsReady: state(milestones.snapshots_ready ?? milestones.snapshotsReady),
|
||||
matched: state(milestones.matched),
|
||||
};
|
||||
}
|
||||
}
|
||||
if ('candidate_set_id' in item || 'candidateSetId' in item) {
|
||||
const v = item.candidate_set_id ?? item.candidateSetId;
|
||||
out.candidateSetId = v == null || v === '' ? null : Number(v);
|
||||
|
||||
@@ -23,7 +23,6 @@ export type FulfillmentProgressNodeKey = typeof FULFILLMENT_PROGRESS_NODES[numbe
|
||||
export const MANUAL_UPLOAD_GATE_ACTIONS = new Set([
|
||||
'wait_manual_upload',
|
||||
'mark_manual_uploaded',
|
||||
'regenerate_manual_upload_todo',
|
||||
]);
|
||||
|
||||
/** 统一 ShippingProcessing 终态 status(停止轮询)。 */
|
||||
|
||||
@@ -81,7 +81,7 @@ describe('useChatShippingMenuHandler', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('uses explicit taskId for generate_excel via Chat Turn', async () => {
|
||||
it('does not dispatch legacy generate_excel Chat Turn', async () => {
|
||||
const ctx = createContext();
|
||||
const { handleShippingMenuAction } = createShippingMenuHandlers(ctx);
|
||||
|
||||
@@ -91,14 +91,22 @@ describe('useChatShippingMenuHandler', () => {
|
||||
{ taskId: 'sn-target-777' },
|
||||
);
|
||||
|
||||
expect(ctx.startChatTurn).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
inputType: 'action',
|
||||
actionType: 'shipping.generate_excel',
|
||||
payload: { task_no: 'SN-TARGET-777' },
|
||||
refs: expect.objectContaining({ task_no: 'SN-TARGET-777' }),
|
||||
}),
|
||||
expect(ctx.startChatTurn).not.toHaveBeenCalled();
|
||||
expect(ctx.refreshShippingActions).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not dispatch legacy match_inventory Chat Turn', async () => {
|
||||
const ctx = createContext();
|
||||
const { handleShippingMenuAction } = createShippingMenuHandlers(ctx);
|
||||
|
||||
await handleShippingMenuAction(
|
||||
{ id: 'match_inventory', label: '匹配库存', message: '请匹配库存' },
|
||||
undefined,
|
||||
{ taskId: 'sn-target-778' },
|
||||
);
|
||||
|
||||
expect(ctx.startChatTurn).not.toHaveBeenCalled();
|
||||
expect(ctx.refreshShippingActions).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('reads the displayed order version before freezing through Chat Turn', async () => {
|
||||
|
||||
@@ -152,6 +152,14 @@ export function createShippingMenuHandlers(ctx: ShippingMenuHandlerContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 旧匹配/Excel 动作仅保留历史文案兼容;业务执行必须由 Projection
|
||||
// 下发的正式 Gate Action 驱动,Chat 不得再创建 legacy Turn。
|
||||
if (action.id === 'match_inventory' || action.id === 'generate_excel') {
|
||||
await ctx.refreshShippingActions();
|
||||
ctx.msg.info(ctx.t('chat.shippingNoticeRefreshDone'));
|
||||
return;
|
||||
}
|
||||
|
||||
const chatTurnActionIds = new Set([
|
||||
'freeze_order',
|
||||
'generate_excel',
|
||||
|
||||
@@ -212,6 +212,24 @@ describe('useShippingNoticeWorkflow', () => {
|
||||
ctl.stop();
|
||||
});
|
||||
|
||||
it('ignores external refresh triggers once only manual Gate tasks remain', async () => {
|
||||
const refreshTrigger = ref(0);
|
||||
api.getShippingProcessing.mockResolvedValue(buildUnifiedProcessing());
|
||||
const ctl = useShippingNoticeWorkflow({ conversationId: ref('conv-1'), refreshTrigger });
|
||||
await vi.advanceTimersByTimeAsync(0);
|
||||
await nextTick();
|
||||
await Promise.resolve();
|
||||
|
||||
expect(api.getShippingProcessing).toHaveBeenCalledTimes(1);
|
||||
refreshTrigger.value += 1;
|
||||
await nextTick();
|
||||
await vi.advanceTimersByTimeAsync(0);
|
||||
|
||||
// 仅待人工处理时,Run 轮询的旁路 refreshTrigger 不得重复唤醒右侧 GET。
|
||||
expect(api.getShippingProcessing).toHaveBeenCalledTimes(1);
|
||||
ctl.stop();
|
||||
});
|
||||
|
||||
it('uses unified work_items as the sole processing read source', async () => {
|
||||
api.getShippingProcessing.mockResolvedValue({
|
||||
conversation_id: 'conv-1',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* 逻辑:由 ChatViewContent / ShippingWorkflowTimeline 消费;仅读 shipping-processing;
|
||||
* focus/viewed 写路径优先应用响应中的 work_items;
|
||||
* 前台 2s / 后台 8s;请求 10s AbortController 超时;失败指数退避至 8s;
|
||||
* 分层轮询:系统处理中 2s 轮询,待复核 30s 轮询;
|
||||
* 分层轮询:仅系统处理中 2s 轮询;外部 Run 轮询不会在待人工处理时反复唤醒本读接口;
|
||||
* 区分 initialLoading / manualRefreshing / polling 三种 loading 态;
|
||||
* 语义签名比较:业务状态未变化时不替换投影对象,防止按钮闪烁与 DOM 重建。
|
||||
*/
|
||||
@@ -450,6 +450,9 @@ export function useShippingNoticeWorkflow(
|
||||
() => readOption(options.refreshTrigger ?? 0),
|
||||
() => {
|
||||
if (!normalizedConversationId.value) return;
|
||||
// [STEP] Run 轮询也会递增 refreshTrigger。右侧已进入人工 Gate 时状态不会
|
||||
// 自动变化,禁止每次 Run 轮询都重拉同一会话投影;首次尚无投影时仍允许恢复。
|
||||
if (processing.value && !shouldContinueProcessingPolling(processing.value)) return;
|
||||
pollingStopped = false;
|
||||
schedulePoll(pollGeneration, 0);
|
||||
},
|
||||
|
||||
@@ -60,6 +60,7 @@ export function useShippingProcessingWorkItem(
|
||||
let timer: ReturnType<typeof window.setTimeout> | null = null;
|
||||
let generation = 0;
|
||||
let stopped = false;
|
||||
let refreshInFlight: { no: string; promise: Promise<void> } | null = null;
|
||||
const pollMs = options.pollMs ?? DEFAULT_POLL_MS;
|
||||
const monotonic = Boolean(options.monotonicProgressVersion);
|
||||
|
||||
@@ -87,6 +88,10 @@ export function useShippingProcessingWorkItem(
|
||||
*/
|
||||
async function refresh(): Promise<void> {
|
||||
const no = String(toValue(workItemNo) || '').trim();
|
||||
if (refreshInFlight?.no === no) {
|
||||
await refreshInFlight.promise;
|
||||
return;
|
||||
}
|
||||
const enabled = options.enabled == null ? true : Boolean(toValue(options.enabled));
|
||||
if (!enabled || !no) {
|
||||
projection.value = null;
|
||||
@@ -96,7 +101,8 @@ export function useShippingProcessingWorkItem(
|
||||
}
|
||||
const gen = generation;
|
||||
loading.value = true;
|
||||
try {
|
||||
const request = (async () => {
|
||||
try {
|
||||
const raw = await getWorkspaceShippingProcessingWorkItem(workItemType, no);
|
||||
if (stopped || gen !== generation) return;
|
||||
const normalized = normalizeShippingProcessingProjection(raw);
|
||||
@@ -112,7 +118,7 @@ export function useShippingProcessingWorkItem(
|
||||
void refresh();
|
||||
}, pollMs);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) {
|
||||
if (stopped || gen !== generation) return;
|
||||
// 404 / 业务不存在:清空投影但不抛到页面主流程。
|
||||
if (err instanceof BusinessError && (err.status === 404 || err.code?.includes('NOT_FOUND'))) {
|
||||
@@ -128,8 +134,15 @@ export function useShippingProcessingWorkItem(
|
||||
void refresh();
|
||||
}, pollMs);
|
||||
}
|
||||
} finally {
|
||||
} finally {
|
||||
if (gen === generation) loading.value = false;
|
||||
}
|
||||
})();
|
||||
refreshInFlight = { no, promise: request };
|
||||
try {
|
||||
await request;
|
||||
} finally {
|
||||
if (refreshInFlight?.promise === request) refreshInFlight = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +160,9 @@ export function useShippingProcessingWorkItem(
|
||||
error.value = null;
|
||||
return;
|
||||
}
|
||||
// OT/PDF 切换时先清空旧投影,避免新请求完成前继续展示第一份 PDF 的状态。
|
||||
projection.value = null;
|
||||
error.value = null;
|
||||
void refresh();
|
||||
},
|
||||
{ immediate: true },
|
||||
|
||||
@@ -162,6 +162,12 @@ export interface ShippingProcessingPrimaryAction {
|
||||
* 用户态统一 Projection facts(T8 决策 F2;子状态事实字典)。
|
||||
*/
|
||||
export interface ShippingProcessingFacts {
|
||||
inventoryMilestones?: {
|
||||
candidatesCalculated: 'pending' | 'completed';
|
||||
candidatesFrozen: 'pending' | 'completed';
|
||||
snapshotsReady: 'pending' | 'completed';
|
||||
matched: 'pending' | 'completed';
|
||||
};
|
||||
inventorySourceStatus?: string | null;
|
||||
candidateSetId?: number | null;
|
||||
candidateSetVersion?: number | null;
|
||||
@@ -183,7 +189,20 @@ export interface ShippingProcessingFacts {
|
||||
transactionErrorCode?: string | null;
|
||||
callbackReceivedAt?: string | null;
|
||||
}>;
|
||||
lineResolutions?: Record<string, unknown>[];
|
||||
lineResolutions?: Array<{
|
||||
lineIndex?: number | null;
|
||||
lineKey?: string | null;
|
||||
disposition?: string | null;
|
||||
resolvedInventorySourceCode?: string | null;
|
||||
inventoryFileNo?: string | null;
|
||||
inventoryFileSha256?: string | null;
|
||||
inventoryRowIndex?: number | null;
|
||||
matchAttemptId?: number | null;
|
||||
requiredQty?: string | number | null;
|
||||
matchedQty?: string | number | null;
|
||||
shortageQty?: string | number | null;
|
||||
[key: string]: unknown;
|
||||
}>;
|
||||
exportState?: string;
|
||||
uploadState?: string;
|
||||
switchState?: string;
|
||||
@@ -937,6 +956,9 @@ export type ShippingProcessGateActionCode =
|
||||
| 'retry_inventory_field_mapping'
|
||||
| 'confirm_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'
|
||||
| 'open_shortage_review'
|
||||
@@ -965,13 +987,44 @@ export interface ShippingProcessGateProjection {
|
||||
blocking_reason?: Record<string, unknown> | null;
|
||||
findings?: Array<Record<string, unknown>>;
|
||||
next_action_code?: ShippingProcessGateActionCode | string | null;
|
||||
allowed_actions?: string[];
|
||||
action_presentation?: ShippingProcessGateActionPresentation[];
|
||||
recovery_targets?: ShippingProcessRecoveryTarget[];
|
||||
passed_at?: string | null;
|
||||
latest_attempt?: {
|
||||
id?: number;
|
||||
attempt_no?: number;
|
||||
status?: string;
|
||||
error_code?: string | null;
|
||||
error_summary?: string | null;
|
||||
} | null;
|
||||
implementation_status?: ShippingProcessGateImplementationStatus;
|
||||
}
|
||||
|
||||
export interface ShippingProcessGateActionPresentation {
|
||||
code: string;
|
||||
label_key: string;
|
||||
kind: 'current_gate' | 'recovery' | 'view' | string;
|
||||
dispatch: 'navigation' | 'mutation' | 'refresh' | string;
|
||||
}
|
||||
|
||||
/** 服务端 RecoveryPlan 只读目标;target_gate 由后端合同推导,客户端不得提交覆盖。 */
|
||||
export interface ShippingProcessRecoveryTarget {
|
||||
action_code: ShippingProcessGateActionCode | string;
|
||||
target_gate: ShippingProcessGateCode | string;
|
||||
resume_after_gate?: ShippingProcessGateCode | string | null;
|
||||
allowed_intermediate_gates?: Array<ShippingProcessGateCode | string>;
|
||||
invalidates?: string[];
|
||||
permission?: string | null;
|
||||
}
|
||||
|
||||
export type ShippingProcessGateImplementationStatus =
|
||||
| 'supported'
|
||||
| 'implemented'
|
||||
| 'adapter_required'
|
||||
| 'blocked'
|
||||
| string;
|
||||
|
||||
/** Execution 用户 Gate 摘要(ui_state.process_gate / GET execution 对齐)。 */
|
||||
export interface ShippingProcessGateUserSummary {
|
||||
execution_no: string;
|
||||
@@ -979,6 +1032,8 @@ export interface ShippingProcessGateUserSummary {
|
||||
current_blocking_gate?: ShippingProcessGateProjection | null;
|
||||
blocking_reason_code?: string | null;
|
||||
blocking_message?: string | null;
|
||||
/** 当前 Gate 最近一次失败的脱敏执行详情;仅用于用户排查,不是 API action。 */
|
||||
failure_detail?: string | null;
|
||||
/** 统一可解释性投影(与 build_explainability_reason 对齐) */
|
||||
explainability?: ShippingExplainabilityReason | null;
|
||||
next_action_code?: ShippingProcessGateActionCode | string | null;
|
||||
@@ -1006,6 +1061,19 @@ export interface ShippingProcessGateUserSummary {
|
||||
sequence_no: number;
|
||||
}>;
|
||||
current_findings?: Array<Record<string, unknown>>;
|
||||
recovery_targets?: ShippingProcessRecoveryTarget[];
|
||||
primary_action?: ShippingProcessGateActionPresentation | null;
|
||||
allowed_actions?: string[];
|
||||
action_presentation?: ShippingProcessGateActionPresentation[];
|
||||
view_actions?: ShippingProcessGateActionPresentation[];
|
||||
active_recovery_plans?: Array<{
|
||||
plan_no: string;
|
||||
action_code: string;
|
||||
current_gate: string;
|
||||
target_gate: string;
|
||||
resume_after_gate?: string | null;
|
||||
status: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface ShippingFieldEvidenceItem {
|
||||
@@ -1217,6 +1285,9 @@ export interface ShippingStpFacts {
|
||||
part_number?: string | null;
|
||||
resolved_inventory_source_code?: string | null;
|
||||
inventory_file_no?: string | null;
|
||||
inventory_file_sha256?: string | null;
|
||||
inventory_row_index?: number | null;
|
||||
match_attempt_id?: number | null;
|
||||
inventory_row_ref?: {
|
||||
reservation_id?: string | null;
|
||||
part_number?: string | null;
|
||||
@@ -2744,6 +2815,10 @@ export interface ShippingOrderReviewLineFulfillmentLine {
|
||||
inventory_snapshot_id?: number | null;
|
||||
inventory_checked_at?: string | null;
|
||||
inventory_source_code?: string | null;
|
||||
inventory_file_no?: string | null;
|
||||
inventory_file_sha256?: string | null;
|
||||
inventory_row_index?: number | null;
|
||||
match_attempt_id?: number | null;
|
||||
inventory_source?: ({
|
||||
code?: string | null;
|
||||
label?: string | null;
|
||||
|
||||
@@ -718,6 +718,37 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.find('[data-testid="review-confirm-create"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('renders a persistent result panel for a completed formal task', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
status: 'confirmed',
|
||||
confirmed_task_no: 'SN-MOCK',
|
||||
confirmed_task_id: 1,
|
||||
has_formal_ot: true,
|
||||
current_stage: { code: 'completed', label_key: 'completed' },
|
||||
automation: { status: 'completed', can_auto_create: false, can_build: false },
|
||||
};
|
||||
const taskApi = await import('@/features/chat/api/shipping.api');
|
||||
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValueOnce({
|
||||
task_no: 'SN-MOCK',
|
||||
status: 'completed',
|
||||
process_status: 'uploaded',
|
||||
upload_status: 'uploaded',
|
||||
lines: [],
|
||||
line_results: [{
|
||||
part_number: 'PN-1', reservation_id: 'RES-1', required_qty: 2,
|
||||
available_qty: 2, shortage_qty: 0, line_status: 'ok',
|
||||
}],
|
||||
export_artifacts: [{ id: 1, artifact_no: 'EXP-1', status: 'ready', file_name: 'result.xlsx' }],
|
||||
events: [],
|
||||
ui_state: { action_buttons: [], summary: {}, process_gate: null },
|
||||
} as any);
|
||||
const wrapper = await mountView();
|
||||
expect(wrapper.find('[data-testid="review-formal-task-result-region"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-formal-task-result-panel"]').text()).toContain('PN-1');
|
||||
expect(wrapper.find('[data-testid="review-formal-task-result-download"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('renders empty optional schema fields as editable line columns', async () => {
|
||||
const wrapper = await mountView();
|
||||
const inputs = wrapper.findAll('[data-testid="review-line-field-input"]');
|
||||
|
||||
@@ -19,7 +19,7 @@ import { computed, defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, r
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { Check, CircleX, Crosshair, Plus, RefreshCw, Undo2, Copy, Trash2 } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError, resolveLocalizedErrorMessage } from '@/shared/api/client';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { useChatPageContext } from '@/features/chat/composables/chat.context';
|
||||
import {
|
||||
@@ -35,7 +35,6 @@ import {
|
||||
retryWorkspaceConversationAutoProgress,
|
||||
retryWorkspaceShippingOrderStpAutoCreate,
|
||||
retryWorkspaceShippingTask,
|
||||
retryWorkspaceShippingTaskLine,
|
||||
viewWorkspaceShippingOrderReviewHighlightDiagnostic,
|
||||
} from '../api/shipping.api';
|
||||
import type {
|
||||
@@ -55,6 +54,7 @@ import ReviewInventoryIssueFallbackCard from '../components/shipping-review/Revi
|
||||
import ReviewAuditTrailDrawer from '../components/shipping-review/ReviewAuditTrailDrawer.vue';
|
||||
import ReviewCompletedChecksPanel from '../components/shipping-review/ReviewCompletedChecksPanel.vue';
|
||||
import ReviewCurrentProcessingCard from '../components/shipping-review/ReviewCurrentProcessingCard.vue';
|
||||
import ReviewConversationRetryDrawer from '../components/shipping-review/ReviewConversationRetryDrawer.vue';
|
||||
import ReviewDocumentNavigation, {
|
||||
type ReviewDocumentNavMode,
|
||||
} from '../components/shipping-review/ReviewDocumentNavigation.vue';
|
||||
@@ -66,6 +66,7 @@ import ReviewWorkbenchModeToggle from '../components/shipping-review/ReviewWorkb
|
||||
import ReviewUnsavedSwitchDialog from '../components/shipping-review/ReviewUnsavedSwitchDialog.vue';
|
||||
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
|
||||
import TaskTodoPanel from '@/features/workspace/shipping-task-center/TaskTodoPanel.vue';
|
||||
import ManualUploadEvidenceDialog from '@/features/workspace/shipping-task-center/ManualUploadEvidenceDialog.vue';
|
||||
import { downloadWorkspaceShippingExcelFile } from '@/features/workspace/api/shipping-tasks.api';
|
||||
import ReviewLineNoOverrideDialog, {
|
||||
type LineNoOverridePayload,
|
||||
@@ -111,6 +112,7 @@ const {
|
||||
shippingProcessingProjection,
|
||||
authoritativeOrderTaskNo,
|
||||
refreshShippingProcessing,
|
||||
shippingProcessingLoading,
|
||||
workflowProgressPolling,
|
||||
versions,
|
||||
statusMessage,
|
||||
@@ -285,7 +287,8 @@ const displayHeaderValues = computed(() => (
|
||||
const displayDraftLines = computed(() => displayCase.value?.draft?.lines || []);
|
||||
|
||||
const showWorkbenchCaseShell = computed(() => Boolean(displayCase.value));
|
||||
const caseContentSkeleton = computed(() => caseSwitchLoading.value || caseSwitchFailed.value);
|
||||
/** 切换期间和失败回退均保留旧快照;无稳定 Case 时才进入空状态骨架。 */
|
||||
const caseContentSkeleton = computed(() => caseSwitchFailed.value && !activeCase.value);
|
||||
|
||||
/** can_build && can_auto_create 时底栏隐藏「确认建单」;文案仅表示资格达标等待入队,不等于正在推进。 */
|
||||
/** queued|running|已有正式 OT|task_missing 时隐藏「确认并创建任务」。 */
|
||||
@@ -459,9 +462,12 @@ const confirmSuccess = ref<{
|
||||
} | null>(null);
|
||||
const progressRetrying = ref(false);
|
||||
const conversationRetrying = ref(false);
|
||||
const conversationRetryResultOpen = ref(false);
|
||||
const conversationRetryDrawerOpen = ref(false);
|
||||
const conversationRetryToastOpen = ref(false);
|
||||
let conversationRetryToastTimer: ReturnType<typeof window.setTimeout> | undefined;
|
||||
const conversationRetryError = ref('');
|
||||
const conversationRetryResult = ref<{
|
||||
summary: { total: number; retried: number; skipped: number; failed: number };
|
||||
summary: { total: number; retried: number; skipped: number; failed: number; blocked?: number };
|
||||
items: Array<{
|
||||
object_type: string;
|
||||
object_ref: string;
|
||||
@@ -471,6 +477,19 @@ const conversationRetryResult = ref<{
|
||||
}>;
|
||||
} | null>(null);
|
||||
|
||||
const hasConversationRetryAttention = computed(() => (
|
||||
Number(conversationRetryResult.value?.summary.failed || 0) > 0
|
||||
|| Number(conversationRetryResult.value?.summary.blocked || 0) > 0
|
||||
));
|
||||
|
||||
function showConversationRetryToast() {
|
||||
if (conversationRetryToastTimer) window.clearTimeout(conversationRetryToastTimer);
|
||||
conversationRetryToastOpen.value = true;
|
||||
conversationRetryToastTimer = window.setTimeout(() => {
|
||||
conversationRetryToastOpen.value = false;
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 题9A:already_running 响应本地冷却(任务号 → 过期毫秒时间戳)。
|
||||
* 当服务端返回 noop.already_running 时写对应 task 条目;按钮禁用在此有效期内叠加,避免「投影 refresh 有 2-3s 滞后期间用户再次点击」。
|
||||
@@ -1165,104 +1184,7 @@ function displayAvailableQty(line: ShippingOrderReviewLineFulfillmentLine | null
|
||||
return String(line.available_qty);
|
||||
}
|
||||
|
||||
const lineOpsBusyKey = ref<string | null>(null);
|
||||
|
||||
/** 任务整体 queued/running:行级写操作隐藏/禁用。 */
|
||||
const taskAutomationRunning = computed(() => {
|
||||
const status = String(activeCase.value?.automation?.status || '').trim().toLowerCase();
|
||||
return ['queued', 'running', 'processing', 'automating'].includes(status);
|
||||
});
|
||||
|
||||
/**
|
||||
* 明细行统一「重试」:POST .../lines/{line_key}/retry;不传内部动作码。
|
||||
* 题3B / 题10A:行 REMATCH 不受整单 running 源阻塞;但此处仍按行按钮互斥和行冷却独立判断。
|
||||
*/
|
||||
async function retryLineUnified(lineKey: string) {
|
||||
const key = String(lineKey || '').trim();
|
||||
if (!key || caseSwitchLoading.value) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
|
||||
return;
|
||||
}
|
||||
// 题3B:整单正在 running → 仅 fetch_inventory(缺快照) 受影响;此处仅用 inventory_source_unstable 或 task_missing 全局阻塞
|
||||
if (Boolean(activeCase.value?.task_missing)) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
|
||||
return;
|
||||
}
|
||||
const taskNo = String(
|
||||
confirmedNoticeTaskNo.value
|
||||
|| activeCase.value?.confirmed_task_no
|
||||
|| formalOtRetryTaskNo.value
|
||||
|| '',
|
||||
).trim();
|
||||
if (!taskNo) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryRpaUnavailable'));
|
||||
return;
|
||||
}
|
||||
if (lineOpsBusyKey.value) return;
|
||||
// 行级冷却:taskNo + lineKey
|
||||
if (isLineRunningCooldownActive(taskNo, key)) {
|
||||
msg.warning(t('chat.shippingOrderReview.lineOps.retryAlreadyRunning', { lineKey: key }));
|
||||
return;
|
||||
}
|
||||
lineOpsBusyKey.value = key;
|
||||
try {
|
||||
const result = await retryWorkspaceShippingTaskLine(taskNo, key);
|
||||
const status = String(result?.status || '').trim().toLowerCase();
|
||||
const reasonCode = String(result?.reason_code || '').trim().toLowerCase();
|
||||
if (status === 'noop' && reasonCode === 'already_running') {
|
||||
markLineRunningCooldown(taskNo, key, TASK_RUNNING_COOLDOWN_MS);
|
||||
msg.warning(
|
||||
String(result?.message || t('chat.shippingOrderReview.lineOps.retryAlreadyRunning', { lineKey: key })),
|
||||
);
|
||||
void refreshShippingProcessing();
|
||||
return;
|
||||
}
|
||||
if (status === 'needs_human') {
|
||||
msg.warning(String(result?.message || t('chat.shippingOrderReview.autoProgress.status.needs_human')));
|
||||
} else if (status === 'failed') {
|
||||
msg.warning(String(result?.message || t('chat.shippingOrderReview.lineOps.retryRpaFailed')));
|
||||
} else {
|
||||
msg.success(t('chat.shippingOrderReview.lineOps.retryRpaSubmitted'));
|
||||
}
|
||||
await reloadLatestDraft();
|
||||
void refreshShippingProcessing();
|
||||
} catch (error) {
|
||||
msg.error(
|
||||
error instanceof BusinessError
|
||||
? resolveLocalizedErrorMessage(error.code, error.message)
|
||||
: t('chat.shippingOrderReview.lineOps.retryRpaFailed'),
|
||||
);
|
||||
} finally {
|
||||
lineOpsBusyKey.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** 行级 already_running 冷却(taskNo + lineKey 组合 → 过期毫秒)。 */
|
||||
const lineRunningCooldownUntilMs = ref<Record<string, number>>({});
|
||||
|
||||
function markLineRunningCooldown(taskNo: string | null | undefined, lineKey: string | null | undefined, durationMs: number = TASK_RUNNING_COOLDOWN_MS) {
|
||||
const t = String(taskNo || '').trim();
|
||||
const l = String(lineKey || '').trim();
|
||||
if (!t || !l) return;
|
||||
const key = `${t}::${l}`;
|
||||
lineRunningCooldownUntilMs.value = {
|
||||
...lineRunningCooldownUntilMs.value,
|
||||
[key]: Date.now() + durationMs,
|
||||
};
|
||||
}
|
||||
|
||||
function isLineRunningCooldownActive(taskNo: string | null | undefined, lineKey: string | null | undefined): boolean {
|
||||
const t = String(taskNo || '').trim();
|
||||
const l = String(lineKey || '').trim();
|
||||
if (!t || !l) return false;
|
||||
const key = `${t}::${l}`;
|
||||
const until = Number(lineRunningCooldownUntilMs.value[key] || 0) || 0;
|
||||
return until > Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* Case 级库存兜底卡「重试」:走任务级统一决策器(无行键时)。
|
||||
*/
|
||||
/** Case 级库存兜底卡:统一由当前 Gate 卡提供精确动作。 */
|
||||
async function retryCaseInventoryFallback() {
|
||||
await retryFormalOtAutoProgress();
|
||||
}
|
||||
@@ -1325,6 +1247,24 @@ async function handleCurrentTaskAction(
|
||||
) {
|
||||
const params = (parameters || {}) as Record<string, unknown>;
|
||||
switch (code) {
|
||||
case 'download_excel': {
|
||||
const taskNo = (params.task_no as string | undefined) || confirmedNoticeTaskNo.value;
|
||||
if (!taskNo) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return;
|
||||
}
|
||||
await downloadWorkspaceShippingExcelFile(taskNo);
|
||||
msg.success(t('chat.shippingOrderReview.workbench.actionSuccess'));
|
||||
break;
|
||||
}
|
||||
case 'view_result':
|
||||
case 'open_fulfillment':
|
||||
case 'view_details':
|
||||
workbenchMode.value = 'formal_task';
|
||||
if (!(await ensureFormalTaskDetailReady())) return;
|
||||
await nextTick();
|
||||
scrollWorkbenchAnchor('review-formal-task-result-region');
|
||||
break;
|
||||
case 'open_inventory_source_review':
|
||||
if (hasCreatedShippingTask.value) {
|
||||
workbenchMode.value = 'formal_task';
|
||||
@@ -1364,6 +1304,9 @@ async function handleCurrentTaskAction(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'mark_manual_uploaded':
|
||||
await formalTodoPanelRef.value?.invokeActionByCode('mark_manual_uploaded');
|
||||
break;
|
||||
default:
|
||||
msg.info(t('chat.shippingOrderReview.currentTask.actionUnknown', { code }));
|
||||
}
|
||||
@@ -1659,6 +1602,51 @@ const confirmedNoticeTaskNo = computed(() => String(
|
||||
/** 确认后履约待办详情;任务中心不再挂工作台,由本工作台承接。 */
|
||||
const formalTaskDetail = ref<ShippingTaskDetail | null>(null);
|
||||
const formalTaskDetailLoading = ref(false);
|
||||
const manualUploadRegistrationOpen = ref(false);
|
||||
|
||||
/** 完成态结果摘要:与正式 ShippingTask 详情同源,禁止从进度条重新推导业务结果。 */
|
||||
const formalResultLineResults = computed(() => formalTaskDetail.value?.line_results || []);
|
||||
const formalResultShortageCount = computed(() => formalResultLineResults.value.filter(
|
||||
(line) => Number(line.shortage_qty || 0) > 0 || String(line.line_status || '').toLowerCase() === 'shortage',
|
||||
).length);
|
||||
const formalResultMatchedCount = computed(() => formalResultLineResults.value.filter(
|
||||
(line) => Number(line.shortage_qty || 0) <= 0 && String(line.line_status || '').toLowerCase() !== 'shortage',
|
||||
).length);
|
||||
const formalResultArtifact = computed(() => formalTaskDetail.value?.export_artifacts?.[0] || null);
|
||||
const formalResultCompletedAt = computed(() => (
|
||||
formalTaskDetail.value?.upload_attempts?.find((attempt) => String(attempt.status || '').toLowerCase() === 'succeeded')?.finished_at
|
||||
|| formalTaskDetail.value?.updated_at
|
||||
|| formalTaskDetail.value?.created_at
|
||||
|| null
|
||||
));
|
||||
const formalResultIsCompleted = computed(() => {
|
||||
const status = String(formalTaskDetail.value?.process_status || '').toLowerCase();
|
||||
return ['completed', 'uploaded', 'closed'].includes(status)
|
||||
|| String(formalTaskDetail.value?.upload_status || '').toLowerCase() === 'uploaded';
|
||||
});
|
||||
|
||||
/** 直接在订单复核页打开人工上传登记,避免依赖仅在 formal_task 模式挂载的 TaskTodoPanel ref。 */
|
||||
function openManualUploadRegistration() {
|
||||
if (!confirmedNoticeTaskNo.value) {
|
||||
msg.warning(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
return;
|
||||
}
|
||||
manualUploadRegistrationOpen.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工上传登记成功后刷新完整工作台状态。
|
||||
* 先重新拉取 Review Case(顶部阶段与 Gate 的权威投影),再刷新任务详情和统一处理投影;
|
||||
* 不能只刷新 OT 详情,否则登记已落库但页面仍会显示旧的人工上传阻断状态。
|
||||
*/
|
||||
async function handleManualUploadSuccess() {
|
||||
manualUploadRegistrationOpen.value = false;
|
||||
await reloadLatestDraft();
|
||||
await Promise.all([
|
||||
loadFormalTaskDetail(),
|
||||
refreshShippingProcessing(),
|
||||
]);
|
||||
}
|
||||
const formalTodoPanelRef = ref<{
|
||||
invokeActionByCode: (actionId: string) => Promise<void>;
|
||||
openCustomerDialog: () => Promise<void>;
|
||||
@@ -1686,7 +1674,9 @@ async function loadFormalTaskDetail() {
|
||||
watch(
|
||||
[confirmedNoticeTaskNo, workbenchMode, hasCreatedShippingTask],
|
||||
([taskNo, mode, created]) => {
|
||||
if (taskNo && created && (mode === 'formal_task' || mode === 'confirm_progress')) {
|
||||
const completed = String(displayCase.value?.current_stage?.code || '').trim().toLowerCase() === 'completed'
|
||||
|| String(displayCase.value?.user_status || '').trim().toLowerCase() === 'completed';
|
||||
if (taskNo && created && (mode === 'formal_task' || mode === 'confirm_progress' || completed)) {
|
||||
void loadFormalTaskDetail();
|
||||
return;
|
||||
}
|
||||
@@ -2115,50 +2105,33 @@ const retryStpAutoCreate = async () => {
|
||||
|
||||
/**
|
||||
* 对话级「重试自动推进」:扫描会话下可恢复 Case/正式 OT。
|
||||
* 核心逻辑:调用 retryWorkspaceConversationAutoProgress;打开结果弹窗;刷新草稿与处理投影。
|
||||
* 核心逻辑:调用 retryWorkspaceConversationAutoProgress;以内嵌摘要展示逐项结果;刷新草稿与处理投影。
|
||||
*/
|
||||
const retryConversationAutoProgress = async () => {
|
||||
const id = String(conversationId.value || '').trim();
|
||||
if (!id || conversationRetrying.value || !showConversationRetry.value) return;
|
||||
if (caseSwitchLoading.value || progressRetrying.value) return;
|
||||
conversationRetrying.value = true;
|
||||
conversationRetryError.value = '';
|
||||
try {
|
||||
const result = await retryWorkspaceConversationAutoProgress(id);
|
||||
conversationRetryResult.value = {
|
||||
summary: result.summary,
|
||||
items: result.items || [],
|
||||
};
|
||||
conversationRetryResultOpen.value = true;
|
||||
// 结果只以短暂提示反馈;逐项详情由用户主动打开右侧抽屉,避免占用复核主内容。
|
||||
showConversationRetryToast();
|
||||
await reloadLatestDraft();
|
||||
await refreshShippingProcessing();
|
||||
} catch (error) {
|
||||
msg.error(resolveReviewErrorMessage(error));
|
||||
// 批量动作失败只影响本次扫描;错误以内嵌提示展示,避免 toast 遮挡并允许继续切换任务。
|
||||
conversationRetryError.value = resolveReviewErrorMessage(error);
|
||||
showConversationRetryToast();
|
||||
} finally {
|
||||
conversationRetrying.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 「关闭并刷新」:关闭对话级重试结果弹窗并重新拉取工作台投影。
|
||||
*/
|
||||
const closeConversationRetryResult = async () => {
|
||||
conversationRetryResultOpen.value = false;
|
||||
conversationRetryResult.value = null;
|
||||
await reloadLatestDraft();
|
||||
await refreshShippingProcessing();
|
||||
};
|
||||
|
||||
/**
|
||||
* 对话级重试跳过原因文案:优先 i18n reason.*,否则回退原始 reason_code。
|
||||
* @param reasonCode - 后端 reason_code
|
||||
*/
|
||||
const conversationRetrySkipReasonLabel = (reasonCode?: string | null) => {
|
||||
const code = String(reasonCode || '').trim();
|
||||
if (!code) return '';
|
||||
const key = `chat.shippingOrderReview.conversationRetry.reason.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
};
|
||||
|
||||
/**
|
||||
* 滚动到工作台锚点(data-testid)。
|
||||
*/
|
||||
@@ -2319,6 +2292,7 @@ const onUnifiedProcessingAction = async (item: ActionPresentationItem) => {
|
||||
const resultEl = document.querySelector('[data-testid="review-formal-task-result-region"]');
|
||||
if (resultEl) {
|
||||
resultEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
msg.info(t('chat.shippingOrderReview.workbench.actionSuccess'));
|
||||
} else {
|
||||
scrollWorkbenchAnchor('review-formal-task-todo-panel');
|
||||
msg.info(t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
@@ -2353,10 +2327,14 @@ const onUnifiedProcessingAction = async (item: ActionPresentationItem) => {
|
||||
}
|
||||
|
||||
if (behavior === 'todo_panel') {
|
||||
const todoCode = entry.todoActionCode || item.actionCode;
|
||||
if (todoCode === 'mark_manual_uploaded') {
|
||||
openManualUploadRegistration();
|
||||
return;
|
||||
}
|
||||
workbenchMode.value = 'formal_task';
|
||||
if (!(await ensureFormalTaskDetailReady())) return;
|
||||
scrollWorkbenchAnchor(entry.scrollTestId || 'review-formal-task-todo-panel');
|
||||
const todoCode = entry.todoActionCode || item.actionCode;
|
||||
await formalTodoPanelRef.value?.invokeActionByCode(todoCode);
|
||||
return;
|
||||
}
|
||||
@@ -2877,10 +2855,12 @@ watch(
|
||||
:conversation-retry-eligible-count="conversationRetryEligibleCount"
|
||||
:conversation-retrying="conversationRetrying"
|
||||
:conversation-retry-disabled="caseSwitchLoading || progressRetrying"
|
||||
:has-conversation-retry-result="hasConversationRetryAttention"
|
||||
@back="back"
|
||||
@open-version-history="openVersionHistory"
|
||||
@open-audit-trail="openAuditTrail"
|
||||
@retry-conversation-auto-progress="() => void retryConversationAutoProgress()"
|
||||
@open-conversation-retry-result="conversationRetryDrawerOpen = true"
|
||||
/>
|
||||
|
||||
<div
|
||||
@@ -2991,6 +2971,7 @@ watch(
|
||||
:item="reviewProgressContext"
|
||||
:task-no="authoritativeOrderTaskNo"
|
||||
:polling="workflowProgressPolling"
|
||||
:refreshing="shippingProcessingLoading"
|
||||
:processing-projection="shippingProcessingProjection"
|
||||
:has-formal-ot="hasFormalOt"
|
||||
data-testid="review-shipping-processing-strip"
|
||||
@@ -2999,7 +2980,7 @@ watch(
|
||||
/>
|
||||
|
||||
<section
|
||||
v-if="hasCreatedShippingTask && workbenchMode === 'formal_task' && formalTaskDetail"
|
||||
v-if="hasCreatedShippingTask && formalTaskDetail && (workbenchMode === 'formal_task' || formalResultIsCompleted)"
|
||||
class="rounded-xl border border-default bg-surface p-3"
|
||||
data-testid="review-formal-task-todo-panel"
|
||||
>
|
||||
@@ -3010,13 +2991,69 @@ watch(
|
||||
<div v-if="formalTaskDetailLoading" class="py-4 text-center text-xs text-muted">
|
||||
{{ t('workspace.shippingNotice.loading') }}
|
||||
</div>
|
||||
<section
|
||||
v-else-if="formalResultIsCompleted"
|
||||
class="mb-3 rounded-xl border border-emerald-200 bg-emerald-50/60 p-3 dark:border-emerald-900 dark:bg-emerald-950/20"
|
||||
data-testid="review-formal-task-result-panel"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<h3 class="text-sm font-semibold text-emerald-900 dark:text-emerald-100">
|
||||
{{ t('chat.shippingOrderReview.workbench.resultTitle') }}
|
||||
</h3>
|
||||
<span class="rounded-full bg-emerald-600 px-2 py-0.5 text-[11px] font-medium text-white">
|
||||
{{ t('chat.shippingOrderReview.workbench.resultCompleted') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-3 grid gap-2 text-xs text-emerald-950 dark:text-emerald-50 sm:grid-cols-3">
|
||||
<div>
|
||||
<div class="text-emerald-700/80 dark:text-emerald-200/80">{{ t('chat.shippingOrderReview.workbench.resultLines') }}</div>
|
||||
<div class="mt-0.5 font-semibold">{{ formalResultLineResults.length }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-emerald-700/80 dark:text-emerald-200/80">{{ t('chat.shippingOrderReview.workbench.resultMatched') }}</div>
|
||||
<div class="mt-0.5 font-semibold">{{ formalResultMatchedCount }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-emerald-700/80 dark:text-emerald-200/80">{{ t('chat.shippingOrderReview.workbench.resultShortage') }}</div>
|
||||
<div class="mt-0.5 font-semibold">{{ formalResultShortageCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="formalResultLineResults.length" class="mt-3 overflow-x-auto rounded-lg border border-emerald-200/80 bg-white/70 dark:border-emerald-900 dark:bg-slate-950/30">
|
||||
<table class="min-w-full text-xs">
|
||||
<thead class="border-b border-emerald-200/80 text-left dark:border-emerald-900">
|
||||
<tr>
|
||||
<th class="px-2 py-1.5 font-medium">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th>
|
||||
<th class="px-2 py-1.5 font-medium">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th>
|
||||
<th class="px-2 py-1.5 font-medium">{{ t('chat.shippingOrderReview.workbench.resultStatus') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="line in formalResultLineResults" :key="`${line.reservation_id || ''}-${line.part_number}`" class="border-b border-emerald-100 last:border-0 dark:border-emerald-950">
|
||||
<td class="px-2 py-1.5">{{ line.part_number || '-' }}</td>
|
||||
<td class="px-2 py-1.5">{{ line.reservation_id || '-' }}</td>
|
||||
<td class="px-2 py-1.5">{{ Number(line.shortage_qty || 0) > 0 ? t('chat.shippingOrderReview.workbench.resultShortage') : t('chat.shippingOrderReview.workbench.resultMatched') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="mt-3 flex flex-wrap items-center justify-between gap-2 text-xs">
|
||||
<span>{{ t('chat.shippingOrderReview.workbench.resultArtifact', { file: formalResultArtifact?.file_name || formalTaskDetail.export_file_name || '-' }) }}</span>
|
||||
<button v-if="formalResultArtifact || formalTaskDetail.export_file_name" type="button" class="rounded-lg border border-emerald-300 bg-white px-2.5 py-1.5 font-medium text-emerald-800 hover:bg-emerald-100 dark:border-emerald-800 dark:bg-slate-900 dark:text-emerald-100" data-testid="review-formal-task-result-download" @click="() => void downloadWorkspaceShippingExcelFile(confirmedNoticeTaskNo)">
|
||||
{{ t('workspace.shippingNotice.todo.downloadExcel') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="formalResultCompletedAt" class="mt-2 text-[11px] text-emerald-700/80 dark:text-emerald-200/80">
|
||||
{{ t('chat.shippingOrderReview.workbench.resultCompletedAt', { time: formalResultCompletedAt }) }}
|
||||
</div>
|
||||
</section>
|
||||
<TaskTodoPanel
|
||||
v-else-if="formalTaskDetail"
|
||||
v-else
|
||||
ref="formalTodoPanelRef"
|
||||
:detail="formalTaskDetail"
|
||||
:gate-can-handle="false"
|
||||
:gate-can-handle="workbenchActionsExecutable"
|
||||
:actions-executable="workbenchActionsExecutable"
|
||||
:hide-primary-actions="true"
|
||||
:hide-gate-card="true"
|
||||
:expected-notice-task-no="confirmedNoticeTaskNo"
|
||||
:expected-order-task-no="authoritativeOrderTaskNo"
|
||||
:expected-review-case-no="activeCase?.case_no || null"
|
||||
@@ -3224,11 +3261,13 @@ watch(
|
||||
</div>
|
||||
<div
|
||||
v-if="showWorkbenchCaseShell"
|
||||
class="relative space-y-2"
|
||||
class="relative space-y-2 transition-opacity duration-150"
|
||||
:class="caseSwitchLoading ? 'pointer-events-none opacity-70' : ''"
|
||||
data-testid="review-case-workbench-shell"
|
||||
:data-case-switching="caseSwitchLoading ? '1' : '0'"
|
||||
:data-case-switch-failed="caseSwitchFailed ? '1' : '0'"
|
||||
:data-case-projection-version="caseProjectionVersion ?? ''"
|
||||
:aria-busy="caseSwitchLoading ? 'true' : 'false'"
|
||||
>
|
||||
<ReviewWorkbenchModeToggle
|
||||
v-if="workbenchMode === 'evidence' || workbenchMode === 'inventory'"
|
||||
@@ -3254,30 +3293,16 @@ watch(
|
||||
:automation="displayCase?.automation"
|
||||
:show-retry="showObjectRetryOnRail"
|
||||
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
|
||||
:retryable="shippingProcessingProjection?.retryable ?? showObjectRetryOnRail"
|
||||
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
|
||||
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
|
||||
:primary-action="shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action"
|
||||
:retrying="taskRetryButtonDisabled || progressRetrying || caseSwitchLoading"
|
||||
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
|
||||
:retrying="displayCase?.process_gate?.current_blocking_gate
|
||||
? (progressRetrying || caseSwitchLoading)
|
||||
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
|
||||
:retry-exhausted-sources="taskInventoryExhaustedSources"
|
||||
:loading="caseContentSkeleton"
|
||||
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
|
||||
/>
|
||||
<ReviewInventoryIssueFallbackCard
|
||||
v-if="hasFormalOt && displayCase?.inventory_issue_fallback && !displayCase?.line_fulfillment?.has_line_inventory_projection"
|
||||
:fallback="displayCase.inventory_issue_fallback"
|
||||
:busy="Boolean(lineOpsBusyKey)"
|
||||
@retry-preparation="() => void retryCaseInventoryFallback()"
|
||||
/>
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!reparseProgressActive && showHumanBlockingGate && displayCase?.process_gate"
|
||||
:summary="displayCase.process_gate"
|
||||
:can-handle="false"
|
||||
:navigation-context="reviewGateNavigationContext"
|
||||
:field-labels="reviewFieldLabels"
|
||||
@refreshed="reloadLatestDraft"
|
||||
@refresh-needed="reloadLatestDraft"
|
||||
@confirm-customer="(taskNo) => void page.openShippingCustomerDialog?.(taskNo)"
|
||||
/>
|
||||
<ReviewCustomerResolutionPanel
|
||||
v-if="activeCase && !activeCase.customer_resolution?.resolved && showEligibilityAsPrimary"
|
||||
ref="customerResolutionPanelRef"
|
||||
@@ -3705,9 +3730,7 @@ watch(
|
||||
<ReviewLineInventoryOps
|
||||
:line="lineFulfillmentFor(String(line.line_key || ''))"
|
||||
:editable="editable"
|
||||
:busy="lineOpsBusyKey === String(line.line_key || '') || saving"
|
||||
:task-running="taskAutomationRunning"
|
||||
@retry-line="() => void retryLineUnified(String(line.line_key || ''))"
|
||||
:busy="saving"
|
||||
@close-line="openCloseFulfillmentDialog([String(line.line_key || '')])"
|
||||
/>
|
||||
</div>
|
||||
@@ -3813,16 +3836,35 @@ watch(
|
||||
:has-formal-ot="shippingProcessingProjection?.hasFormalOt ?? hasFormalOt"
|
||||
:shipping-notice-no="shippingProcessingProjection?.shippingNoticeNo ?? confirmedNoticeTaskNo"
|
||||
:user-status="shippingProcessingProjection?.userStatus ?? displayCase?.user_status"
|
||||
:retryable="shippingProcessingProjection?.retryable ?? showObjectRetryOnRail"
|
||||
:retryable="displayCase?.process_gate?.current_blocking_gate ? false : (shippingProcessingProjection?.retryable ?? showObjectRetryOnRail)"
|
||||
:blocking-reason="shippingProcessingProjection?.blockingReason ?? displayCase?.blocking_reason"
|
||||
:primary-action="shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action"
|
||||
:retrying="taskRetryButtonDisabled || progressRetrying || caseSwitchLoading"
|
||||
:primary-action="displayCase?.process_gate?.current_blocking_gate ? null : (shippingProcessingProjection?.primaryAction ?? displayCase?.primary_action)"
|
||||
:retrying="displayCase?.process_gate?.current_blocking_gate
|
||||
? (progressRetrying || caseSwitchLoading)
|
||||
: (taskRetryButtonDisabled || progressRetrying || caseSwitchLoading)"
|
||||
:retry-exhausted-sources="taskInventoryExhaustedSources"
|
||||
:loading="caseContentSkeleton"
|
||||
@retry="() => void (hasFormalOt ? retryFormalOtAutoProgress() : retryStpAutoCreate())"
|
||||
@locate="(lineKey, fieldId) => handleCurrentTaskLocate(lineKey, fieldId)"
|
||||
@action="(code, params) => void handleCurrentTaskAction(code, params)"
|
||||
/>
|
||||
<ReviewInventoryIssueFallbackCard
|
||||
v-if="hasFormalOt && displayCase?.inventory_issue_fallback && !displayCase?.line_fulfillment?.has_line_inventory_projection"
|
||||
:fallback="displayCase.inventory_issue_fallback"
|
||||
:busy="false"
|
||||
@retry-preparation="() => void retryCaseInventoryFallback()"
|
||||
/>
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!reparseProgressActive && showHumanBlockingGate && displayCase?.process_gate && hasCreatedShippingTask"
|
||||
:summary="displayCase.process_gate"
|
||||
:can-handle="workbenchActionsExecutable"
|
||||
:navigation-context="reviewGateNavigationContext"
|
||||
:field-labels="reviewFieldLabels"
|
||||
@refreshed="reloadLatestDraft"
|
||||
@refresh-needed="reloadLatestDraft"
|
||||
@confirm-customer="(taskNo) => void page.openShippingCustomerDialog?.(taskNo)"
|
||||
@manual-upload="() => void openManualUploadRegistration()"
|
||||
/>
|
||||
<ReviewProfileMatchPanel
|
||||
:profile-match="displayCase?.profile_match"
|
||||
/>
|
||||
@@ -3948,6 +3990,20 @@ watch(
|
||||
@open-audit="() => { processDetailOpen = false; auditTrailOpen = true; }"
|
||||
/>
|
||||
|
||||
<ManualUploadEvidenceDialog
|
||||
v-model:open="manualUploadRegistrationOpen"
|
||||
:task-no="confirmedNoticeTaskNo"
|
||||
:artifact-id="formalTaskDetail?.export_artifacts?.[0]?.id || null"
|
||||
:disabled="!workbenchActionsExecutable"
|
||||
@success="() => { void handleManualUploadSuccess(); }"
|
||||
/>
|
||||
|
||||
<ReviewConversationRetryDrawer
|
||||
:open="conversationRetryDrawerOpen"
|
||||
:result="conversationRetryResult"
|
||||
@close="conversationRetryDrawerOpen = false"
|
||||
/>
|
||||
|
||||
<ReviewUnsavedSwitchDialog
|
||||
:open="unsavedSwitchOpen"
|
||||
:unsaved-count="unsavedEditCount"
|
||||
@@ -3958,52 +4014,26 @@ watch(
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="conversationRetryResultOpen && conversationRetryResult"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4"
|
||||
data-testid="review-conversation-retry-result"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
v-if="conversationRetryToastOpen"
|
||||
class="fixed right-4 top-16 z-50 max-w-xs rounded-full border border-slate-200 bg-white px-3 py-1.5 text-[11px] shadow-md dark:border-slate-700 dark:bg-slate-900"
|
||||
data-testid="review-conversation-retry-toast"
|
||||
role="status"
|
||||
>
|
||||
<div class="w-full max-w-md rounded-xl border border-slate-200 bg-white p-4 shadow-xl dark:border-slate-700 dark:bg-slate-900">
|
||||
<h2 class="text-sm font-semibold text-slate-900 dark:text-slate-100">
|
||||
{{ t('chat.shippingOrderReview.conversationRetry.title') }}
|
||||
</h2>
|
||||
<dl class="mt-3 space-y-1 text-xs text-slate-700 dark:text-slate-200">
|
||||
<div class="flex justify-between gap-3">
|
||||
<dt>{{ t('chat.shippingOrderReview.conversationRetry.retried') }}</dt>
|
||||
<dd data-testid="review-conversation-retry-retried">{{ conversationRetryResult.summary.retried }}</dd>
|
||||
</div>
|
||||
<div class="flex justify-between gap-3">
|
||||
<dt>{{ t('chat.shippingOrderReview.conversationRetry.skipped') }}</dt>
|
||||
<dd data-testid="review-conversation-retry-skipped">{{ conversationRetryResult.summary.skipped }}</dd>
|
||||
</div>
|
||||
<div class="flex justify-between gap-3">
|
||||
<dt>{{ t('chat.shippingOrderReview.conversationRetry.failed') }}</dt>
|
||||
<dd data-testid="review-conversation-retry-failed">{{ conversationRetryResult.summary.failed }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<ul
|
||||
v-if="conversationRetryResult.items.some((item) => item.outcome === 'skipped')"
|
||||
class="mt-3 max-h-40 space-y-1 overflow-y-auto text-xs text-slate-600 dark:text-slate-300"
|
||||
data-testid="review-conversation-retry-skip-list"
|
||||
>
|
||||
<li
|
||||
v-for="item in conversationRetryResult.items.filter((row) => row.outcome === 'skipped')"
|
||||
:key="`${item.object_type}:${item.object_ref}`"
|
||||
>
|
||||
{{ item.object_ref }}:{{ conversationRetrySkipReasonLabel(item.reason_code) || t('chat.shippingOrderReview.conversationRetry.skipped') }}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="mt-4 flex justify-end">
|
||||
<div class="flex items-center gap-2">
|
||||
<RefreshCw class="h-3.5 w-3.5 shrink-0 text-amber-600" />
|
||||
<p v-if="conversationRetryError" class="text-rose-700 dark:text-rose-300">{{ conversationRetryError }}</p>
|
||||
<p v-else class="text-slate-700 dark:text-slate-200">
|
||||
{{ conversationRetryError || t('chat.shippingOrderReview.conversationRetry.toast', { retried: conversationRetryResult?.summary.retried || 0 }) }}
|
||||
<button
|
||||
v-if="hasConversationRetryAttention"
|
||||
type="button"
|
||||
class="rounded bg-sky-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-sky-500"
|
||||
data-testid="review-conversation-retry-close-refresh"
|
||||
@click="() => void closeConversationRetryResult()"
|
||||
class="ml-2 font-medium text-sky-700 hover:underline dark:text-sky-300"
|
||||
data-testid="review-conversation-retry-toast-open"
|
||||
@click="conversationRetryDrawerOpen = true"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.conversationRetry.closeAndRefresh') }}
|
||||
{{ t('chat.shippingOrderReview.conversationRetry.viewResult') }}
|
||||
</button>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ export async function postWorkspaceProcessGateAction(
|
||||
`${WORKSPACE_BASE}/${encodeURIComponent(executionNo)}/gates/${encodeURIComponent(gateCode)}/actions`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
);
|
||||
|
||||
+54
-40
@@ -4,18 +4,17 @@
|
||||
* 依赖:Vitest、Vue Test Utils、vue-i18n、process-gates.api mock。
|
||||
* 逻辑:构造未知环节/动作/技术自由文本;断言业务文案与审计 i18n;切换 execution_no 后清空审计。
|
||||
*/
|
||||
import { flushPromises, mount } from '@vue/test-utils';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import workspaceZhCn from '@/locales/zh-CN/workspace.json';
|
||||
import ProcessGateRecoveryCard from './ProcessGateRecoveryCard.vue';
|
||||
import type { ShippingProcessGateUserSummary } from '../types/process-gate.types';
|
||||
|
||||
const listAuditMock = vi.fn();
|
||||
const postActionMock = vi.fn();
|
||||
|
||||
vi.mock('../api/process-gates.api', () => ({
|
||||
listWorkspaceProcessGateAuditEvents: (...args: unknown[]) => listAuditMock(...args),
|
||||
postWorkspaceProcessGateAction: vi.fn(),
|
||||
postWorkspaceProcessGateAction: (...args: unknown[]) => postActionMock(...args),
|
||||
}));
|
||||
|
||||
vi.mock('vue-router', () => ({
|
||||
@@ -58,16 +57,7 @@ function baseSummary(overrides: Partial<ShippingProcessGateUserSummary> = {}): S
|
||||
|
||||
describe('ProcessGateRecoveryCard', () => {
|
||||
beforeEach(() => {
|
||||
listAuditMock.mockReset();
|
||||
listAuditMock.mockResolvedValue({
|
||||
items: [
|
||||
{
|
||||
id: 1,
|
||||
event_type: 'process_gate_attempt_started',
|
||||
created_at: '2026-08-01T00:00:00Z',
|
||||
},
|
||||
],
|
||||
});
|
||||
postActionMock.mockReset();
|
||||
});
|
||||
|
||||
it('does not expose internal gate, action or diagnostic text', () => {
|
||||
@@ -80,9 +70,13 @@ describe('ProcessGateRecoveryCard', () => {
|
||||
expect(text).toContain('当前步骤');
|
||||
expect(text).toContain('继续处理');
|
||||
expect(text).toContain('当前步骤需要人工处理');
|
||||
expect(text).toContain('责任方');
|
||||
expect(text).toContain('订单复核 / 任务负责人');
|
||||
expect(text).toContain('查看审计');
|
||||
expect(text).toContain('操作建议');
|
||||
expect(text).toContain('继续处理');
|
||||
expect(text).not.toContain('下一步:');
|
||||
expect(text).not.toContain('责任方');
|
||||
expect(text).not.toContain('查看审计');
|
||||
expect(wrapper.find('[data-testid="process-gate-recovery-primary"]').classes())
|
||||
.toEqual(expect.arrayContaining(['min-h-8', 'text-xs', 'border', 'bg-amber-600']));
|
||||
for (const technicalText of [
|
||||
'auto_build_gate_quality_gate_passed', 'quality_gate_internal', 'internal_reason_code',
|
||||
'internal_retry_action', 'HTTP 500', 'node_id', 'traceback', 'worker.py',
|
||||
@@ -123,33 +117,53 @@ describe('ProcessGateRecoveryCard', () => {
|
||||
expect(wrapper.find('[data-testid="process-gate-recovery-card"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('maps audit event codes to business labels and clears cache on execution change', async () => {
|
||||
it('does not render audit or internal execution details for end users', () => {
|
||||
const wrapper = mount(ProcessGateRecoveryCard, {
|
||||
props: { summary: baseSummary({ execution_no: 'EXEC-1' }), canHandle: true },
|
||||
props: { summary: baseSummary(), canHandle: true },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(wrapper.find('[data-testid="process-gate-view-audit"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="process-gate-recovery-targets"]').exists()).toBe(false);
|
||||
expect(wrapper.text()).not.toContain('执行尝试');
|
||||
expect(wrapper.text()).not.toContain('后台编号');
|
||||
});
|
||||
|
||||
await wrapper.get('[data-testid="process-gate-view-audit"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(listAuditMock).toHaveBeenCalledWith('EXEC-1', 1, 20);
|
||||
expect(wrapper.text()).toContain('开始执行处理');
|
||||
expect(wrapper.text()).not.toContain('process_gate_attempt_started');
|
||||
|
||||
listAuditMock.mockResolvedValue({
|
||||
items: [
|
||||
{
|
||||
id: 2,
|
||||
event_type: 'process_gate_blocked',
|
||||
created_at: '2026-08-01T01:00:00Z',
|
||||
},
|
||||
],
|
||||
it('renders a safe failure detail without exposing internal error text', () => {
|
||||
const wrapper = mount(ProcessGateRecoveryCard, {
|
||||
props: {
|
||||
summary: baseSummary({
|
||||
failure_detail: 'Excel 写入失败:模板列缺失',
|
||||
}),
|
||||
canHandle: true,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await wrapper.setProps({ summary: baseSummary({ execution_no: 'EXEC-2' }) });
|
||||
await flushPromises();
|
||||
expect(wrapper.text()).not.toContain('开始执行处理');
|
||||
await wrapper.get('[data-testid="process-gate-view-audit"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(listAuditMock).toHaveBeenCalledWith('EXEC-2', 1, 20);
|
||||
expect(wrapper.text()).toContain('处理环节已阻断');
|
||||
expect(wrapper.find('[data-testid="process-gate-failure-detail"]').text())
|
||||
.toContain('Excel 写入失败:模板列缺失');
|
||||
});
|
||||
|
||||
it('keeps one primary action even when server sends prerequisite recovery targets', () => {
|
||||
const wrapper = mount(ProcessGateRecoveryCard, {
|
||||
props: {
|
||||
summary: baseSummary({
|
||||
current_blocking_gate: {
|
||||
...baseSummary().current_blocking_gate!,
|
||||
gate_code: 'inventory_matching',
|
||||
next_action_code: 'open_inventory_match_review',
|
||||
},
|
||||
next_action_code: 'open_inventory_match_review',
|
||||
recovery_targets: [{
|
||||
action_code: 'retry_inventory_from_preparation',
|
||||
target_gate: 'inventory_preparation',
|
||||
resume_after_gate: 'inventory_matching',
|
||||
invalidates: ['inventory_snapshot'],
|
||||
}],
|
||||
}),
|
||||
canHandle: true,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(wrapper.find('[data-testid="process-gate-recovery-targets"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="process-gate-recovery-primary"]').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
+30
-255
@@ -1,44 +1,22 @@
|
||||
/**
|
||||
* features/shipping-process-gates/components/ProcessGateRecoveryCard.vue
|
||||
* 用途:任务/复核工作台展示当前待处理环节、原因、业务事实 details、责任方、下一步说明与恢复动作。
|
||||
* 用途:任务/复核工作台展示当前待处理环节、原因、失败详情、下一步说明与恢复动作。
|
||||
* 依赖:useShippingProcessGateRecovery、processGateNavigation、process-gates.api、
|
||||
* ShippingProcessGateUserSummary / ShippingExplainabilityReason。
|
||||
* 逻辑:仅 owner_type=human(且非 technical_auto_only)时渲染;系统 Worker 等待整卡隐藏;
|
||||
* 导航类动作 router.push;confirm_customer 发射 confirmCustomer 由父级开弹窗;
|
||||
* POST 类动作调 Workspace API;409 触发 refreshed;
|
||||
* 展示 explainability.details 白名单业务事实;下一步文案独立于按钮;
|
||||
* 可展开审计;canHandle=false 时不渲染恢复主按钮,提示用 Footer;
|
||||
* 下一步文案独立于按钮;canHandle=false 时不渲染恢复主按钮,提示用 Footer;
|
||||
* 禁止堆栈/路径/SQL。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useShippingProcessGateRecovery } from '../composables/useShippingProcessGateRecovery';
|
||||
import type { ProcessGateNavigationContext } from '../composables/processGateNavigation';
|
||||
import { listWorkspaceProcessGateAuditEvents } from '../api/process-gates.api';
|
||||
import type { ShippingProcessGateUserSummary } from '../types/process-gate.types';
|
||||
|
||||
/** 允许在卡片上展示的业务事实键(与后端 _USER_FACING_DETAIL_KEYS 对齐)。 */
|
||||
const DETAIL_FACT_KEYS = [
|
||||
'source_code',
|
||||
'source_codes',
|
||||
'unavailable_source_codes',
|
||||
'unavailable_reasons',
|
||||
'matched_rule_codes',
|
||||
'raw_rule_source_codes',
|
||||
'candidate_inventory_source_codes',
|
||||
'line_key',
|
||||
'line_index',
|
||||
'field_code',
|
||||
'request_id',
|
||||
'process_status',
|
||||
'match_status',
|
||||
'task_no',
|
||||
'has_inventory_lines',
|
||||
'has_export',
|
||||
'execution_no',
|
||||
'inventory_file_id',
|
||||
] as const;
|
||||
|
||||
const props = defineProps<{
|
||||
summary: ShippingProcessGateUserSummary | null | undefined;
|
||||
@@ -54,33 +32,21 @@ const emit = defineEmits<{
|
||||
navigate: [];
|
||||
/** 建单后客户确认:父级打开 ShippingCustomerConfirmDialog */
|
||||
confirmCustomer: [taskNo: string];
|
||||
/** Gate 20 人工上传登记:由任务面板打开既有登记弹窗。 */
|
||||
manualUpload: [];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const { busy, submitPrimaryAction } = useShippingProcessGateRecovery();
|
||||
const auditOpen = ref(false);
|
||||
const auditLoading = ref(false);
|
||||
const auditError = ref('');
|
||||
const auditItems = ref<Array<Record<string, unknown>>>([]);
|
||||
|
||||
/**
|
||||
* Execution 切换时清空审计缓存,避免组件复用展示上一任务的审计。
|
||||
*/
|
||||
watch(
|
||||
() => props.summary?.execution_no,
|
||||
() => {
|
||||
auditOpen.value = false;
|
||||
auditLoading.value = false;
|
||||
auditError.value = '';
|
||||
auditItems.value = [];
|
||||
},
|
||||
);
|
||||
|
||||
const blockingGate = computed(() => props.summary?.current_blocking_gate || null);
|
||||
const nextActionCode = computed(() =>
|
||||
String(props.summary?.next_action_code || blockingGate.value?.next_action_code || '').trim(),
|
||||
);
|
||||
const hasRecoveryAction = computed(() => Boolean(blockingGate.value && nextActionCode.value));
|
||||
const showManualUploadAction = computed(() => (
|
||||
String(blockingGate.value?.gate_code || '').trim().toLowerCase() === 'manual_upload_handoff'
|
||||
&& nextActionCode.value === 'retry_freight_upload_rpa'
|
||||
));
|
||||
|
||||
/**
|
||||
* 是否对业务用户展示「待处理事项」。
|
||||
@@ -100,13 +66,6 @@ const showAsHumanPending = computed(() => {
|
||||
});
|
||||
|
||||
/** 最近 Attempt 序号(用户可见);用于展示「已尝试 N 次」,不推导百分比。 */
|
||||
const latestAttemptNo = computed(() => {
|
||||
const raw = (blockingGate.value as { latest_attempt?: { attempt_no?: number } } | null)
|
||||
?.latest_attempt?.attempt_no;
|
||||
const n = Number(raw);
|
||||
return Number.isFinite(n) && n > 0 ? n : null;
|
||||
});
|
||||
|
||||
/** 仅允许自然语言业务说明进入界面,内部标识、路径和异常信息统一隐藏。 */
|
||||
function safeBusinessText(value: unknown): string {
|
||||
const text = String(value || '').trim();
|
||||
@@ -132,6 +91,12 @@ const actionLabel = computed(() => {
|
||||
return te(key) ? t(key) : t('workspace.shippingNotice.processGate.continueAction');
|
||||
});
|
||||
|
||||
/** 门禁级下一步说明:描述当前主动作将执行的业务动作,避免重复顶部泛化状态说明。 */
|
||||
const nextActionDescription = computed(() => {
|
||||
if (actionLabel.value) return actionLabel.value;
|
||||
return t('workspace.shippingNotice.processGate.noAction');
|
||||
});
|
||||
|
||||
/**
|
||||
* 用户可见阻断说明:优先 blocking_message,其次 i18n 原因码,禁止展示原始 code。
|
||||
*/
|
||||
@@ -148,118 +113,8 @@ const blockingReasonLabel = computed(() => {
|
||||
return te(key) ? t(key) : t('workspace.shippingNotice.processGate.genericBlocking');
|
||||
});
|
||||
|
||||
const diagnosticHint = computed(() => safeBusinessText(props.summary?.diagnostic_hint));
|
||||
|
||||
/**
|
||||
* 当前阻断涉及的具体字段/明细行;优先 Finding,兼容 explainability.details。
|
||||
* 技术字段标识只用于查找业务名称,不直接展示给用户。
|
||||
*/
|
||||
const blockingFieldRows = computed(() => {
|
||||
const findings = [
|
||||
...(props.summary?.current_findings || []),
|
||||
...((blockingGate.value as { findings?: Array<Record<string, unknown>> } | null)?.findings || []),
|
||||
];
|
||||
const sources = findings.length
|
||||
? findings
|
||||
: [props.summary?.explainability?.details || {}];
|
||||
const seen = new Set<string>();
|
||||
const rows: string[] = [];
|
||||
for (const finding of sources) {
|
||||
const details = finding.details && typeof finding.details === 'object'
|
||||
? finding.details as Record<string, unknown>
|
||||
: finding;
|
||||
const fieldKey = String(
|
||||
details.field_code || details.field_id || finding.field_code || finding.field_id || '',
|
||||
).trim();
|
||||
if (!fieldKey) continue;
|
||||
const fieldLabel = props.fieldLabels?.[fieldKey];
|
||||
if (!fieldLabel) continue;
|
||||
const lineRaw = details.line_index ?? finding.line_index;
|
||||
const lineIndex = Number(lineRaw);
|
||||
const label = Number.isFinite(lineIndex)
|
||||
? t('workspace.shippingNotice.processGate.blockingLineField', {
|
||||
line: lineIndex + 1,
|
||||
field: fieldLabel,
|
||||
})
|
||||
: fieldLabel;
|
||||
if (seen.has(label)) continue;
|
||||
seen.add(label);
|
||||
rows.push(label);
|
||||
}
|
||||
return rows;
|
||||
});
|
||||
|
||||
/**
|
||||
* 责任方业务标签(owner/worker/system/admin/external)。
|
||||
*/
|
||||
const responsiblePartyLabel = computed(() => {
|
||||
const code = String(
|
||||
props.summary?.explainability?.responsible_party
|
||||
|| props.summary?.responsible_party
|
||||
|| '',
|
||||
).trim();
|
||||
if (!code) return '';
|
||||
const key = `workspace.shippingNotice.processGate.parties.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
});
|
||||
|
||||
/**
|
||||
* 独立「下一步」业务说明:优先动作 i18n,无动作时用无可执行提示。
|
||||
*/
|
||||
const nextActionDescription = computed(() => {
|
||||
if (actionLabel.value) {
|
||||
return t('workspace.shippingNotice.processGate.nextActionHint', { action: actionLabel.value });
|
||||
}
|
||||
return t('workspace.shippingNotice.processGate.noAction');
|
||||
});
|
||||
|
||||
/**
|
||||
* 将 details 中的值格式化为可读短文本。
|
||||
*/
|
||||
function formatDetailValue(value: unknown): string {
|
||||
if (value == null) return '';
|
||||
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
||||
return String(value);
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((item) => formatDetailValue(item)).filter(Boolean).join('、');
|
||||
}
|
||||
if (typeof value === 'object') {
|
||||
return Object.entries(value as Record<string, unknown>)
|
||||
.map(([key, item]) => `${key}=${formatDetailValue(item)}`)
|
||||
.join(';');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* explainability.details 业务事实行(库存源/规则/行号/request_id)。
|
||||
*/
|
||||
const detailFactRows = computed(() => {
|
||||
const details = props.summary?.explainability?.details;
|
||||
if (!details || typeof details !== 'object') return [] as Array<{ key: string; label: string; value: string }>;
|
||||
const rows: Array<{ key: string; label: string; value: string }> = [];
|
||||
for (const key of DETAIL_FACT_KEYS) {
|
||||
if (!(key in details)) continue;
|
||||
const value = formatDetailValue((details as Record<string, unknown>)[key]);
|
||||
if (!value) continue;
|
||||
const labelKey = `workspace.shippingNotice.processGate.detailKeys.${key}`;
|
||||
rows.push({
|
||||
key,
|
||||
label: te(labelKey) ? t(labelKey) : key,
|
||||
value,
|
||||
});
|
||||
}
|
||||
const requestId = String(props.summary?.explainability?.request_id || '').trim();
|
||||
if (requestId && !rows.some((row) => row.key === 'request_id')) {
|
||||
rows.push({
|
||||
key: 'request_id',
|
||||
label: t('workspace.shippingNotice.processGate.detailKeys.request_id'),
|
||||
value: requestId,
|
||||
});
|
||||
}
|
||||
return rows;
|
||||
});
|
||||
/** 当前失败的可排查详情;后端已脱敏,前端只做长度与技术词过滤。 */
|
||||
const failureDetail = computed(() => safeBusinessText(props.summary?.failure_detail));
|
||||
|
||||
/**
|
||||
* 触发恢复动作:本地客户弹窗 / 导航 / POST;409 时通知父级刷新最新 Gate 投影。
|
||||
@@ -287,56 +142,18 @@ async function runPrimaryAction() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 展开/收起 Gate 审计列表;首次展开时拉取 Workspace 审计 API。
|
||||
*/
|
||||
async function toggleAudit() {
|
||||
auditOpen.value = !auditOpen.value;
|
||||
if (!auditOpen.value || auditItems.value.length || !props.summary?.execution_no) return;
|
||||
auditLoading.value = true;
|
||||
auditError.value = '';
|
||||
try {
|
||||
const page = await listWorkspaceProcessGateAuditEvents(props.summary.execution_no, 1, 20);
|
||||
auditItems.value = Array.isArray(page.items) ? page.items as Array<Record<string, unknown>> : [];
|
||||
} catch {
|
||||
auditError.value = t('workspace.shippingNotice.processGate.auditLoadFailed');
|
||||
auditItems.value = [];
|
||||
} finally {
|
||||
auditLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化审计事件时间。
|
||||
*/
|
||||
function formatAuditTime(value: unknown): string {
|
||||
const text = String(value || '').trim();
|
||||
if (!text) return '—';
|
||||
const date = new Date(text);
|
||||
return Number.isNaN(date.getTime()) ? text : date.toLocaleString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将审计事件码映射为用户可读业务文案;未知码回退通用描述,不暴露内部码。
|
||||
*/
|
||||
function formatAuditEventLabel(item: Record<string, unknown>): string {
|
||||
const code = String(item.event_type || item.action || '').trim();
|
||||
if (!code) return t('workspace.shippingNotice.processGate.auditEventFallback');
|
||||
const key = `workspace.shippingNotice.processGate.auditEvents.${code}`;
|
||||
return te(key) ? t(key) : t('workspace.shippingNotice.processGate.auditEventFallback');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
v-if="showAsHumanPending"
|
||||
class="rounded-2xl border border-amber-200/80 bg-amber-50/60 px-4 py-3 dark:border-amber-900/50 dark:bg-amber-950/20"
|
||||
class="rounded-xl border border-amber-200/80 bg-amber-50/60 p-3 shadow-sm dark:border-amber-900/50 dark:bg-amber-950/20"
|
||||
data-testid="process-gate-recovery-card"
|
||||
>
|
||||
<div class="mb-2 text-xs font-semibold uppercase tracking-wide text-amber-800 dark:text-amber-200">
|
||||
<div class="mb-3 text-sm font-semibold text-amber-950 dark:text-amber-100">
|
||||
{{ $t('workspace.shippingNotice.processGate.title') }}
|
||||
</div>
|
||||
<dl class="grid gap-2 text-sm">
|
||||
<dl class="grid gap-2 text-xs leading-5 text-amber-950 dark:text-amber-100">
|
||||
<div>
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.currentGate') }}</dt>
|
||||
<dd class="font-medium text-secondary">{{ gateLabel }}</dd>
|
||||
@@ -345,50 +162,20 @@ function formatAuditEventLabel(item: Record<string, unknown>): string {
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.blockingMessage') }}</dt>
|
||||
<dd class="text-secondary">{{ blockingReasonLabel }}</dd>
|
||||
</div>
|
||||
<div v-if="blockingFieldRows.length" data-testid="process-gate-blocking-fields">
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.blockingFields') }}</dt>
|
||||
<dd class="text-secondary">{{ blockingFieldRows.join('、') }}</dd>
|
||||
</div>
|
||||
<div v-if="latestAttemptNo != null" data-testid="process-gate-attempt-count">
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.attemptCount') }}</dt>
|
||||
<dd class="text-secondary">
|
||||
{{ $t('workspace.shippingNotice.processGate.attemptCountValue', {
|
||||
current: latestAttemptNo,
|
||||
max: 3,
|
||||
}) }}
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="responsiblePartyLabel">
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.responsibleParty') }}</dt>
|
||||
<dd class="text-secondary">{{ responsiblePartyLabel }}</dd>
|
||||
<div v-if="failureDetail" data-testid="process-gate-failure-detail">
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.failureDetail') }}</dt>
|
||||
<dd class="text-secondary break-words">{{ failureDetail }}</dd>
|
||||
</div>
|
||||
<div data-testid="process-gate-next-action">
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.nextAction') }}</dt>
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.actionSuggestion') }}</dt>
|
||||
<dd class="text-secondary">{{ nextActionDescription }}</dd>
|
||||
</div>
|
||||
<div v-if="detailFactRows.length" data-testid="process-gate-detail-facts">
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.detailFacts') }}</dt>
|
||||
<dd class="mt-1 space-y-1 text-secondary">
|
||||
<div
|
||||
v-for="row in detailFactRows"
|
||||
:key="row.key"
|
||||
class="flex flex-wrap gap-x-2 text-xs"
|
||||
>
|
||||
<span class="text-muted">{{ row.label }}</span>
|
||||
<span class="font-mono break-all">{{ row.value }}</span>
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="diagnosticHint">
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.processGate.diagnosticHint') }}</dt>
|
||||
<dd class="text-secondary">{{ diagnosticHint }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div class="mt-3 flex flex-wrap items-center gap-2">
|
||||
<button
|
||||
v-if="hasRecoveryAction && canHandle"
|
||||
type="button"
|
||||
class="rounded-xl bg-primary px-3 py-1.5 text-sm font-medium text-on-primary disabled:opacity-60"
|
||||
class="inline-flex min-h-8 items-center rounded-md border border-amber-700 bg-amber-600 px-3 py-1.5 text-xs font-semibold text-white shadow-sm transition hover:bg-amber-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 focus-visible:ring-offset-2 disabled:opacity-60 dark:border-amber-400 dark:bg-amber-500 dark:text-slate-950 dark:hover:bg-amber-400"
|
||||
:disabled="busy"
|
||||
data-testid="process-gate-recovery-primary"
|
||||
@click="runPrimaryAction"
|
||||
@@ -396,14 +183,13 @@ function formatAuditEventLabel(item: Record<string, unknown>): string {
|
||||
{{ busy ? $t('workspace.shippingNotice.processGate.submitting') : actionLabel }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showManualUploadAction && canHandle"
|
||||
type="button"
|
||||
class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-secondary hover:bg-surface-soft"
|
||||
data-testid="process-gate-view-audit"
|
||||
@click="toggleAudit"
|
||||
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-manual-upload"
|
||||
@click="emit('manualUpload')"
|
||||
>
|
||||
{{ auditOpen
|
||||
? $t('workspace.shippingNotice.processGate.hideAudit')
|
||||
: $t('workspace.shippingNotice.processGate.viewAudit') }}
|
||||
{{ $t('workspace.shippingNotice.processGate.actionCodes.mark_manual_uploaded') }}
|
||||
</button>
|
||||
<span
|
||||
v-if="!canHandle && hasRecoveryAction"
|
||||
@@ -413,16 +199,5 @@ function formatAuditEventLabel(item: Record<string, unknown>): string {
|
||||
{{ $t('workspace.shippingNotice.processGate.readOnlyUseFooter') }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="auditOpen" class="mt-3 rounded-xl border border-default bg-surface px-3 py-2 text-xs">
|
||||
<p v-if="auditLoading" class="text-muted">{{ $t('workspace.shippingNotice.processGate.auditLoading') }}</p>
|
||||
<p v-else-if="auditError" class="text-rose-600">{{ auditError }}</p>
|
||||
<p v-else-if="!auditItems.length" class="text-muted">{{ $t('workspace.shippingNotice.processGate.auditEmpty') }}</p>
|
||||
<ul v-else class="space-y-2">
|
||||
<li v-for="(item, index) in auditItems" :key="String(item.id || index)" class="border-t border-default pt-2 first:border-t-0 first:pt-0">
|
||||
<div class="font-medium text-secondary">{{ formatAuditEventLabel(item) }}</div>
|
||||
<div class="text-muted">{{ formatAuditTime(item.created_at) }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
+83
-8
@@ -10,7 +10,10 @@ import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { BusinessError, resolveLocalizedErrorMessage } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { postWorkspaceProcessGateAction } from '../api/process-gates.api';
|
||||
import {
|
||||
getWorkspaceProcessExecution,
|
||||
postWorkspaceProcessGateAction,
|
||||
} from '../api/process-gates.api';
|
||||
import type {
|
||||
ShippingProcessGateActionCode,
|
||||
ShippingProcessGateUserSummary,
|
||||
@@ -44,6 +47,47 @@ function newIdempotencyKey(): string {
|
||||
return `pg-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
||||
}
|
||||
|
||||
const ATTEMPT_POLL_INTERVAL_MS = 800;
|
||||
const ATTEMPT_POLL_LIMIT = 25;
|
||||
const ATTEMPT_TERMINAL_STATUSES = new Set(['succeeded', 'failed', 'cancelled', 'superseded']);
|
||||
|
||||
/** 等待异步 Gate Attempt 进入终态,避免 Worker 完成前刷新到旧 Case 投影。 */
|
||||
async function waitForAttemptTerminal(
|
||||
executionNo: string,
|
||||
submittedGateCode: string,
|
||||
attemptId: number,
|
||||
): Promise<void> {
|
||||
for (let index = 0; index < ATTEMPT_POLL_LIMIT; index += 1) {
|
||||
const latest = await getWorkspaceProcessExecution(executionNo);
|
||||
const gateAttempt = latest.current_blocking_gate?.latest_attempt as (
|
||||
{ id?: number; status?: string } | null | undefined
|
||||
);
|
||||
const latestAttemptId = Number(gateAttempt?.id || 0);
|
||||
const latestAttemptStatus = String(gateAttempt?.status || '').trim().toLowerCase();
|
||||
if (
|
||||
(latestAttemptId === attemptId || latestAttemptId === 0)
|
||||
&& ATTEMPT_TERMINAL_STATUSES.has(latestAttemptStatus)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const currentGateCode = String(latest.current_blocking_gate?.gate_code || '').trim();
|
||||
const executionStatus = String(latest.status || '').trim().toLowerCase();
|
||||
if (
|
||||
currentGateCode
|
||||
&& currentGateCode !== submittedGateCode
|
||||
&& !['pending', 'queued', 'running'].includes(executionStatus)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (!latest.current_blocking_gate && ['completed', 'cancelled'].includes(
|
||||
executionStatus,
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
await new Promise((resolve) => window.setTimeout(resolve, ATTEMPT_POLL_INTERVAL_MS));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编排单次门禁恢复:导航类动作直接 router.push;其余 POST 到 Workspace API。
|
||||
* @returns busy 状态与 submitPrimaryAction 方法
|
||||
@@ -64,10 +108,20 @@ export function useShippingProcessGateRecovery() {
|
||||
options?: {
|
||||
payload?: Record<string, unknown>;
|
||||
navigationContext?: ProcessGateNavigationContext;
|
||||
/** 仅允许使用服务端 recovery_targets 下发的动作码覆盖主动作。 */
|
||||
actionCode?: ShippingProcessGateActionCode | string;
|
||||
},
|
||||
): Promise<ProcessGateActionResult> {
|
||||
const gate = summary.current_blocking_gate;
|
||||
const actionCode = (summary.next_action_code || gate?.next_action_code || '') as ShippingProcessGateActionCode | '';
|
||||
const requestedAction = String(options?.actionCode || '').trim();
|
||||
const serverRecoveryAction = (summary.recovery_targets || [])
|
||||
.find((target) => String(target.action_code || '').trim() === requestedAction)
|
||||
?.action_code;
|
||||
if (requestedAction && !serverRecoveryAction) {
|
||||
msg.warning(t('workspace.shippingNotice.processGate.noAction'));
|
||||
return { outcome: 'noop' };
|
||||
}
|
||||
const actionCode = (serverRecoveryAction || summary.next_action_code || gate?.next_action_code || '') as ShippingProcessGateActionCode | '';
|
||||
if (!summary.execution_no || !gate?.gate_code || !actionCode) {
|
||||
msg.warning(t('workspace.shippingNotice.processGate.noAction'));
|
||||
return { outcome: 'noop' };
|
||||
@@ -112,12 +166,36 @@ export function useShippingProcessGateRecovery() {
|
||||
}
|
||||
busy.value = true;
|
||||
try {
|
||||
await postWorkspaceProcessGateAction(summary.execution_no, String(gate.gate_code), {
|
||||
// 写入前重新读取服务端 Gate 版本,避免 Case 投影刷新稍慢时提交旧版本。
|
||||
// 动作归属仍由后端最终校验;若当前 Gate 已变化,不复用旧动作。
|
||||
let submitVersion = expectedVersion;
|
||||
try {
|
||||
const latest = await getWorkspaceProcessExecution(summary.execution_no);
|
||||
const latestGate = latest.current_blocking_gate;
|
||||
if (latestGate && String(latestGate.gate_code) === String(gate.gate_code)) {
|
||||
const latestVersion = Number(latestGate.evaluation_version);
|
||||
if (Number.isFinite(latestVersion) && latestVersion >= 1) submitVersion = latestVersion;
|
||||
}
|
||||
} catch {
|
||||
// 读取失败时继续使用页面快照版本,让后端版本锁决定是否允许写入。
|
||||
}
|
||||
const response = await postWorkspaceProcessGateAction(summary.execution_no, String(gate.gate_code), {
|
||||
action_code: actionCode,
|
||||
expected_gate_version: expectedVersion,
|
||||
expected_gate_version: submitVersion,
|
||||
idempotency_key: newIdempotencyKey(),
|
||||
payload: options?.payload,
|
||||
});
|
||||
if (response.dispatch === 'async_job' && Number(response.attempt?.id) > 0) {
|
||||
try {
|
||||
await waitForAttemptTerminal(
|
||||
summary.execution_no,
|
||||
String(gate.gate_code),
|
||||
Number(response.attempt.id),
|
||||
);
|
||||
} catch {
|
||||
// 最终仍由父级刷新完整 Case;短暂轮询失败不得把已受理动作误报为执行失败。
|
||||
}
|
||||
}
|
||||
msg.success(t('workspace.shippingNotice.processGate.actionSubmitted'));
|
||||
return { outcome: 'submitted' };
|
||||
} catch (error: unknown) {
|
||||
@@ -126,10 +204,7 @@ export function useShippingProcessGateRecovery() {
|
||||
|| error.status === 409
|
||||
);
|
||||
if (isVersionMismatch) {
|
||||
msg.warning(resolveLocalizedErrorMessage(
|
||||
'SHIPPING.PROCESS_GATE_VERSION_MISMATCH',
|
||||
error instanceof BusinessError ? error.message : undefined,
|
||||
));
|
||||
// 409 是并发刷新信号,不是需要弹窗的业务失败;父级会重新拉取完整 Case。
|
||||
return { outcome: 'refresh_needed' };
|
||||
}
|
||||
const message = error instanceof BusinessError
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {
|
||||
ShippingProcessGateProjection,
|
||||
ShippingProcessGateStatus,
|
||||
ShippingProcessGateUserSummary,
|
||||
ShippingProcessRecoveryTarget,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
export type {
|
||||
@@ -26,6 +27,7 @@ export type {
|
||||
ShippingProcessGateProjection,
|
||||
ShippingProcessGateStatus,
|
||||
ShippingProcessGateUserSummary,
|
||||
ShippingProcessRecoveryTarget,
|
||||
};
|
||||
|
||||
/** 门禁阻断原因详情(用户可见;details 仅业务事实)。 */
|
||||
|
||||
@@ -98,6 +98,8 @@ function toItem(
|
||||
const chatOrRight = surface === 'chat' || surface === 'right';
|
||||
if (intent === 'open_order_review' && chatOrRight) {
|
||||
labelKey = 'chat.shippingProcessing.action.open_order_processing';
|
||||
} else if (normalized === 'retry_freight_upload_rpa' || normalized === 'retry_upload') {
|
||||
labelKey = 'chat.shippingNoticeRetryUploadAction';
|
||||
} else if (intent === 'retry' && chatOrRight) {
|
||||
labelKey = 'chat.shippingProcessing.action.retry_parse';
|
||||
} else if (normalized === 'focus_task' && chatOrRight) {
|
||||
@@ -183,6 +185,8 @@ export function resolveProcessingActionPresentation(
|
||||
const code = String(raw || '').trim();
|
||||
if (!code) return;
|
||||
const key = code.toLowerCase();
|
||||
// 仅用于管理员恢复缺失待办记录,不作为普通用户履约动作展示。
|
||||
if (key === 'regenerate_manual_upload_todo') return;
|
||||
if (seen.has(key)) return;
|
||||
seen.add(key);
|
||||
const intent = mapActionCodeToIntent(code);
|
||||
@@ -218,11 +222,31 @@ export function resolveProcessingActionPresentation(
|
||||
};
|
||||
|
||||
pushCode(projection.primaryAction?.code || projection.currentGate?.nextActionCode);
|
||||
// Gate 20 同时保留两条用户路径:主动重试 RPA 与人工上传登记。
|
||||
// 该动作由正式任务面板打开登记弹窗,不走 Gate API。
|
||||
if (
|
||||
String(projection.currentGate?.gateCode || '').trim().toLowerCase() === 'manual_upload_handoff'
|
||||
&& items.some((item) => String(item.actionCode).toLowerCase() === 'retry_freight_upload_rpa')
|
||||
) {
|
||||
pushCode('mark_manual_uploaded');
|
||||
}
|
||||
// [ORDER-STABLE] 对 availableActions 标准化(去重 + 字典序排序),确保后端返回顺序不影响前端按钮顺序。
|
||||
const normalizedAvailableActions = normalizeActionCodes(projection.availableActions || []);
|
||||
for (const action of normalizedAvailableActions) {
|
||||
pushCode(action);
|
||||
}
|
||||
// Gate 19 RPA 失败时,人工登记作为任务级替代路径展示,避免与 RPA 重试并列。
|
||||
if (
|
||||
String(projection.currentGate?.gateCode || '').trim().toLowerCase() === 'freight_upload_rpa'
|
||||
&& items.some((item) => String(item.actionCode).toLowerCase() === 'retry_freight_upload_rpa')
|
||||
) {
|
||||
for (let index = items.length - 1; index >= 0; index -= 1) {
|
||||
const code = String(items[index]?.actionCode || '').toLowerCase();
|
||||
if (code === 'mark_manual_uploaded' || code === 'open_manual_upload' || code === 'wait_manual_upload') {
|
||||
items.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items.length === 0 && (status === 'completed' || status === 'failed' || status === 'cancelled')) {
|
||||
pushCode('view_result');
|
||||
|
||||
@@ -24,6 +24,7 @@ const props = defineProps<{
|
||||
projection: ShippingProcessingProjection;
|
||||
/** 宿主轮询中提示(显示在标题行)。 */
|
||||
polling?: boolean;
|
||||
refreshing?: boolean;
|
||||
/** 正式 OT 已创建时保留 prop 兼容(进度条不再展示当前需要文案)。 */
|
||||
hasFormalOt?: boolean;
|
||||
}>();
|
||||
@@ -182,9 +183,10 @@ function nodeShortLabel(stage: string): string {
|
||||
type="button"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-1 text-[11px] font-medium text-secondary hover:bg-surface-muted"
|
||||
data-testid="review-progress-refresh"
|
||||
:disabled="refreshing"
|
||||
@click="emit('refresh')"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.action.refresh') }}
|
||||
{{ refreshing ? t('chat.shippingOrderReview.workflowProgress.polling') : t('chat.shippingProcessing.action.refresh') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -124,6 +124,42 @@ describe('workbenchActionRegistry', () => {
|
||||
expect(result.secondary).toBeNull();
|
||||
});
|
||||
|
||||
it('shows RPA upload retry instead of manual upload entries when Gate 19 is blocked', () => {
|
||||
const result = resolveProcessingActionPresentation(projection({
|
||||
stage: 'freight_uploading',
|
||||
currentGate: {
|
||||
gateCode: 'freight_upload_rpa',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'retry_freight_upload_rpa',
|
||||
blockingReasonCode: 'upload_rpa_failed',
|
||||
attemptNo: 1,
|
||||
},
|
||||
availableActions: ['download_excel', 'mark_manual_uploaded'],
|
||||
}), { surface: 'review', actionsExecutable: true });
|
||||
|
||||
expect(result.primary?.actionCode).toBe('retry_freight_upload_rpa');
|
||||
expect(result.primary?.intent).toBe('retry');
|
||||
expect(result.secondary?.actionCode).toBe('download_excel');
|
||||
expect(result.overflow.map((item) => item.actionCode)).not.toContain('mark_manual_uploaded');
|
||||
});
|
||||
|
||||
it('does not turn the admin todo-regeneration recovery action into manual upload', () => {
|
||||
const result = resolveProcessingActionPresentation(projection({
|
||||
stage: 'freight_uploading',
|
||||
currentGate: {
|
||||
gateCode: 'manual_upload_handoff',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'regenerate_manual_upload_todo',
|
||||
blockingReasonCode: 'manual_upload_todo_missing',
|
||||
attemptNo: 1,
|
||||
},
|
||||
availableActions: ['download_excel'],
|
||||
}), { surface: 'review', actionsExecutable: true });
|
||||
|
||||
expect(result.primary?.actionCode).toBe('download_excel');
|
||||
expect(result.overflow.map((item) => item.actionCode)).not.toContain('regenerate_manual_upload_todo');
|
||||
});
|
||||
|
||||
it('hides confirm_customer when customer panel unavailable', () => {
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
||||
expect(shouldRenderWorkbenchAction(WORKBENCH_ACTION_REGISTRY.confirm_customer, {
|
||||
|
||||
+26
-10
@@ -2,7 +2,7 @@
|
||||
* features/workspace/shipping-task-center/TaskTodoPanel.actionsExecutable.spec.ts
|
||||
* 用途:验收 A2——Gate 只读时 Footer 委托 invokeActionByCode 仍可写。
|
||||
* 依赖:Vitest、Vue Test Utils、TaskTodoPanel、shipping.api mock。
|
||||
* 逻辑:gateCanHandle=false + actionsExecutable=true 时匹配库存 API 被调用;
|
||||
* 逻辑:gateCanHandle=false + actionsExecutable=true 时正式 Gate Action 被调用;
|
||||
* actionsExecutable=false 时直接返回;hidePrimaryActions 时不渲染 action_buttons。
|
||||
*/
|
||||
import { flushPromises, mount } from '@vue/test-utils';
|
||||
@@ -11,20 +11,22 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import TaskTodoPanel from './TaskTodoPanel.vue';
|
||||
import type { ShippingTaskDetail } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const matchInventory = vi.fn().mockResolvedValue({});
|
||||
const postGateAction = vi.fn().mockResolvedValue({});
|
||||
const refreshBadge = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock('@/features/chat/api/shipping.api', () => ({
|
||||
confirmWorkspaceShippingCustomer: vi.fn(),
|
||||
confirmWorkspaceShippingInventorySource: vi.fn(),
|
||||
freezeWorkspaceShippingOrder: vi.fn(),
|
||||
generateWorkspaceShippingExcel: vi.fn(),
|
||||
listWorkspaceShippingCustomerOptions: vi.fn().mockResolvedValue([]),
|
||||
matchWorkspaceShippingInventory: (...args: unknown[]) => matchInventory(...args),
|
||||
retryWorkspaceShippingUpload: vi.fn(),
|
||||
submitWorkspaceShippingDecision: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/shipping-process-gates/api/process-gates.api', () => ({
|
||||
postWorkspaceProcessGateAction: (...args: unknown[]) => postGateAction(...args),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/workspace/api/shipping-tasks.api', () => ({
|
||||
downloadWorkspaceShippingExcelFile: vi.fn(),
|
||||
}));
|
||||
@@ -77,18 +79,24 @@ function detail(): ShippingTaskDetail {
|
||||
summary: { title: 't', message: 'm' },
|
||||
action_buttons: [],
|
||||
checkpoint_kind: 'inventory',
|
||||
process_gate: null,
|
||||
process_gate: {
|
||||
execution_no: 'SPE-1',
|
||||
current_blocking_gate: {
|
||||
gate_code: 'inventory_matching',
|
||||
evaluation_version: 3,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as unknown as ShippingTaskDetail;
|
||||
}
|
||||
|
||||
describe('TaskTodoPanel actionsExecutable', () => {
|
||||
beforeEach(() => {
|
||||
matchInventory.mockClear();
|
||||
postGateAction.mockClear();
|
||||
refreshBadge.mockClear();
|
||||
});
|
||||
|
||||
it('invokes match API when gateCanHandle=false but actionsExecutable=true', async () => {
|
||||
it('invokes formal Gate Action when gateCanHandle=false but actionsExecutable=true', async () => {
|
||||
const wrapper = mount(TaskTodoPanel, {
|
||||
props: {
|
||||
detail: detail(),
|
||||
@@ -101,7 +109,15 @@ describe('TaskTodoPanel actionsExecutable', () => {
|
||||
expect(wrapper.get('[data-testid="gate-stub"]').attributes('data-can-handle')).toBe('false');
|
||||
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('match_inventory');
|
||||
await flushPromises();
|
||||
expect(matchInventory).toHaveBeenCalledWith('SN-1', undefined);
|
||||
expect(postGateAction).toHaveBeenCalledWith(
|
||||
'SPE-1',
|
||||
'inventory_matching',
|
||||
expect.objectContaining({
|
||||
action_code: 'retry_inventory_matching',
|
||||
expected_gate_version: 3,
|
||||
idempotency_key: expect.any(String),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('blocks fulfillment invoke when expectedNoticeTaskNo mismatches', async () => {
|
||||
@@ -117,7 +133,7 @@ describe('TaskTodoPanel actionsExecutable', () => {
|
||||
});
|
||||
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('match_inventory');
|
||||
await flushPromises();
|
||||
expect(matchInventory).not.toHaveBeenCalled();
|
||||
expect(postGateAction).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('no-ops invokeActionByCode when actionsExecutable=false', async () => {
|
||||
@@ -132,6 +148,6 @@ describe('TaskTodoPanel actionsExecutable', () => {
|
||||
});
|
||||
await (wrapper.vm as { invokeActionByCode: (id: string) => Promise<void> }).invokeActionByCode('match_inventory');
|
||||
await flushPromises();
|
||||
expect(matchInventory).not.toHaveBeenCalled();
|
||||
expect(postGateAction).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -23,9 +23,7 @@ import {
|
||||
confirmWorkspaceShippingCustomer,
|
||||
confirmWorkspaceShippingInventorySource,
|
||||
freezeWorkspaceShippingOrder,
|
||||
generateWorkspaceShippingExcel,
|
||||
listWorkspaceShippingCustomerOptions,
|
||||
matchWorkspaceShippingInventory,
|
||||
retryWorkspaceShippingUpload,
|
||||
submitWorkspaceShippingDecision,
|
||||
type ShippingFulfillmentOwnershipContext,
|
||||
@@ -35,6 +33,7 @@ import { refreshShippingTodoBadge } from '@/features/workspace/composables/useSh
|
||||
import InventorySourceSelectDialog from './InventorySourceSelectDialog.vue';
|
||||
import ManualUploadEvidenceDialog from './ManualUploadEvidenceDialog.vue';
|
||||
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
|
||||
import { postWorkspaceProcessGateAction } from '@/features/shipping-process-gates/api/process-gates.api';
|
||||
import type { ShippingProcessGateUserSummary } from '@/features/chat/types/shipping.api.types';
|
||||
import { gateSummaryIndicatesManualUpload } from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
|
||||
@@ -48,6 +47,8 @@ const props = withDefaults(defineProps<{
|
||||
actionsExecutable?: boolean;
|
||||
/** 为 true 时隐藏全部 action_buttons(订单处理工作台写入口仅 Footer)。 */
|
||||
hidePrimaryActions?: boolean;
|
||||
/** 订单处理工作台将 Gate 卡提升到右侧展示时隐藏此处重复卡。 */
|
||||
hideGateCard?: boolean;
|
||||
/** 工作台权威正式 Notice 号;与 detail.task_no 不一致时禁止履约写。 */
|
||||
expectedNoticeTaskNo?: string | null;
|
||||
/** 工作台权威 OT 号,随履约 API 校验归属。 */
|
||||
@@ -61,6 +62,7 @@ const props = withDefaults(defineProps<{
|
||||
gateCanHandle: undefined,
|
||||
actionsExecutable: undefined,
|
||||
hidePrimaryActions: false,
|
||||
hideGateCard: false,
|
||||
expectedNoticeTaskNo: null,
|
||||
expectedOrderTaskNo: null,
|
||||
expectedReviewCaseNo: null,
|
||||
@@ -223,6 +225,7 @@ const visibleActions = computed(() => {
|
||||
if (hasBlockingGate.value) return [];
|
||||
return actionButtons.value.filter((action) => {
|
||||
const id = String(action.id || '');
|
||||
if (id === 'regenerate_manual_upload_todo') return false;
|
||||
if (UNIFIED_OWNED_ACTION_IDS.has(id)) {
|
||||
return false;
|
||||
}
|
||||
@@ -419,6 +422,24 @@ async function assertFulfillmentOwnership(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 将兼容按钮收口为服务端正式 Gate Action;缺少 Projection 身份时只刷新。 */
|
||||
async function requestProjectedGateAction(actionCode: string): Promise<boolean> {
|
||||
const executionNo = String(processGateSummary.value?.execution_no || '').trim();
|
||||
const gate = processGateSummary.value?.current_blocking_gate;
|
||||
const gateCode = String(gate?.gate_code || '').trim();
|
||||
const version = Number(gate?.evaluation_version);
|
||||
if (!executionNo || !gateCode || !Number.isInteger(version)) {
|
||||
emit('refreshed');
|
||||
return false;
|
||||
}
|
||||
await postWorkspaceProcessGateAction(executionNo, gateCode, {
|
||||
action_code: actionCode,
|
||||
expected_gate_version: version,
|
||||
idempotency_key: `task-todo:${executionNo}:${gateCode}:${version}:${actionCode}:${crypto.randomUUID()}`,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行后端允许的动作;人工上传/客户/库存源/冻结走对话框,其余走对应工作台 API。
|
||||
*/
|
||||
@@ -458,12 +479,12 @@ async function runAction(action: ShippingChatAction) {
|
||||
return;
|
||||
}
|
||||
if (id === 'generate_excel') {
|
||||
await generateWorkspaceShippingExcel(props.detail.task_no, ownership);
|
||||
await requestProjectedGateAction('regenerate_excel_artifact');
|
||||
await afterSuccess();
|
||||
return;
|
||||
}
|
||||
if (id === 'match_inventory' || id === 'rematch') {
|
||||
await matchWorkspaceShippingInventory(props.detail.task_no, ownership);
|
||||
await requestProjectedGateAction('retry_inventory_matching');
|
||||
await afterSuccess();
|
||||
return;
|
||||
}
|
||||
@@ -511,6 +532,7 @@ defineExpose({
|
||||
<template>
|
||||
<div class="space-y-3">
|
||||
<ProcessGateRecoveryCard
|
||||
v-if="!hideGateCard"
|
||||
:summary="processGateSummary"
|
||||
:can-handle="resolvedGateCanHandle"
|
||||
:navigation-context="{
|
||||
@@ -520,6 +542,7 @@ defineExpose({
|
||||
@refreshed="afterSuccess"
|
||||
@refresh-needed="afterSuccess"
|
||||
@confirm-customer="() => void openCustomerDialog()"
|
||||
@manual-upload="() => void invokeActionByCode('mark_manual_uploaded')"
|
||||
/>
|
||||
<section
|
||||
v-if="!hasBlockingGate && !isSystemAutoWait"
|
||||
|
||||
@@ -1544,6 +1544,16 @@
|
||||
"formalEditTarget": "Current edit target: formal task",
|
||||
"actionSuccess": "Action completed",
|
||||
"resultNotReady": "Processing result is not ready yet",
|
||||
"resultTitle": "Processing result",
|
||||
"resultCompleted": "Completed",
|
||||
"resultLines": "Order lines",
|
||||
"resultMatched": "Inventory matched",
|
||||
"resultShortage": "Inventory shortage",
|
||||
"resultPartNumber": "Part number",
|
||||
"resultReservation": "Reservation ID",
|
||||
"resultStatus": "Status",
|
||||
"resultArtifact": "Shipping Excel: {file}",
|
||||
"resultCompletedAt": "Completed at: {time}",
|
||||
"enterInventory": "View inventory issues",
|
||||
"returnStandard": "Back to standard review",
|
||||
"openPdf": "Open PDF",
|
||||
@@ -1789,9 +1799,21 @@
|
||||
},
|
||||
"conversationRetry": {
|
||||
"title": "Conversation retry result",
|
||||
"subtitle": "Recoverable tasks were scanned and synced to the workbench",
|
||||
"retrying": "Submitting…",
|
||||
"viewResult": "View result",
|
||||
"toast": "Submitted {retried} task(s)",
|
||||
"outcome": {
|
||||
"queued": "Submitted",
|
||||
"needs_human": "Manual action",
|
||||
"failed": "Retry failed",
|
||||
"skipped": "Skipped",
|
||||
"unknown": "Status pending"
|
||||
},
|
||||
"retried": "Retried",
|
||||
"skipped": "Skipped",
|
||||
"failed": "Failed",
|
||||
"blocked": "Blocked",
|
||||
"closeAndRefresh": "Close and refresh",
|
||||
"reason": {
|
||||
"already_running": "Already running",
|
||||
@@ -2058,6 +2080,13 @@
|
||||
"wave": "Fulfillment wave",
|
||||
"task": "Formal task",
|
||||
"snapshotId": "Inventory snapshot ID",
|
||||
"inventorySource": "Actual inventory source",
|
||||
"inventoryFile": "Inventory file number",
|
||||
"inventoryFileSha256": "Inventory file SHA-256",
|
||||
"inventoryRow": "Inventory row",
|
||||
"requiredQty": "Required quantity",
|
||||
"availableQty": "Available quantity",
|
||||
"matchAttempt": "Match attempt",
|
||||
"matchedAt": "Match checked at",
|
||||
"decisionSource": "Decision source",
|
||||
"decisionSourceValue": {
|
||||
@@ -2282,6 +2311,8 @@
|
||||
"subtitle": "Shows which document profile matched this PDF and candidate scores. Changing the profile requires reparse.",
|
||||
"selected": "Selected profile",
|
||||
"noSelected": "No profile selected",
|
||||
"expandCandidates": "Show candidate profiles ({count})",
|
||||
"collapseCandidates": "Hide candidate profiles",
|
||||
"routeType": "Route type",
|
||||
"executionMode": "Execution mode",
|
||||
"score": "Score {score}",
|
||||
|
||||
@@ -191,6 +191,7 @@
|
||||
"title": "Action needed",
|
||||
"currentGate": "Current step",
|
||||
"blockingMessage": "What needs attention",
|
||||
"failureDetail": "Failure details",
|
||||
"blockingFields": "Blocking fields",
|
||||
"blockingLineField": "Line {line}: {field}",
|
||||
"reasonCode": "Reason",
|
||||
@@ -234,7 +235,8 @@
|
||||
"customerTaskMissing": "Task number missing — cannot open customer confirm. Refresh and try again.",
|
||||
"genericBlocking": "This step needs manual attention",
|
||||
"unknownStep": "Current step",
|
||||
"continueAction": "Continue",
|
||||
"continueAction": "Continue",
|
||||
"recoveryTargets": "Prerequisite recovery",
|
||||
"actionSubmitted": "Action submitted",
|
||||
"submitting": "Submitting…",
|
||||
"readOnlyUseFooter": "Use the footer action bar to proceed",
|
||||
@@ -261,10 +263,13 @@
|
||||
"recheck_freeze_readiness": "Recheck freeze readiness",
|
||||
"retry_task_creation": "Retry task creation",
|
||||
"retry_inventory_preparation": "Retry inventory preparation",
|
||||
"retry_inventory_from_preparation": "Recover from inventory preparation",
|
||||
"refresh_inventory_candidate_projection": "Refresh inventory candidate status",
|
||||
"poll_inventory_preparation": "Refresh inventory preparation progress",
|
||||
"upload_inventory_file": "Upload inventory file",
|
||||
"retry_inventory_field_mapping": "Retry inventory field mapping",
|
||||
"retry_inventory_from_field_mapping": "Recover from field mapping",
|
||||
"retry_inventory_from_matching": "Rematch using current inventory",
|
||||
"confirm_inventory_field_mapping": "Confirm inventory field mapping",
|
||||
"retry_inventory_matching": "Retry inventory matching",
|
||||
"open_inventory_match_review": "Open inventory match review",
|
||||
@@ -274,7 +279,8 @@
|
||||
"regenerate_excel_artifact": "Regenerate Excel",
|
||||
"poll_freight_upload_rpa": "Refresh freight upload progress",
|
||||
"retry_freight_upload_rpa": "Retry freight upload RPA",
|
||||
"regenerate_manual_upload_todo": "Regenerate manual-upload todo"
|
||||
"regenerate_manual_upload_todo": "Regenerate manual-upload todo",
|
||||
"mark_manual_uploaded": "Record manual upload"
|
||||
},
|
||||
"reasons": {
|
||||
"freeze_not_ready": "Order is not ready to build or freeze",
|
||||
@@ -330,6 +336,12 @@
|
||||
"inventory_file_identity_mismatch": "Returned file does not match the selected inventory source",
|
||||
"inventory_mapping_required": "Inventory field mapping requires confirmation",
|
||||
"inventory_match_failed": "Inventory matching failed",
|
||||
"inventory_candidates_required": "No inventory candidate set is available; fetch inventory before matching",
|
||||
"inventory_candidates_frozen_required": "Inventory candidates are not confirmed; complete source confirmation first",
|
||||
"inventory_snapshot_prepare_failed": "Inventory snapshot preparation failed; review inventory retrieval and retry",
|
||||
"inventory_snapshots_pending": "Inventory snapshots are still being prepared; refresh shortly",
|
||||
"inventory_match_not_ready": "Inventory is not ready for matching; complete inventory preparation first",
|
||||
"projection_data_inconsistent": "Processing data is inconsistent; refresh and retry, or contact an administrator",
|
||||
"inventory_insufficient": "Insufficient inventory",
|
||||
"inventory_shortage_review_required": "Inventory shortage requires review",
|
||||
"excel_not_ready": "Excel generation conditions are not met",
|
||||
@@ -391,6 +403,7 @@
|
||||
},
|
||||
"nextAction": "Next step",
|
||||
"nextActionHint": "Next: {action}",
|
||||
"actionSuggestion": "Recommended action",
|
||||
"detailFacts": "Key facts",
|
||||
"detailKeys": {
|
||||
"source_code": "Inventory source",
|
||||
|
||||
@@ -1544,6 +1544,16 @@
|
||||
"formalEditTarget": "วัตถุที่กำลังแก้ไข: งานอย่างเป็นทางการ",
|
||||
"actionSuccess": "ดำเนินการสำเร็จ",
|
||||
"resultNotReady": "ยังไม่สร้างผลการประมวลผล",
|
||||
"resultTitle": "ผลการประมวลผล",
|
||||
"resultCompleted": "เสร็จสมบูรณ์",
|
||||
"resultLines": "รายการคำสั่งซื้อ",
|
||||
"resultMatched": "จับคู่คลังสินค้าสำเร็จ",
|
||||
"resultShortage": "สินค้าคงคลังขาด",
|
||||
"resultPartNumber": "หมายเลขชิ้นส่วน",
|
||||
"resultReservation": "Reservation ID",
|
||||
"resultStatus": "สถานะ",
|
||||
"resultArtifact": "ไฟล์ Excel จัดส่ง: {file}",
|
||||
"resultCompletedAt": "เสร็จสิ้นเมื่อ: {time}",
|
||||
"enterInventory": "ดูปัญหาสต็อก",
|
||||
"returnStandard": "กลับสู่การตรวจมาตรฐาน",
|
||||
"openPdf": "เปิด PDF",
|
||||
@@ -1789,9 +1799,21 @@
|
||||
},
|
||||
"conversationRetry": {
|
||||
"title": "ผลการลองใหม่ระดับบทสนทนา",
|
||||
"subtitle": "สแกนงานที่กู้คืนได้ในบทสนทนานี้และซิงก์ไปยังเวิร์กเบนช์แล้ว",
|
||||
"retrying": "กำลังส่งใหม่…",
|
||||
"viewResult": "ดูผลลัพธ์",
|
||||
"toast": "ส่งงานใหม่แล้ว {retried} รายการ",
|
||||
"outcome": {
|
||||
"queued": "ส่งแล้ว",
|
||||
"needs_human": "ต้องดำเนินการโดยเจ้าหน้าที่",
|
||||
"failed": "ลองใหม่ล้มเหลว",
|
||||
"skipped": "ข้ามแล้ว",
|
||||
"unknown": "รอตรวจสอบสถานะ"
|
||||
},
|
||||
"retried": "ลองใหม่แล้ว",
|
||||
"skipped": "ข้ามแล้ว",
|
||||
"failed": "ล้มเหลว",
|
||||
"blocked": "ถูกบล็อกโดยเกต",
|
||||
"closeAndRefresh": "ปิดและรีเฟรช",
|
||||
"reason": {
|
||||
"already_running": "กำลังดำเนินการอยู่แล้ว",
|
||||
@@ -2058,6 +2080,13 @@
|
||||
"wave": "Wave การปฏิบัติตาม",
|
||||
"task": "งานอย่างเป็นทางการ",
|
||||
"snapshotId": "Inventory snapshot ID",
|
||||
"inventorySource": "แหล่งสินค้าคงคลังจริง",
|
||||
"inventoryFile": "หมายเลขไฟล์สินค้าคงคลัง",
|
||||
"inventoryFileSha256": "SHA-256 ไฟล์สินค้าคงคลัง",
|
||||
"inventoryRow": "แถวสินค้าคงคลัง",
|
||||
"requiredQty": "จำนวนที่ต้องการ",
|
||||
"availableQty": "จำนวนที่มี",
|
||||
"matchAttempt": "ครั้งที่จับคู่",
|
||||
"matchedAt": "เวลาตรวจสอบการจับคู่",
|
||||
"decisionSource": "แหล่งการตัดสินใจ",
|
||||
"decisionSourceValue": {
|
||||
@@ -2282,6 +2311,8 @@
|
||||
"subtitle": "แสดงเทมเพลตที่จับคู่กับ PDF นี้และคะแนนตัวเลือก การเปลี่ยนเทมเพลตต้องระบุใหม่",
|
||||
"selected": "เทมเพลตที่เลือก",
|
||||
"noSelected": "ยังไม่ได้เลือกเทมเพลต",
|
||||
"expandCandidates": "แสดงเทมเพลตที่เป็นไปได้ ({count})",
|
||||
"collapseCandidates": "ซ่อนเทมเพลตที่เป็นไปได้",
|
||||
"routeType": "ประเภทเส้นทาง",
|
||||
"executionMode": "โหมดการทำงาน",
|
||||
"score": "คะแนน {score}",
|
||||
|
||||
@@ -132,6 +132,7 @@
|
||||
"title": "รายการที่ต้องดำเนินการ",
|
||||
"currentGate": "ขั้นตอนปัจจุบัน",
|
||||
"blockingMessage": "เหตุผลที่ต้องดำเนินการ",
|
||||
"failureDetail": "รายละเอียดความล้มเหลว",
|
||||
"blockingFields": "ฟิลด์ที่ขัดขวาง",
|
||||
"blockingLineField": "แถว {line}: {field}",
|
||||
"reasonCode": "เหตุผล",
|
||||
@@ -175,7 +176,8 @@
|
||||
"customerTaskMissing": "ไม่มีหมายเลขงาน — ไม่สามารถเปิดยืนยันลูกค้าได้ โปรดรีเฟรชแล้วลองใหม่",
|
||||
"genericBlocking": "ขั้นตอนนี้ต้องดำเนินการด้วยตนเอง",
|
||||
"unknownStep": "ขั้นตอนปัจจุบัน",
|
||||
"continueAction": "ดำเนินการต่อ",
|
||||
"continueAction": "ดำเนินการต่อ",
|
||||
"recoveryTargets": "การกู้คืนขั้นก่อนหน้า",
|
||||
"actionSubmitted": "ส่งการดำเนินการแล้ว",
|
||||
"submitting": "กำลังส่ง…",
|
||||
"readOnlyUseFooter": "ใช้แถบดำเนินการด้านล่างเพื่อดำเนินการต่อ",
|
||||
@@ -194,6 +196,7 @@
|
||||
"retry_duplicate_detection": "ลองตรวจหาข้อมูลซ้ำอีกครั้ง",
|
||||
"adjudicate_duplicate": "ตัดสินคำสั่งซื้อซ้ำ",
|
||||
"reconcile_and_progress": "ปรับทานตัวและกู้คืนอัตโนมัติ",
|
||||
"refresh_inventory_candidate_projection": "รีเฟรชสถานะผู้สมัครสินค้าคงคลัง",
|
||||
"resolve_field_conflicts": "แก้ไขความขัดแย้งฟิลด์",
|
||||
"retry_with_latest_rules": "ลองใหม่ด้วยกฎล่าสุด",
|
||||
"open_inventory_source_review": "เปิดการตรวจสอบแหล่งสต็อก",
|
||||
@@ -202,9 +205,12 @@
|
||||
"recheck_freeze_readiness": "ตรวจสอบสิทธิ์การสร้างงานใหม่",
|
||||
"retry_task_creation": "ลองสร้างงานใหม่",
|
||||
"retry_inventory_preparation": "ลองเตรียมสต็อกใหม่",
|
||||
"retry_inventory_from_preparation": "กู้คืนจากขั้นเตรียมสต็อก",
|
||||
"poll_inventory_preparation": "รีเฟรชความคืบหน้าเตรียมสต็อก",
|
||||
"upload_inventory_file": "อัปโหลดไฟล์สต็อก",
|
||||
"retry_inventory_field_mapping": "ลองแมปฟิลด์สต็อกอีกครั้ง",
|
||||
"retry_inventory_from_field_mapping": "กู้คืนจากขั้นแมปฟิลด์สต็อก",
|
||||
"retry_inventory_from_matching": "จับคู่ใหม่ด้วยสต็อกปัจจุบัน",
|
||||
"confirm_inventory_field_mapping": "ยืนยันการแมปฟิลด์สต็อก",
|
||||
"retry_inventory_matching": "ลองจับคู่สต็อกอีกครั้ง",
|
||||
"open_inventory_match_review": "เปิดการตรวจสอบการจับคู่สต็อก",
|
||||
@@ -214,7 +220,8 @@
|
||||
"regenerate_excel_artifact": "สร้าง Excel ใหม่",
|
||||
"poll_freight_upload_rpa": "รีเฟรชความคืบหน้าอัปโหลด freight",
|
||||
"retry_freight_upload_rpa": "ลองอัปโหลด freight RPA อีกครั้ง",
|
||||
"regenerate_manual_upload_todo": "สร้างรายการอัปโหลดด้วยตนเองใหม่"
|
||||
"regenerate_manual_upload_todo": "สร้างรายการอัปโหลดด้วยตนเองใหม่",
|
||||
"mark_manual_uploaded": "บันทึกการอัปโหลดด้วยตนเอง"
|
||||
},
|
||||
"reasons": {
|
||||
"freeze_not_ready": "คำสั่งซื้อยังไม่พร้อมสร้างหรือ freeze",
|
||||
@@ -266,6 +273,16 @@
|
||||
"inventory_file_identity_mismatch": "ไฟล์ที่ได้รับไม่ตรงกับแหล่งสินค้าคงคลัง",
|
||||
"inventory_mapping_required": "ต้องยืนยันการแมปฟิลด์สินค้าคงคลัง",
|
||||
"inventory_match_failed": "จับคู่สินค้าคงคลังล้มเหลว",
|
||||
"inventory_candidates_required": "ยังไม่มีชุดผู้สมัครสินค้าคงคลัง จึงจับคู่ไม่ได้ โปรดดึงสินค้าคงคลังก่อน",
|
||||
"inventory_candidates_missing": "ไม่พบเวอร์ชันผู้สมัครสินค้าคงคลังอย่างเป็นทางการ โปรดเปิดการตรวจทานแหล่งสินค้าคงคลังอีกครั้ง",
|
||||
"inventory_candidate_version_stale": "เวอร์ชันผู้สมัครสินค้าคงคลังเปลี่ยนแปลง โปรดรีเฟรชและดำเนินการอีกครั้ง",
|
||||
"inventory_candidate_data_incomplete": "ข้อมูลผู้สมัครสินค้าคงคลังไม่ครบถ้วน โปรดยืนยันเวอร์ชันผู้สมัครใหม่",
|
||||
"inventory_match_out_of_candidate_scope": "ผลการจับคู่เกินขอบเขตผู้สมัครปัจจุบันและต้องตรวจทานด้วยคน",
|
||||
"inventory_candidates_frozen_required": "ยังไม่ได้ยืนยันผู้สมัครสินค้าคงคลัง โปรดยืนยันแหล่งสินค้าคงคลังก่อน",
|
||||
"inventory_snapshot_prepare_failed": "เตรียมสแนปช็อตสินค้าคงคลังล้มเหลว โปรดตรวจสอบผลการดึงข้อมูลแล้วลองใหม่",
|
||||
"inventory_snapshots_pending": "กำลังเตรียมสแนปช็อตสินค้าคงคลัง โปรดรีเฟรชอีกครั้งภายหลัง",
|
||||
"inventory_match_not_ready": "สินค้าคงคลังยังไม่พร้อมจับคู่ โปรดเตรียมสินค้าคงคลังก่อน",
|
||||
"projection_data_inconsistent": "ข้อมูลความคืบหน้าไม่สอดคล้อง โปรดรีเฟรชแล้วลองใหม่ หรือติดต่อผู้ดูแลระบบ",
|
||||
"inventory_insufficient": "สินค้าคงคลังไม่พอ",
|
||||
"inventory_shortage_review_required": "มีสินค้าขาด ต้องตรวจทานด้วยคน",
|
||||
"excel_not_ready": "ยังไม่พร้อมสร้าง Excel",
|
||||
@@ -327,6 +344,7 @@
|
||||
},
|
||||
"nextAction": "ขั้นตอนถัดไป",
|
||||
"nextActionHint": "ถัดไป: {action}",
|
||||
"actionSuggestion": "การดำเนินการที่แนะนำ",
|
||||
"detailFacts": "ข้อเท็จจริงสำคัญ",
|
||||
"detailKeys": {
|
||||
"source_code": "แหล่งสต็อก",
|
||||
|
||||
@@ -1578,6 +1578,16 @@
|
||||
"formalEditTarget": "当前编辑对象:正式任务",
|
||||
"actionSuccess": "操作已完成",
|
||||
"resultNotReady": "处理结果尚未生成",
|
||||
"resultTitle": "处理结果",
|
||||
"resultCompleted": "已完成",
|
||||
"resultLines": "订单明细",
|
||||
"resultMatched": "库存匹配成功",
|
||||
"resultShortage": "库存缺口",
|
||||
"resultPartNumber": "料号",
|
||||
"resultReservation": "Reservation ID",
|
||||
"resultStatus": "状态",
|
||||
"resultArtifact": "发货 Excel:{file}",
|
||||
"resultCompletedAt": "完成时间:{time}",
|
||||
"enterInventory": "查看库存问题",
|
||||
"returnStandard": "返回标准复核",
|
||||
"openPdf": "打开 PDF",
|
||||
@@ -1823,9 +1833,21 @@
|
||||
},
|
||||
"conversationRetry": {
|
||||
"title": "对话重试结果",
|
||||
"subtitle": "已扫描本会话可恢复任务,结果已同步到工作台",
|
||||
"retrying": "正在重新提交…",
|
||||
"viewResult": "查看结果",
|
||||
"toast": "已提交 {retried} 个任务",
|
||||
"outcome": {
|
||||
"queued": "已提交",
|
||||
"needs_human": "需人工处理",
|
||||
"failed": "重试失败",
|
||||
"skipped": "已跳过",
|
||||
"unknown": "状态待确认"
|
||||
},
|
||||
"retried": "已重试",
|
||||
"skipped": "已跳过",
|
||||
"failed": "失败",
|
||||
"blocked": "被门禁阻断",
|
||||
"closeAndRefresh": "关闭并刷新",
|
||||
"reason": {
|
||||
"already_running": "已在处理中",
|
||||
@@ -2104,6 +2126,13 @@
|
||||
"wave": "履约波次",
|
||||
"task": "正式任务",
|
||||
"snapshotId": "库存快照 ID",
|
||||
"inventorySource": "实际库存源",
|
||||
"inventoryFile": "库存文件编号",
|
||||
"inventoryFileSha256": "库存文件 SHA-256",
|
||||
"inventoryRow": "库存行号",
|
||||
"requiredQty": "需求数量",
|
||||
"availableQty": "可用数量",
|
||||
"matchAttempt": "匹配 Attempt",
|
||||
"matchedAt": "匹配校验时间",
|
||||
"decisionSource": "决定来源",
|
||||
"decisionSourceValue": {
|
||||
@@ -2328,6 +2357,8 @@
|
||||
"subtitle": "展示本 PDF 是否命中文档模板;字段缺失见「字段完整性」。",
|
||||
"selected": "命中模板",
|
||||
"noSelected": "未选定模板",
|
||||
"expandCandidates": "查看候选模板({count})",
|
||||
"collapseCandidates": "收起候选模板",
|
||||
"routeType": "路由类型",
|
||||
"executionMode": "执行模式",
|
||||
"score": "得分 {score}",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"title": "待处理事项",
|
||||
"currentGate": "当前处理环节",
|
||||
"blockingMessage": "需要处理的原因",
|
||||
"failureDetail": "失败详情",
|
||||
"blockingFields": "阻断字段",
|
||||
"blockingLineField": "第 {line} 行:{field}",
|
||||
"reasonCode": "处理原因",
|
||||
@@ -235,7 +236,8 @@
|
||||
"customerTaskMissing": "缺少任务编号,无法打开客户确认,请刷新后重试",
|
||||
"genericBlocking": "当前步骤需要人工处理",
|
||||
"unknownStep": "当前步骤",
|
||||
"continueAction": "继续处理",
|
||||
"continueAction": "继续处理",
|
||||
"recoveryTargets": "前置恢复",
|
||||
"actionSubmitted": "操作已提交",
|
||||
"submitting": "提交中…",
|
||||
"readOnlyUseFooter": "请使用底部操作栏继续处理",
|
||||
@@ -262,10 +264,13 @@
|
||||
"recheck_freeze_readiness": "重新检查建单资格",
|
||||
"retry_task_creation": "重试创建任务",
|
||||
"retry_inventory_preparation": "重试库存准备",
|
||||
"retry_inventory_from_preparation": "从库存准备重新恢复",
|
||||
"refresh_inventory_candidate_projection": "刷新库存候选状态",
|
||||
"poll_inventory_preparation": "刷新库存准备进度",
|
||||
"upload_inventory_file": "上传库存文件",
|
||||
"retry_inventory_field_mapping": "重试库存字段映射",
|
||||
"retry_inventory_from_field_mapping": "从字段映射重新恢复",
|
||||
"retry_inventory_from_matching": "使用当前库存重新匹配",
|
||||
"confirm_inventory_field_mapping": "确认库存字段映射",
|
||||
"retry_inventory_matching": "重试库存匹配",
|
||||
"open_inventory_match_review": "打开库存匹配复核",
|
||||
@@ -275,7 +280,8 @@
|
||||
"regenerate_excel_artifact": "重新生成 Excel",
|
||||
"poll_freight_upload_rpa": "刷新货代上传进度",
|
||||
"retry_freight_upload_rpa": "重试货代上传 RPA",
|
||||
"regenerate_manual_upload_todo": "重新生成待上传待办"
|
||||
"regenerate_manual_upload_todo": "重新生成待上传待办",
|
||||
"mark_manual_uploaded": "人工上传登记"
|
||||
},
|
||||
"reasons": {
|
||||
"freeze_not_ready": "订单尚未满足建单/冻结条件",
|
||||
@@ -331,6 +337,12 @@
|
||||
"inventory_file_identity_mismatch": "返回文件与所选库存源不一致",
|
||||
"inventory_mapping_required": "库存字段映射待确认",
|
||||
"inventory_match_failed": "库存匹配失败",
|
||||
"inventory_candidates_required": "当前没有库存候选集,无法开始库存匹配;请先重新获取库存",
|
||||
"inventory_candidates_frozen_required": "库存候选集尚未确认,无法开始库存匹配;请先完成库存源确认",
|
||||
"inventory_snapshot_prepare_failed": "库存快照准备失败,请查看库存获取结果后重试",
|
||||
"inventory_snapshots_pending": "库存快照仍在准备中,请稍后刷新进度",
|
||||
"inventory_match_not_ready": "库存尚未满足匹配条件,请先完成库存准备",
|
||||
"projection_data_inconsistent": "处理进度数据不一致,请刷新页面后重试;若仍失败请联系管理员",
|
||||
"inventory_insufficient": "库存不足",
|
||||
"inventory_shortage_review_required": "存在库存缺口,需要人工处理",
|
||||
"excel_not_ready": "当前尚不满足 Excel 生成条件",
|
||||
@@ -392,6 +404,7 @@
|
||||
},
|
||||
"nextAction": "下一步",
|
||||
"nextActionHint": "下一步:{action}",
|
||||
"actionSuggestion": "操作建议",
|
||||
"detailFacts": "关键事实",
|
||||
"detailKeys": {
|
||||
"source_code": "库存源",
|
||||
|
||||
@@ -1544,6 +1544,16 @@
|
||||
"formalEditTarget": "目前編輯對象:正式任務",
|
||||
"actionSuccess": "操作已完成",
|
||||
"resultNotReady": "處理結果尚未生成",
|
||||
"resultTitle": "處理結果",
|
||||
"resultCompleted": "已完成",
|
||||
"resultLines": "訂單明細",
|
||||
"resultMatched": "庫存匹配成功",
|
||||
"resultShortage": "庫存缺口",
|
||||
"resultPartNumber": "料號",
|
||||
"resultReservation": "Reservation ID",
|
||||
"resultStatus": "狀態",
|
||||
"resultArtifact": "發貨 Excel:{file}",
|
||||
"resultCompletedAt": "完成時間:{time}",
|
||||
"enterInventory": "查看庫存問題",
|
||||
"returnStandard": "返回標準複核",
|
||||
"openPdf": "開啟 PDF",
|
||||
@@ -1789,9 +1799,21 @@
|
||||
},
|
||||
"conversationRetry": {
|
||||
"title": "對話重試結果",
|
||||
"subtitle": "已掃描本對話可恢復任務,結果已同步至工作台",
|
||||
"retrying": "正在重新提交…",
|
||||
"viewResult": "查看結果",
|
||||
"toast": "已提交 {retried} 個任務",
|
||||
"outcome": {
|
||||
"queued": "已提交",
|
||||
"needs_human": "需人工處理",
|
||||
"failed": "重試失敗",
|
||||
"skipped": "已跳過",
|
||||
"unknown": "狀態待確認"
|
||||
},
|
||||
"retried": "已重試",
|
||||
"skipped": "已跳過",
|
||||
"failed": "失敗",
|
||||
"blocked": "被門禁阻斷",
|
||||
"closeAndRefresh": "關閉並重新整理",
|
||||
"reason": {
|
||||
"already_running": "已在處理中",
|
||||
@@ -2058,6 +2080,13 @@
|
||||
"wave": "履約波次",
|
||||
"task": "正式任務",
|
||||
"snapshotId": "庫存快照 ID",
|
||||
"inventorySource": "實際庫存源",
|
||||
"inventoryFile": "庫存文件編號",
|
||||
"inventoryFileSha256": "庫存文件 SHA-256",
|
||||
"inventoryRow": "庫存行號",
|
||||
"requiredQty": "需求數量",
|
||||
"availableQty": "可用數量",
|
||||
"matchAttempt": "匹配 Attempt",
|
||||
"matchedAt": "匹配校驗時間",
|
||||
"decisionSource": "決定來源",
|
||||
"decisionSourceValue": {
|
||||
@@ -2282,6 +2311,8 @@
|
||||
"subtitle": "展示本 PDF 命中的文件範本與候選分;更換範本需重新識別。",
|
||||
"selected": "命中範本",
|
||||
"noSelected": "未選定範本",
|
||||
"expandCandidates": "查看候選範本({count})",
|
||||
"collapseCandidates": "收起候選範本",
|
||||
"routeType": "路由類型",
|
||||
"executionMode": "執行模式",
|
||||
"score": "得分 {score}",
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
"title": "待處理事項",
|
||||
"currentGate": "目前處理環節",
|
||||
"blockingMessage": "需要處理的原因",
|
||||
"failureDetail": "失敗詳情",
|
||||
"blockingFields": "阻斷欄位",
|
||||
"blockingLineField": "第 {line} 行:{field}",
|
||||
"reasonCode": "處理原因",
|
||||
@@ -235,7 +236,8 @@
|
||||
"customerTaskMissing": "缺少任務編號,無法開啟客戶確認,請重新整理後再試",
|
||||
"genericBlocking": "目前步驟需要人工處理",
|
||||
"unknownStep": "目前步驟",
|
||||
"continueAction": "繼續處理",
|
||||
"continueAction": "繼續處理",
|
||||
"recoveryTargets": "前置恢復",
|
||||
"actionSubmitted": "操作已提交",
|
||||
"submitting": "提交中…",
|
||||
"readOnlyUseFooter": "請使用底部操作列繼續處理",
|
||||
@@ -262,10 +264,13 @@
|
||||
"recheck_freeze_readiness": "重新檢查建單資格",
|
||||
"retry_task_creation": "重試建立任務",
|
||||
"retry_inventory_preparation": "重試庫存準備",
|
||||
"retry_inventory_from_preparation": "從庫存準備重新恢復",
|
||||
"refresh_inventory_candidate_projection": "重新整理庫存候選狀態",
|
||||
"poll_inventory_preparation": "重新整理庫存準備進度",
|
||||
"upload_inventory_file": "上傳庫存檔案",
|
||||
"retry_inventory_field_mapping": "重試庫存欄位對應",
|
||||
"retry_inventory_from_field_mapping": "從欄位對應重新恢復",
|
||||
"retry_inventory_from_matching": "使用目前庫存重新匹配",
|
||||
"confirm_inventory_field_mapping": "確認庫存欄位對應",
|
||||
"retry_inventory_matching": "重試庫存匹配",
|
||||
"open_inventory_match_review": "開啟庫存匹配覆核",
|
||||
@@ -275,7 +280,8 @@
|
||||
"regenerate_excel_artifact": "重新產生 Excel",
|
||||
"poll_freight_upload_rpa": "重新整理貨代上傳進度",
|
||||
"retry_freight_upload_rpa": "重試貨代上傳 RPA",
|
||||
"regenerate_manual_upload_todo": "重新產生待上傳待辦"
|
||||
"regenerate_manual_upload_todo": "重新產生待上傳待辦",
|
||||
"mark_manual_uploaded": "人工上傳登記"
|
||||
},
|
||||
"reasons": {
|
||||
"freeze_not_ready": "訂單尚未滿足建單/凍結條件",
|
||||
@@ -331,6 +337,12 @@
|
||||
"inventory_file_identity_mismatch": "返回檔案與所選庫存源不一致",
|
||||
"inventory_mapping_required": "庫存欄位對應待確認",
|
||||
"inventory_match_failed": "庫存匹配失敗",
|
||||
"inventory_candidates_required": "目前沒有庫存候選集,無法開始庫存匹配;請先重新取得庫存",
|
||||
"inventory_candidates_frozen_required": "庫存候選集尚未確認,請先完成庫存來源確認",
|
||||
"inventory_snapshot_prepare_failed": "庫存快照準備失敗,請檢查庫存取得結果後重試",
|
||||
"inventory_snapshots_pending": "庫存快照仍在準備中,請稍後刷新進度",
|
||||
"inventory_match_not_ready": "庫存尚未滿足匹配條件,請先完成庫存準備",
|
||||
"projection_data_inconsistent": "處理進度資料不一致,請刷新頁面後重試;若仍失敗請聯繫管理員",
|
||||
"inventory_insufficient": "庫存不足",
|
||||
"inventory_shortage_review_required": "存在庫存缺口,需要人工處理",
|
||||
"excel_not_ready": "目前尚不滿足 Excel 產生條件",
|
||||
@@ -392,6 +404,7 @@
|
||||
},
|
||||
"nextAction": "下一步",
|
||||
"nextActionHint": "下一步:{action}",
|
||||
"actionSuggestion": "操作建議",
|
||||
"detailFacts": "關鍵事實",
|
||||
"detailKeys": {
|
||||
"source_code": "庫存源",
|
||||
|
||||
Reference in new issue
Block a user