feat(shipping-notice): 收敛订单处理状态与履约门禁

This commit is contained in:
hugo committed 2026-09-07 09:42:12 +08:00
1 parent bffcd55b40
commit 70dd0051b8
153 files changed
+10916 -4296

No files matched your search

@@ -24,8 +24,6 @@ export type ShippingActionId = (typeof SHIPPING_ACTION_IDS)[number];
export const SHIPPING_KNOWN_ACTION_ID_SET = new Set<string>(SHIPPING_ACTION_IDS);
/** Backend state-machine codes — must never appear in user-visible chat text. */
export const SHIPPING_TERMINAL_CHECKPOINTS = new Set(['uploaded', 'completed', 'rejected']);
export const SHIPPING_INTERNAL_STATUS_TOKENS = [
'rpa_pending',
'upload_rpa_pending',
@@ -1,259 +0,0 @@
<!--
features/chat/components/shipping-review/ReviewLineNoOverrideDialog.vue
用途:复核页编辑内部项次 line_no 时的强制原因弹窗(覆盖须审计)。
依赖:vue-i18n、dialog-overlay / dialog-panel。
逻辑:ShippingOrderReviewView 拦截 line_no 输入变更;确认后携带 reasonCode/reasonText 调用 patchLine。
确认仅发出事件,不自行关闭;父组件成功后再关,失败时保留原因选择与说明。
打开时聚焦原因选择框,Tab 焦点陷阱在弹窗内,关闭后恢复先前焦点。
-->
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
/** 与后端 LINE_NO_OVERRIDE_REASON_CODES 对齐的稳定原因码。 */
const LINE_NO_OVERRIDE_REASON_CODES = [
'recognition_error',
'customer_line_exception',
'business_correction',
'other',
] as const;
type LineNoOverrideReasonCode = (typeof LINE_NO_OVERRIDE_REASON_CODES)[number];
/** 内部项次覆盖确认载荷;供复核页 confirm 事件消费。 */
export type LineNoOverridePayload = {
value: string;
reasonCode: LineNoOverrideReasonCode;
reasonText: string;
};
interface Props {
modelValue: boolean;
/** 用户拟写入的新项次值(已在输入框中编辑)。 */
pendingValue: string;
confirmLoading?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
confirmLoading: false,
});
const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void;
(e: 'confirm', payload: LineNoOverridePayload): void;
(e: 'cancel'): void;
}>();
const { t } = useI18n();
const reasonCode = ref<LineNoOverrideReasonCode>('recognition_error');
const reasonText = ref('');
const reasonMissing = ref(false);
const textMissing = ref(false);
const panelRef = ref<HTMLElement | null>(null);
const reasonSelectRef = ref<HTMLSelectElement | null>(null);
let previouslyFocused: HTMLElement | null = null;
const FOCUSABLE_SELECTOR = [
'a[href]',
'button:not([disabled])',
'textarea:not([disabled])',
'input:not([disabled])',
'select:not([disabled])',
'[tabindex]:not([tabindex="-1"])',
].join(',');
const title = computed(() => t('chat.shippingOrderReview.lineNoOverrideDialog.title'));
const impact = computed(() => t('chat.shippingOrderReview.lineNoOverrideDialog.impact'));
/**
* 原因码展示文案。
* @param code - 后端允许的覆盖原因码
*/
const reasonLabel = (code: string) =>
t(`chat.shippingOrderReview.lineNoOverrideDialog.reasons.${code}`);
/** 收集弹窗内可聚焦控件,供 Tab 陷阱使用。 */
const focusableNodes = (): HTMLElement[] => {
if (!panelRef.value) return [];
return Array.from(panelRef.value.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR))
.filter((node) => !node.hasAttribute('disabled') && node.getAttribute('aria-hidden') !== 'true');
};
/** 关闭弹窗并同步 v-model。 */
const closeDialog = () => {
emit('update:modelValue', false);
};
const handleCancel = () => {
if (props.confirmLoading) return;
emit('cancel');
closeDialog();
};
/**
* 校验原因码与「其他」说明后提交覆盖。
* 核心逻辑:other 强制补充说明;确认后不关闭,由父组件在保存成功后再关,失败时保留表单。
*/
const handleConfirm = () => {
if (props.confirmLoading) return;
reasonMissing.value = false;
textMissing.value = false;
if (!reasonCode.value) {
reasonMissing.value = true;
return;
}
const trimmed = reasonText.value.trim();
if (reasonCode.value === 'other' && !trimmed) {
textMissing.value = true;
return;
}
emit('confirm', {
value: String(props.pendingValue ?? '').trim(),
reasonCode: reasonCode.value,
reasonText: trimmed,
});
};
/**
* Escape 关闭;Tab / Shift+Tab 在弹窗内循环,阻止焦点逃逸到背景页。
*/
const onKeydown = (event: KeyboardEvent) => {
if (!props.modelValue) return;
if (event.key === 'Escape' && !props.confirmLoading) {
event.preventDefault();
event.stopPropagation();
handleCancel();
return;
}
if (event.key !== 'Tab') return;
const nodes = focusableNodes();
const first = nodes[0];
const last = nodes[nodes.length - 1];
// noUncheckedIndexedAccess:空数组或下标越界时 first/last 可能为 undefined。
if (!first || !last) {
event.preventDefault();
return;
}
const active = document.activeElement as HTMLElement | null;
const inside = Boolean(active && panelRef.value?.contains(active));
if (event.shiftKey) {
if (!inside || active === first) {
event.preventDefault();
last.focus();
}
return;
}
if (!inside || active === last) {
event.preventDefault();
first.focus();
}
};
watch(
() => props.modelValue,
async (open, wasOpen) => {
if (typeof document === 'undefined') return;
if (open && !wasOpen) {
reasonCode.value = 'recognition_error';
reasonText.value = '';
reasonMissing.value = false;
textMissing.value = false;
previouslyFocused = document.activeElement instanceof HTMLElement
? document.activeElement
: null;
document.addEventListener('keydown', onKeydown, true);
await nextTick();
(reasonSelectRef.value || focusableNodes()[0])?.focus();
return;
}
if (!open && wasOpen) {
document.removeEventListener('keydown', onKeydown, true);
const restoreTarget = previouslyFocused;
previouslyFocused = null;
await nextTick();
restoreTarget?.focus?.();
}
},
);
onBeforeUnmount(() => {
if (typeof document !== 'undefined') {
document.removeEventListener('keydown', onKeydown, true);
}
});
</script>
<template>
<Teleport to="body">
<div
v-if="modelValue"
class="dialog-overlay z-50 flex items-center justify-center p-4"
role="dialog"
aria-modal="true"
:aria-label="title"
data-testid="review-line-no-override-dialog"
@click.self="handleCancel"
>
<div ref="panelRef" class="dialog-panel w-full max-w-md space-y-4 p-5">
<header>
<h2 class="text-base font-semibold text-primary" id="review-line-no-override-title">{{ title }}</h2>
<p class="mt-2 text-sm text-secondary">{{ impact }}</p>
<p class="mt-2 text-sm text-primary">
{{ t('chat.shippingOrderReview.lineNoOverrideDialog.newValue', { value: pendingValue || '—' }) }}
</p>
</header>
<label class="block space-y-1 text-sm">
<span class="text-secondary">{{ t('chat.shippingOrderReview.lineNoOverrideDialog.reasonCodeLabel') }}</span>
<select
ref="reasonSelectRef"
v-model="reasonCode"
class="select-field w-full text-sm"
data-testid="review-line-no-reason-code"
:disabled="confirmLoading"
:aria-labelledby="'review-line-no-override-title'"
@change="reasonMissing = false"
>
<option v-for="code in LINE_NO_OVERRIDE_REASON_CODES" :key="code" :value="code">
{{ reasonLabel(code) }}
</option>
</select>
<p v-if="reasonMissing" class="text-xs text-rose-600 dark:text-rose-400">
{{ t('chat.shippingOrderReview.lineNoOverrideDialog.reasonCodeRequired') }}
</p>
</label>
<label class="block space-y-1 text-sm">
<span class="text-secondary">{{ t('chat.shippingOrderReview.lineNoOverrideDialog.reasonTextLabel') }}</span>
<textarea
v-model="reasonText"
rows="3"
class="input-field w-full resize-y text-sm"
:placeholder="t('chat.shippingOrderReview.lineNoOverrideDialog.reasonTextPlaceholder')"
data-testid="review-line-no-reason-text"
:disabled="confirmLoading"
@input="textMissing = false"
/>
<p v-if="textMissing" class="text-xs text-rose-600 dark:text-rose-400">
{{ t('chat.shippingOrderReview.lineNoOverrideDialog.reasonTextRequired') }}
</p>
</label>
<footer class="flex justify-end gap-2 pt-1">
<button type="button" class="btn-secondary btn-sm" :disabled="confirmLoading" @click="handleCancel">
{{ t('common.deleteDialog.cancel') }}
</button>
<button
type="button"
class="btn-primary btn-sm"
:disabled="confirmLoading"
data-testid="review-line-no-override-submit"
@click="handleConfirm"
>
{{ confirmLoading ? t('chat.shippingOrderReview.saving') : t('chat.shippingOrderReview.lineNoOverrideDialog.confirm') }}
</button>
</footer>
</div>
</div>
</Teleport>
</template>
@@ -485,7 +485,7 @@ function workbenchFileGroup(file: WorkbenchFileRow): WorkbenchFileGroup | null {
const status = String(file.projection?.uiState?.status || file.projection?.userStatus || file.projection?.status || file.status_label || '')
.trim().toLowerCase();
if (status === 'retryable' || status === 'failed') return 'failed';
if (status === 'waiting_human' || status === 'idle') return 'waiting_human';
if (status === 'waiting_human') return 'waiting_human';
if (status === 'running' || status === 'processing') return 'processing';
if (status === 'completed') return 'completed';
if (status === 'cancelled') return 'cancelled';
@@ -564,8 +564,21 @@ function workbenchFileStatus(file: WorkbenchFileRow, task: ConversationProcessin
return resolveShippingProcessingStatusLabel(String(status), te, t);
}
/**
* 忽略分区文件行:不走 status 组与 taskGroup 对齐过滤(ignored 是展示桶,
* 父任务仍保留 domain group=processing/completed)。
*/
function ignoredWorkbenchFileRows(task: ConversationProcessingUserTask): WorkbenchFileRow[] {
return visibleWorkbenchFileRows(task).filter((file) => isIgnoredNonOrderAttachment(file.projection));
const filter = props.lifecycleFilter || 'all';
const query = String(props.fileSearchQuery || '').trim().toLowerCase();
return workbenchFileRows(task)
.filter((file) => isIgnoredNonOrderAttachment(file.projection))
.filter((file) => {
if (filter !== 'all' && String(file.projection?.uiState?.lifecycleStage || '') !== filter) return false;
if (!query) return true;
return [file.filename, file.label, file.po_number]
.some((value) => String(value || '').toLowerCase().includes(query));
});
}
/** Excel 附件不进入订单 PDF 识别;仅作为只读诊断行展示。 */
@@ -40,13 +40,13 @@ describe('useChat user attachment snapshots', () => {
const buildTaskUiStateEvent = (
taskNo: string,
actionId: string,
checkpoint = 'ready_export',
position = 'ready_export',
) => ({
event: 'shipping_ui_state',
task_no: taskNo,
ui_state: {
task_no: taskNo,
checkpoint,
position,
match_status: 'matched',
review_status: null,
pending_human_reason: null,
@@ -35,6 +35,7 @@ import {
getShippingParseReviewPayload,
sanitizeShippingConversationText,
} from '../shipping';
import { isShippingUiParseReview } from '../shipping/shippingUiPosition';
import { isShippingSpreadsheetFile } from '../shipping/shippingUploadPrompt';
import { extractExt } from '../constants/shipping';
import {
@@ -310,13 +311,8 @@ export function useChatShipping(options: UseChatShippingOptions) {
const normalizedTaskId = String(taskId || getActiveShippingTaskId() || '').trim().toUpperCase();
if (!conversationKey || !normalizedTaskId || !isShippingNoticeAgent.value || isShippingActionBusy.value) return;
const detail = activeShippingTaskDetail.value;
// 复核同步只消费后端统一 ui_state.checkpoint,不读取 review_status 等领域事实推导。
const checkpoint = String(
detail?.ui_state?.checkpoint?.code
|| detail?.ui_state?.checkpoint_code
|| '',
).trim();
if (checkpoint !== 'parse_review') return;
// 复核同步:优先 review_status / Gate / position(isShippingUiParseReview)。
if (!isShippingUiParseReview(detail?.ui_state || null)) return;
const exists = messages.value.some((msg) => {
if (msg.type !== 'shipping-parse-review' || !msg.payload || typeof msg.payload !== 'object') return false;
return String((msg.payload as { taskId?: string }).taskId || '').trim().toUpperCase() === normalizedTaskId;
@@ -58,4 +58,15 @@ describe('parseOrderReviewConfirmResponse', () => {
expect(parsed?.taskNo).toBe('SN-NOTICE');
expect(parsed?.orderTaskNo).toBe('OT-ROOT-C102');
});
it('reads auto_progress.position only', () => {
const parsed = parseOrderReviewConfirmResponse(baseResponse({
auto_progress: {
status: 'queued',
position: 'inventory_pending',
user_mode: 'auto_continue',
},
}));
expect(parsed?.position).toBe('inventory_pending');
});
});
@@ -3,18 +3,16 @@
* 用途:统一解析复核确认建单 API 的业务态,禁止调用方仅凭 HTTP/success/confirm_ok 判定推进成功。
* 依赖:ShippingOrderReviewConfirmResponse 类型。
* 逻辑:ShippingOrderReviewView / 其他确认调用方共用;与后端 resolve_confirm_outcome 枚举对齐;
* 同时暴露 shipping_notice_no 与 order_task_no,禁止用 Notice 编号聚焦 OT 卡。
* 同时暴露 shipping_notice_no 与 order_task_no,禁止用 Notice 编号聚焦 OT 卡;
* 位置只读 auto_progress.position。
*/
import type { ShippingOrderReviewConfirmResponse } from '@/features/chat/types/shipping.api.types';
/** 与后端 confirm_outcome 对齐的稳定枚举。 */
export type ShippingOrderReviewConfirmOutcome =
| 'confirmed_and_auto_progress_started'
| 'confirmed_auto_progress_failed'
| 'confirmed_auto_progress_not_scheduled'
| string;
/** 确认响应解析结果:建单与自动推进解耦。 */
export interface ParsedOrderReviewConfirmResult {
/** 正式 ShippingNotice 编号(自动推进 / 工作台)。 */
@@ -29,15 +27,14 @@ export interface ParsedOrderReviewConfirmResult {
progressFailed: boolean;
progressStatus: string;
progressMessage: string;
checkpoint: string;
/** Gate 位置标签(derive_position) */
position: string;
}
const PROGRESS_FAILED_STATUSES = new Set([
'enqueue_failed',
'sync_execution_failed',
'failed',
]);
/**
* 解析复核确认响应的业务态。
* 核心逻辑:confirm_ok 仅表示建单成功;推进成败读 confirm_outcome / auto_progress.status;
@@ -53,13 +50,11 @@ export function parseOrderReviewConfirmResponse(
response?.shipping_notice_no || response?.task_no || '',
).trim();
if (!taskNo) return null;
const orderTaskNo = String(
response?.order_task_no
|| response?.case?.order_task_no
|| '',
).trim();
const progressStatus = String(response?.auto_progress?.status || '').trim();
const confirmOutcome = String(response?.confirm_outcome || '').trim()
|| (PROGRESS_FAILED_STATUSES.has(progressStatus)
@@ -67,13 +62,11 @@ export function parseOrderReviewConfirmResponse(
: response?.auto_progress_started
? 'confirmed_and_auto_progress_started'
: 'confirmed_auto_progress_not_scheduled');
const progressFailed = confirmOutcome === 'confirmed_auto_progress_failed'
|| PROGRESS_FAILED_STATUSES.has(progressStatus);
const autoProgressStarted = Boolean(response?.auto_progress_started)
|| confirmOutcome === 'confirmed_and_auto_progress_started';
const position = String(response?.auto_progress?.position || '').trim();
return {
taskNo,
orderTaskNo,
@@ -83,6 +76,6 @@ export function parseOrderReviewConfirmResponse(
progressFailed,
progressStatus: progressStatus || confirmOutcome,
progressMessage: String(response?.auto_progress?.message || ''),
checkpoint: String(response?.auto_progress?.checkpoint || ''),
position,
};
}
@@ -524,6 +524,36 @@ describe('useShippingOrderReview build eligibility writes', () => {
expect(review.previewUrl.value).toMatch(/^blob:/);
});
it('refreshReviewQueue reloads lifecycle stages without touching Case or PDF preview', async () => {
const review = useShippingOrderReview();
await review.load('RUN-1', 'CASE-1');
const blob = new Blob(['%PDF'], { type: 'application/pdf' });
api.getPreview.mockResolvedValue(blob);
await review.ensurePreviewLoaded('CASE-1');
const previewBefore = review.previewUrl.value;
const caseCallsBefore = api.getCase.mock.calls.length;
api.getQueue.mockResolvedValue({
summary: { total: 1, needs_action: 0, processing: 0, completed: 1 },
items: [{
case_no: 'CASE-1',
document_id: 1,
status: 'confirmed',
issue_count: 0,
available_actions: [],
lifecycle_stage: 'upload_complete',
}],
});
const ok = await review.refreshReviewQueue();
// 左侧队列阶段必须可单独刷新;不得顺带切换 Case 或清掉已加载预览。
expect(ok).toBe(true);
expect(review.reviewQueue.value?.items[0]?.lifecycle_stage).toBe('upload_complete');
expect(api.getCase.mock.calls.length).toBe(caseCallsBefore);
expect(review.previewUrl.value).toBe(previewBefore);
expect(review.caseSwitchLoading.value).toBe(false);
});
it('discards a stale preview success after Case A switches to Case B', async () => {
const review = useShippingOrderReview();
await review.load('RUN-1', 'CASE-1');
@@ -709,6 +739,38 @@ describe('useShippingOrderReview build eligibility writes', () => {
expect(review.requestedCaseNo.value).toBe('CASE-FAIL');
});
it('beginCrossRunSwitch keeps workbench shell but drops previous OT projection authority', async () => {
// 关键断言:跨 Run 不清空 activeCase(避免大骨架),但必须撤销旧 OT,防止右卡/库存串味。
api.getCase.mockResolvedValueOnce(buildCase({ case_no: 'CASE-OLD' }));
api.getEvidence.mockResolvedValueOnce({ items: [] });
const review = useShippingOrderReview();
await review.selectCase('CASE-OLD');
review.reviewProgressContext.value = {
item_no: 'WI-1',
workflow_no: 'WF-1',
conversation_id: 'conv-1',
root_document_id: 1,
current_document_id: 1,
current_version_no: 1,
current_run_no: 'RUN-1',
current_case_no: 'CASE-OLD',
user_task_no: 'OT-OLD',
user_task_authoritative: true,
lifecycle_status: 'fulfillment_prep',
current_stage: 'fulfillment_prep',
lock_version: 1,
} as any;
review.beginCrossRunSwitch('CASE-NEW');
expect(review.caseSwitchLoading.value).toBe(true);
expect(review.requestedCaseNo.value).toBe('CASE-NEW');
expect(review.activeCase.value?.case_no).toBe('CASE-OLD');
expect(review.reviewProgressContext.value?.current_case_no).toBe('CASE-NEW');
expect(review.reviewProgressContext.value?.user_task_no).toBeNull();
expect(review.reviewProgressContext.value?.user_task_authoritative).toBe(false);
});
it('discards stale selectCase responses when switching PDFs quickly', async () => {
// 关键断言:A 后发先至不得覆盖后选的 B;切换时先清空瞬态。
let resolveA: ((value: ShippingOrderReviewCase) => void) | null = null;
@@ -1144,6 +1206,53 @@ describe('useShippingOrderReview build eligibility writes', () => {
expect(review.reviewProgressContext.value?.user_task_authoritative).toBe(true);
});
it('uses confirmed OT number when case order_task_no is empty but confirmed_task_no is OT-prefixed', async () => {
// 关键断言:正式任务下游 Case.order_task_no 可能暂空,但 confirmed_task_no 已是 OT 时
// 仍须启动 work-item 投影;否则右卡永久「正在获取最新状态 / 待机」。
api.getCase.mockResolvedValue(buildCase({
candidate_id: 42,
candidate: { candidate_no: 'CAND-42', validation_status: 'ready' },
status: 'confirmed',
has_formal_ot: true,
confirmed_task_no: 'OT-CONFIRMED-ONLY',
order_task_no: null,
}));
api.getRun.mockResolvedValue({
run_no: 'RUN-1',
summary: {},
items: [{ case_no: 'CASE-1', document_id: 1, status: 'confirmed', available_actions: [] }],
});
api.getEvidence.mockResolvedValue({ items: [] });
const review = useShippingOrderReview();
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1' });
expect(review.reviewProgressContext.value?.user_task_no).toBe('OT-CONFIRMED-ONLY');
expect(review.reviewProgressContext.value?.user_task_authoritative).toBe(true);
});
it('does not treat SN confirmed_task_no as order_task work-item key', async () => {
api.getCase.mockResolvedValue(buildCase({
candidate_id: 42,
candidate: { candidate_no: 'CAND-42', validation_status: 'ready' },
status: 'confirmed',
has_formal_ot: true,
confirmed_task_no: 'SN-NOTICE-1',
order_task_no: null,
}));
api.getRun.mockResolvedValue({
run_no: 'RUN-1',
summary: {},
items: [{ case_no: 'CASE-1', document_id: 1, status: 'confirmed', available_actions: [] }],
});
api.getEvidence.mockResolvedValue({ items: [] });
const review = useShippingOrderReview();
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1' });
expect(review.reviewProgressContext.value?.user_task_no).toBeNull();
});
it('leaves OT unset while waiting for a reparse Case when candidate-bound case lacks order_task_no', async () => {
vi.useFakeTimers();
api.getCase.mockResolvedValue(buildCase({
@@ -1375,6 +1484,55 @@ describe('useShippingOrderReview build eligibility writes', () => {
expect(api.getEvidence).not.toHaveBeenCalled();
});
it('[选法 2] selectCase skips Case + Evidence on formal downstream nav items', async () => {
api.getRun.mockResolvedValue({
run_no: 'RUN-1',
summary: {},
items: [
{
case_no: 'CASE-1', document_id: 1, status: 'confirmed',
lifecycle_stage: 'freight_upload', lifecycle_entries: [],
has_formal_ot: true, confirmed_task_no: 'OT-1',
},
{
case_no: 'CASE-2', document_id: 2, status: 'confirmed',
lifecycle_stage: 'freight_upload', lifecycle_entries: [],
has_formal_ot: true, confirmed_task_no: 'OT-2',
},
],
});
api.getQueue.mockResolvedValue({
summary: { total: 2, needs_action: 0, processing: 0, completed: 2 },
items: [
{
case_no: 'CASE-1', document_id: 1, status: 'confirmed',
lifecycle_stage: 'freight_upload', lifecycle_entries: [],
has_formal_ot: true, confirmed_task_no: 'OT-1',
},
{
case_no: 'CASE-2', document_id: 2, status: 'confirmed',
lifecycle_stage: 'freight_upload', lifecycle_entries: [],
has_formal_ot: true, confirmed_task_no: 'OT-2',
},
],
});
api.getCase.mockClear();
api.getEvidence.mockClear();
const review = useShippingOrderReview();
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1' });
api.getCase.mockClear();
api.getEvidence.mockClear();
await review.selectCase('CASE-2');
expect(api.getCase).not.toHaveBeenCalled();
expect(api.getEvidence).not.toHaveBeenCalled();
expect(review.requestedCaseNo.value).toBe('CASE-2');
expect(review.activeCase.value).toBeNull();
expect(review.evidence.value).toEqual([]);
});
it('[选法 2] loadReviewCase lazily fetches review Case + Evidence on demand', async () => {
api.getCase.mockClear();
api.getEvidence.mockClear();
@@ -1392,6 +1550,23 @@ describe('useShippingOrderReview build eligibility writes', () => {
expect(api.getEvidence).toHaveBeenCalledWith('CASE-1');
});
it('[选法 2] loadReviewCase can skip Evidence for fulfillment_prep write-path debt', async () => {
api.getCase.mockClear();
api.getEvidence.mockClear();
api.getCase.mockResolvedValue({
case: buildCase({ case_no: 'CASE-1' }),
projection_version: 1,
loading_context: null,
});
const review = useShippingOrderReview();
await review.loadReviewCase('CASE-1', { includeEvidence: false });
expect(api.getCase).toHaveBeenCalledWith('CASE-1');
expect(api.getEvidence).not.toHaveBeenCalled();
expect(review.activeCase.value?.case_no).toBe('CASE-1');
});
});
@@ -3,9 +3,14 @@
* 用途:订单复核工作台 composable,编排 Run/Case/PDF、草稿写入与建单确认。
* 依赖:shipping API review/extraction-run、useShippingProcessingWorkItem、Vue ref/computed、BusinessError。
* 逻辑:按 runNo 加载 Review Run/Case;合成 ShippingReviewProgressContext;
* OT 绑定 Case.order_task_no / Candidate;切换时保留稳定显示壳,目标快照到齐后原子替换;
* OT 绑定优先 Case.order_task_no,其次 OT- 前缀的 confirmed_task_no;
* 同 Run 切 PDF 用 selectCase;跨 Run 用 beginCrossRunSwitch 撤销旧 OT 投影权威后
* 再走 load 目标优先路径;正式下游(通知准备/货代上传/通知完成)切文件不拉
* Case/Evidence(与 load 选法 2 一致),OT 由队列 confirmed_task_no 绑定;
* 切换时保留稳定显示壳,目标快照到齐后原子替换;
* 409 REVIEW_DRAFT_VERSION_MISMATCH 冲突处理;build_eligibility 驱动 confirm/reroute;
* 重识别后刷新正式 Run/Case/Gate 投影,并在新版 Case 确认落位后通知页面同步深链;
* 货代上传确认等写后动作须 refreshReviewQueue,左侧本批队列 lifecycle_stage 才与五阶段同步;
* PDF Blob 由 ensurePreviewLoaded 按需加载。
*/
import {
@@ -65,7 +70,7 @@ import type {
} from '../types/shipping.api.types';
import { useShippingProcessingWorkItem } from '../shipping/useShippingProcessingWorkItem';
/** ???????????? */
/** */
export type ReviewStatusMessage =
| 'superseded'
| 'work_item_closed'
@@ -73,10 +78,10 @@ export type ReviewStatusMessage =
| 'draft_version_conflict'
| null;
/** ????????? ConflictError.code???????? */
/** ConflictError.code */
export const REVIEW_DRAFT_VERSION_MISMATCH = 'SHIPPING.REVIEW_DRAFT_VERSION_MISMATCH';
/** ?????????? confirm ????? */
/** confirm */
export const REVIEW_BUILD_ELIGIBILITY_BLOCKED = 'SHIPPING.REVIEW_BUILD_ELIGIBILITY_BLOCKED';
/**
@@ -85,7 +90,7 @@ export const REVIEW_BUILD_ELIGIBILITY_BLOCKED = 'SHIPPING.REVIEW_BUILD_ELIGIBILI
*/
export const PROGRESS_POLL_MS = 5000;
/** ????????????/??????????? Case ??? */
/** / Case */
export type DraftVersionConflict = {
localVersion: number;
serverVersion: number | null;
@@ -94,17 +99,17 @@ export type DraftVersionConflict = {
};
/**
* ??????????????409 REVIEW_DRAFT_VERSION_MISMATCH??
* @param error - ???????
* 409 REVIEW_DRAFT_VERSION_MISMATCH
* @param error -
*/
export function isDraftVersionMismatchError(error: unknown): boolean {
return error instanceof BusinessError && error.code === REVIEW_DRAFT_VERSION_MISMATCH;
}
/**
* ???????????????????/??/???/????????????
* @param localCase - ???????? Case
* @param serverCase - ????????? Case
* ///
* @param localCase - Case
* @param serverCase - Case
*/
export function summarizeDraftConflictDiff(
localCase: ShippingOrderReviewCase | null,
@@ -156,8 +161,8 @@ export function isReviewCaseHistorical(activeCase: ReviewCaseRef, workItem: Work
}
/**
* ?? WorkItem ??????? closed/cancelled??
* ?????confirmed / building_order ???? lifecycle ???????
* WorkItem closed/cancelled
* confirmed / building_order lifecycle
*/
export function isReviewWorkItemClosed(workItem: WorkItemRef): boolean {
const status = String(workItem?.lifecycle_status || '').trim();
@@ -165,28 +170,28 @@ export function isReviewWorkItemClosed(workItem: WorkItemRef): boolean {
}
/**
* ?????????? Case ? WorkItem ????
* Case ? WorkItem
*/
export function isReviewReadOnly(activeCase: ReviewCaseRef, workItem: WorkItemRef): boolean {
return isReviewCaseHistorical(activeCase, workItem) || isReviewWorkItemClosed(workItem);
}
/**
* ???? build_eligibility ?????????
* @param eligibility - Case draft ???????????????
* build_eligibility
* @param eligibility - Case draft
*/
export function isBuildConfirmBlocked(eligibility?: ShippingOrderReviewBuildEligibility | null): boolean {
return Boolean(eligibility && eligibility.can_build === false);
}
/**
* ????????????????????
* ??????? can_build ? false ????????????????
*
* can_build ? false
*/
/**
* ??????????????????? / ???? / ??????
* ?????suggestion_pending?unavailable_source_codes ??????????????
* @param line - build_eligibility ???
* / /
* suggestion_pending?unavailable_source_codes
* @param line - build_eligibility
*/
export function lineNeedsInventoryRoutingRecovery(
line: ShippingOrderReviewBuildEligibilityLineProjection,
@@ -196,14 +201,14 @@ export function lineNeedsInventoryRoutingRecovery(
}
/**
* ? Case / Extraction Run ????? WorkflowItem lifecycle_status?
* ?????draft/ready ? pending_review?non_order ? cancelled?
* confirmed ???? closed?????? building_order ???
* ??? closed / quality_issue ? closed?Extraction Run ????? Case ????
* ? Case / Extraction Run WorkflowItem lifecycle_status?
* draft/ready ? pending_review?non_order ? cancelled?
* confirmed closed building_order
* closed / quality_issue ? closed?Extraction Run Case
*
* @param caseStatus - Review Case ??
* @param runStatus - Extraction Run ??????
* @returns ??????? lifecycle ???
* @param caseStatus - Review Case
* @param runStatus - Extraction Run
* @returns lifecycle
*/
export function mapReviewContextLifecycleStatus(
caseStatus?: string | null,
@@ -215,7 +220,7 @@ export function mapReviewContextLifecycleStatus(
if (cs === 'non_order') return 'cancelled';
if (cs === 'quality_issue') return 'closed';
if (cs === 'closed') return 'closed';
// [UI-05] confirmed ? closed????????????????????
// [UI-05] confirmed ? closed
if (cs === 'confirmed') {
if (['building_order', 'inventory_matching', 'generating_excel'].includes(rs)) return rs;
if (['manual_upload_pending', 'upload_rpa_pending', 'upload_rpa_running'].includes(rs)) return rs;
@@ -234,16 +239,34 @@ export function mapReviewContextLifecycleStatus(
}
/**
* ? Review Run/Case???? Extraction Run????? ShippingReviewProgressContext ??????
* ?????Workflow API ?????????? authoritativeOrderTaskNo ???????
* 是否处于正式任务下游阶段(通知准备 / 货代上传 / 通知完成)。
* 核心逻辑:有正式 OT 且 lifecycle_stage 不在接收解析/订单复核;与 load 选法 2 同谓词。
*
* @param params.reviewRun - ?? Review Run ??
* @param params.activeCase - ?? Case ??
* @param params.conversationId - ?? ID
* @param params.itemNo - ????????? order_task_no?
* @param params.extractionRun - ?? Extraction Run????/?????
* @param params.userTaskNo - ???? OT ???confirm order_task_no ??
* @returns ?????????? run/case ????? null
* @param item - 队列或 Run 导航项(含 has_formal_ot / lifecycle_stage)
* @returns 下游阶段为 true,应跳过复核 Case/Evidence 拉取
*/
function isFormalDownstreamNavItem(item: {
has_formal_ot?: boolean;
lifecycle_stage?: string | null;
} | null | undefined): boolean {
if (!item?.has_formal_ot) return false;
const stage = String(item.lifecycle_stage || '').trim().toLowerCase();
return Boolean(stage) && !['intake_parse', 'order_review'].includes(stage);
}
/**
* 从 Review Run/Case(及可选 Extraction Run)合成 ShippingReviewProgressContext。
* 核心逻辑:不依赖 Workflow API;为 authoritativeOrderTaskNo / 右卡 work-item 提供 OT 键。
* OT 解析序:Case.order_task_no → OT- 前缀 confirmed_task_no → 显式 userTaskNo →
* (无 Candidate 绑定时)Extraction Run.user_task_no。
*
* @param params.reviewRun - 当前 Review Run 投影
* @param params.activeCase - 当前 Case 投影
* @param params.conversationId - 会话 ID
* @param params.itemNo - 可选 item / order_task_no 覆盖
* @param params.extractionRun - 可选 Extraction Run(建单前/重解析)
* @param params.userTaskNo - 显式 OT(如 confirm 返回的 order_task_no)
* @returns 可驱动进度的上下文;无 run/case 身份时返回 null
*/
function synthesizeWorkItemFromReviewContext(params: {
reviewRun: ShippingOrderReviewRun | null;
@@ -281,13 +304,17 @@ function synthesizeWorkItemFromReviewContext(params: {
const caseStatus = activeCase?.status || caseSummary?.status || null;
const lifecycle = mapReviewContextLifecycleStatus(caseStatus, extractionRun?.status || null);
const documentId = Number(activeCase?.document?.id || caseSummary?.document_id || 0);
// [UI-03] Case ?? Candidate ????? Run ? OT?
// [UI-03] Case 已绑 Candidate 时优先 Case.order_task_no(一对一 OT),禁止回退 Run 根号。
const hasCandidateBinding = Boolean(
activeCase?.candidate_id
|| activeCase?.candidate?.candidate_no,
);
// confirmed_task_no 仅在其本身已是 OT- 编号时作兜底(正式任务下游 order_task_no 可能暂空,
// 而右卡 work-item 必须以 OT 号启动;SN 号不得当作 order_task work-item 键)。
const confirmedTaskNo = String(activeCase?.confirmed_task_no || '').trim();
const resolvedUserTaskNo = String(
activeCase?.order_task_no
|| (confirmedTaskNo.startsWith('OT-') ? confirmedTaskNo : '')
|| userTaskNo
|| (!hasCandidateBinding ? extractionRun?.user_task_no : '')
|| '',
@@ -326,7 +353,7 @@ export function useShippingOrderReview(options: {
const reviewProgressContext = ref<ShippingReviewProgressContext | null>(null);
/** 当前 Run 的用户态五阶段进度;页面 loading 或尚无 Case 时仍可展示。 */
const extractionLifecycleProgress = ref<ShippingOrderExtractionLifecycleProgress | null>(null);
/** ?? OT ???????????????? */
/** OT */
const authoritativeOrderTaskNo = computed(() => {
const item = reviewProgressContext.value;
const no = String(item?.user_task_no || '').trim();
@@ -366,7 +393,7 @@ export function useShippingOrderReview(options: {
const saveFailed = ref(false);
/** 显式校验期间清空旧资格投影,避免短暂显示过期的“不可建单”。 */
const validationInProgress = ref(false);
/** ???????????????????????????? */
/** */
const draftConflict = ref<DraftVersionConflict | null>(null);
const versionsLoading = ref(false);
const evidence = ref<ShippingOrderReviewEvidence[]>([]);
@@ -375,7 +402,7 @@ export function useShippingOrderReview(options: {
const focusedFieldId = ref<string | null>(null);
const focusedLineKey = ref<string | null>(null);
/**
* ??????????????????? Draft ?? focusedFieldId/focusedLineKey ???
* Draft focusedFieldId/focusedLineKey
*/
const evidenceDrawerFocus = ref<{
fieldId: string | null;
@@ -385,7 +412,7 @@ export function useShippingOrderReview(options: {
evidenceId: string | null;
} | null>(null);
const previewUrl = ref('');
/** ?? previewUrl ??? Case?????????? */
/** previewUrl Case */
const previewCaseNo = ref<string | null>(null);
const previewLoading = ref(false);
const previewLoadFailed = ref(false);
@@ -405,11 +432,16 @@ export function useShippingOrderReview(options: {
let caseSwitchAbortController: AbortController | null = null;
/** 当前正在请求或已选定的 Case 编号(与 generation 双校验)。 */
const requestedCaseNo = ref<string | null>(null);
/**
* 已成功拉取 Evidence 的 Case 编号;正式下游跳过或清空证据时置空,
* 供切回订单复核时判断是否需补拉 Evidence(不可用 evidence.length,空证据合法)。
*/
let reviewEvidenceCaseNo: string | null = null;
/** 同 Run 内切换 PDF/Case 的轻量加载态(不触发整页 loading)。 */
const caseSwitchLoading = ref(false);
/** Case 切换失败(与 Run 级 loadFailed / 进度错误分离)。 */
const caseSwitchFailed = ref(false);
/** ?????????? Workflow ????? */
/** Workflow */
const showWorkflowProgress = ref(false);
const workflowProgressPolling = ref(false);
let contextConversationId = '';
@@ -430,7 +462,7 @@ export function useShippingOrderReview(options: {
};
/**
* ????? WorkflowItem ????????? / ???????
* WorkflowItem /
*/
const stopWorkflowProgressPolling = () => {
if (progressPollTimer != null) {
@@ -589,9 +621,9 @@ export function useShippingOrderReview(options: {
};
/**
* ?????????????????
* ???????? OT ?????? ShippingProcessing????? Extraction Run
* ?? WorkflowItem ??????????????? OT ???? Run ?????
*
* OT ShippingProcessing Extraction Run
* WorkflowItem OT Run
*/
const startWorkflowProgressPolling = (itemNo?: string | null) => {
stopWorkflowProgressPolling();
@@ -661,14 +693,14 @@ export function useShippingOrderReview(options: {
}
}
} catch {
/* ???????????????? */
/* */
}
};
void tick();
progressPollTimer = window.setInterval(() => { void tick(); }, PROGRESS_POLL_MS);
};
// ???? setup ?????????? composable ?????? Vue warn?
// setup composable Vue warn?
if (getCurrentInstance()) {
onBeforeUnmount(() => {
caseSwitchAbortController?.abort();
@@ -681,40 +713,40 @@ export function useShippingOrderReview(options: {
}
/**
* ????????????????? Case?
* Case?
*/
const isViewingHistoricalVersion = computed(() =>
isReviewCaseHistorical(activeCase.value, reviewProgressContext.value),
);
/** ?????????????????? */
/** */
const isWorkItemClosed = computed(() => isReviewWorkItemClosed(reviewProgressContext.value));
/** ??/????????????????????????? */
/** / */
const isReadOnly = computed(() => isReviewReadOnly(activeCase.value, reviewProgressContext.value));
/**
* Draft ?????edit_draft ???????
* Draft edit_draft
*/
const editable = computed(() => {
if (isReadOnly.value) return false;
return activeCase.value?.available_actions.includes('edit_draft') || false;
});
/** ???????????confirmed + edit_formal_task?? */
/** confirmed + edit_formal_task */
const formalEditable = computed(() => {
if (isReadOnly.value) return false;
return activeCase.value?.available_actions.includes('edit_formal_task') || false;
});
/** ???? Schema ?????????? */
/** Schema */
const canEditFormalFields = computed(() => (
formalEditable.value
&& (activeCase.value?.formal_editable_field_ids?.length ?? 0) > 0
));
/**
* ?????????draft ???formal ? formal_editable_field_ids?
* draft formal ? formal_editable_field_ids?
*/
const isFieldEditable = (fieldId: string) => {
if (isReadOnly.value || saving.value) return false;
@@ -725,16 +757,16 @@ export function useShippingOrderReview(options: {
};
/**
* ?????? Case ????????????
* ?????????????????????????
* Case
*
*/
const refreshStatusMessage = () => {
if (draftConflict.value) {
statusMessage.value = 'draft_version_conflict';
return;
}
// ?????? Case ?????? superseded????????????
// ?????????????????????????????
// Case superseded
//
if (isViewingHistoricalVersion.value || activeCase.value?.status === 'superseded') {
statusMessage.value = 'superseded';
return;
@@ -747,31 +779,31 @@ export function useShippingOrderReview(options: {
};
/**
* ?????????????????????
*
*/
const draftConflictDiffLines = computed(() =>
summarizeDraftConflictDiff(activeCase.value, draftConflict.value?.serverCase || null),
);
/** ?? Case ???????????validate ???? */
/** Case validate */
const buildEligibility = computed(
() => validationInProgress.value ? null : (activeCase.value?.draft?.build_eligibility ?? null),
);
/** ?? build_eligibility ? can_build ? false ???????? */
/** build_eligibility ? can_build ? false */
const canConfirmBuild = computed(() => (
!validationInProgress.value
&& Boolean(buildEligibility.value)
&& !isBuildConfirmBlocked(buildEligibility.value)
));
/** ??????????????????????????? */
/** */
const routingRecoveryLines = computed(() =>
(buildEligibility.value?.line_projections || []).filter(lineNeedsInventoryRoutingRecovery),
);
/**
* ??? Review ????? WorkItem ??????? Workflow API??
* Review WorkItem Workflow API
*/
const resolveWorkItem = async (
conversationId: string,
@@ -788,7 +820,7 @@ export function useShippingOrderReview(options: {
};
/**
* ???? WorkItem ???????????????????
* WorkItem
*/
const refreshWorkItemContext = async (
conversationId?: string,
@@ -860,7 +892,7 @@ export function useShippingOrderReview(options: {
};
/**
* ???? PDF ?? URL?????????
* PDF URL
*/
const clearPreview = () => {
++previewRequestGeneration;
@@ -873,14 +905,19 @@ export function useShippingOrderReview(options: {
};
/**
* ?????? Case ? PDF ???????? / ?? PDF ?????
* ?????? Case ????????????????? inflight?????????
* @param caseNo - ?? Case??? activeCase
* @returns ?????? previewUrl
* Case ? PDF / PDF
* Case inflight
* @param caseNo - Case activeCase
* @returns previewUrl
*/
const ensurePreviewLoaded = async (caseNo?: string | null): Promise<boolean> => {
const target = String(caseNo || activeCase.value?.case_no || '').trim();
if (!target || activeCase.value?.case_no !== target) return false;
// 正式下游可能无 activeCase;仍允许按 requestedCaseNo / 显式 caseNo 拉 PDF。
const target = String(
caseNo || activeCase.value?.case_no || requestedCaseNo.value || '',
).trim();
if (!target) return false;
if (activeCase.value && activeCase.value.case_no !== target) return false;
if (!activeCase.value && requestedCaseNo.value !== target) return false;
if (previewCaseNo.value === target && previewUrl.value) return true;
if (previewInflight?.caseNo === target) return previewInflight.promise;
@@ -895,7 +932,11 @@ export function useShippingOrderReview(options: {
if (
requestGeneration !== previewRequestGeneration
|| generation !== caseLoadGeneration
|| activeCase.value?.case_no !== target
|| (
activeCase.value
? activeCase.value.case_no !== target
: requestedCaseNo.value !== target
)
) {
URL.revokeObjectURL(url);
return false;
@@ -991,7 +1032,7 @@ export function useShippingOrderReview(options: {
}
};
/** ?? Run ??????? URL ?? Case??????? PDF? */
/** Run URL Case PDF? */
const load = async (
runNo: string,
preferredCaseNo?: string,
@@ -1009,7 +1050,7 @@ export function useShippingOrderReview(options: {
loadFailed.value = false;
draftConflict.value = null;
saveFailed.value = false;
// [STEP 1] ?????????????????????? WorkflowItem ????? Run ???
// [STEP 1] WorkflowItem Run
contextConversationId = String(options?.conversationId || '').trim();
contextItemNo = String(options?.itemNo || '').trim();
const hasStableWorkbench = Boolean(reviewRun.value && activeCase.value);
@@ -1055,6 +1096,7 @@ export function useShippingOrderReview(options: {
if (generation !== caseLoadGeneration) return;
applyCaseSnapshot(caseSnapshot);
evidence.value = caseEvidence?.items || [];
reviewEvidenceCaseNo = preferredCaseNo;
clearPreview();
const [run, queue] = await Promise.all([runRequest, queueRequest]);
@@ -1078,11 +1120,7 @@ export function useShippingOrderReview(options: {
const navItem = (queue.items || run.items).find(
(item) => String(item.case_no || '').trim() === String(caseNo || '').trim(),
) || null;
const navStage = String(navItem?.lifecycle_stage || '').trim().toLowerCase();
const isFormalDownstream = Boolean(
navItem?.has_formal_ot
&& !['intake_parse', 'order_review'].includes(navStage),
);
const isFormalDownstream = isFormalDownstreamNavItem(navItem);
let caseSnapshot: ShippingOrderReviewCaseSnapshot | null = null;
let caseEvidence: { case_no: string; items: ShippingOrderReviewEvidence[] } | null = null;
if (!isFormalDownstream && caseNo) {
@@ -1097,13 +1135,14 @@ export function useShippingOrderReview(options: {
extractionLifecycleProgress.value = run.lifecycle_progress || null;
applyCaseSnapshot(caseSnapshot);
evidence.value = caseEvidence?.items || [];
// [STEP] ??????? PDF??????????????????????
reviewEvidenceCaseNo = caseEvidence ? String(caseNo || '').trim() || null : null;
// [STEP] PDF
clearPreview();
await refreshWorkItemContext(contextConversationId, contextItemNo, {
expectedLoadGeneration: generation,
});
initialLoadCompleted = true;
// refreshWorkItemContext ????? ref???????? ref????? load ???????????
// refreshWorkItemContext ref ref load
} catch {
if (generation !== caseLoadGeneration) return;
loadFailed.value = !hasStableWorkbench;
@@ -1133,9 +1172,41 @@ export function useShippingOrderReview(options: {
if (generation !== caseLoadGeneration) return;
if (isInitialLoad) initialLoading.value = false;
runLoading.value = false;
// 跨 Run 的 beginCrossRunSwitch 会提前打开 caseSwitchLoading;整页 load 收尾必须关掉。
caseSwitchLoading.value = false;
}
};
/**
* 跨 Run 切文件启动:立刻进入切换态并撤销旧 OT 投影权威。
* 核心逻辑:保留 activeCase/工作台壳(避免大骨架闪动),但清空 user_task_no,
* 让 shippingProcessingProjection 立即丢弃上一份 PDF 的右卡/库存态;目标 Case
* 仍由随后的 load(preferredCaseNo) 目标优先路径写入。
* @param caseNo - 目标复核 Case 编号
*/
const beginCrossRunSwitch = (caseNo: string) => {
const target = String(caseNo || '').trim();
if (!target) return;
caseSwitchAbortController?.abort();
caseSwitchAbortController = null;
++caseLoadGeneration;
++intakeParseRequestGeneration;
requestedCaseNo.value = target;
caseSwitchLoading.value = true;
caseSwitchFailed.value = false;
runSwitchFailed.value = false;
const progress = reviewProgressContext.value;
if (progress) {
reviewProgressContext.value = {
...progress,
current_case_no: target,
user_task_no: null,
user_task_authoritative: false,
};
}
clearPreview();
};
/**
* 切换 Case 前清理瞬态业务状态。
* 核心逻辑:清空 Case/Evidence/LLM 建议/字段与证据焦点/预览与错误标记;
@@ -1147,6 +1218,7 @@ export function useShippingOrderReview(options: {
caseProjectionVersion.value = null;
caseLoadingContext.value = null;
evidence.value = [];
reviewEvidenceCaseNo = null;
llmSuggestions.value = [];
focusedFieldId.value = null;
focusedLineKey.value = null;
@@ -1163,8 +1235,9 @@ export function useShippingOrderReview(options: {
/**
* 切换 PDF/Case:请求代次保护 + 清空业务 Case,防止旧值残留 DOM。
* 核心逻辑:立即 activeCase=null;仅保留 Run 进度/PDF 导航;中区纯布局 skeleton;
* 失败保持空骨架(不回显旧 Case);过期响应丢弃。
* 核心逻辑:立即进入切换态;正式下游(与 load 选法 2 同谓词)不拉 Case/Evidence,
* 仅绑定 requestedCaseNo 并撤销旧 OT 权威,由队列 confirmed_task_no + 任务详情驱动;
* 复核阶段仍拉 Case+Evidence;目标快照到齐后一次性替换;失败保留上一份稳定快照。
* @param caseNo - 目标复核 Case 编号
*/
const selectCase = async (caseNo: string) => {
@@ -1184,6 +1257,38 @@ export function useShippingOrderReview(options: {
intakeParseLoading.value = false;
intakeParseLoadFailed.value = false;
try {
// [选法 2] 正式下游切 PDF:不拉复核 Case/Evidence(与 load 一致)。
const navItem = (reviewQueue.value?.items || reviewRun.value?.items || []).find(
(item) => String(item.case_no || '').trim() === target,
) || null;
if (isFormalDownstreamNavItem(navItem)) {
if (generation !== caseLoadGeneration) return;
if (requestedCaseNo.value !== target) return;
applyCaseSnapshot(null);
evidence.value = [];
reviewEvidenceCaseNo = null;
focusedFieldId.value = null;
focusedLineKey.value = null;
evidenceDrawerFocus.value = null;
draftConflict.value = null;
saveFailed.value = false;
loadFailed.value = false;
statusMessage.value = null;
// 撤销旧 OT 权威,避免多 PDF 串 work-item;新 OT 由 confirmedNoticeTaskNo 触发任务详情后注入。
const progress = reviewProgressContext.value;
if (progress) {
reviewProgressContext.value = {
...progress,
current_case_no: target,
user_task_no: null,
user_task_authoritative: false,
};
}
await refreshWorkItemContext();
refreshStatusMessage();
return;
}
const [detail, result] = await Promise.all([
getWorkspaceShippingOrderReviewCase(target, controller.signal),
getWorkspaceShippingOrderReviewEvidence(target, controller.signal),
@@ -1195,6 +1300,7 @@ export function useShippingOrderReview(options: {
clearPreview();
applyCaseSnapshot(detail);
evidence.value = result.items;
reviewEvidenceCaseNo = target;
focusedFieldId.value = null;
focusedLineKey.value = null;
evidenceDrawerFocus.value = null;
@@ -1218,7 +1324,7 @@ export function useShippingOrderReview(options: {
}
};
/** ?????? Case????????? DTO ??????????????? */
/** Case DTO */
const save = async (action: () => Promise<ShippingOrderReviewCase>) => {
saving.value = true;
saveFailed.value = false;
@@ -1288,7 +1394,7 @@ export function useShippingOrderReview(options: {
});
/**
* ?????????? Notice update API ??? Case ??? order_data_version?
* Notice update API Case order_data_version?
*/
const saveFormalField = async (action: () => Promise<void>) => {
if (!activeCase.value) return;
@@ -1309,10 +1415,10 @@ export function useShippingOrderReview(options: {
};
/**
* ???????????????? Case???????????
* ???????????? saveFailed???????? draftConflict ??????
* @param error - ????????
* @param localVersion - ????????????
* Case
* saveFailed draftConflict
* @param error -
* @param localVersion -
*/
const markWriteFailure = async (error: unknown, localVersion: number) => {
saveFailed.value = true;
@@ -1326,7 +1432,7 @@ export function useShippingOrderReview(options: {
serverCase = (await getWorkspaceShippingOrderReviewCase(activeCase.value.case_no)).case;
serverVersion = serverCase.draft?.draft_version ?? null;
} catch {
/* ?????????????????????? */
/* */
}
draftConflict.value = {
localVersion,
@@ -1341,6 +1447,7 @@ export function useShippingOrderReview(options: {
* 门禁动作完成后静默同步当前 Case。
* 核心逻辑:这不是用户切换 PDF,故不能复用 selectCase;保留已加载预览、字段/证据焦点与 intake
* 上下文,仅在当前 Case 的快照和证据都返回后替换数据,再同步 Run 与 WorkflowItem 状态。
* 注意:本函数不刷新左侧本批队列;生命周期阶段变更须另调 refreshReviewQueue。
*/
const reloadLatestDraft = async () => {
if (!activeCase.value) return;
@@ -1371,7 +1478,31 @@ export function useShippingOrderReview(options: {
};
/**
* ???????????
* 静默重拉会话级 Review Stream 队列,更新左侧本批订单的 lifecycle_stage。
* 核心逻辑:以当前 Run 为锚点调用 getWorkspaceShippingOrderReviewQueue;不碰 Case/预览/焦点。
* 用于货代上传确认、RPA 终态等写后场景——reloadLatestDraft 只刷 Case,不会更新队列阶段文案。
*
* @returns 是否成功写回 reviewQueue
*/
const refreshReviewQueue = async (): Promise<boolean> => {
const runNo = String(
reviewRun.value?.run_no
|| activeCase.value?.run_no
|| '',
).trim();
if (!runNo) return false;
try {
const queue = await getWorkspaceShippingOrderReviewQueue(runNo);
reviewQueue.value = queue;
return true;
} catch {
// 队列刷新失败不影响主工作面;下次显式刷新或切换 PDF 仍会重拉。
return false;
}
};
/**
*
*/
const toggleConflictDiff = () => {
if (!draftConflict.value) return;
@@ -1451,7 +1582,7 @@ export function useShippingOrderReview(options: {
};
/**
* ?????????????????409 ????? markWriteFailure?
* 409 markWriteFailure?
* @param draftLineId - 草稿行稳定身份;为空表示整单重算
*/
const rerouteInventoryRouting = (draftLineId?: string) => {
@@ -1464,7 +1595,7 @@ export function useShippingOrderReview(options: {
}));
};
/** ????????????????? Task ??? Case??????? DTO? */
/** Task Case DTO? */
const confirm = async () => {
if (!activeCase.value) return null;
if (isBuildConfirmBlocked(buildEligibility.value)) {
@@ -1490,7 +1621,7 @@ export function useShippingOrderReview(options: {
extractionLifecycleProgress.value = reviewRun.value.lifecycle_progress || null;
}
await refreshWorkItemContext();
// [UI-02] ?????? OT???? Notice task_no / ??? workflow_item_id ??????
// [UI-02] OT Notice task_no / workflow_item_id
const orderTaskNo = String(
response.order_task_no
|| response.case?.order_task_no
@@ -1525,23 +1656,23 @@ export function useShippingOrderReview(options: {
};
const createManualDraft = () => activeCase.value && save(() => createWorkspaceShippingOrderReviewManualDraft(activeCase.value!.case_no));
/**
* ????????????????????
* @param reason - ?????
* @param comment - ????
*
* @param reason -
* @param comment -
*/
const markNonOrder = (reason: string, comment?: string) =>
activeCase.value && save(() => markWorkspaceShippingOrderReviewNonOrder(activeCase.value!.case_no, reason, comment));
/**
* ???????`other` ??????????
* @param reason - ?????
* @param comment - ????
* `other`
* @param reason -
* @param comment -
*/
const markQualityIssue = (reason: string, comment?: string) =>
activeCase.value && save(() => markWorkspaceShippingOrderReviewQualityIssue(activeCase.value!.case_no, reason, comment));
/**
* ? PDF ??????? Run?????????????????????????????? Case?
* @param reason - ??????
* @param comment - ????
* ? PDF Run Case?
* @param reason -
* @param comment -
*/
const reparseDocument = async (reason: string, comment?: string) => {
if (!activeCase.value) return null;
@@ -1565,7 +1696,7 @@ export function useShippingOrderReview(options: {
}
};
/**
* ?????????? LLM ?????????
* LLM
*/
const focusSuggestionField = (fieldId: string, lineKey?: string | null) => {
focusedFieldId.value = fieldId;
@@ -1573,8 +1704,8 @@ export function useShippingOrderReview(options: {
};
/**
* ?????????????????evidence_id??
* ?????????/?????????????? clearEvidenceDrawerFocus?
* evidence_id
* / clearEvidenceDrawerFocus?
*/
const setEvidenceDrawerFocus = (payload: {
fieldId?: string | null;
@@ -1596,13 +1727,13 @@ export function useShippingOrderReview(options: {
};
};
/** ????????????????????? */
/** */
const clearEvidenceDrawerFocus = () => {
evidenceDrawerFocus.value = null;
};
/**
* ????????? Dify ???????
* Dify
*/
const requestSuggestion = async (issueCode?: string | null) => {
if (!activeCase.value || !focusedFieldId.value) return null;
@@ -1627,7 +1758,7 @@ export function useShippingOrderReview(options: {
};
/**
* ???? LLM ???
* LLM
*/
const decideSuggestion = async (
suggestionNo: string,
@@ -1649,8 +1780,8 @@ export function useShippingOrderReview(options: {
};
/**
* ????????????? Run/Case?
* @returns ?? run_no ? case_no???????? null?
* Run/Case?
* @returns run_no ? case_no null?
*/
const currentVersionTarget = (): { runNo: string; caseNo: string } | null => {
const runNo = String(reviewProgressContext.value?.current_run_no || reviewRun.value?.run_no || '').trim();
@@ -1675,13 +1806,36 @@ export function useShippingOrderReview(options: {
/**
* 【选法 2】正式任务下游阶段懒加载复核编辑器:不重拉 Run/Queue,仅按需读取
* 当前文件的 Case 快照 + Evidence,供用户从「通知准备」切回「订单复核」阶段使用。
* 当前文件的 Case 快照;Evidence 默认一并拉取,通知准备写路径可关(includeEvidence=false)。
* @param caseNo - 目标 Case 编号
* @param options.includeEvidence - 为 false 时只拉 Case(fulfillment_prep 写路径债务)
*/
const loadReviewCase = async (caseNo: string | null | undefined) => {
const loadReviewCase = async (
caseNo: string | null | undefined,
options?: { includeEvidence?: boolean },
) => {
const normalized = String(caseNo || '').trim();
if (!normalized) return;
const includeEvidence = options?.includeEvidence !== false;
// 已有目标 Case,且不需要 Evidence 或 Evidence 已齐,跳过重复请求。
if (
activeCase.value?.case_no === normalized
&& (!includeEvidence || reviewEvidenceCaseNo === normalized)
) {
return;
}
const generation = ++caseLoadGeneration;
try {
if (!includeEvidence) {
const caseSnapshot = await getWorkspaceShippingOrderReviewCase(normalized);
if (generation !== caseLoadGeneration) return;
applyCaseSnapshot(caseSnapshot);
clearPreview();
await refreshWorkItemContext(contextConversationId, contextItemNo, {
expectedLoadGeneration: generation,
});
return;
}
const [caseSnapshot, caseEvidence] = await Promise.all([
getWorkspaceShippingOrderReviewCase(normalized),
getWorkspaceShippingOrderReviewEvidence(normalized),
@@ -1689,6 +1843,7 @@ export function useShippingOrderReview(options: {
if (generation !== caseLoadGeneration) return;
applyCaseSnapshot(caseSnapshot);
evidence.value = caseEvidence?.items || [];
reviewEvidenceCaseNo = normalized;
clearPreview();
await refreshWorkItemContext(contextConversationId, contextItemNo, {
expectedLoadGeneration: generation,
@@ -1758,12 +1913,14 @@ export function useShippingOrderReview(options: {
load,
loadReviewCase,
selectCase,
beginCrossRunSwitch,
resetCaseTransientState,
requestedCaseNo,
refreshWorkItemContext,
currentVersionTarget,
openCurrentVersion,
reloadLatestDraft,
refreshReviewQueue,
toggleConflictDiff,
patchHeader,
patchLine,
@@ -11,12 +11,20 @@ import {
businessFileKeys,
flattenBusinessFileProjections,
normalizeConversationProcessingProjection,
normalizeLifecycleStatus,
resolveConversationProcessingFromUnified,
stabilizeTaskObjects,
} from './conversationProcessingProjection';
import type { ShippingProcessingProjection } from '@/features/chat/types/shipping.api.types';
describe('conversationProcessingProjection', () => {
it('normalizeLifecycleStatus keeps F2 waiting_human (no fold to waiting_review)', () => {
expect(normalizeLifecycleStatus('waiting_human')).toBe('waiting_human');
expect(normalizeLifecycleStatus('waiting_review')).toBe('waiting_review');
expect(normalizeLifecycleStatus('pending_review')).toBe('pending_review');
expect(normalizeLifecycleStatus('retryable')).toBe('failed');
});
it('EML 容器不计为业务文件,只保留附件叶子', () => {
const items = [{
sourceType: 'eml', sourceSummary: { filename: 'mail.eml' },
@@ -277,23 +277,17 @@ export function createIntakeOtStabilizer(options?: { graceMs?: number }): Intake
}
/**
* 归一化生命周期状态:把旧/兼容形态统一映射为新的单一状态。
* 核心逻辑:waiting_human(旧 conversation_processing 兜底)一律归并为
* waiting_review(新统一投影);pending_review 收敛到 waiting_review;
* 其它保持原值。用于避免两套投影切换时造成状态文本闪烁、语义签名漂移。
* 透传生命周期/用户态码;禁止把 F2 user_status 压成 stage 词。
* 核心逻辑:waiting_human 保持 waiting_human;waiting_review 仅当输入本就
* 是 stage/progress 码时原样返回。不再做 LEGACY-UNIFY 同义词折叠。
* @param status - 原始 lifecycle / userStatus / status_label
* @returns 归一化后的生命周期状态码
* @returns 归一化后的状态码(空输入返回空串)
*/
export function normalizeLifecycleStatus(
status: string | null | undefined,
): string {
const raw = String(status || '').trim().toLowerCase();
if (!raw) return '';
// [LEGACY-UNIFY] 旧兼容状态一律收敛为 waiting_review,保证显示「待复核」而非 waiting human。
if (raw === 'waiting_human' || raw === 'pending_review' || raw === 'review_required') {
return 'waiting_review';
}
if (raw === 'partially_completed') return 'waiting_review';
if (raw === 'manual_upload' || raw === 'waiting_manual_upload') return 'manual_upload_pending';
if (raw === 'retryable') return 'failed';
return raw;
@@ -888,8 +882,8 @@ export function resolveConversationProcessingFromUnified(
/**
* 归一化旧 conversation_processing 投影的生命周期状态。
* 核心逻辑:将所有组的 userStatus/status_label 统一为新形态,waiting_human 归并为 waiting_review,
* 避免 work_items 为空回退时,旧投影状态与统一 work_items 状态来回切换造成文案闪烁。
* 核心逻辑:浅拷贝 tasks 并规范 ui_state;userStatus/status_label 保持 F2 原词,
* 禁止把 waiting_human 折叠为 waiting_review。
*
* @param projection - 原始 embedded conversation_processing 投影
* @returns 归一化后的投影(新对象,浅拷贝 tasks 并覆盖 userStatus/status_label)
@@ -12,6 +12,7 @@ export * from './shippingDownload';
export * from './shippingDecisionFormat';
export * from './shippingUploadPrompt';
export * from './shippingParseReview';
export * from './shippingUiPosition';
export * from './shippingMatchResult';
export * from './shippingStepper';
export * from './shippingLocalMessages';
@@ -212,6 +212,19 @@ describe('normalizeShippingProcessingProjection', () => {
expect(normalizeShippingProcessingProjection({ status: 'processing' })).toBeNull();
});
it('returns null for already-camelCase DTO (must only run at API snake boundary)', () => {
// 关键断言:normalize 只读 snake;若 composable 对 API 已规范化结果再跑一遍,
// 会把 workItemNo 读空并整包洗成 null(右卡永久「获取中/待机」)。
expect(normalizeShippingProcessingProjection({
workItemNo: 'OT-1',
workItemType: 'order_task',
status: 'waiting_review',
stage: 'inventory_matching',
userStatus: 'waiting_human',
uiState: { status: 'waiting_human', lifecycleStage: 'fulfillment_prep' },
})).toBeNull();
});
it('normalizes work_items arrays', () => {
const items = normalizeShippingProcessingWorkItems([
{ work_item_no: 'OT-A', work_item_type: 'order_task', status: 'processing', stage: 'document_parsing' },
@@ -6,10 +6,16 @@
*/
/**
* 将 submit_decision 结果格式化为本地 assistant 消息 Markdown。
*
* @param decision - 决策动作码
* @param result - API 响应(可读 position,不参与文案拼接)
* @param taskId - 任务编号尾注
* @param fallbackDoneMessage - 缺省 message 时的兜底文案
* @returns Markdown 正文
*/
export function formatShippingDecisionAssistantMessage(
decision: string,
result: { message?: string; data?: Record<string, unknown>; checkpoint?: string },
result: { message?: string; data?: Record<string, unknown>; position?: string },
taskId: string,
fallbackDoneMessage: string,
): string {
@@ -1,20 +1,31 @@
/**
* features/chat/shipping/shippingParseReview.ts
* 用途:从 ChatMessage 读取 shipping-parse-review 类型 payload。
* 依赖:chat.types、shipping.types。
* 逻辑:ShippingParseReviewMessage 渲染 parse_review 可编辑订单表时使用。
*/
import type { ChatMessage } from '../types/chat.types';
import type { ShippingParseReviewPayload } from '../types/shipping.types';
/** 从 shipping-parse-review 消息提取 taskId、checkpoint 与 lines。 */
export function getShippingParseReviewPayload(chatMsg: ChatMessage): ShippingParseReviewPayload | null {
if (!chatMsg || chatMsg.type !== 'shipping-parse-review') return null;
const payload = chatMsg.payload;
if (!payload || typeof payload !== 'object') return null;
const taskId = String((payload as ShippingParseReviewPayload).taskId || '').trim();
const checkpoint = String((payload as ShippingParseReviewPayload).checkpoint || '').trim();
const lines = (payload as ShippingParseReviewPayload).lines;
if (!taskId || !checkpoint || !Array.isArray(lines)) return null;
return payload as ShippingParseReviewPayload;
}
/**
* features/chat/shipping/shippingParseReview.ts
* 用途:从 ChatMessage 读取 shipping-parse-review 类型 payload。
* 依赖:chat.types、shipping.types。
* 逻辑:ShippingParseReviewMessage 渲染 parse_review 可编辑订单表时使用;
* 新消息以 taskId+lines 为准,position 缺省视为 parse_review。
*/
import type { ChatMessage } from '../types/chat.types';
import type { ShippingParseReviewPayload } from '../types/shipping.types';
/**
* 从 shipping-parse-review 消息提取 taskId 与 lines。
*
* 核心逻辑:校验 taskId + lines;position 仅为展示标签,不参与门禁。
*
* @param chatMsg - 聊天消息
* @returns 校验通过的 payload;否则 null
*/
export function getShippingParseReviewPayload(chatMsg: ChatMessage): ShippingParseReviewPayload | null {
if (!chatMsg || chatMsg.type !== 'shipping-parse-review') return null;
const payload = chatMsg.payload;
if (!payload || typeof payload !== 'object') return null;
const typed = { ...(payload as ShippingParseReviewPayload) };
const taskId = String(typed.taskId || '').trim();
const lines = typed.lines;
if (!taskId || !Array.isArray(lines)) return null;
// 归一化:缺省 position 时用 parse_review,避免渲染路径空串。
typed.position = String(typed.position || 'parse_review').trim() || 'parse_review';
return typed;
}
␍
@@ -81,20 +81,21 @@ export function projectionRequiresManualUploadWorkbench(
}
/**
* 从 Gate 摘要 / checkpoint 判断是否展示「待人工上传登记」提示。
* 从 Gate 摘要 / 用户模式判断是否展示「待人工上传登记」提示。
*
* @param params.nextActionCode - process_gate 或 current_blocking_gate 的 next_action_code
* @param params.checkpointKind - ui_state.checkpoint_kind
* @param params.userMode - derive_user_mode / ui_state.user_mode
* @param params.availableActions - 后端允许的 action 列表
* @returns 是否展示人工上传说明
*/
export function gateSummaryIndicatesManualUpload(params: {
nextActionCode?: string | null;
checkpointKind?: string | null;
userMode?: string | null;
availableActions?: string[] | null;
}): boolean {
if (isManualUploadGateAction(params.nextActionCode)) return true;
if (String(params.checkpointKind || '').trim() === 'wait_manual_upload') return true;
const mode = String(params.userMode || '').trim();
if (mode === 'wait_manual_upload') return true;
const actions = Array.isArray(params.availableActions) ? params.availableActions : [];
return actions.some((action) => isManualUploadGateAction(action));
}
@@ -17,9 +17,12 @@ import {
} from './shippingProcessingLabels';
describe('shippingProcessingLabels', () => {
it('bridges pending_review to waiting_review key', () => {
it('maps waiting_human to its own status key (no LEGACY bridge to waiting_review)', () => {
expect(shippingProcessingStatusKey('waiting_human')).toBe(
'chat.shippingProcessing.status.waiting_human',
);
expect(shippingProcessingStatusKey('pending_review')).toBe(
'chat.shippingProcessing.status.waiting_review',
'chat.shippingProcessing.status.pending_review',
);
});
@@ -36,10 +39,15 @@ describe('shippingProcessingLabels', () => {
expect(resolveShippingProcessingStatusLabel('queued', te, t)).toBe('排队中');
});
it('uses unified label when available', () => {
const te = (key: string) => key === 'chat.shippingProcessing.status.waiting_review';
const t = (key: string) => (key.includes('waiting_review') ? '待复核' : key);
expect(resolveShippingProcessingStatusLabel('pending_review', te, t)).toBe('待复核');
it('does not treat dirty pending_review as waiting_review label', () => {
const te = (key: string) => key === 'chat.shippingProcessing.status.waiting_review'
|| key === 'chat.shippingProcessing.taskStatus.unknown';
const t = (key: string) => {
if (key.includes('waiting_review')) return '待复核';
if (key.endsWith('.unknown')) return '状态待确认';
return key;
};
expect(resolveShippingProcessingStatusLabel('pending_review', te, t)).toBe('状态待确认');
});
it('uses the safe unknown label instead of exposing an unrecognized status code', () => {
@@ -16,11 +16,10 @@ import {
mapProcessingStageToLifecycle,
} from '@/features/shipping-progress/stageMapping';
/** 会话 processing 旧 status_label → 统一 ShippingProcessingStatus。 */
/** status_label / F2 user_status → i18n 用 ShippingProcessingStatus(禁止脏词桥到 waiting_review)。 */
const LEGACY_STATUS_TO_PROCESSING: Record<string, string> = {
queued: 'processing',
processing: 'processing',
pending_review: 'waiting_review',
waiting_review: 'waiting_review',
waiting_human: 'waiting_human',
failed: 'failed',
@@ -29,7 +28,6 @@ const LEGACY_STATUS_TO_PROCESSING: Record<string, string> = {
cancelling: 'processing',
blocked: 'blocked',
automating: 'automating',
review_case_draft: 'waiting_review',
};
/**
@@ -275,7 +275,7 @@ export function sanitizeShippingConversationText(text: string, enabled: boolean)
.replace(/\braw_text\b/gi, '通知原文');
result = result.replace(/[((]\s*显示\s*[「"'`][^"'`]+[」"'`]\s*[))]/g, '');
result = result.replace(
/\b(pending_human_reason|review_status|checkpoint|match_status|human_options)\s*[::=]\s*[「"'`]?[^\s,;]+[「"'`]?/gi,
/\b(pending_human_reason|review_status|position|user_mode|match_status|human_options)\s*[::=]\s*[「"'`]?[^\s,;]+[「"'`]?/gi,
'',
);
for (const token of SHIPPING_INTERNAL_STATUS_TOKENS) {
@@ -0,0 +1,82 @@
/**
* features/chat/shipping/shippingUiPosition.spec.ts
* 用途:锁定聊天侧 Gate-first 位置/终态/parse_review 判定,只认 position / user_mode。
* 依赖:vitest、shippingUiPosition。
*/
import { describe, expect, it } from 'vitest';
import {
isShippingUiParseReview,
isShippingUiTerminal,
resolveShippingUiPosition,
resolveShippingUiUserMode,
} from './shippingUiPosition';
import type { ShippingTaskUiState } from '../types/shipping.api.types';
function ui(partial: Partial<ShippingTaskUiState>): ShippingTaskUiState {
return {
task_no: 'OT-1',
steps: [],
summary: { title: 't', message: 'm' },
...partial,
};
}
describe('shippingUiPosition', () => {
it('prefers review_status disposition over flat position', () => {
expect(resolveShippingUiPosition(ui({
review_status: 'parse_review',
position: 'order_freeze',
}))).toBe('parse_review');
});
it('maps order_field_extraction gate to parse_review', () => {
expect(resolveShippingUiPosition(ui({
process_gate: {
execution_no: 'SPE-1',
status: 'blocked',
current_gate_code: 'order_field_extraction',
},
position: 'order_freeze',
}))).toBe('parse_review');
});
it('reads flat position when gate absent', () => {
expect(resolveShippingUiPosition(ui({
position: 'inventory_pending',
}))).toBe('inventory_pending');
});
it('reads summary.position when top-level absent', () => {
expect(resolveShippingUiPosition(ui({
summary: { title: 't', message: 'm', position: 'ready_to_export' },
}))).toBe('ready_to_export');
});
it('detects terminal via lifecycle and user mode before position', () => {
expect(isShippingUiTerminal(ui({
lifecycle_stage: 'upload_complete',
position: 'inventory_pending',
}))).toBe(true);
expect(isShippingUiTerminal(ui({
user_mode: 'complete',
position: 'ready_to_match',
}))).toBe(true);
expect(isShippingUiTerminal(ui({
review_status: 'rejected',
}))).toBe(true);
expect(isShippingUiTerminal(ui({
position: 'uploaded',
}))).toBe(true);
});
it('detects parse_review via review_status or gate', () => {
expect(isShippingUiParseReview(ui({ review_status: 'parse_review' }))).toBe(true);
expect(isShippingUiParseReview(ui({
process_gate: {
execution_no: 'SPE-1',
status: 'blocked',
current_gate_code: 'order_field_extraction',
},
}))).toBe(true);
expect(isShippingUiParseReview(ui({ position: 'inventory_pending' }))).toBe(false);
});
it('reads user mode from user_mode / summary.user_mode', () => {
expect(resolveShippingUiUserMode(ui({ user_mode: 'must_human' }))).toBe('must_human');
expect(resolveShippingUiUserMode(ui({
summary: { title: 't', message: 'm', user_mode: 'wait_manual_upload' },
}))).toBe('wait_manual_upload');
});
});
@@ -0,0 +1,93 @@
/**
* features/chat/shipping/shippingUiPosition.ts
* 用途:从 ui_state 解析位置 / 用户模式 / 终态与 parse_review,优先 Gate、review_status、lifecycle。
* 依赖:shipping.api.types.ShippingTaskUiState。
* 逻辑:聊天刷新与复核同步消费本模块;只读 flat position / user_mode(含 summary 同名字段),禁止再读 checkpoint_*。
*/
import type { ShippingTaskUiState } from '../types/shipping.api.types';
/** 复核处置即位置(与后端 derive_position 对齐)。 */
const REVIEW_DISPOSITION_POSITIONS = new Set([
'parse_review',
'rsv_req',
'quality_issue',
'customer_review',
'rejected',
]);
/** 终态位置标签。 */
const TERMINAL_POSITIONS = new Set(['uploaded', 'completed', 'rejected']);
/** 终态生命周期。 */
const TERMINAL_LIFECYCLE = new Set(['upload_complete', 'completed']);
/** Gate code → 位置(仅聊天判定用最小集;完整映射在后端 derive_position)。 */
const GATE_CODE_TO_POSITION: Record<string, string> = {
order_field_extraction: 'parse_review',
customer_resolution: 'customer_review',
reservation_validation: 'rsv_req',
manual_upload_handoff: 'waiting_upload',
artifact_generation: 'export_ready',
freight_upload_rpa: 'upload_failed',
};
/**
* 解析用户处置模式(等同后端 derive_user_mode)。
*
* 核心逻辑:顶层 user_mode → summary.user_mode。
*
* @param ui - 后端 ui_state
* @returns auto_continue | must_human | wait_manual_upload | complete | ''
*/
export function resolveShippingUiUserMode(ui?: ShippingTaskUiState | null): string {
return String(
ui?.user_mode
|| ui?.summary?.user_mode
|| '',
).trim();
}
/**
* 解析当前位置标签(等同后端 derive_position)。
*
* 核心逻辑:review 处置 → Gate code 映射 → flat position / summary.position。
*
* @param ui - 后端 ui_state
* @returns 位置字符串;无法解析时为空
*/
export function resolveShippingUiPosition(ui?: ShippingTaskUiState | null): string {
const review = String(ui?.review_status || '').trim();
if (REVIEW_DISPOSITION_POSITIONS.has(review)) {
return review;
}
const gate = ui?.process_gate || ui?.summary?.process_gate;
const gateCode = String(gate?.current_gate_code || '').trim();
if (gateCode && GATE_CODE_TO_POSITION[gateCode]) {
return GATE_CODE_TO_POSITION[gateCode];
}
return String(
ui?.position
|| ui?.summary?.position
|| '',
).trim();
}
/**
* 是否已达终态(上传完成 / 驳回 / user_mode=complete)。
*
* @param ui - 后端 ui_state
*/
export function isShippingUiTerminal(ui?: ShippingTaskUiState | null): boolean {
if (!ui) return false;
const lifecycle = String(ui.lifecycle_stage || ui.stage?.code || '').trim();
if (TERMINAL_LIFECYCLE.has(lifecycle)) return true;
if (resolveShippingUiUserMode(ui) === 'complete') return true;
const review = String(ui.review_status || '').trim();
if (review === 'rejected') return true;
return TERMINAL_POSITIONS.has(resolveShippingUiPosition(ui));
}
/**
* 是否处于解析复核位(需同步 shipping-parse-review 消息)。
*
* @param ui - 后端 ui_state
*/
export function isShippingUiParseReview(ui?: ShippingTaskUiState | null): boolean {
if (!ui) return false;
if (String(ui.review_status || '').trim() === 'parse_review') return true;
const gate = ui.process_gate || ui.summary?.process_gate;
if (String(gate?.current_gate_code || '').trim() === 'order_field_extraction') return true;
return resolveShippingUiPosition(ui) === 'parse_review';
}
@@ -6,9 +6,6 @@
*/
import i18n from '@/i18n';
/**
* 根据上传 API 响应 checkpoint 生成发给 Agent 的 follow-up 提示语。
*/
/**
* 根据通知提交 API 响应生成发给 Dify 的 follow-up 提示语(触发完整订单抽取链)。
*/
@@ -30,7 +30,7 @@ export interface ShippingParseReviewContext {
/**
* 创建发货通知 parse review 卡片处理器。
*
* 核心逻辑:根据任务详情与 checkpoint 维护本地复核卡片,并把单头/订单行编辑回写到后端。
* 核心逻辑:根据任务详情与 Gate/review 位置维护本地复核卡片,并把单头/订单行编辑回写到后端。
* @param ctx - parse review 卡片上下文
* @returns 复核卡片同步与编辑处理函数集合
*/
@@ -42,11 +42,12 @@ describe('useChatShippingRefresh', () => {
it('syncs ui_state for notifications without attaching chat action buttons', async () => {
getWorkspaceShippingTaskUiState.mockResolvedValue({
task_no: 'SN-FOCUS-B',
checkpoint: 'ready_export',
match_status: 'matched',
lifecycle_stage: 'fulfillment_prep',
user_mode: 'auto_continue',
position: 'ready_to_export',
match_status: 'fulfillable',
review_status: null,
pending_human_reason: null,
match_status: 'fulfillable',
current_step: null,
steps: [],
summary: {
@@ -102,11 +103,12 @@ describe('useChatShippingRefresh', () => {
it('clears legacy shipping_actions even when api returns action_buttons', async () => {
getWorkspaceShippingTaskUiState.mockResolvedValue({
task_no: 'SN-SOURCE-001',
checkpoint: 'ready_export',
match_status: 'matched',
lifecycle_stage: 'fulfillment_prep',
user_mode: 'auto_continue',
position: 'ready_to_export',
match_status: 'fulfillable',
review_status: null,
pending_human_reason: null,
match_status: 'fulfillable',
current_step: null,
steps: [],
summary: {
@@ -187,4 +189,33 @@ describe('useChatShippingRefresh', () => {
expect(getWorkspaceShippingTaskUiState).not.toHaveBeenCalled();
expect(messages.value[0].shipping_actions).toBeUndefined();
});
it('treats lifecycle upload_complete as terminal without position code', async () => {
getWorkspaceShippingTaskUiState.mockResolvedValue({
task_no: 'SN-DONE-001',
lifecycle_stage: 'upload_complete',
user_mode: 'complete',
steps: [],
summary: { title: '已完成', message: '上传完成' },
});
const messages = ref([
{
role: 'assistant' as const,
content: '处理中',
shipping_actions: [{ id: 'x', label: 'x', message: 'x', variant: 'primary' as const }],
},
]);
const { refreshShippingActions } = createShippingActionsRefresher({
isShippingNoticeAgent: computed(() => true),
messages,
conversationId: ref('conv-done'),
isThinking: ref(false),
resolvedShippingTaskId: ref('SN-DONE-001'),
shippingTaskIdFromQuery: computed(() => ''),
getActiveShippingTaskId: () => 'SN-DONE-001',
});
await refreshShippingActions();
expect(messages.value[0].shipping_actions).toBeUndefined();
expect(messages.value[0].shipping_ui_state?.lifecycle_stage).toBe('upload_complete');
});
});
@@ -1,12 +1,12 @@
/**
* features/chat/shipping/useChatShippingRefresh.ts
* 用途:刷新聊天区发货通知 UI State,同步后端 summary/checkpoint 到消息,供通知展示。
* 依赖:shipping.api、shippingTaskId、shippingNoticeActions 常量、chat.types。
* 逻辑:由 useChatShipping 调用本文件;只读取后端 /ui-state 并净化正文中的动作菜单文案,不再把 action_buttons 映射为消息按钮。
* 用途:刷新聊天区发货通知 UI State,同步后端 summary 到消息,供通知展示。
* 依赖:shipping.api、shippingTaskId、shippingUiPosition、shippingText、chat.types。
* 逻辑:由 useChatShipping 调用;终态判定走 Gate/lifecycle/position/user_mode(isShippingUiTerminal)。
*/
import { getWorkspaceShippingTaskUiState } from '@/features/chat/api/shipping.api';
import { SHIPPING_TERMINAL_CHECKPOINTS } from '@/constants/shippingNoticeActions';
import { findLatestShippingTaskId } from './shippingTaskId';
import { isShippingUiTerminal } from './shippingUiPosition';
import { stripShippingActionListByButtons, stripShippingPlainActionMenu } from './shippingText';
import type { ChatMessage } from '../types/chat.types';
import type { ShippingTaskUiState } from '../types/shipping.api.types';
@@ -118,12 +118,8 @@ export function createShippingActionsRefresher(ctx: ShippingRefreshContext) {
// keep existing SSE-delivered ui_state if present
}
}
const apiCheckpoint = String(
apiState?.checkpoint?.code
|| apiState?.checkpoint_code
|| '',
).trim() || null;
if (apiResolved && apiCheckpoint && SHIPPING_TERMINAL_CHECKPOINTS.has(apiCheckpoint)) {
// [STEP] 终态:清空履约按钮并全量同步 ui_state;判定优先 lifecycle / user_mode / review。
if (apiResolved && isShippingUiTerminal(apiState)) {
msgs.forEach((rawMsg) => {
const m = rawMsg as ChatMessage;
if (m.role === 'assistant') {
@@ -0,0 +1,93 @@
/**
* features/chat/shipping/useShippingProcessingWorkItem.spec.ts
* 用途:验收 work-item 轮询 composable 不二次 normalize、能落盘 API 已规范化投影。
* 依赖:Vitest、Vue、useShippingProcessingWorkItem。
* 逻辑:API 层已 snake→camel;若 composable 再 normalize(只认 snake),会把投影洗成 null。
*/
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
import { defineComponent, nextTick, ref } from 'vue';
import { mount, flushPromises } from '@vue/test-utils';
const getWorkspaceShippingProcessingWorkItem = vi.fn();
vi.mock('../api/shipping.api', () => ({
getWorkspaceShippingProcessingWorkItem: (...args: unknown[]) => (
getWorkspaceShippingProcessingWorkItem(...args)
),
}));
import { useShippingProcessingWorkItem } from './useShippingProcessingWorkItem';
describe('useShippingProcessingWorkItem', () => {
beforeEach(() => {
getWorkspaceShippingProcessingWorkItem.mockReset();
});
afterEach(() => {
vi.clearAllMocks();
});
it('keeps API-normalized camelCase projection (must not re-normalize to null)', async () => {
// 关键断言:右卡「正在获取最新状态/待机」曾因二次 normalize 只读 snake 把
// workItemNo 读空、整包洗成 null;API 已返回的 camelCase 投影必须原样落盘。
getWorkspaceShippingProcessingWorkItem.mockResolvedValue({
workItemType: 'order_task',
workItemNo: 'OT-20260905-DAC55F90',
sourceType: 'eml',
status: 'waiting_review',
stage: 'inventory_matching',
progressVersion: 24,
lastActivityAt: '2026-09-05T11:25:45Z',
submissionNo: 'SOS-1',
intakeNo: 'SNI-1',
userStatus: 'waiting_human',
uiState: {
status: 'waiting_human',
stage: 'inventory_matching',
lifecycleStage: 'fulfillment_prep',
lifecycleEntries: [],
blocking_reason: { code: 'inventory_shortage_review_required' },
primary_action: { code: 'retry_inventory_matching' },
secondary_actions: [],
},
sourceSummary: {
emailSubject: null,
filename: 'a.pdf',
documentId: 1,
documentCount: 1,
parsedDocumentCount: 1,
candidateCount: 1,
customerName: null,
poNumber: null,
},
childOrderTasks: [],
hasFormalOt: false,
});
const workItemNo = ref('OT-20260905-DAC55F90');
let api: ReturnType<typeof useShippingProcessingWorkItem> | null = null;
const Comp = defineComponent({
setup() {
api = useShippingProcessingWorkItem('order_task', workItemNo, {
continuousPolling: false,
monotonicProgressVersion: true,
});
return () => null;
},
});
mount(Comp);
await flushPromises();
await nextTick();
expect(getWorkspaceShippingProcessingWorkItem).toHaveBeenCalledWith(
'order_task',
'OT-20260905-DAC55F90',
);
expect(api!.projection.value).not.toBeNull();
expect(api!.projection.value?.workItemNo).toBe('OT-20260905-DAC55F90');
expect(api!.projection.value?.userStatus).toBe('waiting_human');
expect(api!.projection.value?.uiState?.lifecycleStage).toBe('fulfillment_prep');
expect(api!.projection.value?.uiState?.primary_action?.code).toBe('retry_inventory_matching');
expect(api!.error.value).toBeNull();
});
});
@@ -1,8 +1,10 @@
/**
* features/chat/shipping/useShippingProcessingWorkItem.ts
* 用途:按 work_item_type + work_item_no 轮询统一 ShippingProcessingProjection。
* 依赖:shipping.api、normalizeShippingProcessing、mergeWorkbenchProcessingProjection。
* 依赖:shipping.api(已在边界 normalize)、mergeWorkbenchProcessingProjection。
* 逻辑:复核台 / 任务中心双读;工作台可启用 monotonicProgressVersion;404 时保持 null。
* 禁止对本 composable 再跑 normalize:API 已输出 camelCase,二次 normalize
* 只认 snake_case 会把 workItemNo 读空并整包洗成 null(右卡永久「获取中/待机」)。
*/
import {
@@ -18,7 +20,6 @@ import { BusinessError } from '@/shared/api/client';
import { mergeWorkbenchProcessingProjection } from '@/features/shipping-progress/mergeProcessingProjection';
import { getWorkspaceShippingProcessingWorkItem } from '../api/shipping.api';
import type { ShippingProcessingProjection } from '../types/shipping.api.types';
import { normalizeShippingProcessingProjection } from './normalizeShippingProcessing';
const DEFAULT_POLL_MS = 3000;
const TERMINAL_STATUSES = new Set([
@@ -93,6 +94,7 @@ export function useShippingProcessingWorkItem(
/**
* 拉取一次投影;失败保留上一帧。
* 核心逻辑:直接消费 API 已 normalize 的 camelCase 投影,禁止二次 normalize。
*/
async function refresh(): Promise<void> {
const no = String(toValue(workItemNo) || '').trim();
@@ -111,13 +113,13 @@ export function useShippingProcessingWorkItem(
loading.value = true;
const request = (async () => {
try {
const raw = await getWorkspaceShippingProcessingWorkItem(workItemType, no);
// [STEP 1] API 边界已完成 snake→camel;此处不得再 normalize(会读空 workItemNo → null)。
const incoming = await getWorkspaceShippingProcessingWorkItem(workItemType, no);
if (stopped || gen !== generation) return;
const normalized = normalizeShippingProcessingProjection(raw);
// [STEP] 工作台单调合并:旧包丢弃;新包整包替换;同版本浅合并。任务中心不启用。
// [STEP 2] 工作台单调合并:旧包丢弃;新包整包替换;同版本浅合并。任务中心不启用。
projection.value = monotonic
? mergeWorkbenchProcessingProjection(projection.value, normalized)
: normalized;
? mergeWorkbenchProcessingProjection(projection.value, incoming)
: incoming;
error.value = null;
clearTimer();
const next = projection.value;
@@ -1458,17 +1458,10 @@ export interface ShippingTaskUiState {
lifecycle_entries?: ShippingProcessingLifecycleEntry[];
/** 无有效 Candidate 时的独立接收解析处置授权;不是订单生命周期入口。 */
intake_parse_authorized?: boolean;
checkpoint?: {
code?: string | null;
kind?: string | null;
label?: string | null;
} | null;
checkpoint_view?: {
code?: string | null;
kind?: string | null;
label?: string | null;
} | null;
checkpoint_code?: string | null;
/** Gate 位置标签(derive_position);与后端 ui_state.position 同构。 */
position?: string | null;
/** 用户处置模式(derive_user_mode);与后端 ui_state.user_mode 同构。 */
user_mode?: 'auto_continue' | 'must_human' | 'wait_manual_upload' | 'complete' | string | null;
todo?: {
title?: string | null;
message?: string | null;
@@ -1522,7 +1515,10 @@ export interface ShippingTaskUiState {
required_qty?: string | number | null;
available_qty?: string | number | null;
shortage_qty?: string | number | null;
/** Match 正式匹配源;未匹配时为空,禁止用候选回填。 */
source_code?: string | null;
/** CandidateSet 取数目标(单源才填);改源覆写后、匹配前用于下拉回显。 */
selected_source_code?: string | null;
status?: string | null;
/** 多文件冲突行(D5):候选源列表供行内下拉,选定后走 override_line_inventory_source。 */
source_ambiguous?: boolean;
@@ -1555,7 +1551,6 @@ export interface ShippingTaskUiState {
message?: string | null;
} | null;
lifecycle_status?: 'active' | 'voided' | 'archived' | string | null;
checkpoint_kind?: 'auto_continue' | 'must_human' | 'wait_manual_upload' | 'complete' | string | null;
review_status?: string | null;
pending_human_reason?: string | null;
match_status?: string | null;
@@ -1568,7 +1563,10 @@ export interface ShippingTaskUiState {
/** 文件解析阶段汇总的全部待处理问题(库存源 + 解析 warnings 等) */
issues?: string[] | null;
stage?: string | null;
checkpoint_kind?: string | null;
/** 与顶层 user_mode 同源;部分投影只写在 summary。 */
user_mode?: string | null;
/** 与顶层 position 同源;部分投影只写在 summary。 */
position?: string | null;
current_todo?: string | null;
pause_reason?: string | null;
pause_reason_code?: string | null;
@@ -1647,8 +1645,6 @@ export interface ShippingFreightNoticeGroup {
upload_error_code?: string | null;
/** 最近一次上传的用户可见失败原因;仅后端事实,禁止前端按状态猜测。 */
upload_error_message?: string | null;
/** 需人工接管的原因码(如 upload_rpa_pending / manual_upload_pending)。 */
pending_human_reason?: string | null;
export_file_name?: string | null;
available_actions?: string[];
lines: Array<{
@@ -1670,14 +1666,14 @@ export interface ShippingInventoryUploadResponse {
status: string;
message?: string;
task_id?: string;
checkpoint?: string;
position?: string;
data?: Record<string, unknown>;
}
export interface ShippingTaskCreateResponse {
status: string;
message?: string;
task_id?: string;
checkpoint?: string;
position?: string;
data?: Record<string, unknown>;
}
@@ -1699,7 +1695,7 @@ export interface ShippingNoticeUploadResponse {
status: string;
message?: string;
task_id?: string;
checkpoint?: string;
position?: string;
idempotent_replay?: boolean;
file_summary?: ShippingNoticeFileSummary;
data?: Record<string, unknown> & { orchestrator_started?: boolean };
@@ -2755,7 +2751,9 @@ export interface ShippingOrderReviewConfirmResponse {
auto_progress?: {
status?: string | null;
message?: string | null;
checkpoint?: string | null;
/** Gate 位置标签(derive_position) */
position?: string | null;
user_mode?: string | null;
enqueue_result?: string | null;
} | null;
}
@@ -3408,6 +3406,6 @@ export interface ShippingDecisionResponse {
status: string;
message?: string;
task_id?: string;
checkpoint?: string;
position?: string;
data?: Record<string, unknown>;
}
@@ -216,7 +216,8 @@ export type ChatUploadFileSpec =
export interface ShippingParseReviewPayload {
taskId: string;
checkpoint: string;
/** Gate 位置标签;缺省时视为 parse_review */
position?: string;
header: {
customer_name?: string | null;
customer_code?: string | null;
@@ -13,6 +13,7 @@ import { createRouter, createMemoryHistory } from 'vue-router';
import ShippingOrderReviewView from './ShippingOrderReviewView.vue';
import ReviewCurrentProcessingCard from '../components/shipping-review/ReviewCurrentProcessingCard.vue';
import ReviewFieldConflictPanel from '../components/shipping-review/ReviewFieldConflictPanel.vue';
import ManualUploadEvidenceDialog from '@/features/workspace/shipping-task-center/ManualUploadEvidenceDialog.vue';
import { CHAT_PAGE_KEY } from '@/features/chat/composables/chat.context';
import {
auditWorkspaceShippingOrderReviewEligibilityDetails,
@@ -54,10 +55,12 @@ vi.mock('@/features/workspace/api/shipping-tasks.api', () => ({
const focusSuggestionField = vi.fn();
const load = vi.fn().mockResolvedValue(undefined);
const selectCase = vi.fn().mockResolvedValue(undefined);
const beginCrossRunSwitch = vi.fn();
const ensureIntakeParseContextLoaded = vi.fn().mockResolvedValue(true);
/** 确认建单 mock:用例可改写返回值以断言 confirm_outcome / auto_progress 解析。 */
const confirmMock = vi.fn();
const reloadLatestDraftMock = vi.fn().mockResolvedValue(undefined);
const refreshReviewQueueMock = vi.fn().mockResolvedValue(true);
const refreshShippingProcessingMock = vi.fn().mockResolvedValue(undefined);
const startWorkflowProgressPollingMock = vi.fn();
const stopWorkflowProgressPollingMock = vi.fn();
@@ -302,9 +305,11 @@ function createReviewComposableMock() {
load,
loadReviewCase: vi.fn().mockResolvedValue(undefined),
selectCase,
beginCrossRunSwitch,
refreshWorkItemContext: vi.fn(),
openCurrentVersion: vi.fn(),
reloadLatestDraft: reloadLatestDraftMock,
refreshReviewQueue: refreshReviewQueueMock,
toggleConflictDiff: vi.fn(),
patchHeader: vi.fn(),
patchLine: patchLineMock,
@@ -578,7 +583,7 @@ async function mountView(query: Record<string, string> = {}) {
autoProgress: {
status: { unknown: '', needs_retry: '待重试', needs_human: '需要人工处理' },
result: '{status}',
checkpoint: '{checkpoint}',
position: '{position}',
viewTask: '返回对话查看进度',
returnToChat: '返回对话查看进度',
retry: '重试自动推进',
@@ -1171,11 +1176,13 @@ describe('ShippingOrderReviewView layout phase 1', () => {
};
const wrapper = await mountView();
load.mockClear();
beginCrossRunSwitch.mockClear();
await wrapper.get('[data-testid="review-doc-nav-CASE-RUN-2"]').trigger('click');
await flushPromises();
// 路由变更是唯一加载所有者,不能在 select 中再次请求相同 Run/Case。
// 跨 Run 先清旧 OT 投影权威,再只由路由 watcher 触发一次 load。
expect(beginCrossRunSwitch).toHaveBeenCalledWith('CASE-RUN-2');
expect(load).toHaveBeenCalledTimes(1);
expect(load).toHaveBeenCalledWith('RUN-2', 'CASE-RUN-2', {
conversationId: 'conv-1', itemNo: undefined,
@@ -2511,12 +2518,14 @@ describe('ShippingOrderReviewView layout phase 1', () => {
// 关键断言:订单基线列和库存事实合为唯一行级工作表,库存源不得退化为任务级 CRANE。
const workspace = wrapper.get('[data-testid="review-fulfillment-prep-workspace"]');
// 关键交互断言:明细在窄视口保持横向可读,行级操作列固定在右侧。
// 关键交互断言:标题/选行条不滚动;仅表体横向可读,行级操作列固定在右侧。
expect(workspace.classes()).toContain('review-fulfillment-prep-workspace');
expect(workspace.classes()).toContain('overflow-x-auto');
expect(workspace.get('table').classes()).toContain('review-fulfillment-prep-table');
expect(workspace.get('thead th:last-child').classes()).toContain('review-fulfillment-sticky-action-head');
expect(workspace.get('tbody tr:first-child td:last-child').classes()).toContain('review-fulfillment-sticky-action-cell');
expect(workspace.classes()).not.toContain('overflow-x-auto');
const tableScroll = workspace.get('[data-testid="review-fulfillment-prep-table-scroll"]');
expect(tableScroll.classes()).toContain('overflow-x-auto');
expect(tableScroll.get('table').classes()).toContain('review-fulfillment-prep-table');
expect(tableScroll.get('thead th:last-child').classes()).toContain('review-fulfillment-sticky-action-head');
expect(tableScroll.get('tbody tr:first-child td:last-child').classes()).toContain('review-fulfillment-sticky-action-cell');
expect(workspace.text()).toContain('RSV-FROZEN');
expect(workspace.text()).toContain('PN-FROZEN');
expect(workspace.text()).toContain('DBS');
@@ -3165,6 +3174,37 @@ describe('ShippingOrderReviewView layout phase 1', () => {
expect(wrapper.find('[data-testid="manual-upload-evidence-dialog"]').exists()).toBe(false);
});
it('refreshes left-nav queue after manual upload confirmation success', async () => {
activeCase.value = {
...activeCase.value,
status: 'confirmed', confirmed_task_no: 'SN-UPLOAD-QUEUE', confirmed_task_id: 21, has_formal_ot: true,
};
const taskApi = await import('@/features/chat/api/shipping.api');
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
task_no: 'SN-UPLOAD-QUEUE', status: 'completed', business_no: 'WYC26082499',
lines: [], events: [], export_artifacts: [{ id: 1 }],
ui_state: { lifecycle_stage: 'upload_complete', actions: { primary: null, secondary: [] }, summary: {}, steps: [] },
} as any);
vi.mocked(taskApi.getWorkspaceShippingFreightNoticeGroups).mockResolvedValue({
po_number: 'PO-QUEUE',
items: [{ business_no: 'WYC26082499', po_number: 'PO-QUEUE', lines: [] }],
} as any);
const wrapper = await mountView({ lifecycle_stage: 'freight_upload' });
await flushPromises();
reloadLatestDraftMock.mockClear();
refreshReviewQueueMock.mockClear();
refreshShippingProcessingMock.mockClear();
wrapper.findComponent(ManualUploadEvidenceDialog).vm.$emit('success');
await flushPromises();
// 确认上传后五阶段会到「通知完成」;左侧本批队列必须同步重拉 lifecycle_stage。
expect(reloadLatestDraftMock).toHaveBeenCalled();
expect(refreshReviewQueueMock).toHaveBeenCalled();
expect(refreshShippingProcessingMock).toHaveBeenCalled();
});
it('renders one Notice card and one business_no Excel download for freight upload', async () => {
activeCase.value = {
...activeCase.value,
@@ -3475,7 +3515,8 @@ describe('ShippingOrderReviewView layout phase 1', () => {
summary: {}, steps: [],
},
} as any);
// 完成面改版后按「已上传通知聚合」消费同一份 freight groups;仅 uploaded 通知进入完成面。
// 完成面按「已上传通知聚合」消费同一份 freight groups。
// 契约:聚合接口 upload_status 已经投影归一,成功终态为 uploaded。
vi.mocked(taskApi.getWorkspaceShippingFreightNoticeGroups).mockResolvedValue({
po_number: 'PO-100',
items: [
@@ -3490,7 +3531,8 @@ describe('ShippingOrderReviewView layout phase 1', () => {
await flushPromises();
const evidence = wrapper.get('[data-testid="review-lifecycle-upload-complete"]');
// 只展示已上传通知(uploaded),未上传(pending)不进入完成面。
// 只展示已成功上传通知(uploaded),未上传(pending)不进入完成面。
expect(wrapper.get('[data-testid="review-upload-complete-toolbar"]').text()).toContain('本批已上传 1 张发货通知');
expect(evidence.text()).toContain('WYC26082401');
expect(evidence.text()).not.toContain('WYC26082402');
// 人工确认不再展示或依赖货代回执号,即使历史投影仍带有 freight_ref_no。
@@ -3545,6 +3587,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
expect(wrapper.find('[data-testid="review-upload-complete-toolbar"]').exists()).toBe(false);
// 分组到达后:loading 让位,batchCount 工具栏与已上传列表恢复渲染。
// 契约:后端 Notice 面 upload_status 已投影为 uploaded。
resolveGroups({
po_number: 'PO-UPCOMPLETE',
items: [{
@@ -3625,6 +3668,38 @@ describe('ShippingOrderReviewView layout phase 1', () => {
expect(wrapper.findAll('[data-testid="review-freight-upload-download-SN-PO-WAVE-1"]')).toHaveLength(0);
});
it('shows inline RPA and confirm actions when freight notice groups authorize them', async () => {
activeCase.value = {
...activeCase.value,
status: 'confirmed', confirmed_task_no: 'SN-PO-ACTIONS', confirmed_task_id: 25, has_formal_ot: true,
};
const taskApi = await import('@/features/chat/api/shipping.api');
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
task_no: 'SN-PO-ACTIONS', business_no: 'WYC-ACTIONS', status: 'processing', lines: [], events: [],
ui_state: { lifecycle_stage: 'freight_upload', lifecycle_entries: [], actions: { primary: null, secondary: [] }, stage_context: { upload: {} } },
} as any);
vi.mocked(taskApi.getWorkspaceShippingFreightNoticeGroups).mockResolvedValue({
po_number: 'PO-ACTIONS',
items: [{
business_no: 'WYC-ACTIONS',
po_number: 'PO-ACTIONS',
upload_status: 'pending',
export_file_name: 'WYC-ACTIONS.xlsx',
available_actions: ['download_excel', 'retry_freight_upload_rpa', 'mark_manual_uploaded'],
lines: [],
}],
} as any);
const wrapper = await mountView({ lifecycle_stage: 'freight_upload' });
await flushPromises();
// 关键断言:后端授权后的 RPA/确认必须作为行内主按钮出现,不能再藏进空白「更多」菜单。
expect(wrapper.find('[data-testid="review-freight-upload-download"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="review-freight-upload-rpa"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="review-freight-upload-confirm"]').exists()).toBe(true);
expect(wrapper.findAll('[data-testid="review-freight-upload-more"]')).toHaveLength(0);
});
it('sends selected business_nos for freight batch actions', async () => {
activeCase.value = { ...activeCase.value, status: 'confirmed', confirmed_task_no: 'SN-PO-BATCH', confirmed_task_id: 23, has_formal_ot: true };
const taskApi = await import('@/features/chat/api/shipping.api');
@@ -11,7 +11,8 @@
正式任务动作直接提交后端 Gate,避免以无界面组件充当隐藏执行器;
逻辑:建单前订单检查为主卡;正式 OT 后保持 standard,不自动切 formal_task 空壳;
当前 Case 的明确恢复动作优先右栏 CurrentProcessingCard,
不回落至底栏;库存动作仅明细行浮层;表单保存校验仅底栏。
不回落至底栏;库存动作仅明细行浮层;表单保存校验仅底栏;
货代上传确认成功后须 refreshReviewQueue,左侧本批阶段与五阶段对齐。
-->
<script setup lang="ts">
import { computed, defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
@@ -173,10 +174,12 @@ const {
ensureIntakeParseContextLoaded,
load,
selectCase,
beginCrossRunSwitch,
requestedCaseNo,
refreshWorkItemContext,
openCurrentVersion,
reloadLatestDraft,
refreshReviewQueue,
toggleConflictDiff,
patchHeader,
patchLine,
@@ -209,7 +212,14 @@ const {
onReparseCaseReady: handleReparseCaseReady,
// [选法 2] 正式任务下游阶段不再反推复核 Case;OT 号改由已拉取的任务详情提供,
// 使 work-item 统一投影能在 activeCase 为空时仍正常加载。
externalOrderTaskNo: () => String(formalTaskDetail.value?.order_task_no || '').trim() || null,
// order_task_no 优先;若后端 enrich 曾把 OT 自序列化的 order_task_no 冲成 null,
// 则当 task_no 本身是 OT- 前缀时回退 task_no(禁止把 SN 号当 work-item 键)。
externalOrderTaskNo: () => {
const orderTaskNo = String(formalTaskDetail.value?.order_task_no || '').trim();
if (orderTaskNo) return orderTaskNo;
const taskNo = String(formalTaskDetail.value?.task_no || '').trim();
return taskNo.startsWith('OT-') ? taskNo : null;
},
});
const msg = useMessage();
@@ -263,10 +273,48 @@ const LIFECYCLE_STAGE_CODES: ReviewLifecycleStageCode[] = [
/**
* 生命周期阶段只描述用户工作 surface;订单、库存、上传状态仍由后端 Projection/Gate 裁决。
* 读序(契约 §1.1 / §6):正式 OT 优先 A → A 未就绪降级 B → 建单前 reviewQueue/Run → A 兜底。
*/
const lifecycleUiState = computed(() => {
const processing = shippingProcessingProjection.value?.uiState;
const formal = formalTaskDetail.value?.ui_state;
const formalOtReady = Boolean(
activeCase.value?.has_formal_ot
|| (
activeCase.value?.confirmed_task_id
&& String(activeCase.value?.confirmed_task_no || '').trim()
&& !activeCase.value?.task_missing
),
);
const aHasLifecycle = Boolean(
processing?.lifecycleStage
|| (Array.isArray(processing?.lifecycleEntries) && processing.lifecycleEntries.length > 0),
);
/**
* 将 A.blocking_reason 解析为页签阻断文案;无 i18n 时退回 code/message。
* @returns 可展示的阻断说明;无可展示内容时为空串
*/
const resolveBlockerFromProcessing = (): string => {
const reason = processing?.blocking_reason;
if (!reason) return '';
const key = String(reason.i18nKey || '').trim();
if (key && te(key)) {
return String(t(key, (reason.details || {}) as Record<string, unknown>)).trim();
}
return String(reason.code || '').trim();
};
// [STEP 1] 正式 OT:页签 stage/entries/blocker 认 A(与右卡同源)。
if (formalOtReady && aHasLifecycle) {
return {
stage: processing?.lifecycleStage || null,
entries: processing?.lifecycleEntries || [],
blocker: resolveBlockerFromProcessing(),
intakeParseAuthorized: false,
};
}
// [STEP 2] A 轮询未落位时短暂降级 B,避免页签空窗。
if (formal?.lifecycle_stage || formal?.lifecycle_entries?.length) {
return {
stage: formal.lifecycle_stage || null,
@@ -275,8 +323,7 @@ const lifecycleUiState = computed(() => {
intakeParseAuthorized: false,
};
}
// Review Case 尚未建正式任务时,Run/Queue 项仍由后端下发生命周期入口;
// 不得因 formal task 缺失而回退到前端默认订单复核。
// [STEP 3] 建单前:Run/Queue 项仍由后端下发生命周期入口。
const currentCaseNo = String(activeCase.value?.case_no || '').trim();
const reviewEntry = (reviewQueue.value?.items || reviewRun.value?.items || []).find(
(item) => String(item.case_no || '').trim() === currentCaseNo,
@@ -840,11 +887,10 @@ const currentTaskRetryable = computed(() => (
const currentTaskRecoveryActions = computed(() => {
if (formalTaskProjectionPending.value) return [];
if (hasFormalOt.value) {
// [§2.4 单源] 恢复动作从 A(shippingProcessingProjection.ui_state.secondary_actions)读,
// 不再从 B(formalTaskDetail.ui_state.actions)slice。能力仍取任务级
// stage_context.preparation.capabilities(B 工作面事实,§2 保留)。动作码同源(A==C==B),
// 该改动纯收敛。行级库存选源动作只在表格逐行处理,禁止作为任务级按钮出现在右侧卡。
const gateRecovery = (currentTaskUiState.value?.secondary_actions || [])
// [§2.4 单源] 任务级恢复按钮只读 A.secondary_actions;不再叠加 B.capabilities。
// capabilities 仍可作点击执行的 stageCapabilityBypass 查找(见 handleCurrentTaskAction),
// 但不得单独渲成右卡按钮——能力要展示须先并进 A。行级选源禁止出现在右卡。
return (currentTaskUiState.value?.secondary_actions || [])
.filter((action) => action.enabled
&& String(action.code || '').trim() !== 'download_excel'
&& !isNoticeScopedAction(action))
@@ -853,21 +899,10 @@ const currentTaskRecoveryActions = computed(() => {
// 统一右卡 domain:actionCodes.<code>(见 currentTaskPrimaryAction 注;A 的 i18nKey 可能是 chat 域)。
i18nKey: `workspace.shippingNotice.processGate.actionCodes.${String(action.code || '').trim()}`,
}))
.filter((action): action is { code: string; i18nKey: string } => Boolean(action.code));
const capabilityActions = (formalPreparationContext.value?.capabilities || [])
.filter((cap) => cap.scope === 'task' && cap.enabled && String(cap.action_code || '').trim())
.map((cap) => ({
code: String(cap.action_code).trim(),
i18nKey: `chat.shippingOrderReview.lifecycle.prepare.capability.${cap.code}`,
}));
const seen = new Set<string>();
return [...gateRecovery, ...capabilityActions].filter((action) => {
const code = String(action.code || '').trim();
if (!code || seen.has(code)) return false;
if (LINE_SCOPE_INVENTORY_ACTIONS.has(code)) return false;
seen.add(code);
return true;
});
.filter((action): action is { code: string; i18nKey: string } => {
const code = String(action.code || '').trim();
return Boolean(code) && !LINE_SCOPE_INVENTORY_ACTIONS.has(code);
});
}
const projection = shippingProcessingProjection.value;
if (projection) {
@@ -978,7 +1013,8 @@ const confirmSuccess = ref<{
progressFailed: boolean;
progressStatus: string;
progressMessage: string;
checkpoint: string;
/** Gate 位置标签(derive_position) */
position: string;
/** 来自 Case 投影的刷新恢复(非本次确认即时响应) */
restoredFromProjection?: boolean;
} | null>(null);
@@ -1026,7 +1062,7 @@ function hydrateConfirmProgressFromCase() {
progressFailed: true,
progressStatus: String(progress.status || 'needs_retry'),
progressMessage: String(progress.message || ''),
checkpoint: '',
position: '',
restoredFromProjection: true,
};
}
@@ -2383,14 +2419,23 @@ const freightGroupsInFlight = ref(false);
const selectedFreightBusinessNos = ref<string[]>([]);
const freightBatchBusy = ref<'download' | 'confirm' | 'rpa' | 'regenerate' | null>(null);
/**
* 通知完成面的只读聚合:同 PO 中已有上传成功证据(upload_status=uploaded)的发货通知。
* 判断货代通知聚合行是否已具备上传成功事实。
* 核心逻辑:聚合接口 upload_status 已经过后端 project_notice_upload_status 归一,
* 成功终态只认 uploaded;禁止再扩 succeeded/success 同义词兜底。
* @param group - 当前发货通知单聚合行。
* @returns 是否已上传成功。
*/
function isFreightNoticeUploaded(group: ShippingFreightNoticeGroup): boolean {
return String(group.upload_status || '').trim().toLowerCase() === 'uploaded';
}
/**
* 通知完成面的只读聚合:同 PO 中已有上传成功证据的发货通知。
* 核心逻辑:与货代上传面消费同一份 freightNoticeGroups,仅按终态过滤;未上传的
* 通知仍留在货代上传面处理,完成面不出现混淆态。
*/
const uploadedFreightNoticeGroups = computed(() =>
freightNoticeGroups.value.filter((item) =>
String(item.upload_status || '').trim().toLowerCase() === 'uploaded',
),
freightNoticeGroups.value.filter((item) => isFreightNoticeUploaded(item)),
);
/** 批次留底下载:把已完成通知全部打包为 ZIP(复用后端 /shipping-notices/batch/export)。 */
const uploadingBatchArchive = ref(false);
@@ -2500,11 +2545,26 @@ function formalPreparationLineFulfillment(line: { snapshot_line_id?: number | nu
return preparationLineFulfillmentFor(line.snapshot_line_id);
}
function formalPreparationLineSource(line: { snapshot_line_id?: number | null; source_code?: string | null }): string {
/**
* 行「库存源」只读展示文案:Match 正式源优先,其次 CandidateSet 取数目标。
* 核心逻辑:不把任务级 inventory_sources 回填到行;无正式/选中源时显示 —。
*/
function formalPreparationLineSource(line: {
snapshot_line_id?: number | null;
source_code?: string | null;
selected_source_code?: string | null;
}): string {
const fulfillment = formalPreparationLineFulfillment(line);
const source = fulfillment?.inventory_source;
const label = String(source?.label || '').trim();
const code = String(source?.code || line.source_code || fulfillment?.inventory_source_code || '').trim();
// 展示优先级:Match 正式源 → CandidateSet 取数目标 → fulfillment 兼容字段。
const code = String(
source?.code
|| line.source_code
|| line.selected_source_code
|| fulfillment?.inventory_source_code
|| '',
).trim();
if (label && code) return `${label}(${code})`;
return label || code || '—';
}
@@ -2587,22 +2647,38 @@ function formalPreparationLineAllows(
return Boolean(fulfillment?.inventory_allowed_actions?.includes(action));
}
/**
* 通知准备行匹配状态文案:后端 status 现为 user_line_status(如 inventory_matched),
* 优先履约用户态文案,再回退 prepare.matchStatus;禁止把原始码直接展示给用户。
*/
function formalPreparationLineStatusLabel(line: { snapshot_line_id?: number | null; status?: string | null; shortage_qty?: string | number | null }): string {
const fulfillment = formalPreparationLineFulfillment(line);
if (fulfillment?.decision?.decision_code === 'release_inventory_shortage') {
return t('chat.shippingOrderReview.lifecycle.prepare.releaseShortage');
}
const status = String(line.status || '').trim().toLowerCase();
if (status === 'matched' && Number(line.shortage_qty || 0) <= 0) {
if ((status === 'matched' || status === 'inventory_matched') && Number(line.shortage_qty || 0) <= 0) {
return t('chat.shippingOrderReview.lifecycle.prepare.matched');
}
if (status === 'shortage' || Number(line.shortage_qty || 0) > 0) {
return t('chat.shippingOrderReview.lifecycle.prepare.shortage');
}
const userKey = `chat.shippingOrderReview.fulfillmentDecision.userLineStatus.${status}`;
if (status && te(userKey)) return t(userKey);
const key = `chat.shippingOrderReview.lifecycle.prepare.matchStatus.${status || 'unknown'}`;
return te(key) ? t(key) : status || '—';
}
/**
* 通知准备区右上角阶段徽标:后端下发 ready/processing/blocked,必须走 i18n。
*/
function formalPreparationStatusLabel(status?: string | null): string {
const code = String(status || '').trim().toLowerCase();
if (!code) return '';
const key = `chat.shippingOrderReview.lifecycle.prepare.status.${code}`;
return te(key) ? t(key) : code;
}
const releaseInventoryLine = ref<ShippingOrderReviewLineFulfillmentLine | null>(null);
const releaseInventoryReason = ref('');
const releaseInventoryFieldValues = ref<Record<string, string>>({});
@@ -2698,12 +2774,16 @@ function openManualUploadRegistration() {
/**
* 人工上传登记成功后刷新完整工作台状态。
* 先重新拉取 Review Case(顶部阶段与 Gate 的权威投影),再刷新任务详情和统一处理投影;
* 不能只刷新 OT 详情,否则登记已落库但页面仍会显示旧的人工上传阻断状态。
* 先重新拉取 Review Case(顶部阶段与 Gate 的权威投影),再刷新左侧本批队列生命周期、
* 任务详情和统一处理投影;不能只刷新 OT 详情,否则登记已落库但页面仍会显示旧的人工上传阻断状态;
* 也不能省略 refreshReviewQueue,否则五阶段已到「通知完成」而左侧仍停在「货代上传」。
*/
async function handleManualUploadSuccess() {
manualUploadRegistrationOpen.value = false;
await reloadLatestDraft();
await Promise.all([
reloadLatestDraft(),
refreshReviewQueue(),
]);
await Promise.all([
loadFormalTaskDetail(),
refreshShippingProcessing(),
@@ -2821,8 +2901,9 @@ function isFreightUploadProjectionTerminal(): boolean {
}
/**
* 投影到达货代上传终态时刷新一次分组列表(幂等守卫,防止投影在途反复触发)。
* 核心逻辑:只在“上传行为已结束”时写列表;uploading 期间不产生任何额外请求。
* 投影到达货代上传终态时刷新一次分组列表与左侧队列(幂等守卫,防止投影在途反复触发)。
* 核心逻辑:只在“上传行为已结束”时写列表;uploading 期间不产生任何额外请求;
* 同时 refreshReviewQueue,使 RPA 自动完成路径下左侧 lifecycle_stage 与五阶段一致。
*/
function maybeRefreshFreightGroupsOnTerminal() {
if (!isLifecycleFreightUpload.value && !isLifecycleUploadComplete.value) return;
@@ -2832,6 +2913,7 @@ function maybeRefreshFreightGroupsOnTerminal() {
if (!isFreightUploadProjectionTerminal()) return;
freightNoticeGroupsFinalized = true;
void loadFreightNoticeGroups(taskNo);
void refreshReviewQueue();
}
// [PERF] 以任务级处理投影为唯一终态信号,替代独立的 5s 分组轮询:进入货代上传时的初始拉取由
@@ -2851,14 +2933,14 @@ watch(
{ immediate: true },
);
// [PERF] 货代上传分组是否正在等待异步 RPA 回调(uploading / upload_rpa_pending)。
// 只有该状态才需要轮询投影去感知回调落地;空闲(pending,自动上传关闭待人工)、已终态
// (uploaded / failed)都不会自行变化,不应轮询。
/**
* 货代上传分组是否正在等待异步 RPA 回调。
* 核心逻辑:只认投影后的 upload_status(uploading);禁止再读 OT 人工原因列。
*/
function hasFreightGroupsInFlightRpa(groups: ShippingFreightNoticeGroup[]): boolean {
return (groups || []).some((group) => {
const st = String(group.upload_status || '').trim().toLowerCase();
const pendingHuman = String(group.pending_human_reason || '').trim().toLowerCase();
return st === 'uploading' || st === 'upload_rpa_pending' || pendingHuman === 'upload_rpa_pending';
return st === 'uploading';
});
}
@@ -2923,18 +3005,6 @@ function toggleFreightNoticeSelection(businessNo: string, checked: boolean) {
: selectedFreightBusinessNos.value.filter((item) => item !== businessNo);
}
/**
* 判断通知单是否已有后端确认的上传成功事实。
* 核心逻辑:仅消费当前分组的 upload_status;已上传通知不得再次发起 RPA 或人工确认。
* @param group - 后端下发的发货通知单聚合行。
* @returns 是否已上传成功。
*/
function isFreightNoticeUploaded(group: ShippingFreightNoticeGroup): boolean {
return ['uploaded', 'succeeded', 'success'].includes(
String(group.upload_status || '').trim().toLowerCase(),
);
}
/** 已选通知单中任一已上传时,批量写入动作必须 fail-closed,避免重复提交成功通知。 */
const selectedFreightNoticesContainUploaded = computed(() => {
const selected = new Set(selectedFreightBusinessNos.value);
@@ -3031,15 +3101,14 @@ function canRegenerateFreightNotice(group: ShippingFreightNoticeGroup): boolean
/**
* 判断单条通知单是否存在可展开的更多操作。
* 核心逻辑:已上传通知一律不展示更多按钮;其他状态仅在后端授权了至少一个动作时展示,避免空白菜单。
* 核心逻辑:已上传通知一律不展示更多按钮;RPA/确认已提到行内主按钮,
* 更多菜单仅承载低频的 Excel 重生,避免空白菜单。
* @param group - 当前发货通知单聚合行。
* @returns 是否显示更多操作入口。
*/
function hasFreightNoticeMoreActions(group: ShippingFreightNoticeGroup): boolean {
if (isFreightNoticeUploaded(group)) return false;
return canRunFreightNoticeAction(group, 'retry_freight_upload_rpa')
|| canRunFreightNoticeAction(group, 'mark_manual_uploaded')
|| canRegenerateFreightNotice(group);
return canRegenerateFreightNotice(group);
}
/** 仅展示 Notice 聚合接口下发的已授权动作;最终写入仍由对应 API 二次校验。 */
@@ -3209,9 +3278,7 @@ function freightLineNoDisplay(line: { line_no?: string | number | null }): {
/**
* 逐发货通知单的货代上传状态展示。
* 核心逻辑:upload_status 为后端事实;把 uploaded/uploading/failed/pending 映射为文案与色阶,
* 并携带 upload_error_code/upload_error_message 作为逐单失败原因。前端禁止按 upload_status 之外的状态猜原因,
* 未知状态一律回落 pending,避免把内部执行字段当作用户原因。
* 核心逻辑:只认投影后的 upload_status 与 upload_error_*;禁止读 OT 人工原因列。
* @param group - 当前发货通知单聚合行(含 upload_status 与逐单错误字段)。
*/
function freightUploadStatusDisplay(group: ShippingFreightNoticeGroup): {
@@ -3221,9 +3288,8 @@ function freightUploadStatusDisplay(group: ShippingFreightNoticeGroup): {
reason: string | null;
} {
const status = String(group.upload_status || '').trim().toLowerCase();
const pendingHuman = String(group.pending_human_reason || '').trim().toLowerCase();
const reason = group.upload_error_message || group.upload_error_code || null;
if (['uploaded', 'succeeded', 'success'].includes(status)) {
if (status === 'uploaded') {
return {
state: 'uploaded',
label: t('chat.shippingOrderReview.lifecycle.freightUpload.uploadStatus.uploaded'),
@@ -3248,7 +3314,7 @@ function freightUploadStatusDisplay(group: ShippingFreightNoticeGroup): {
reason: t('chat.shippingOrderReview.lifecycle.freightUpload.uploadError', { reason }),
};
}
if (['uploading', 'upload_rpa_pending'].includes(status) || pendingHuman === 'upload_rpa_pending') {
if (status === 'uploading') {
return {
state: 'uploading',
label: t('chat.shippingOrderReview.lifecycle.freightUpload.uploadStatus.uploading'),
@@ -3256,14 +3322,6 @@ function freightUploadStatusDisplay(group: ShippingFreightNoticeGroup): {
reason: null,
};
}
if (pendingHuman) {
return {
state: 'needs_human',
label: t('chat.shippingOrderReview.lifecycle.freightUpload.uploadStatus.needsHuman'),
chipClass: 'bg-amber-100 text-amber-800 dark:bg-amber-950/50 dark:text-amber-200',
reason: reason ? t('chat.shippingOrderReview.lifecycle.freightUpload.uploadError', { reason }) : null,
};
}
return {
state: 'pending',
label: t('chat.shippingOrderReview.lifecycle.freightUpload.uploadStatus.pending'),
@@ -3915,7 +3973,7 @@ const submitPendingAction = async (payload: ReviewConfirmPayload) => {
progressFailed: parsed.progressFailed,
progressStatus: parsed.progressStatus,
progressMessage: parsed.progressMessage,
checkpoint: parsed.checkpoint,
position: parsed.position,
restoredFromProjection: false,
};
if (parsed.progressFailed) {
@@ -3971,7 +4029,7 @@ const closeAuxiliaryPanelsForCaseSwitch = () => {
};
// [NO-OPTIMISTIC MEMORY] 行级选源/覆写是「点保存才生效」的实提交,未保存的暂存选择
// 不得跨文件/切换残留(否则会把上一文件的未保存意图带进新行)。切换即清空暂存,
// 行回到后端真实 source_code 状态,用户须重新选择并点保存。
// 行回到后端 selected_source_code / source_code,用户须重新选择并点保存。
lineSourceSelections.value = {};
lineSourceBusy.value = false;
overrideSourceSelections.value = {};
@@ -4078,6 +4136,13 @@ const select = async (caseNo: string) => {
if (sourceRunNo && sourceRunNo !== String(reviewRun.value?.run_no || '').trim()) {
pendingCrossRunCaseNo.value = caseNo;
try {
// 先进入切换态并清掉上一 OT 投影权威,再改路由;否则 load() 完成前会出现
// 「文件 B 高亮 + 库存/右卡仍是 A」的串味。工作台壳仍保留(无大骨架)。
beginCrossRunSwitch(caseNo);
formalTaskDetailGeneration += 1;
formalTaskDetail.value = null;
formalTaskDetailLoadFailed.value = false;
formalTaskDetailLoading.value = false;
// 先原子提交目标 Run/Case/阶段深链,再读取目标 Case。否则 load() 期间旧文件的
// lifecycle watcher 会把 target stage 写回,形成“文件 B + 阶段 A”的错误组合。
await router.replace({ query: {
@@ -4398,16 +4463,22 @@ function retryFormalTaskDetail() {
* 需要 case_no + draft_version,preparationWaveSelectableLines 读 displayCase.line_fulfillment。
* 该自动补拉是写路径必需的已知暂留债务;根治 = 后续计划「波次出单写路径改源到任务级」,
* 完成后随任务把 fulfillment_prep 一并移出本集合;
* - watch 行为本身不变:集合内阶段 + activeCase 为空 → loadReviewCase 补拉 Case 快照。
* - 通知准备只补 Case、不补 Evidence;订单复核/接收解析补 Case+Evidence(含从准备切回时补证据)。
*/
const REVIEW_EDITOR_NEEDED_STAGES: ReviewLifecycleStageCode[] = ['intake_parse', 'order_review', 'fulfillment_prep'];
watch(
lifecycleCurrentStageCode,
(stage) => {
if (!stage || !REVIEW_EDITOR_NEEDED_STAGES.includes(stage)) return;
if (activeCase.value) return;
const caseNo = String(displayCase.value?.case_no || '').trim();
if (caseNo) void loadReviewCase(caseNo);
if (!caseNo) return;
if (stage === 'fulfillment_prep') {
if (activeCase.value) return;
void loadReviewCase(caseNo, { includeEvidence: false });
return;
}
// intake_parse / order_review:需要复核编辑器(Case + Evidence)
void loadReviewCase(caseNo, { includeEvidence: true });
},
);
@@ -4764,9 +4835,10 @@ watch(
<span
v-if="formalPreparationContext?.status"
class="rounded-full bg-brand-50 px-2.5 py-1 text-xs font-medium text-brand-700 dark:bg-brand-950/30 dark:text-brand-300"
>{{ formalPreparationContext?.status }}</span>
>{{ formalPreparationStatusLabel(formalPreparationContext?.status) }}</span>
</div>
<div v-if="formalPreparationDisplayLines.length" class="review-fulfillment-prep-workspace mt-4 overflow-x-auto rounded-lg border border-default" data-testid="review-fulfillment-prep-workspace">
<div v-if="formalPreparationDisplayLines.length" class="review-fulfillment-prep-workspace mt-4 rounded-lg border border-default" data-testid="review-fulfillment-prep-workspace">
<!-- 标题与选行操作条固定不参与横向滚动,仅表头/表体横向滑动。 -->
<div class="flex items-center justify-between gap-3 border-b border-default bg-surface-muted/30 px-3 py-2">
<div class="text-xs font-semibold text-primary">{{ t('chat.shippingOrderReview.lifecycle.prepare.matchWorkspace') }}</div>
<span class="text-xs text-secondary">{{ t('chat.shippingOrderReview.lifecycle.prepare.lineCount', { count: formalPreparationDisplayLines.length }) }}</span>
@@ -4778,10 +4850,12 @@ watch(
</div>
<button type="button" class="rounded-lg bg-emerald-600 px-3 py-1.5 font-medium text-white disabled:opacity-50" data-testid="review-fulfillment-prep-confirm-wave" :disabled="preparationWaveBusy || !selectedPreparationSnapshotLineIds.length" @click="confirmPreparationWave">{{ preparationWaveBusy ? t('chat.shippingOrderReview.fulfillmentDecision.waving') : t('chat.shippingOrderReview.fulfillmentDecision.confirmWave', { count: selectedPreparationSnapshotLineIds.length }) }}</button>
</div>
<table class="review-fulfillment-prep-table min-w-[1060px] text-xs">
<thead class="border-b border-default bg-surface-muted/50 text-left"><tr><th v-if="preparationEditable" class="w-10 px-3 py-2"><input type="checkbox" class="rounded border-default" :checked="allPreparationWaveSelected" :disabled="!preparationWaveSelectableLines.length || preparationWaveBusy" :aria-label="t('chat.shippingOrderReview.fulfillmentDecision.selectReady')" @change="toggleAllPreparationLineSelection(($event.target as HTMLInputElement).checked)"></th><th v-if="preparationCustomerPoLineVisible" class="whitespace-nowrap px-3 py-2">{{ preparationCustomerPoLineLabel() }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.requiredQty') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.inventorySource') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.fulfillmentDecision.availableQty') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.fulfillmentDecision.shortage') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.lineStatus') }}</th><th class="review-fulfillment-sticky-action-head whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lineOps.moreActions') }}</th></tr></thead>
<tbody><tr v-for="(line, lineIndex) in formalPreparationDisplayLines" :key="line.snapshot_line_id || `${line.reservation_id}-${line.part_number}`" :class="Number(line.shortage_qty || 0) > 0 ? 'border-b border-amber-100 bg-amber-50/40 last:border-0 dark:border-amber-950 dark:bg-amber-950/10' : 'border-b border-default last:border-0'"><td v-if="preparationEditable" class="w-10 px-3 py-2"><input type="checkbox" class="rounded border-default" :checked="selectedPreparationSnapshotLineIds.includes(String(line.snapshot_line_id))" :disabled="preparationWaveBusy || !preparationWaveSelectableLines.some((item) => String(item.snapshot_line_id) === String(line.snapshot_line_id))" :aria-label="`${t('chat.shippingOrderReview.fulfillmentDecision.selectReady')}: ${preparationLineCustomerPoLine(line)}`" :data-testid="`review-fulfillment-line-select-${line.snapshot_line_id || lineIndex}`" @change="togglePreparationLineSelection(String(line.snapshot_line_id || lineIndex), ($event.target as HTMLInputElement).checked)"></td><td v-if="preparationCustomerPoLineVisible" class="whitespace-nowrap px-3 py-2">{{ preparationLineCustomerPoLine(line) }}</td><td class="whitespace-nowrap px-3 py-2 font-medium text-primary">{{ line.reservation_id || '—' }}</td><td class="max-w-[220px] truncate px-3 py-2" :title="line.part_number || '—'">{{ line.part_number || '—' }}</td><td class="whitespace-nowrap px-3 py-2">{{ line.required_qty ?? '—' }}</td><td class="max-w-[220px] px-3 py-2"><div v-if="line.source_ambiguous && !formalPreparationSourceLocked" class="flex items-center gap-1" :data-testid="`review-line-source-ambiguous-${line.snapshot_line_id || lineIndex}`" :title="t('chat.shippingOrderReview.lifecycle.prepare.sourceAmbiguous')"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-source-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="lineSourceSelections[String(line.snapshot_line_id || lineIndex)] || line.source_code || ''" @change="lineSourceSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.lifecycle.prepare.selectSource') }}</option><option v-for="code in line.source_candidates || []" :key="code" :value="code">{{ lineSourceOptionLabel(code) }}</option></select><button type="button" class="rounded bg-brand-600 px-2 py-1 text-xs font-medium text-white disabled:opacity-50" :data-testid="`review-line-source-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!lineSourceSelections[String(line.snapshot_line_id || lineIndex)] || lineSourceBusy || !preparationEditable" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" @click="submitLineSourceSelection(line)"><Check class="h-3.5 w-3.5" /></button></div><span v-else-if="line.source_ambiguous && formalPreparationSourceLocked" class="text-xs text-secondary" :title="t('chat.shippingOrderReview.lifecycle.prepare.sourceLocked')">{{ t('chat.shippingOrderReview.lifecycle.prepare.sourceLocked') }}</span><span v-else-if="!formalPreparationSourceLocked && formSourceOptions.length" class="flex items-center gap-1" :data-testid="`review-line-source-override-${line.snapshot_line_id || lineIndex}`" :title="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-source-override-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="overrideSourceSelections[String(line.snapshot_line_id || lineIndex)] || line.source_code || ''" @change="overrideSourceSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.lifecycle.prepare.selectSource') }}</option><option v-for="s in formSourceOptions" :key="String(s.source_code)" :value="String(s.source_code)">{{ overrideSourceOptionLabel(String(s.source_code)) }}</option></select><button type="button" class="rounded bg-brand-600 px-2 py-1 text-xs font-medium text-white disabled:opacity-50" :data-testid="`review-line-source-override-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!overrideSourceSelections[String(line.snapshot_line_id || lineIndex)] || overrideSourceBusy" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :data-line-index="lineIndex" @click="submitOverrideSource(line)"><Check class="h-3.5 w-3.5" /></button></span><span v-else class="block max-w-[220px] truncate" :title="formalPreparationLineSource(line)">{{ formalPreparationLineSource(line) }}</span></td><td class="whitespace-nowrap px-3 py-2">{{ line.available_qty ?? '—' }}</td><td class="whitespace-nowrap px-3 py-2 font-medium" :class="Number(line.shortage_qty || 0)Line truncated
</table>
<div class="overflow-x-auto overscroll-x-contain" data-testid="review-fulfillment-prep-table-scroll">
<table class="review-fulfillment-prep-table min-w-[1060px] text-xs">
<thead class="border-b border-default bg-surface-muted/50 text-left"><tr><th v-if="preparationEditable" class="w-10 px-3 py-2"><input type="checkbox" class="rounded border-default" :checked="allPreparationWaveSelected" :disabled="!preparationWaveSelectableLines.length || preparationWaveBusy" :aria-label="t('chat.shippingOrderReview.fulfillmentDecision.selectReady')" @change="toggleAllPreparationLineSelection(($event.target as HTMLInputElement).checked)"></th><th v-if="preparationCustomerPoLineVisible" class="whitespace-nowrap px-3 py-2">{{ preparationCustomerPoLineLabel() }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.requiredQty') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.inventorySource') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.fulfillmentDecision.availableQty') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.fulfillmentDecision.shortage') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.lineStatus') }}</th><th class="review-fulfillment-sticky-action-head whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lineOps.moreActions') }}</th></tr></thead>
<tbody><tr v-for="(line, lineIndex) in formalPreparationDisplayLines" :key="line.snapshot_line_id || `${line.reservation_id}-${line.part_number}`" :class="Number(line.shortage_qty || 0) > 0 ? 'border-b border-amber-100 bg-amber-50/40 last:border-0 dark:border-amber-950 dark:bg-amber-950/10' : 'border-b border-default last:border-0'"><td v-if="preparationEditable" class="w-10 px-3 py-2"><input type="checkbox" class="rounded border-default" :checked="selectedPreparationSnapshotLineIds.includes(String(line.snapshot_line_id))" :disabled="preparationWaveBusy || !preparationWaveSelectableLines.some((item) => String(item.snapshot_line_id) === String(line.snapshot_line_id))" :aria-label="`${t('chat.shippingOrderReview.fulfillmentDecision.selectReady')}: ${preparationLineCustomerPoLine(line)}`" :data-testid="`review-fulfillment-line-select-${line.snapshot_line_id || lineIndex}`" @change="togglePreparationLineSelection(String(line.snapshot_line_id || lineIndex), ($event.target as HTMLInputElement).checked)"></td><td v-if="preparationCustomerPoLineVisible" class="whitespace-nowrap px-3 py-2">{{ preparationLineCustomerPoLine(line) }}</td><td class="whitespace-nowrap px-3 py-2 font-medium text-primary">{{ line.reservation_id || '—' }}</td><td class="max-w-[220px] truncate px-3 py-2" :title="line.part_number || '—'">{{ line.part_number || '—' }}</td><td class="whitespace-nowrap px-3 py-2">{{ line.required_qty ?? '—' }}</td><td class="max-w-[220px] px-3 py-2"><div v-if="line.source_ambiguous && !formalPreparationSourceLocked" class="flex items-center gap-1" :data-testid="`review-line-source-ambiguous-${line.snapshot_line_id || lineIndex}`" :title="t('chat.shippingOrderReview.lifecycle.prepare.sourceAmbiguous')"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-source-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="lineSourceSelections[String(line.snapshot_line_id || lineIndex)] || line.source_code || ''" @change="lineSourceSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.lifecycle.prepare.selectSource') }}</option><option v-for="code in line.source_candidates || []" :key="code" :value="code">{{ lineSourceOptionLabel(code) }}</option></select><button type="button" class="rounded bg-brand-600 px-2 py-1 text-xs font-medium text-white disabled:opacity-50" :data-testid="`review-line-source-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!lineSourceSelections[String(line.snapshot_line_id || lineIndex)] || lineSourceBusy || !preparationEditable" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" @click="submitLineSourceSelection(line)"><Check class="h-3.5 w-3.5" /></button></div><span v-else-if="line.source_ambiguous && formalPreparationSourceLocked" class="text-xs text-secondary" :title="t('chat.shippingOrderReview.lifecycle.prepare.sourceLocked')">{{ t('chat.shippingOrderReview.lifecycle.prepare.sourceLocked') }}</span><span v-else-if="!formalPreparationSourceLocked && formSourceOptions.length" class="flex items-center gap-1" :data-testid="`review-line-source-override-${line.snapshot_line_id || lineIndex}`" :title="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-source-override-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="overrideSourceSelections[String(line.snapshot_line_id || lineIndex)] || line.selected_source_code || line.source_code || ''" @change="overrideSourceSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.lifecycle.prepare.selectSource') }}</option><option v-for="s in formSourceOptions" :key="String(s.source_code)" :value="String(s.source_code)">{{ overrideSourceOptionLabel(String(s.source_code)) }}</option></select><button type="button" class="rounded bg-brand-600 px-2 py-1 text-xs font-medium text-white disabled:opacity-50" :data-testid="`review-line-source-override-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!overrideSourceSelections[String(line.snapshot_line_id || lineIndex)] || overrideSourceBusy" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :data-line-index="lineIndex" @click="submitOverrideSource(line)"><Check class="h-3.5 w-3.5" /></button></span><span v-else class="block max-w-[220px] truncate" :title="formalPreparationLineSource(line)">{{ formalPreparationLineSource(line) }}</span></td><td class="whitespace-nowrap px-3 py-2">{{ line.available_qty ?? '—' }}</td><td class="whitespace-nowrap px-3 py-2 font-medium" :class=Line truncated
</table>
</div>
</div>
<p v-else class="mt-3 rounded-lg border border-default bg-surface-muted/50 p-3 text-xs text-secondary" data-testid="review-fulfillment-prep-pending">
{{ t('chat.shippingOrderReview.lifecycle.prepare.pending') }}
@@ -4844,11 +4918,25 @@ watch(
<div class="flex items-center gap-2">
<span :class="freightUploadStatusDisplay(group).chipClass" :title="freightUploadStatusDisplay(group).reason || undefined" class="rounded-full px-2 py-0.5 font-medium cursor-help" tabindex="0">{{ freightUploadStatusDisplay(group).label }}</span>
<button type="button" class="rounded border border-brand-200 px-2 py-1 font-medium text-brand-700 hover:bg-brand-50" data-testid="review-freight-upload-download" :disabled="saving" @click="void downloadFreightNotice(group.business_no)">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.download') }}</button>
<button
v-if="canRunFreightNoticeAction(group, 'retry_freight_upload_rpa')"
type="button"
class="rounded border border-default px-2 py-1 font-medium text-primary hover:bg-surface-muted disabled:opacity-50"
data-testid="review-freight-upload-rpa"
:disabled="freightBatchBusy !== null"
@click="void runFreightNoticeAction(group, 'rpa')"
>{{ t('chat.shippingOrderReview.lifecycle.freightUpload.rpa') }}</button>
<button
v-if="canRunFreightNoticeAction(group, 'mark_manual_uploaded')"
type="button"
class="rounded border border-default px-2 py-1 font-medium text-primary hover:bg-surface-muted disabled:opacity-50"
data-testid="review-freight-upload-confirm"
:disabled="freightBatchBusy !== null"
@click="void runFreightNoticeAction(group, 'confirm')"
>{{ t('chat.shippingOrderReview.lifecycle.freightUpload.confirm') }}</button>
<details v-if="hasFreightNoticeMoreActions(group)" class="relative" data-testid="review-freight-upload-more">
<summary class="list-none rounded border border-default p-1 text-secondary hover:bg-surface" :aria-label="t('chat.shippingProcessing.action.more')"><MoreHorizontal class="h-3.5 w-3.5" aria-hidden="true" /></summary>
<div class="absolute right-0 top-7 z-10 flex min-w-40 flex-col gap-1 rounded border border-default bg-surface p-1 shadow-lg">
<button v-if="canRunFreightNoticeAction(group, 'retry_freight_upload_rpa')" type="button" class="rounded px-2 py-1 text-left text-[11px] text-primary hover:bg-surface-muted disabled:opacity-50" :disabled="freightBatchBusy !== null" @click="void runFreightNoticeAction(group, 'rpa')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchRpa') }}</button>
<button v-if="canRunFreightNoticeAction(group, 'mark_manual_uploaded')" type="button" class="rounded px-2 py-1 text-left text-[11px] text-primary hover:bg-surface-muted disabled:opacity-50" :disabled="freightBatchBusy !== null" @click="void runFreightNoticeAction(group, 'confirm')">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.batchConfirm') }}</button>
<button v-if="canRegenerateFreightNotice(group)" type="button" class="rounded px-2 py-1 text-left text-[11px] text-primary hover:bg-surface-muted disabled:opacity-50" :disabled="freightBatchBusy !== null" data-testid="review-freight-upload-regenerate" @click="void runFreightNoticeAction(group, 'regenerate')">{{ t('workspace.shippingNotice.processGate.actionCodes.regenerate_excel_artifact') }}</button>
</div>
</details>
@@ -5634,7 +5722,7 @@ watch(
/**
* 用途:库存匹配明细在窄工作区保留业务列宽,且行级授权操作始终可用。
* 依赖:formalPreparationLines 与后端下发的 inventory_allowed_actions。
* 逻辑:容器负责横向滚动,右侧单个操作单元格 sticky,不改变操作授权或状态判断。
* 逻辑:仅表头/表体容器横向滚动(标题与选行条固定),右侧操作列 sticky。
*/
.review-fulfillment-prep-table {
width: max-content;
@@ -154,23 +154,23 @@ describe('workbenchActionRegistry', () => {
expect(resolved?.todoActionCode).toBe('retry_inventory_matching');
});
it('routes reload inventory result through the formal Gate todo action', () => {
it('routes merged inventory rematch through the formal Gate todo action', () => {
const result = resolveProcessingActionPresentation(projection({
uiState: {
status: 'retryable', stage: 'inventory_preparation', blocking_reason: null,
primary_action: { code: 'reload_inventory_result', label_key: 'x' }, secondary_actions: [],
primary_action: { code: 'retry_inventory_matching', label_key: 'x' }, secondary_actions: [],
},
currentGate: {
gateCode: 'inventory_preparation',
status: 'blocked_retryable',
nextActionCode: 'reload_inventory_result',
nextActionCode: 'retry_inventory_matching',
},
}), { surface: 'review' });
const resolved = resolveWorkbenchActionItem(result.primary!, { postCreate: true });
expect(result.primary?.intent).toBe('reload_inventory_result');
expect(result.primary?.intent).toBe('retry_inventory_matching');
expect(resolved?.reviewBehavior).toBe('todo_panel');
expect(resolved?.todoActionCode).toBe('reload_inventory_result');
expect(resolved?.todoActionCode).toBe('retry_inventory_matching');
});
it('shows RPA upload retry instead of manual upload entries when Gate 19 is blocked', () => {
@@ -83,7 +83,7 @@ function detail(): ShippingTaskDetail {
},
secondary: [],
},
checkpoint_kind: 'inventory',
user_mode: 'must_human',
process_gate: {
execution_no: 'SPE-1',
current_blocking_gate: {
+184 -20
View File
@@ -542,7 +542,13 @@
"resolveFailed": "Failed to resolve conflict. Refresh and try again."
},
"shippingNoticeUi": {
"stage": {"intakeParse": "Intake and parsing", "orderReview": "Order review", "fulfillmentPrep": "Notification preparation", "freightUpload": "Freight upload", "uploadComplete": "Notification completion"},
"stage": {
"intakeParse": "Intake and parsing",
"orderReview": "Order review",
"fulfillmentPrep": "Notification preparation",
"freightUpload": "Freight upload",
"uploadComplete": "Notification completion"
},
"rpaModeBrowser": "Real RPA",
"rpaModeMock": "Mock RPA",
"rpaModeUnknown": "RPA mode unknown",
@@ -998,7 +1004,11 @@
"progressPercent": "Completion",
"stepNo": "Step {value}",
"defaultLearnerName": "Current learner",
"noContent": { "loading": "Loading training content...", "title": "No training content", "description": "The administrator has not published the current training configuration yet." },
"noContent": {
"loading": "Loading training content...",
"title": "No training content",
"description": "The administrator has not published the current training configuration yet."
},
"unknownDepartment": "Department pending",
"video": {
"title": "Step 1: Watch the training video",
@@ -1468,13 +1478,136 @@
"blocked": "Prerequisite incomplete",
"prerequisite": "Complete the current stage first",
"autoAdvanced": "Auto-advanced to {stage}",
"identity": {"po": "PO: {value}", "case": "Case: {value}", "version": "Order version: V{value}"},
"descriptions": {"intake_parse": "Review the email body and current attachment, then resolve intake parsing issues.", "order_review": "Verify fields and evidence, resolve conflicts, and freeze the order.", "fulfillment_prep": "Complete inventory matching and generate the notice Excel.", "freight_upload": "Download the notice, run RPA or register a manual upload, and reconcile unknown results.", "upload_complete": "Shown only after complete upload-success evidence is verified."},
"intakeParse": {"title": "Intake and parsing", "email": "Email body", "emailPreviewTitle": "Safe email body preview", "noEmail": "No email context", "attachment": "Current attachment", "fileName": "File name", "fileType": "File type", "preview": "Attachment preview", "previewLoading": "Loading attachment preview…", "loadPreview": "Load attachment preview", "previewUnsupported": "The current attachment is not a PDF and cannot be previewed here.", "loading": "Loading intake parsing context…", "loadFailed": "Failed to load intake parsing context.", "retry": "Retry"},
"prepare": {"customerPoLine": "Customer PO Line No.", "title": "Notice preparation", "subtitle": "Handle inventory candidates, matching issues, and notice generation here.", "frozenOrder": "Frozen order", "inventorySource": "Inventory source", "excel": "Shipping Excel", "downloadInventory": "Download inventory file", "retryInventory": "Re-fetch inventory", "sourceAmbiguous": "This line matched multiple inventory sources; select the actual shipping warehouse", "sourceLocked": "Notice Excel generated; inventory source is locked", "selectSource": "Select inventory source", "releaseShortage": "Release shortage", "releaseShortageHint": "Release allows shipping Excel generation. State the reason for this shortage release.", "releaseReasonPlaceholder": "Enter release reason (required)", "releaseConfirm": "Confirm release", "requiredQty": "Required quantity", "matchWorkspace": "Inventory matching", "lineCount": "{count} inventory results", "lineStatus": "Match status", "matched": "Matched", "shortage": "Inventory shortage", "matchStatus": {"not_found": "Inventory not found", "preparing": "Preparing inventory", "mapping_failed": "Inventory mapping failed", "unavailable": "Inventory unavailable", "source_conflict": "Inventory source conflict", "invalid_key": "Invalid match key", "result_missing": "Awaiting match result", "unknown": "Unknown status"}, "pending": "Inventory matching or the shipping file is not ready yet. Use the current processing card to continue.", "loadFailed": "Failed to load notice preparation details; current data could not be confirmed.", "detailUnavailable": "Notice preparation details have not returned yet, so frozen order and inventory matching data cannot be shown.", "retry": "Reload", "capability": {"retry_inventory_preparation": "Re-fetch inventory", "reload_inventory_result": "Reload inventory result", "override_line_inventory_source": "Change inventory source"}, "capabilityDisabled": {"excel_locked": "Notice Excel generated; inventory source is locked", "no_candidates": "No available inventory source candidates", "no_prior_result": "No prior inventory result"}},
"freightUpload": {"title": "Freight upload", "subtitle": "Grouped by shipping notice; each shipping notice has one Excel.", "loading": "Loading shipping notices…", "loadFailed": "Failed to load shipping notices. Refresh and try again.", "poMissing": "The current task has no recognized PO, so notices cannot be grouped yet.", "empty": "No uploadable shipping notices for this PO.", "download": "Download Excel", "lineNo": "Line", "lineNoSourceCustomerPo": "Customer PO line no.", "lineNoSourceSequence": "System sequence (internal line no. not recognized)", "selected": "{count} notices selected", "batchDownload": "Download selected", "batchRpa": "Batch RPA upload", "batchConfirm": "Confirm selected uploaded", "noticeCount": "{count} shipping notice(s)", "uploadError": "Upload error reason: {reason}", "uploadStatus": {"pending": "Pending upload", "uploading": "Uploading", "failed": "Upload failed", "uploaded": "Uploaded", "needsHuman": "Manual upload needed"}},
"uploadComplete": {"title": "Notification completion", "subtitle": "Upload-success evidence is verified. This view is read only.", "batchCount": "{count} shipping notice(s) uploaded in this batch", "batchDownload": "Download batch ZIP", "batchDownloading": "Packaging…", "uploaded": "Uploaded", "uploadedAt": "{time}", "exportFile": "File: {file}", "expand": "Show line details", "collapse": "Hide line details", "uploadMode": "Upload method: {mode}", "uploadModeManual": "Manual confirmation", "uploadModeRpa": "RPA upload", "empty": "No uploaded shipping notices in this batch."},
"upload": {"title": "Freight upload", "subtitle": "Download the notice Excel, upload it on the freight platform and confirm the manual upload, or run RPA.", "manualUpload": "Confirm manual upload", "attempt": "Latest upload attempt: {mode} · {status}"},
"identity": {
"po": "PO: {value}",
"case": "Case: {value}",
"version": "Order version: V{value}"
},
"descriptions": {
"intake_parse": "Review the email body and current attachment, then resolve intake parsing issues.",
"order_review": "Verify fields and evidence, resolve conflicts, and freeze the order.",
"fulfillment_prep": "Complete inventory matching and generate the notice Excel.",
"freight_upload": "Download the notice, run RPA or register a manual upload, and reconcile unknown results.",
"upload_complete": "Shown only after complete upload-success evidence is verified."
},
"intakeParse": {
"title": "Intake and parsing",
"email": "Email body",
"emailPreviewTitle": "Safe email body preview",
"noEmail": "No email context",
"attachment": "Current attachment",
"fileName": "File name",
"fileType": "File type",
"preview": "Attachment preview",
"previewLoading": "Loading attachment preview…",
"loadPreview": "Load attachment preview",
"previewUnsupported": "The current attachment is not a PDF and cannot be previewed here.",
"loading": "Loading intake parsing context…",
"loadFailed": "Failed to load intake parsing context.",
"retry": "Retry"
},
"prepare": {
"customerPoLine": "Customer PO Line No.",
"title": "Notice preparation",
"subtitle": "Handle inventory candidates, matching issues, and notice generation here.",
"frozenOrder": "Frozen order",
"inventorySource": "Inventory source",
"excel": "Shipping Excel",
"downloadInventory": "Download inventory file",
"retryInventory": "Re-fetch inventory",
"sourceAmbiguous": "This line matched multiple inventory sources; select the actual shipping warehouse",
"sourceLocked": "Notice Excel generated; inventory source is locked",
"selectSource": "Select inventory source",
"releaseShortage": "Release shortage",
"releaseShortageHint": "Release allows shipping Excel generation. State the reason for this shortage release.",
"releaseReasonPlaceholder": "Enter release reason (required)",
"releaseConfirm": "Confirm release",
"requiredQty": "Required quantity",
"matchWorkspace": "Inventory matching",
"lineCount": "{count} inventory results",
"lineStatus": "Match status",
"matched": "Matched",
"shortage": "Inventory shortage",
"matchStatus": {
"not_found": "Inventory not found",
"preparing": "Preparing inventory",
"mapping_failed": "Inventory mapping failed",
"unavailable": "Inventory unavailable",
"source_conflict": "Inventory source conflict",
"invalid_key": "Invalid match key",
"result_missing": "Awaiting match result",
"unknown": "Unknown status",
"inventory_matched": "Matched"
},
"pending": "Inventory matching or the shipping file is not ready yet. Use the current processing card to continue.",
"loadFailed": "Failed to load notice preparation details; current data could not be confirmed.",
"detailUnavailable": "Notice preparation details have not returned yet, so frozen order and inventory matching data cannot be shown.",
"retry": "Reload",
"capability": {
"retry_inventory_preparation": "Re-fetch inventory",
"reload_inventory_result": "Reload inventory result",
"override_line_inventory_source": "Change inventory source"
},
"capabilityDisabled": {
"excel_locked": "Notice Excel generated; inventory source is locked",
"no_candidates": "No available inventory source candidates",
"no_prior_result": "No prior inventory result"
},
"status": {
"ready": "Match ready",
"processing": "Processing",
"blocked": "Blocked"
}
},
"freightUpload": {
"title": "Freight upload",
"subtitle": "Grouped by shipping notice; each shipping notice has one Excel.",
"loading": "Loading shipping notices…",
"loadFailed": "Failed to load shipping notices. Refresh and try again.",
"poMissing": "The current task has no recognized PO, so notices cannot be grouped yet.",
"empty": "No uploadable shipping notices for this PO.",
"download": "Download Excel",
"rpa": "RPA upload",
"confirm": "Confirm uploaded",
"lineNo": "Line",
"lineNoSourceCustomerPo": "Customer PO line no.",
"lineNoSourceSequence": "System sequence (internal line no. not recognized)",
"selected": "{count} notices selected",
"batchDownload": "Download selected",
"batchRpa": "Batch RPA upload",
"batchConfirm": "Confirm selected uploaded",
"noticeCount": "{count} shipping notice(s)",
"uploadError": "Upload error reason: {reason}",
"uploadStatus": {
"pending": "Pending upload",
"uploading": "Uploading",
"failed": "Upload failed",
"uploaded": "Uploaded",
"needsHuman": "Manual upload needed"
}
},
"uploadComplete": {
"title": "Notification completion",
"subtitle": "Upload-success evidence is verified. This view is read only.",
"batchCount": "{count} shipping notice(s) uploaded in this batch",
"batchDownload": "Download batch ZIP",
"batchDownloading": "Packaging…",
"uploaded": "Uploaded",
"uploadedAt": "{time}",
"exportFile": "File: {file}",
"expand": "Show line details",
"collapse": "Hide line details",
"uploadMode": "Upload method: {mode}",
"uploadModeManual": "Manual confirmation",
"uploadModeRpa": "RPA upload",
"empty": "No uploaded shipping notices in this batch."
},
"upload": {
"title": "Freight upload",
"subtitle": "Download the notice Excel, upload it on the freight platform and confirm the manual upload, or run RPA.",
"manualUpload": "Confirm manual upload",
"attempt": "Latest upload attempt: {mode} · {status}"
},
"stages": {
"intake_parse": "Intake and parsing",
"order_review": "Order review",
@@ -1792,7 +1925,7 @@
"confirmAutoProgress": "Task {taskNo} created and auto-progress started",
"autoProgress": {
"result": "Auto-progress result: {status}",
"checkpoint": "Current checkpoint: {checkpoint}",
"position": "Current position: {position}",
"viewTask": "Back to chat to view progress",
"returnToChat": "Back to chat to view progress",
"returnedFocusHint": "Back in chat, focused on task {taskNo} (see In progress on the right)",
@@ -2245,12 +2378,17 @@
"ready": "Ready",
"unknownField": "Unknown field"
},
"fieldConflict": {
"fieldConflict": {
"title": "Field conflicts to resolve ({count})",
"subtitle": "Conflicting values from multiple sources are not auto-applied. Pick one value or enter a custom value before building the order.",
"evidenceIssueTitle": "Evidence to confirm ({count})",
"evidenceIssueSubtitle": "This field lacks traceable document evidence, not a value conflict. Verify the source or reparse the document.",
"scope": { "header": "Order header", "line": "Order line", "line_unassigned": "Order line (not located)", "unscoped": "Field scope not located" },
"subtitle": "Conflicting values from multiple sources are not auto-applied. Pick one value or enter a custom value before building the order.",
"evidenceIssueTitle": "Evidence to confirm ({count})",
"evidenceIssueSubtitle": "This field lacks traceable document evidence, not a value conflict. Verify the source or reparse the document.",
"scope": {
"header": "Order header",
"line": "Order line",
"line_unassigned": "Order line (not located)",
"unscoped": "Field scope not located"
},
"optionLabel": "Option {index}",
"adoptOption": "Use this value",
"customValue": "Enter custom value",
@@ -2575,9 +2713,18 @@
"downloadFailed": "{count} batch output download(s) failed. Retry individually.",
"singleDownloadFailed": "Batch output download failed"
},
"stageSummary": {"empty": "No files", "needsAction": "{count} needs action", "processing": "{count} processing", "completed": "{count} completed", "total": "{count} files"},
"stageSummary": {
"empty": "No files",
"needsAction": "{count} needs action",
"processing": "{count} processing",
"completed": "{count} completed",
"total": "{count} files"
},
"unclassified": "{count} file(s) still need a lifecycle stage; see the file list",
"search": {"label": "Search files or PO", "placeholder": "Search filename or PO"},
"search": {
"label": "Search files or PO",
"placeholder": "Search filename or PO"
},
"fileProcessing": "File processing",
"filteringByStage": "Filtered by: {stage}",
"clearStageFilter": "Clear filter",
@@ -2704,8 +2851,26 @@
"retry": "Processing failed; check the reason and retry"
},
"progress": {
"step": {"document_queued":"Waiting for the parsing task to start","layout_parsing_started":"Parsing the PDF layout","layout_parsing_completed":"PDF layout parsing completed","profile_matching":"Matching the order template","profile_matched":"Order template matched","table_reconstructed":"Reconstructing the order table","order_fields_extracted":"Extracting order fields","email_supplement_merged":"Merging email supplements","review_ready":"Order result is ready for review","review_required":"Order result requires manual review"},
"lifecycleReason": {"failed":"The current step failed. View details and retry.","cancelled":"This processing run was cancelled.","review_required":"The current result requires manual review.","processing_slow":"The current step is taking longer than expected and is still running.","queue_backlog":"The current step is queued and waiting to run.","processing_attention":"The current step has not completed for a long time. View details or refresh later."},
"step": {
"document_queued": "Waiting for the parsing task to start",
"layout_parsing_started": "Parsing the PDF layout",
"layout_parsing_completed": "PDF layout parsing completed",
"profile_matching": "Matching the order template",
"profile_matched": "Order template matched",
"table_reconstructed": "Reconstructing the order table",
"order_fields_extracted": "Extracting order fields",
"email_supplement_merged": "Merging email supplements",
"review_ready": "Order result is ready for review",
"review_required": "Order result requires manual review"
},
"lifecycleReason": {
"failed": "The current step failed. View details and retry.",
"cancelled": "This processing run was cancelled.",
"review_required": "The current result requires manual review.",
"processing_slow": "The current step is taking longer than expected and is still running.",
"queue_backlog": "The current step is queued and waiting to run.",
"processing_attention": "The current step has not completed for a long time. View details or refresh later."
},
"title": "Order Processing Progress",
"completedOfTotal": "{done} / {total} completed",
"currentStage": "Current: {stage}",
@@ -3406,7 +3571,6 @@
"complete": "Complete",
"missing": "Missing"
},
"transfer": {
"fileProgressTitle": "Receipt file preparation",
"stageFileReady": "File ready",
+184 -20
View File
@@ -542,7 +542,13 @@
"resolveFailed": "แก้ความขัดแย้งไม่สำเร็จ กรุณารีเฟรชแล้วลองใหม่"
},
"shippingNoticeUi": {
"stage": {"intakeParse": "รับและแยกวิเคราะห์", "orderReview": "ตรวจสอบคำสั่งซื้อ", "fulfillmentPrep": "เตรียมการแจ้งการจัดส่ง", "freightUpload": "อัปโหลดให้ผู้ให้บริการขนส่ง", "uploadComplete": "การแจ้งการจัดส่งเสร็จสิ้น"},
"stage": {
"intakeParse": "รับและแยกวิเคราะห์",
"orderReview": "ตรวจสอบคำสั่งซื้อ",
"fulfillmentPrep": "เตรียมการแจ้งการจัดส่ง",
"freightUpload": "อัปโหลดให้ผู้ให้บริการขนส่ง",
"uploadComplete": "การแจ้งการจัดส่งเสร็จสิ้น"
},
"rpaModeBrowser": "RPA จริง",
"rpaModeMock": "Mock RPA",
"rpaModeUnknown": "ไม่ทราบโหมด RPA",
@@ -998,7 +1004,11 @@
"progressPercent": "เปอร์เซ็นต์เสร็จสิ้น",
"stepNo": "ขั้นตอน {value}",
"defaultLearnerName": "ผู้เรียนปัจจุบัน",
"noContent": { "loading": "กำลังโหลดเนื้อหาการฝึกอบรม...", "title": "ยังไม่มีเนื้อหาการฝึกอบรม", "description": "ผู้ดูแลระบบยังไม่ได้เผยแพร่การกำหนดค่าการฝึกอบรมปัจจุบัน" },
"noContent": {
"loading": "กำลังโหลดเนื้อหาการฝึกอบรม...",
"title": "ยังไม่มีเนื้อหาการฝึกอบรม",
"description": "ผู้ดูแลระบบยังไม่ได้เผยแพร่การกำหนดค่าการฝึกอบรมปัจจุบัน"
},
"unknownDepartment": "ยังไม่ได้ระบุแผนก",
"video": {
"title": "ขั้นตอน 1: ดูวิดีโออบรม",
@@ -1468,13 +1478,136 @@
"blocked": "เงื่อนไขก่อนหน้ายังไม่เสร็จ",
"prerequisite": "กรุณาทำขั้นตอนปัจจุบันให้เสร็จก่อน",
"autoAdvanced": "เดินหน้าอัตโนมัติไปยัง {stage}",
"identity": {"po": "PO: {value}", "case": "Case: {value}", "version": "เวอร์ชันคำสั่งซื้อ: V{value}"},
"descriptions": {"intake_parse": "ตรวจสอบเนื้อหาอีเมลและไฟล์แนบปัจจุบัน แล้วจัดการปัญหาการแยกวิเคราะห์ขาเข้า", "order_review": "ตรวจสอบข้อมูลและหลักฐาน แก้ข้อขัดแย้ง และตรึงคำสั่งซื้อ", "fulfillment_prep": "จับคู่สต็อกและสร้าง Excel แจ้งงาน", "freight_upload": "ดาวน์โหลดไฟล์แจ้งงาน รัน RPA หรือลงทะเบียนการอัปโหลดด้วยตนเอง และตรวจสอบผลลัพธ์ที่ไม่ทราบ", "upload_complete": "แสดงเมื่อยืนยันหลักฐานความสำเร็จของการอัปโหลดครบถ้วนแล้วเท่านั้น"},
"intakeParse": {"title": "รับและแยกวิเคราะห์", "email": "เนื้อหาอีเมล", "emailPreviewTitle": "ตัวอย่างเนื้อหาอีเมลแบบปลอดภัย", "noEmail": "ไม่มีบริบทอีเมล", "attachment": "ไฟล์แนบปัจจุบัน", "fileName": "ชื่อไฟล์", "fileType": "ประเภทไฟล์", "preview": "ตัวอย่างไฟล์แนบ", "previewLoading": "กำลังโหลดตัวอย่างไฟล์แนบ…", "loadPreview": "โหลดตัวอย่างไฟล์แนบ", "previewUnsupported": "ไฟล์แนบปัจจุบันไม่ใช่ PDF และไม่สามารถแสดงตัวอย่างที่นี่ได้", "loading": "กำลังโหลดบริบทการแยกวิเคราะห์ขาเข้า…", "loadFailed": "โหลดบริบทการแยกวิเคราะห์ขาเข้าไม่สำเร็จ", "retry": "ลองอีกครั้ง"},
"prepare": {"customerPoLine": "เลขที่บรรทัด PO ของลูกค้า", "title": "เตรียมการแจ้ง", "subtitle": "จัดการตัวเลือกสต็อก ปัญหาการจับคู่ และการสร้างไฟล์แจ้งงานที่นี่", "frozenOrder": "คำสั่งซื้อที่ตรึงแล้ว", "inventorySource": "แหล่งสต็อก", "excel": "Excel การจัดส่ง", "downloadInventory": "ดาวน์โหลดไฟล์สินค้าคงคลัง", "retryInventory": "ดึงข้อมูลสต็อกอีกครั้ง", "sourceAmbiguous": "รายการนี้ตรงกับหลายแหล่งสินค้า โปรดเลือกคลังที่จัดส่งจริง", "sourceLocked": "สร้าง Excel แจ้งเตือนแล้ว แหล่งสินค้าถูกล็อก", "selectSource": "เลือกแหล่งสินค้า", "releaseShortage": "อนุมัติส่วนขาดสต็อก", "releaseShortageHint": "การอนุมัติทำให้สร้าง Excel การจัดส่งได้ โปรดระบุเหตุผลสำหรับส่วนขาดนี้", "releaseReasonPlaceholder": "กรอกเหตุผลการอนุมัติ (จำเป็น)", "releaseConfirm": "ยืนยันการอนุมัติ", "requiredQty": "จำนวนที่ต้องการ", "matchWorkspace": "การจับคู่สต็อก", "lineCount": "ผลลัพธ์สต็อก {count} รายการ", "lineStatus": "สถานะการจับคู่", "matched": "จับคู่แล้ว", "shortage": "สต็อกไม่เพียงพอ", "matchStatus": {"not_found": "ไม่พบสต็อก", "preparing": "กำลังเตรียมสต็อก", "mapping_failed": "จับคู่ฟิลด์สต็อกไม่สำเร็จ", "unavailable": "สต็อกไม่พร้อมใช้", "source_conflict": "แหล่งสต็อกขัดแย้ง", "invalid_key": "คีย์จับคู่ไม่ถูกต้อง", "result_missing": "กำลังรอผลการจับคู่", "unknown": "ไม่ทราบสถานะ"}, "pending": "การจับคู่สต็อกหรือไฟล์แจ้งการจัดส่งยังไม่พร้อม โปรดดำเนินการจากบัตรงานปัจจุบัน", "loadFailed": "โหลดรายละเอียดการเตรียมการแจ้งไม่สำเร็จ จึงยังยืนยันข้อมูลปัจจุบันไม่ได้", "detailUnavailable": "ยังไม่ได้รับรายละเอียดการเตรียมการแจ้ง จึงยังแสดงคำสั่งซื้อที่ตรึงและข้อมูลการจับคู่สต็อกไม่ได้", "retry": "โหลดอีกครั้ง", "capability": {"retry_inventory_preparation": "ดึงข้อมูลสต็อกอีกครั้ง", "reload_inventory_result": "อ่านผลสต็อกอีกครั้ง", "override_line_inventory_source": "เปลี่ยนแหล่งสต็อก"}, "capabilityDisabled": {"excel_locked": "สร้าง Excel แจ้งเตือนแล้ว แหล่งสินค้าถูกล็อก", "no_candidates": "ยังไม่มีตัวเลือกแหล่งสต็อกที่พร้อมใช้", "no_prior_result": "ยังไม่มีผลลัพธ์สต็อกในประวัติ"}},
"freightUpload": {"title": "อัปโหลดให้ผู้ให้บริการขนส่ง", "subtitle": "จัดกลุ่มตามใบแจ้งส่งสินค้า; แต่ละใบแจ้งส่งสินค้ามี Excel หนึ่งไฟล์", "loading": "กำลังโหลดใบแจ้งส่งสินค้า…", "loadFailed": "โหลดใบแจ้งส่งสินค้าไม่สำเร็จ โปรดลองรีเฟรช", "poMissing": "งานปัจจุบันยังไม่พบ PO จึงยังจัดกลุ่มใบแจ้งส่งสินค้าไม่ได้", "empty": "ไม่มีใบแจ้งส่งสินค้าที่อัปโหลดได้สำหรับ PO นี้", "download": "ดาวน์โหลด Excel", "lineNo": "รายการ", "lineNoSourceCustomerPo": "เลขบรรทัด PO ของลูกค้า", "lineNoSourceSequence": "ลำดับระบบ (ไม่พบเลขรายการภายใน)", "selected": "เลือกแล้ว {count} ใบแจ้งส่งสินค้า", "batchDownload": "ดาวน์โหลดที่เลือก", "batchRpa": "อัปโหลด RPA แบบกลุ่ม", "batchConfirm": "ยืนยันว่าอัปโหลดแล้ว", "noticeCount": "รวม {count} ใบแจ้งส่งสินค้า", "uploadError": "สาเหตุการอัปโหลดล้มเหลว: {reason}", "uploadStatus": {"pending": "รออัปโหลด", "uploading": "กำลังอัปโหลด", "failed": "อัปโหลดล้มเหลว", "uploaded": "อัปโหลดแล้ว", "needsHuman": "ต้องอัปโหลดด้วยตนเอง"}},
"uploadComplete": {"title": "แจ้งเสร็จสิ้น", "subtitle": "ยืนยันหลักฐานความสำเร็จของการอัปโหลดแล้ว หน้านี้อ่านได้อย่างเดียว", "batchCount": "ชุดนี้ได้อัปโหลดใบแจ้งส่งสินค้าแล้ว {count} ใบ", "batchDownload": "ดาวน์โหลด ZIP ทั้งชุด", "batchDownloading": "กำลังแพ็ก…", "uploaded": "อัปโหลดแล้ว", "uploadedAt": "{time}", "exportFile": "ไฟล์: {file}", "expand": "แสดงรายละเอียด", "collapse": "ซ่อนรายละเอียด", "uploadMode": "วิธีอัปโหลด: {mode}", "uploadModeManual": "ยืนยันด้วยตนเอง", "uploadModeRpa": "อัปโหลด RPA", "empty": "ชุดนี้ยังไม่มีใบแจ้งส่งสินค้าที่อัปโหลดแล้ว"},
"upload": {"title": "อัปโหลดให้ผู้ให้บริการขนส่ง", "subtitle": "ดาวน์โหลด Excel แจ้งงาน อัปโหลดบนแพลตฟอร์มขนส่งแล้วยืนยันการอัปโหลดด้วยตนเอง หรือรัน RPA", "manualUpload": "ยืนยันการอัปโหลดด้วยตนเอง", "attempt": "ความพยายามอัปโหลดล่าสุด: {mode} · {status}"},
"identity": {
"po": "PO: {value}",
"case": "Case: {value}",
"version": "เวอร์ชันคำสั่งซื้อ: V{value}"
},
"descriptions": {
"intake_parse": "ตรวจสอบเนื้อหาอีเมลและไฟล์แนบปัจจุบัน แล้วจัดการปัญหาการแยกวิเคราะห์ขาเข้า",
"order_review": "ตรวจสอบข้อมูลและหลักฐาน แก้ข้อขัดแย้ง และตรึงคำสั่งซื้อ",
"fulfillment_prep": "จับคู่สต็อกและสร้าง Excel แจ้งงาน",
"freight_upload": "ดาวน์โหลดไฟล์แจ้งงาน รัน RPA หรือลงทะเบียนการอัปโหลดด้วยตนเอง และตรวจสอบผลลัพธ์ที่ไม่ทราบ",
"upload_complete": "แสดงเมื่อยืนยันหลักฐานความสำเร็จของการอัปโหลดครบถ้วนแล้วเท่านั้น"
},
"intakeParse": {
"title": "รับและแยกวิเคราะห์",
"email": "เนื้อหาอีเมล",
"emailPreviewTitle": "ตัวอย่างเนื้อหาอีเมลแบบปลอดภัย",
"noEmail": "ไม่มีบริบทอีเมล",
"attachment": "ไฟล์แนบปัจจุบัน",
"fileName": "ชื่อไฟล์",
"fileType": "ประเภทไฟล์",
"preview": "ตัวอย่างไฟล์แนบ",
"previewLoading": "กำลังโหลดตัวอย่างไฟล์แนบ…",
"loadPreview": "โหลดตัวอย่างไฟล์แนบ",
"previewUnsupported": "ไฟล์แนบปัจจุบันไม่ใช่ PDF และไม่สามารถแสดงตัวอย่างที่นี่ได้",
"loading": "กำลังโหลดบริบทการแยกวิเคราะห์ขาเข้า…",
"loadFailed": "โหลดบริบทการแยกวิเคราะห์ขาเข้าไม่สำเร็จ",
"retry": "ลองอีกครั้ง"
},
"prepare": {
"customerPoLine": "เลขที่บรรทัด PO ของลูกค้า",
"title": "เตรียมการแจ้ง",
"subtitle": "จัดการตัวเลือกสต็อก ปัญหาการจับคู่ และการสร้างไฟล์แจ้งงานที่นี่",
"frozenOrder": "คำสั่งซื้อที่ตรึงแล้ว",
"inventorySource": "แหล่งสต็อก",
"excel": "Excel การจัดส่ง",
"downloadInventory": "ดาวน์โหลดไฟล์สินค้าคงคลัง",
"retryInventory": "ดึงข้อมูลสต็อกอีกครั้ง",
"sourceAmbiguous": "รายการนี้ตรงกับหลายแหล่งสินค้า โปรดเลือกคลังที่จัดส่งจริง",
"sourceLocked": "สร้าง Excel แจ้งเตือนแล้ว แหล่งสินค้าถูกล็อก",
"selectSource": "เลือกแหล่งสินค้า",
"releaseShortage": "อนุมัติส่วนขาดสต็อก",
"releaseShortageHint": "การอนุมัติทำให้สร้าง Excel การจัดส่งได้ โปรดระบุเหตุผลสำหรับส่วนขาดนี้",
"releaseReasonPlaceholder": "กรอกเหตุผลการอนุมัติ (จำเป็น)",
"releaseConfirm": "ยืนยันการอนุมัติ",
"requiredQty": "จำนวนที่ต้องการ",
"matchWorkspace": "การจับคู่สต็อก",
"lineCount": "ผลลัพธ์สต็อก {count} รายการ",
"lineStatus": "สถานะการจับคู่",
"matched": "จับคู่แล้ว",
"shortage": "สต็อกไม่เพียงพอ",
"matchStatus": {
"not_found": "ไม่พบสต็อก",
"preparing": "กำลังเตรียมสต็อก",
"mapping_failed": "จับคู่ฟิลด์สต็อกไม่สำเร็จ",
"unavailable": "สต็อกไม่พร้อมใช้",
"source_conflict": "แหล่งสต็อกขัดแย้ง",
"invalid_key": "คีย์จับคู่ไม่ถูกต้อง",
"result_missing": "กำลังรอผลการจับคู่",
"unknown": "ไม่ทราบสถานะ",
"inventory_matched": "จับคู่แล้ว"
},
"pending": "การจับคู่สต็อกหรือไฟล์แจ้งการจัดส่งยังไม่พร้อม โปรดดำเนินการจากบัตรงานปัจจุบัน",
"loadFailed": "โหลดรายละเอียดการเตรียมการแจ้งไม่สำเร็จ จึงยังยืนยันข้อมูลปัจจุบันไม่ได้",
"detailUnavailable": "ยังไม่ได้รับรายละเอียดการเตรียมการแจ้ง จึงยังแสดงคำสั่งซื้อที่ตรึงและข้อมูลการจับคู่สต็อกไม่ได้",
"retry": "โหลดอีกครั้ง",
"capability": {
"retry_inventory_preparation": "ดึงข้อมูลสต็อกอีกครั้ง",
"reload_inventory_result": "อ่านผลสต็อกอีกครั้ง",
"override_line_inventory_source": "เปลี่ยนแหล่งสต็อก"
},
"capabilityDisabled": {
"excel_locked": "สร้าง Excel แจ้งเตือนแล้ว แหล่งสินค้าถูกล็อก",
"no_candidates": "ยังไม่มีตัวเลือกแหล่งสต็อกที่พร้อมใช้",
"no_prior_result": "ยังไม่มีผลลัพธ์สต็อกในประวัติ"
},
"status": {
"ready": "จับคู่พร้อมแล้ว",
"processing": "กำลังดำเนินการ",
"blocked": "ถูกบล็อก"
}
},
"freightUpload": {
"title": "อัปโหลดให้ผู้ให้บริการขนส่ง",
"subtitle": "จัดกลุ่มตามใบแจ้งส่งสินค้า; แต่ละใบแจ้งส่งสินค้ามี Excel หนึ่งไฟล์",
"loading": "กำลังโหลดใบแจ้งส่งสินค้า…",
"loadFailed": "โหลดใบแจ้งส่งสินค้าไม่สำเร็จ โปรดลองรีเฟรช",
"poMissing": "งานปัจจุบันยังไม่พบ PO จึงยังจัดกลุ่มใบแจ้งส่งสินค้าไม่ได้",
"empty": "ไม่มีใบแจ้งส่งสินค้าที่อัปโหลดได้สำหรับ PO นี้",
"download": "ดาวน์โหลด Excel",
"rpa": "อัปโหลด RPA",
"confirm": "ยืนยันอัปโหลด",
"lineNo": "รายการ",
"lineNoSourceCustomerPo": "เลขบรรทัด PO ของลูกค้า",
"lineNoSourceSequence": "ลำดับระบบ (ไม่พบเลขรายการภายใน)",
"selected": "เลือกแล้ว {count} ใบแจ้งส่งสินค้า",
"batchDownload": "ดาวน์โหลดที่เลือก",
"batchRpa": "อัปโหลด RPA แบบกลุ่ม",
"batchConfirm": "ยืนยันว่าอัปโหลดแล้ว",
"noticeCount": "รวม {count} ใบแจ้งส่งสินค้า",
"uploadError": "สาเหตุการอัปโหลดล้มเหลว: {reason}",
"uploadStatus": {
"pending": "รออัปโหลด",
"uploading": "กำลังอัปโหลด",
"failed": "อัปโหลดล้มเหลว",
"uploaded": "อัปโหลดแล้ว",
"needsHuman": "ต้องอัปโหลดด้วยตนเอง"
}
},
"uploadComplete": {
"title": "แจ้งเสร็จสิ้น",
"subtitle": "ยืนยันหลักฐานความสำเร็จของการอัปโหลดแล้ว หน้านี้อ่านได้อย่างเดียว",
"batchCount": "ชุดนี้ได้อัปโหลดใบแจ้งส่งสินค้าแล้ว {count} ใบ",
"batchDownload": "ดาวน์โหลด ZIP ทั้งชุด",
"batchDownloading": "กำลังแพ็ก…",
"uploaded": "อัปโหลดแล้ว",
"uploadedAt": "{time}",
"exportFile": "ไฟล์: {file}",
"expand": "แสดงรายละเอียด",
"collapse": "ซ่อนรายละเอียด",
"uploadMode": "วิธีอัปโหลด: {mode}",
"uploadModeManual": "ยืนยันด้วยตนเอง",
"uploadModeRpa": "อัปโหลด RPA",
"empty": "ชุดนี้ยังไม่มีใบแจ้งส่งสินค้าที่อัปโหลดแล้ว"
},
"upload": {
"title": "อัปโหลดให้ผู้ให้บริการขนส่ง",
"subtitle": "ดาวน์โหลด Excel แจ้งงาน อัปโหลดบนแพลตฟอร์มขนส่งแล้วยืนยันการอัปโหลดด้วยตนเอง หรือรัน RPA",
"manualUpload": "ยืนยันการอัปโหลดด้วยตนเอง",
"attempt": "ความพยายามอัปโหลดล่าสุด: {mode} · {status}"
},
"stages": {
"intake_parse": "รับและแยกวิเคราะห์",
"order_review": "ทบทวนคำสั่งซื้อ",
@@ -1792,7 +1925,7 @@
"confirmAutoProgress": "สร้างงาน {taskNo} แล้ว และเริ่มการดำเนินการอัตโนมัติ",
"autoProgress": {
"result": "ผลการดำเนินการอัตโนมัติ: {status}",
"checkpoint": "จุดตรวจปัจจุบัน: {checkpoint}",
"position": "ตำแหน่งปัจจุบัน: {position}",
"viewTask": "กลับไปแชทเพื่อดูความคืบหน้า",
"returnToChat": "กลับไปแชทเพื่อดูความคืบหน้า",
"returnedFocusHint": "กลับสู่แชทแล้ว และโฟกัสงาน {taskNo} (ดูที่แถบด้านขวา)",
@@ -2245,12 +2378,17 @@
"ready": "ผ่าน",
"unknownField": "ฟิลด์ไม่ทราบ"
},
"fieldConflict": {
"fieldConflict": {
"title": "ความขัดแย้งของฟิลด์ที่ต้องตัดสิน ({count})",
"subtitle": "ค่าจากหลายแหล่งไม่ตรงกันจะไม่ถูกเขียนอัตโนมัติ เลือกค่าหนึ่งหรือกรอกค่าเองก่อนสร้างคำสั่ง",
"evidenceIssueTitle": "หลักฐานที่ต้องยืนยัน ({count})",
"evidenceIssueSubtitle": "ฟิลด์นี้ไม่มีหลักฐานเอกสารที่ตรวจสอบย้อนกลับได้ ไม่ใช่ความขัดแย้งของค่า โปรดตรวจต้นฉบับหรือแยกวิเคราะห์ใหม่",
"scope": { "header": "ส่วนหัวคำสั่งซื้อ", "line": "รายละเอียดคำสั่งซื้อ", "line_unassigned": "รายละเอียดคำสั่งซื้อ (ยังไม่ระบุตำแหน่ง)", "unscoped": "ยังไม่ระบุขอบเขตฟิลด์" },
"subtitle": "ค่าจากหลายแหล่งไม่ตรงกันจะไม่ถูกเขียนอัตโนมัติ เลือกค่าหนึ่งหรือกรอกค่าเองก่อนสร้างคำสั่ง",
"evidenceIssueTitle": "หลักฐานที่ต้องยืนยัน ({count})",
"evidenceIssueSubtitle": "ฟิลด์นี้ไม่มีหลักฐานเอกสารที่ตรวจสอบย้อนกลับได้ ไม่ใช่ความขัดแย้งของค่า โปรดตรวจต้นฉบับหรือแยกวิเคราะห์ใหม่",
"scope": {
"header": "ส่วนหัวคำสั่งซื้อ",
"line": "รายละเอียดคำสั่งซื้อ",
"line_unassigned": "รายละเอียดคำสั่งซื้อ (ยังไม่ระบุตำแหน่ง)",
"unscoped": "ยังไม่ระบุขอบเขตฟิลด์"
},
"optionLabel": "ตัวเลือก {index}",
"adoptOption": "ใช้ค่านี้",
"customValue": "กรอกค่าเอง",
@@ -2575,9 +2713,18 @@
"downloadFailed": "ดาวน์โหลดผลลัพธ์ {count} รายการไม่สำเร็จ โปรดลองทีละรายการ",
"singleDownloadFailed": "ดาวน์โหลดผลลัพธ์ของชุดไม่สำเร็จ"
},
"stageSummary": {"empty": "ไม่มีไฟล์", "needsAction": "{count} รายการรอดำเนินการ", "processing": "{count} กำลังดำเนินการ", "completed": "{count} เสร็จสิ้น", "total": "{count} ไฟล์"},
"stageSummary": {
"empty": "ไม่มีไฟล์",
"needsAction": "{count} รายการรอดำเนินการ",
"processing": "{count} กำลังดำเนินการ",
"completed": "{count} เสร็จสิ้น",
"total": "{count} ไฟล์"
},
"unclassified": "มี {count} ไฟล์ที่รอยืนยันขั้นตอน โปรดดูรายการไฟล์",
"search": {"label": "ค้นหาไฟล์หรือ PO", "placeholder": "ค้นหาชื่อไฟล์หรือ PO"},
"search": {
"label": "ค้นหาไฟล์หรือ PO",
"placeholder": "ค้นหาชื่อไฟล์หรือ PO"
},
"fileProcessing": "กำลังประมวลผลไฟล์",
"filteringByStage": "กรองตาม: {stage}",
"clearStageFilter": "ล้างตัวกรอง",
@@ -2704,8 +2851,26 @@
"retry": "การประมวลผลล้มเหลว โปรดตรวจสอบสาเหตุแล้วลองใหม่"
},
"progress": {
"step": {"document_queued":"กำลังรอเริ่มงานแยกวิเคราะห์","layout_parsing_started":"กำลังแยกวิเคราะห์โครงร่าง PDF","layout_parsing_completed":"แยกวิเคราะห์โครงร่าง PDF เสร็จแล้ว","profile_matching":"กำลังจับคู่เทมเพลตคำสั่งซื้อ","profile_matched":"จับคู่เทมเพลตคำสั่งซื้อแล้ว","table_reconstructed":"กำลังสร้างตารางคำสั่งซื้อใหม่","order_fields_extracted":"กำลังดึงข้อมูลฟิลด์คำสั่งซื้อ","email_supplement_merged":"กำลังรวมข้อมูลเพิ่มเติมจากอีเมล","review_ready":"ผลคำสั่งซื้อพร้อมให้ตรวจทาน","review_required":"ผลคำสั่งซื้อต้องตรวจทานโดยผู้ใช้"},
"lifecycleReason": {"failed":"ขั้นตอนปัจจุบันล้มเหลว โปรดดูรายละเอียดและลองใหม่","cancelled":"การประมวลผลครั้งนี้ถูกยกเลิกแล้ว","review_required":"ผลลัพธ์ปัจจุบันต้องตรวจทานโดยผู้ใช้","processing_slow":"ขั้นตอนปัจจุบันใช้เวลานานกว่าที่คาดและระบบยังทำงานอยู่","queue_backlog":"ขั้นตอนปัจจุบันอยู่ในคิวรอการทำงาน","processing_attention":"ขั้นตอนปัจจุบันยังไม่เสร็จเป็นเวลานาน โปรดดูรายละเอียดหรือรีเฟรชภายหลัง"},
"step": {
"document_queued": "กำลังรอเริ่มงานแยกวิเคราะห์",
"layout_parsing_started": "กำลังแยกวิเคราะห์โครงร่าง PDF",
"layout_parsing_completed": "แยกวิเคราะห์โครงร่าง PDF เสร็จแล้ว",
"profile_matching": "กำลังจับคู่เทมเพลตคำสั่งซื้อ",
"profile_matched": "จับคู่เทมเพลตคำสั่งซื้อแล้ว",
"table_reconstructed": "กำลังสร้างตารางคำสั่งซื้อใหม่",
"order_fields_extracted": "กำลังดึงข้อมูลฟิลด์คำสั่งซื้อ",
"email_supplement_merged": "กำลังรวมข้อมูลเพิ่มเติมจากอีเมล",
"review_ready": "ผลคำสั่งซื้อพร้อมให้ตรวจทาน",
"review_required": "ผลคำสั่งซื้อต้องตรวจทานโดยผู้ใช้"
},
"lifecycleReason": {
"failed": "ขั้นตอนปัจจุบันล้มเหลว โปรดดูรายละเอียดและลองใหม่",
"cancelled": "การประมวลผลครั้งนี้ถูกยกเลิกแล้ว",
"review_required": "ผลลัพธ์ปัจจุบันต้องตรวจทานโดยผู้ใช้",
"processing_slow": "ขั้นตอนปัจจุบันใช้เวลานานกว่าที่คาดและระบบยังทำงานอยู่",
"queue_backlog": "ขั้นตอนปัจจุบันอยู่ในคิวรอการทำงาน",
"processing_attention": "ขั้นตอนปัจจุบันยังไม่เสร็จเป็นเวลานาน โปรดดูรายละเอียดหรือรีเฟรชภายหลัง"
},
"title": "สถานะการประมวลผลคำสั่ง",
"completedOfTotal": "เสร็จแล้ว {done} / {total}",
"currentStage": "ปัจจุบัน: {stage}",
@@ -3406,7 +3571,6 @@
"complete": "ครบ",
"missing": "ขาดเอกสาร"
},
"transfer": {
"fileProgressTitle": "การเตรียมไฟล์รับของ",
"stageFileReady": "ไฟล์พร้อม",
+185 -21
View File
@@ -576,7 +576,13 @@
"resolveFailed": "解决冲突失败,请刷新后重试"
},
"shippingNoticeUi": {
"stage": {"intakeParse": "接收解析", "orderReview": "订单复核", "fulfillmentPrep": "通知准备", "freightUpload": "货代上传", "uploadComplete": "通知完成"},
"stage": {
"intakeParse": "接收解析",
"orderReview": "订单复核",
"fulfillmentPrep": "通知准备",
"freightUpload": "货代上传",
"uploadComplete": "通知完成"
},
"rpaModeBrowser": "真实 RPA",
"rpaModeMock": "Mock RPA",
"rpaModeUnknown": "RPA 模式未知",
@@ -1032,7 +1038,11 @@
"progressPercent": "完成度",
"stepNo": "步骤 {value}",
"defaultLearnerName": "当前学员",
"noContent": { "loading": "正在加载培训内容...", "title": "暂无培训内容", "description": "管理员尚未发布当前培训配置,请稍后再试。" },
"noContent": {
"loading": "正在加载培训内容...",
"title": "暂无培训内容",
"description": "管理员尚未发布当前培训配置,请稍后再试。"
},
"unknownDepartment": "待补充部门",
"video": {
"title": "第一步:观看培训视频",
@@ -1575,13 +1585,136 @@
"blocked": "前置未完成",
"prerequisite": "请先完成当前阶段",
"autoAdvanced": "已自动推进到{stage}",
"identity": {"po": "PO:{value}", "case": "Case:{value}", "version": "订单版本:V{value}"},
"descriptions": {"intake_parse": "核对邮件正文和当前附件,处置接收解析异常。", "order_review": "核实字段和证据,处理冲突并冻结订单。", "fulfillment_prep": "完成库存匹配并生成通知 Excel。", "freight_upload": "下载通知文件、执行 RPA 或登记人工上传,并核对未知结果。", "upload_complete": "仅在上传成功证据完整时展示通知完成。"},
"intakeParse": {"title": "接收解析", "email": "邮件正文", "emailPreviewTitle": "邮件正文安全预览", "noEmail": "无邮件上下文", "attachment": "当前附件", "fileName": "文件名", "fileType": "文件类型", "preview": "附件预览", "previewLoading": "正在加载附件预览…", "loadPreview": "加载附件预览", "previewUnsupported": "当前附件不是 PDF,不能在此预览。", "loading": "正在加载接收解析上下文…", "loadFailed": "接收解析上下文加载失败。", "retry": "重试"},
"prepare": {"customerPoLine": "客户PO行号", "title": "通知准备", "subtitle": "库存候选、匹配异常和通知文件生成均在此阶段处理。", "frozenOrder": "冻结订单", "inventorySource": "库存源", "excel": "通知 Excel", "downloadInventory": "下载库存文件", "retryInventory": "重新获取库存", "sourceAmbiguous": "该行在多个库存源命中,请选择实际发货仓库", "sourceLocked": "通知 Excel 已生成,库存源已锁定", "selectSource": "选择库存源", "releaseShortage": "库存缺口放行", "releaseShortageHint": "放行后可生成发货 Excel;请填写本次缺口放行原因。", "releaseReasonPlaceholder": "请输入放行原因(必填)", "releaseConfirm": "确认放行", "requiredQty": "需求数量", "matchWorkspace": "库存匹配", "lineCount": "{count} 行库存结果", "lineStatus": "匹配状态", "matched": "已匹配", "shortage": "库存不足", "matchStatus": {"not_found": "未匹配到库存", "preparing": "库存准备中", "mapping_failed": "库存映射失败", "unavailable": "库存不可用", "source_conflict": "库存源冲突", "invalid_key": "匹配键无效", "result_missing": "等待匹配结果", "unknown": "状态未知"}, "pending": "库存匹配或通知文件尚未生成。请查看右侧当前处理,按当前门禁继续。", "loadFailed": "通知准备任务详情加载失败,当前数据未能确认。", "detailUnavailable": "通知准备任务详情尚未返回,暂时无法展示冻结订单和库存匹配数据。", "retry": "重新加载", "capability": {"retry_inventory_preparation": "重新获取库存", "reload_inventory_result": "重读库存结果", "override_line_inventory_source": "修改库存源"}, "capabilityDisabled": {"excel_locked": "通知 Excel 已生成,库存源已锁定", "no_candidates": "暂无可用库存源候选", "no_prior_result": "暂无历史库存结果"}},
"freightUpload": {"title": "货代上传", "subtitle": "按发货通知单聚合展示;每张发货通知单对应一张 Excel。", "loading": "正在加载发货通知…", "loadFailed": "发货通知加载失败,请刷新后重试。", "poMissing": "当前任务尚未识别到 PO,暂时无法聚合发货通知。", "empty": "当前 PO 暂无可上传的发货通知。", "download": "下载 Excel", "lineNo": "项次", "lineNoSourceCustomerPo": "客户 PO 行号", "lineNoSourceSequence": "系统行序(未识别到内部项次)", "selected": "已选 {count} 个发货通知", "batchDownload": "批量下载", "batchRpa": "批量 RPA 上传", "batchConfirm": "批量确认已上传", "noticeCount": "共 {count} 张发货通知", "uploadError": "上传失败原因:{reason}", "uploadStatus": {"pending": "待上传", "uploading": "上传中", "failed": "上传失败", "uploaded": "已上传", "needsHuman": "需人工上传"}},
"uploadComplete": {"title": "通知完成", "subtitle": "上传成功证据已核验,以下内容仅供查看。", "batchCount": "本批已上传 {count} 张发货通知", "batchDownload": "下载本批 ZIP", "batchDownloading": "正在打包…", "uploaded": "已上传", "uploadedAt": "{time}", "exportFile": "文件:{file}", "expand": "展开明细", "collapse": "收起明细", "uploadMode": "上传方式:{mode}", "uploadModeManual": "人工确认", "uploadModeRpa": "RPA 上传", "empty": "本批暂无已上传的发货通知。"},
"upload": {"title": "货代上传", "subtitle": "下载已生成的通知 Excel,上传至货代平台后确认人工上传,或执行 RPA。", "manualUpload": "确认人工上传", "attempt": "最近上传尝试:{mode} · {status}"},
"identity": {
"po": "PO:{value}",
"case": "Case:{value}",
"version": "订单版本:V{value}"
},
"descriptions": {
"intake_parse": "核对邮件正文和当前附件,处置接收解析异常。",
"order_review": "核实字段和证据,处理冲突并冻结订单。",
"fulfillment_prep": "完成库存匹配并生成通知 Excel。",
"freight_upload": "下载通知文件、执行 RPA 或登记人工上传,并核对未知结果。",
"upload_complete": "仅在上传成功证据完整时展示通知完成。"
},
"intakeParse": {
"title": "接收解析",
"email": "邮件正文",
"emailPreviewTitle": "邮件正文安全预览",
"noEmail": "无邮件上下文",
"attachment": "当前附件",
"fileName": "文件名",
"fileType": "文件类型",
"preview": "附件预览",
"previewLoading": "正在加载附件预览…",
"loadPreview": "加载附件预览",
"previewUnsupported": "当前附件不是 PDF,不能在此预览。",
"loading": "正在加载接收解析上下文…",
"loadFailed": "接收解析上下文加载失败。",
"retry": "重试"
},
"prepare": {
"customerPoLine": "客户PO行号",
"title": "通知准备",
"subtitle": "库存候选、匹配异常和通知文件生成均在此阶段处理。",
"frozenOrder": "冻结订单",
"inventorySource": "库存源",
"excel": "通知 Excel",
"downloadInventory": "下载库存文件",
"retryInventory": "重新获取库存",
"sourceAmbiguous": "该行在多个库存源命中,请选择实际发货仓库",
"sourceLocked": "通知 Excel 已生成,库存源已锁定",
"selectSource": "选择库存源",
"releaseShortage": "库存缺口放行",
"releaseShortageHint": "放行后可生成发货 Excel;请填写本次缺口放行原因。",
"releaseReasonPlaceholder": "请输入放行原因(必填)",
"releaseConfirm": "确认放行",
"requiredQty": "需求数量",
"matchWorkspace": "库存匹配",
"lineCount": "{count} 行库存结果",
"lineStatus": "匹配状态",
"matched": "已匹配",
"shortage": "库存不足",
"matchStatus": {
"not_found": "未匹配到库存",
"preparing": "库存准备中",
"mapping_failed": "库存映射失败",
"unavailable": "库存不可用",
"source_conflict": "库存源冲突",
"invalid_key": "匹配键无效",
"result_missing": "等待匹配结果",
"unknown": "状态未知",
"inventory_matched": "已匹配"
},
"pending": "库存匹配或通知文件尚未生成。请查看右侧当前处理,按当前门禁继续。",
"loadFailed": "通知准备任务详情加载失败,当前数据未能确认。",
"detailUnavailable": "通知准备任务详情尚未返回,暂时无法展示冻结订单和库存匹配数据。",
"retry": "重新加载",
"capability": {
"retry_inventory_preparation": "重新获取库存",
"reload_inventory_result": "重读库存结果",
"override_line_inventory_source": "修改库存源"
},
"capabilityDisabled": {
"excel_locked": "通知 Excel 已生成,库存源已锁定",
"no_candidates": "暂无可用库存源候选",
"no_prior_result": "暂无历史库存结果"
},
"status": {
"ready": "匹配完成",
"processing": "处理中",
"blocked": "已阻断"
}
},
"freightUpload": {
"title": "货代上传",
"subtitle": "按发货通知单聚合展示;每张发货通知单对应一张 Excel。",
"loading": "正在加载发货通知…",
"loadFailed": "发货通知加载失败,请刷新后重试。",
"poMissing": "当前任务尚未识别到 PO,暂时无法聚合发货通知。",
"empty": "当前 PO 暂无可上传的发货通知。",
"download": "下载 Excel",
"rpa": "RPA 上传",
"confirm": "确认上传",
"lineNo": "项次",
"lineNoSourceCustomerPo": "客户 PO 行号",
"lineNoSourceSequence": "系统行序(未识别到内部项次)",
"selected": "已选 {count} 个发货通知",
"batchDownload": "批量下载",
"batchRpa": "批量 RPA 上传",
"batchConfirm": "批量确认已上传",
"noticeCount": "共 {count} 张发货通知",
"uploadError": "上传失败原因:{reason}",
"uploadStatus": {
"pending": "待上传",
"uploading": "上传中",
"failed": "上传失败",
"uploaded": "已上传",
"needsHuman": "需人工上传"
}
},
"uploadComplete": {
"title": "通知完成",
"subtitle": "上传成功证据已核验,以下内容仅供查看。",
"batchCount": "本批已上传 {count} 张发货通知",
"batchDownload": "下载本批 ZIP",
"batchDownloading": "正在打包…",
"uploaded": "已上传",
"uploadedAt": "{time}",
"exportFile": "文件:{file}",
"expand": "展开明细",
"collapse": "收起明细",
"uploadMode": "上传方式:{mode}",
"uploadModeManual": "人工确认",
"uploadModeRpa": "RPA 上传",
"empty": "本批暂无已上传的发货通知。"
},
"upload": {
"title": "货代上传",
"subtitle": "下载已生成的通知 Excel,上传至货代平台后确认人工上传,或执行 RPA。",
"manualUpload": "确认人工上传",
"attempt": "最近上传尝试:{mode} · {status}"
},
"stages": {
"intake_parse": "接收解析",
"order_review": "订单复核",
@@ -1899,7 +2032,7 @@
"confirmAutoProgress": "已创建任务 {taskNo},已进入自动推进",
"autoProgress": {
"result": "自动推进结果:{status}",
"checkpoint": "当前检查点:{checkpoint}",
"position": "当前位置:{position}",
"viewTask": "返回对话查看进度",
"returnToChat": "返回对话查看进度",
"returnedFocusHint": "已返回对话,并聚焦任务 {taskNo}(见右侧「本次处理中」)",
@@ -2364,12 +2497,17 @@
"ready": "已通过",
"unknownField": "未知字段"
},
"fieldConflict": {
"fieldConflict": {
"title": "字段冲突待裁决({count})",
"subtitle": "多来源取值不一致时不会自动写入。请选用一方或填写手工值后再建单。",
"evidenceIssueTitle": "证据待确认({count})",
"evidenceIssueSubtitle": "该字段缺少可追溯文档证据,不是取值冲突;请核对原文或重新解析。",
"scope": { "header": "订单头", "line": "订单明细", "line_unassigned": "订单明细(未定位)", "unscoped": "字段范围未定位" },
"subtitle": "多来源取值不一致时不会自动写入。请选用一方或填写手工值后再建单。",
"evidenceIssueTitle": "证据待确认({count})",
"evidenceIssueSubtitle": "该字段缺少可追溯文档证据,不是取值冲突;请核对原文或重新解析。",
"scope": {
"header": "订单头",
"line": "订单明细",
"line_unassigned": "订单明细(未定位)",
"unscoped": "字段范围未定位"
},
"optionLabel": "候选 {index}",
"adoptOption": "采用此值",
"customValue": "填写手工值",
@@ -2429,7 +2567,7 @@
"possible_revision": "可能为修订版本"
}
},
"profileMatch": {
"profileMatch": {
"title": "文档模板匹配",
"subtitle": "展示本 PDF 是否命中文档模板;字段缺失见「字段完整性」。",
"selected": "命中模板",
@@ -2649,9 +2787,18 @@
"downloadFailed": "本批有 {count} 个产物下载失败,请逐项重试",
"singleDownloadFailed": "下载本批产物失败"
},
"stageSummary": {"empty": "暂无文件", "needsAction": "{count} 待处理", "processing": "{count} 处理中", "completed": "{count} 已完成", "total": "{count} 个文件"},
"stageSummary": {
"empty": "暂无文件",
"needsAction": "{count} 待处理",
"processing": "{count} 处理中",
"completed": "{count} 已完成",
"total": "{count} 个文件"
},
"unclassified": "另有 {count} 个文件阶段待确认,请查看文件清单",
"search": {"label": "搜索文件或 PO", "placeholder": "搜索文件名或 PO"},
"search": {
"label": "搜索文件或 PO",
"placeholder": "搜索文件名或 PO"
},
"fileProcessing": "文件处理中",
"filteringByStage": "已筛选:{stage}",
"clearStageFilter": "清除筛选",
@@ -2778,8 +2925,26 @@
"retry": "当前处理失败,请检查原因后重试"
},
"progress": {
"step": {"document_queued":"正在等待解析任务启动","layout_parsing_started":"正在解析 PDF 版面","layout_parsing_completed":"PDF 版面解析完成","profile_matching":"正在匹配订单模板","profile_matched":"订单模板匹配完成","table_reconstructed":"正在还原订单表格","order_fields_extracted":"正在提取订单字段","email_supplement_merged":"正在合并邮件补充信息","review_ready":"订单结果已生成,等待复核","review_required":"需要人工复核订单结果"},
"lifecycleReason": {"failed":"当前步骤处理失败,请查看详情后重试。","cancelled":"本次处理已取消。","review_required":"当前结果需要人工复核。","processing_slow":"当前步骤耗时较长,系统仍在继续。","queue_backlog":"当前步骤正在排队等待执行。","processing_attention":"当前步骤长时间未完成,请查看详情或稍后刷新。"},
"step": {
"document_queued": "正在等待解析任务启动",
"layout_parsing_started": "正在解析 PDF 版面",
"layout_parsing_completed": "PDF 版面解析完成",
"profile_matching": "正在匹配订单模板",
"profile_matched": "订单模板匹配完成",
"table_reconstructed": "正在还原订单表格",
"order_fields_extracted": "正在提取订单字段",
"email_supplement_merged": "正在合并邮件补充信息",
"review_ready": "订单结果已生成,等待复核",
"review_required": "需要人工复核订单结果"
},
"lifecycleReason": {
"failed": "当前步骤处理失败,请查看详情后重试。",
"cancelled": "本次处理已取消。",
"review_required": "当前结果需要人工复核。",
"processing_slow": "当前步骤耗时较长,系统仍在继续。",
"queue_backlog": "当前步骤正在排队等待执行。",
"processing_attention": "当前步骤长时间未完成,请查看详情或稍后刷新。"
},
"title": "订单处理进度",
"completedOfTotal": "已完成 {done} / {total}",
"currentStage": "当前:{stage}",
@@ -3480,7 +3645,6 @@
"complete": "齐全",
"missing": "缺资料"
},
"transfer": {
"fileProgressTitle": "收料文件准备",
"stageFileReady": "文件就绪",
+184 -20
View File
@@ -542,7 +542,13 @@
"resolveFailed": "解決衝突失敗,請重新整理後再試"
},
"shippingNoticeUi": {
"stage": {"intakeParse": "接收解析", "orderReview": "訂單複核", "fulfillmentPrep": "通知準備", "freightUpload": "貨代上傳", "uploadComplete": "通知完成"},
"stage": {
"intakeParse": "接收解析",
"orderReview": "訂單複核",
"fulfillmentPrep": "通知準備",
"freightUpload": "貨代上傳",
"uploadComplete": "通知完成"
},
"rpaModeBrowser": "真實 RPA",
"rpaModeMock": "Mock RPA",
"rpaModeUnknown": "RPA 模式未知",
@@ -998,7 +1004,11 @@
"progressPercent": "完成度",
"stepNo": "步驟 {value}",
"defaultLearnerName": "當前學員",
"noContent": { "loading": "正在載入培訓內容...", "title": "暫無培訓內容", "description": "管理員尚未發布當前培訓配置,請稍後再試。" },
"noContent": {
"loading": "正在載入培訓內容...",
"title": "暫無培訓內容",
"description": "管理員尚未發布當前培訓配置,請稍後再試。"
},
"unknownDepartment": "待補充部門",
"video": {
"title": "第一步:觀看培訓影片",
@@ -1468,13 +1478,136 @@
"blocked": "前置未完成",
"prerequisite": "請先完成目前階段",
"autoAdvanced": "已自動推進到{stage}",
"identity": {"po": "PO:{value}", "case": "Case:{value}", "version": "訂單版本:V{value}"},
"descriptions": {"intake_parse": "核對郵件正文和目前附件,處理接收解析異常。", "order_review": "核實欄位與證據、處理衝突並凍結訂單。", "fulfillment_prep": "完成庫存匹配並產生通知 Excel。", "freight_upload": "下載通知檔案、執行 RPA 或登記人工上傳,並核對未知結果。", "upload_complete": "僅在上傳成功證據完整時顯示通知完成。"},
"intakeParse": {"title": "接收解析", "email": "郵件正文", "emailPreviewTitle": "郵件正文安全預覽", "noEmail": "無郵件上下文", "attachment": "目前附件", "fileName": "檔案名稱", "fileType": "檔案類型", "preview": "附件預覽", "previewLoading": "正在載入附件預覽…", "loadPreview": "載入附件預覽", "previewUnsupported": "目前附件不是 PDF,無法在此預覽。", "loading": "正在載入接收解析上下文…", "loadFailed": "接收解析上下文載入失敗。", "retry": "重試"},
"prepare": {"customerPoLine": "客戶PO行號", "title": "通知準備", "subtitle": "在此處處理庫存候選、匹配異常與通知檔產生。", "frozenOrder": "凍結訂單", "inventorySource": "庫存來源", "excel": "發貨 Excel", "downloadInventory": "下載庫存檔案", "retryInventory": "重新取得庫存", "sourceAmbiguous": "該行在多個庫存源命中,請選擇實際發貨倉庫", "sourceLocked": "通知 Excel 已生成,庫存源已鎖定", "selectSource": "選擇庫存源", "releaseShortage": "放行庫存缺口", "releaseShortageHint": "放行後可產生發貨 Excel;請填寫本次缺口放行原因。", "releaseReasonPlaceholder": "請輸入放行原因(必填)", "releaseConfirm": "確認放行", "requiredQty": "需求數量", "matchWorkspace": "庫存匹配", "lineCount": "{count} 行庫存結果", "lineStatus": "匹配狀態", "matched": "已匹配", "shortage": "庫存不足", "matchStatus": {"not_found": "未匹配到庫存", "preparing": "庫存準備中", "mapping_failed": "庫存對應失敗", "unavailable": "庫存不可用", "source_conflict": "庫存來源衝突", "invalid_key": "匹配鍵無效", "result_missing": "等待匹配結果", "unknown": "狀態未知"}, "pending": "庫存匹配或通知檔案尚未產生。請查看右側目前處理,依目前門禁繼續。", "loadFailed": "通知準備任務詳情載入失敗,目前資料無法確認。", "detailUnavailable": "通知準備任務詳情尚未返回,暫時無法展示凍結訂單和庫存匹配資料。", "retry": "重新載入", "capability": {"retry_inventory_preparation": "重新取得庫存", "reload_inventory_result": "重讀庫存結果", "override_line_inventory_source": "修改庫存來源"}, "capabilityDisabled": {"excel_locked": "通知 Excel 已生成,庫存源已鎖定", "no_candidates": "暫無可用庫存來源候選", "no_prior_result": "暫無歷史庫存結果"}},
"freightUpload": {"title": "貨代上傳", "subtitle": "按發貨通知單聚合展示;每張發貨通知單對應一張 Excel。", "loading": "正在載入發貨通知…", "loadFailed": "發貨通知載入失敗,請重新整理後重試。", "poMissing": "目前任務尚未識別到 PO,暫時無法聚合發貨通知。", "empty": "目前 PO 沒有可上傳的發貨通知。", "download": "下載 Excel", "lineNo": "項次", "lineNoSourceCustomerPo": "客戶 PO 行號", "lineNoSourceSequence": "系統行序(未識別到內部項次)", "selected": "已選 {count} 個發貨通知", "batchDownload": "批量下載", "batchRpa": "批量 RPA 上傳", "batchConfirm": "批量確認已上傳", "noticeCount": "共 {count} 張發貨通知", "uploadError": "上傳失敗原因:{reason}", "uploadStatus": {"pending": "待上傳", "uploading": "上傳中", "failed": "上傳失敗", "uploaded": "已上傳", "needsHuman": "需人工上傳"}},
"uploadComplete": {"title": "通知完成", "subtitle": "上傳成功證據已核驗,以下內容僅供查看。", "batchCount": "本批已上傳 {count} 張發貨通知", "batchDownload": "下載本批 ZIP", "batchDownloading": "正在打包…", "uploaded": "已上傳", "uploadedAt": "{time}", "exportFile": "檔案:{file}", "expand": "展開明細", "collapse": "收合明細", "uploadMode": "上傳方式:{mode}", "uploadModeManual": "人工確認", "uploadModeRpa": "RPA 上傳", "empty": "本批暫無已上傳的發貨通知。"},
"upload": {"title": "貨代上傳", "subtitle": "下載通知 Excel、上傳至貨代平台後確認人工上傳,或執行 RPA。", "manualUpload": "確認人工上傳", "attempt": "最近上傳嘗試:{mode} · {status}"},
"identity": {
"po": "PO:{value}",
"case": "Case:{value}",
"version": "訂單版本:V{value}"
},
"descriptions": {
"intake_parse": "核對郵件正文和目前附件,處理接收解析異常。",
"order_review": "核實欄位與證據、處理衝突並凍結訂單。",
"fulfillment_prep": "完成庫存匹配並產生通知 Excel。",
"freight_upload": "下載通知檔案、執行 RPA 或登記人工上傳,並核對未知結果。",
"upload_complete": "僅在上傳成功證據完整時顯示通知完成。"
},
"intakeParse": {
"title": "接收解析",
"email": "郵件正文",
"emailPreviewTitle": "郵件正文安全預覽",
"noEmail": "無郵件上下文",
"attachment": "目前附件",
"fileName": "檔案名稱",
"fileType": "檔案類型",
"preview": "附件預覽",
"previewLoading": "正在載入附件預覽…",
"loadPreview": "載入附件預覽",
"previewUnsupported": "目前附件不是 PDF,無法在此預覽。",
"loading": "正在載入接收解析上下文…",
"loadFailed": "接收解析上下文載入失敗。",
"retry": "重試"
},
"prepare": {
"customerPoLine": "客戶PO行號",
"title": "通知準備",
"subtitle": "在此處處理庫存候選、匹配異常與通知檔產生。",
"frozenOrder": "凍結訂單",
"inventorySource": "庫存來源",
"excel": "發貨 Excel",
"downloadInventory": "下載庫存檔案",
"retryInventory": "重新取得庫存",
"sourceAmbiguous": "該行在多個庫存源命中,請選擇實際發貨倉庫",
"sourceLocked": "通知 Excel 已生成,庫存源已鎖定",
"selectSource": "選擇庫存源",
"releaseShortage": "放行庫存缺口",
"releaseShortageHint": "放行後可產生發貨 Excel;請填寫本次缺口放行原因。",
"releaseReasonPlaceholder": "請輸入放行原因(必填)",
"releaseConfirm": "確認放行",
"requiredQty": "需求數量",
"matchWorkspace": "庫存匹配",
"lineCount": "{count} 行庫存結果",
"lineStatus": "匹配狀態",
"matched": "已匹配",
"shortage": "庫存不足",
"matchStatus": {
"not_found": "未匹配到庫存",
"preparing": "庫存準備中",
"mapping_failed": "庫存對應失敗",
"unavailable": "庫存不可用",
"source_conflict": "庫存來源衝突",
"invalid_key": "匹配鍵無效",
"result_missing": "等待匹配結果",
"unknown": "狀態未知",
"inventory_matched": "已匹配"
},
"pending": "庫存匹配或通知檔案尚未產生。請查看右側目前處理,依目前門禁繼續。",
"loadFailed": "通知準備任務詳情載入失敗,目前資料無法確認。",
"detailUnavailable": "通知準備任務詳情尚未返回,暫時無法展示凍結訂單和庫存匹配資料。",
"retry": "重新載入",
"capability": {
"retry_inventory_preparation": "重新取得庫存",
"reload_inventory_result": "重讀庫存結果",
"override_line_inventory_source": "修改庫存來源"
},
"capabilityDisabled": {
"excel_locked": "通知 Excel 已生成,庫存源已鎖定",
"no_candidates": "暫無可用庫存來源候選",
"no_prior_result": "暫無歷史庫存結果"
},
"status": {
"ready": "匹配完成",
"processing": "處理中",
"blocked": "已阻斷"
}
},
"freightUpload": {
"title": "貨代上傳",
"subtitle": "按發貨通知單聚合展示;每張發貨通知單對應一張 Excel。",
"loading": "正在載入發貨通知…",
"loadFailed": "發貨通知載入失敗,請重新整理後重試。",
"poMissing": "目前任務尚未識別到 PO,暫時無法聚合發貨通知。",
"empty": "目前 PO 沒有可上傳的發貨通知。",
"download": "下載 Excel",
"rpa": "RPA 上傳",
"confirm": "確認上傳",
"lineNo": "項次",
"lineNoSourceCustomerPo": "客戶 PO 行號",
"lineNoSourceSequence": "系統行序(未識別到內部項次)",
"selected": "已選 {count} 個發貨通知",
"batchDownload": "批量下載",
"batchRpa": "批量 RPA 上傳",
"batchConfirm": "批量確認已上傳",
"noticeCount": "共 {count} 張發貨通知",
"uploadError": "上傳失敗原因:{reason}",
"uploadStatus": {
"pending": "待上傳",
"uploading": "上傳中",
"failed": "上傳失敗",
"uploaded": "已上傳",
"needsHuman": "需人工上傳"
}
},
"uploadComplete": {
"title": "通知完成",
"subtitle": "上傳成功證據已核驗,以下內容僅供查看。",
"batchCount": "本批已上傳 {count} 張發貨通知",
"batchDownload": "下載本批 ZIP",
"batchDownloading": "正在打包…",
"uploaded": "已上傳",
"uploadedAt": "{time}",
"exportFile": "檔案:{file}",
"expand": "展開明細",
"collapse": "收合明細",
"uploadMode": "上傳方式:{mode}",
"uploadModeManual": "人工確認",
"uploadModeRpa": "RPA 上傳",
"empty": "本批暫無已上傳的發貨通知。"
},
"upload": {
"title": "貨代上傳",
"subtitle": "下載通知 Excel、上傳至貨代平台後確認人工上傳,或執行 RPA。",
"manualUpload": "確認人工上傳",
"attempt": "最近上傳嘗試:{mode} · {status}"
},
"stages": {
"intake_parse": "接收解析",
"order_review": "訂單覆核",
@@ -1792,7 +1925,7 @@
"confirmAutoProgress": "已建立任務 {taskNo},已進入自動推進",
"autoProgress": {
"result": "自動推進結果:{status}",
"checkpoint": "目前檢查點:{checkpoint}",
"position": "目前進度位置:{position}",
"viewTask": "返回對話查看進度",
"returnToChat": "返回對話查看進度",
"returnedFocusHint": "已返回對話,並聚焦任務 {taskNo}(見右側「本次處理中」)",
@@ -2245,12 +2378,17 @@
"ready": "已通過",
"unknownField": "未知欄位"
},
"fieldConflict": {
"fieldConflict": {
"title": "欄位衝突待裁決({count})",
"subtitle": "多來源取值不一致時不會自動寫入。請選用一方或填寫人工值後再建單。",
"evidenceIssueTitle": "證據待確認({count})",
"evidenceIssueSubtitle": "此欄位缺少可追溯文件證據,並非取值衝突;請核對原文或重新解析。",
"scope": { "header": "訂單表頭", "line": "訂單明細", "line_unassigned": "訂單明細(未定位)", "unscoped": "欄位範圍未定位" },
"subtitle": "多來源取值不一致時不會自動寫入。請選用一方或填寫人工值後再建單。",
"evidenceIssueTitle": "證據待確認({count})",
"evidenceIssueSubtitle": "此欄位缺少可追溯文件證據,並非取值衝突;請核對原文或重新解析。",
"scope": {
"header": "訂單表頭",
"line": "訂單明細",
"line_unassigned": "訂單明細(未定位)",
"unscoped": "欄位範圍未定位"
},
"optionLabel": "候選 {index}",
"adoptOption": "採用此值",
"customValue": "填寫人工值",
@@ -2575,9 +2713,18 @@
"downloadFailed": "本批有 {count} 個產物下載失敗,請逐項重試",
"singleDownloadFailed": "下載本批產物失敗"
},
"stageSummary": {"empty": "暫無檔案", "needsAction": "{count} 待處理", "processing": "{count} 處理中", "completed": "{count} 已完成", "total": "{count} 個檔案"},
"stageSummary": {
"empty": "暫無檔案",
"needsAction": "{count} 待處理",
"processing": "{count} 處理中",
"completed": "{count} 已完成",
"total": "{count} 個檔案"
},
"unclassified": "另有 {count} 個檔案的階段待確認,請查看檔案清單",
"search": {"label": "搜尋檔案或 PO", "placeholder": "搜尋檔名或 PO"},
"search": {
"label": "搜尋檔案或 PO",
"placeholder": "搜尋檔名或 PO"
},
"fileProcessing": "檔案處理中",
"filteringByStage": "已篩選:{stage}",
"clearStageFilter": "清除篩選",
@@ -2704,8 +2851,26 @@
"retry": "目前處理失敗,請檢查原因後重試"
},
"progress": {
"step": {"document_queued":"正在等待解析工作啟動","layout_parsing_started":"正在解析 PDF 版面","layout_parsing_completed":"PDF 版面解析完成","profile_matching":"正在比對訂單範本","profile_matched":"訂單範本比對完成","table_reconstructed":"正在還原訂單表格","order_fields_extracted":"正在擷取訂單欄位","email_supplement_merged":"正在合併郵件補充資訊","review_ready":"訂單結果已產生,等待覆核","review_required":"需要人工覆核訂單結果"},
"lifecycleReason": {"failed":"目前步驟處理失敗,請查看詳情後重試。","cancelled":"本次處理已取消。","review_required":"目前結果需要人工覆核。","processing_slow":"目前步驟耗時較長,系統仍在繼續。","queue_backlog":"目前步驟正在排隊等待執行。","processing_attention":"目前步驟長時間未完成,請查看詳情或稍後重新整理。"},
"step": {
"document_queued": "正在等待解析工作啟動",
"layout_parsing_started": "正在解析 PDF 版面",
"layout_parsing_completed": "PDF 版面解析完成",
"profile_matching": "正在比對訂單範本",
"profile_matched": "訂單範本比對完成",
"table_reconstructed": "正在還原訂單表格",
"order_fields_extracted": "正在擷取訂單欄位",
"email_supplement_merged": "正在合併郵件補充資訊",
"review_ready": "訂單結果已產生,等待覆核",
"review_required": "需要人工覆核訂單結果"
},
"lifecycleReason": {
"failed": "目前步驟處理失敗,請查看詳情後重試。",
"cancelled": "本次處理已取消。",
"review_required": "目前結果需要人工覆核。",
"processing_slow": "目前步驟耗時較長,系統仍在繼續。",
"queue_backlog": "目前步驟正在排隊等待執行。",
"processing_attention": "目前步驟長時間未完成,請查看詳情或稍後重新整理。"
},
"title": "訂單處理進度",
"completedOfTotal": "已完成 {done} / {total}",
"currentStage": "目前:{stage}",
@@ -3406,7 +3571,6 @@
"complete": "齊全",
"missing": "缺資料"
},
"transfer": {
"fileProgressTitle": "收料檔案準備",
"stageFileReady": "檔案就緒",