Merge branch 'hugo-shipping-notice' into dev

# Conflicts:
#	backend/app/services/shipping_notice/receipt_report_notification.py
This commit is contained in:
hugo committed 2026-09-23 01:09:28 +08:00
commit 876a7ade7d
212 files changed
+12056 -2889

No files matched your search

+21 -1
View File
@@ -16,6 +16,7 @@ import type {
TransferRunResult,
TransferSourceFileStatus,
TransferSourceOption,
TransferType,
} from '../types/transfer.types';
const BASE = '/api/in-transit-transfer';
@@ -26,6 +27,10 @@ const jsonHeaders = () => ({ 'Content-Type': 'application/json', ...getAuthHeade
export interface CreatePrecheckPayload {
source_codes: string[];
business_date?: string;
receipt_date_from?: string;
receipt_date_to?: string;
/** 调拨业务类型;缺省为在途仓至HUB仓 */
transfer_type?: TransferType;
}
/** 创建预检(只读) */
@@ -86,12 +91,27 @@ export const downloadTransferReceiptFiles = (runNo: string) =>
/** 下载预检冻结的 ERP 库存表(csv) */
export const downloadTransferErpInventory = (runNo: string) =>
requestBlob(`${BASE}/runs/${runNo}/erp-inventory`, { headers: getAuthHeaders() });
requestBlob(`${BASE}/runs/${runNo}/external-inventory`, { headers: getAuthHeaders() });
/** 下载七 Sheet 异常 Excel */
export const downloadTransferExceptions = (runNo: string) =>
requestBlob(`${BASE}/runs/${runNo}/exceptions.xlsx`, { headers: getAuthHeaders() });
/** 批量重查 ERP 库存(可恢复阻断行;invoice_nos 缺省 = 全部阻断行) */
export const requeryTransferItems = (precheckNo: string, invoiceNos?: string[]) =>
requestJson<{ precheck_no: string; total: number; results: Array<Record<string, unknown>> }>(
`${BASE}/prechecks/${precheckNo}/items/requery`,
{ method: 'POST', body: JSON.stringify(invoiceNos ? { invoice_nos: invoiceNos } : {}), headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' } },
);
/** 按选中来源打包下载各自最新归档收料文件(zip) */
export const downloadTransferSourceFiles = (sourceCodes: string[]) =>
requestBlob(`${BASE}/sources/receipt-files`, {
method: 'POST',
headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' },
body: JSON.stringify({ source_codes: sourceCodes }),
});
/** 待处理异常列表(可恢复/已关闭/结果未知 + 老化等级) */
export const listTransferBacklog = () =>
requestJson<TransferBacklogItem[]>(`${BASE}/backlog`, { headers: getAuthHeaders() });
@@ -103,6 +103,8 @@ const isTransferMessage = computed(
|| message.type === 'transfer-progress'
|| message.type === 'transfer-result',
);
/** 调拨消息带宽表格(预检明细 10+ 列),放宽气泡宽度上限避免横向挤压成局部布局。 */
const wideMessage = computed(() => isTransferMessage.value || isContractReviewMessage.value);
const isLeaveMessage = computed(() =>
message.type === 'leave-form'
@@ -709,8 +711,8 @@ function handleInlineDownload(file: InlineDownloadFile): void {
<template>
<div
:data-msg-index="index"
class="group mx-auto mb-6 flex w-full max-w-4xl animate-slide-up"
:class="message.role === 'user' ? 'justify-end' : 'justify-start'"
class="group mx-auto mb-6 flex w-full animate-slide-up"
:class="message.role === 'user' ? 'justify-end' : wideMessage ? 'max-w-[min(96vw,1500px)]' : 'max-w-4xl justify-start'"
>
<div
class="flex flex-col"
@@ -721,7 +723,7 @@ function handleInlineDownload(file: InlineDownloadFile): void {
class="text-[15px] leading-relaxed"
:class="message.role === 'user'
? 'rounded-2xl rounded-tr-sm bg-brand-600 px-5 py-2.5 text-white shadow-sm shadow-brand-500/15'
: isContractReviewMessage
: isContractReviewMessage || isTransferMessage
? 'w-full'
: shippingOrderExtractionState
? 'w-full'
@@ -64,14 +64,14 @@ describe('TransferHomePanel chat home entry', () => {
precheck_id: 'TPC-1', status: 'ready_to_execute', business_date: '2026-08-06',
eligible_receipt_date_to: '2026-08-05', expires_at: '',
counts: { file_invoice_count: 1, not_matured_count: 0, prechecked_count: 1, executable_count: 1, blocked_count: 0 },
estimated_transfer_quantity: '1200', estimated_erp_write_count: 1, precheck_hash: 'sha256:x',
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, precheck_hash: 'sha256:x',
});
api.getTransferPrecheck.mockResolvedValue({
summary: {
precheck_id: 'TPC-1', status: 'ready_to_execute', business_date: '2026-08-06',
eligible_receipt_date_to: '2026-08-05', expires_at: '',
counts: { file_invoice_count: 1, not_matured_count: 0, prechecked_count: 1, executable_count: 1, blocked_count: 0 },
estimated_transfer_quantity: '1200', estimated_erp_write_count: 1, precheck_hash: 'sha256:x',
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, precheck_hash: 'sha256:x',
},
items: [{
source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器组件', specification: 'A',
@@ -118,8 +118,8 @@ function goBack() {
</div>
</template>
<!-- 子流程:复用自驱动的 TransferMessageView -->
<div v-else class="w-full max-w-4xl pr-2">
<!-- 子流程:复用自驱动的 TransferMessageView(预检宽表格需要全宽,上限对齐消息气泡宽布局) -->
<div v-else class="w-full max-w-[min(96vw,1500px)] pr-2">
<button
type="button"
data-testid="transfer-home-back"
@@ -38,7 +38,7 @@ const payload = {
expires_at: '',
counts: { file_invoice_count: 1, not_matured_count: 0, prechecked_count: 1, executable_count: 1, blocked_count: 0 },
estimated_transfer_quantity: '1200',
estimated_erp_write_count: 1,
estimated_external_write_count: 1,
precheck_hash: 'sha256:x',
},
items: [{
@@ -57,7 +57,7 @@ const runPayload = {
run_no: 'RUN-1',
status: 'success',
result: {
erp_documents: [{
external_documents: [{
document_no: 'TRF-10001', from_warehouse: 'DBS-TRANSIT', to_warehouse: 'HUB-CN01',
material_count: 1, total_quantity: '1200', posting_status: 'posted',
lines: [{ material_no: 'MAT-1', material_name: '连接器组件', specification: 'A', invoice_no: 'INV-001', quantity: '1200' }],
@@ -167,7 +167,7 @@ describe('TransferMessageView self-driving wiring', () => {
await wrapper.find('[data-testid="transfer-source-option-DBS-AWSBI"] input').setValue(true);
await wrapper.find('[data-testid="transfer-source-confirm"]').trigger('click');
await flushPromises();
expect(api.createTransferPrecheck).toHaveBeenCalledWith({ source_codes: ['DBS-AWSBI'] });
expect(api.createTransferPrecheck).toHaveBeenCalledWith({ source_codes: ['DBS-AWSBI'], transfer_type: 'in_transit_to_hub' });
expect(wrapper.find('[data-testid="transfer-precheck-card"]').exists()).toBe(true);
});
});
@@ -16,6 +16,8 @@ import TransferBacklogSummaryCard from './TransferBacklogSummaryCard.vue';
import TransferManualCloseDialog from './TransferManualCloseDialog.vue';
import TransferSourceSelectCard from './TransferSourceSelectCard.vue';
import { useChatTransfer } from '../../composables/useChatTransfer';
import { downloadTransferSourceFiles, getTransferPrecheck, requeryTransferItems } from '../../api/transfer.api';
import { triggerBlobDownload } from '@/shared/utils/download';
import { useMessage } from '@/shared/composables/useMessage';
import type {
TransferBacklogItem,
@@ -23,6 +25,7 @@ import type {
TransferPrecheckSummary,
TransferRunResult,
TransferSourceProgress,
TransferType,
} from '../../types/transfer.types';
const props = defineProps<{
@@ -86,6 +89,40 @@ function applyPayload(payload?: Record<string, unknown> | null) {
applyPayload(props.payload);
watch(() => props.payload, applyPayload);
/** 打包下载选中来源的最新归档收料文件 */
async function onDownloadSources(sourceCodes: string[]) {
if (!sourceCodes.length) return;
busy.value = true;
try {
const result = await downloadTransferSourceFiles(sourceCodes);
triggerBlobDownload(result.blob, result.filename ?? `receipt-files-${sourceCodes.length}.zip`);
} catch (e) {
reportError(e);
} finally {
busy.value = false;
}
}
/** 重新获取 ERP 库存:批量重查后用服务端明细原位刷新(保留勾选中仍阻断的行) */
async function onRequery(invoiceNos: string[]) {
if (!invoiceNos.length || !transfer.precheckId.value) return;
busy.value = true;
try {
await requeryTransferItems(transfer.precheckId.value, invoiceNos);
const detail = await getTransferPrecheck(transfer.precheckId.value);
items.value = detail.items;
if (detail.summary) summaryRef.value = detail.summary;
const stillBlocked = new Set(
items.value.filter((item) => String(item.result).startsWith('blocked_')).map((item) => item.invoice_no),
);
transfer.selected.value = new Set([...transfer.selected.value].filter((no) => stillBlocked.has(no)));
} catch (e) {
reportError(e);
} finally {
busy.value = false;
}
}
/** 直接生成调拨单(决策 4/5:无独立确认页) */
async function onExecute(invoiceNos: string[]) {
busy.value = true;
@@ -159,11 +196,15 @@ async function onCloseConfirm(reason: string) {
}
}
/** 来源实例选择确认 → 创建预检并切换预检卡(决策 4:两步第一步) */
async function onSourceConfirm(sourceCodes: string[]) {
/** 来源实例选择确认 → 创建预检并切换预检卡(决策 4:两步第一步;收料日期范围为查询范围;调拨类型决定数据范围) */
async function onSourceConfirm(
sourceCodes: string[],
dateRange?: { from?: string; to?: string },
transferType?: TransferType,
) {
busy.value = true;
try {
await transfer.createPrecheck(sourceCodes);
await transfer.createPrecheck(sourceCodes, undefined, dateRange, transferType);
mode.value = 'precheck';
summaryRef.value = transfer.precheck.value;
items.value = transfer.items.value;
@@ -206,15 +247,20 @@ async function onSourceRetry(sourceCodes: string[]) {
:busy="busy"
:retrying="retryingSource"
@confirm="onSourceConfirm"
@download="onDownloadSources"
@retry="onSourceRetry"
/>
<TransferPrecheckCard
v-else-if="mode === 'precheck' && summaryRef"
:summary="summaryRef"
:items="items"
:sources="transfer.sources.value"
:selected="transfer.selected.value"
:requery-busy="busy"
:busy="busy"
@toggle="(invoiceNo, checked) => transfer.toggleSelect(invoiceNo, checked)"
@toggle-all="(invoiceNos, checked) => invoiceNos.forEach((no) => transfer.toggleSelect(no, checked))"
@requery="onRequery"
@execute="onExecute"
/>
<TransferProgressCard v-else-if="mode === 'progress'" :run-no="runNo" :status="status" :busy="busy" />
@@ -1,24 +1,34 @@
<!--
features/chat/components/messages/TransferPrecheckCard.vue
用途:预检卡——计数 + 调拨明细表(决策 6 十列)+ 勾选 + “直接生成调拨单”按钮。
依赖:props(summary/items/selected/busy)、i18n chat.transfer.*。
逻辑:阻断/未成熟项 checkbox 禁用;无选择或 busy 时生成按钮禁用;
emit execute(invoiceNos)(决策 4/5:无独立确认页)。
用途:预检卡——计数 + 来源失败提示 + 调拨明细表(含筛选)+ 勾选 + “直接生成调拨单”按钮。
依赖:props(summary/items/sources/selected/busy)、i18n chat.transfer.*。
逻辑:明细表渲染 filtered(关键字/结果筛选生效);阻断/未成熟项 checkbox 禁用;
重查范围含可恢复阻断与可执行行;阻断原因经结果徽标 title 悬浮透出不占行高;
无选择或 busy 时生成按钮禁用;emit execute(invoiceNos)(决策 4/5:无独立确认页);
来源级解析/文件失败经 sources.error_code 透出(防"安静全 0")。
-->
<script setup lang="ts">
import { computed } from 'vue';
import type { TransferPrecheckItem, TransferPrecheckSummary } from '../../types/transfer.types';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { deriveBatchNo } from './transferBatch';
import type { TransferPrecheckItem, TransferPrecheckSummary, TransferSourceProgress } from '../../types/transfer.types';
const { t } = useI18n();
const props = defineProps<{
summary: TransferPrecheckSummary;
items: TransferPrecheckItem[];
sources?: TransferSourceProgress[];
selected: Set<string>;
busy?: boolean;
requeryBusy?: boolean;
}>();
const emit = defineEmits<{
toggle: [invoiceNo: string, checked: boolean];
'toggle-all': [invoiceNos: string[], checked: boolean];
execute: [invoiceNos: string[]];
requery: [invoiceNos: string[]];
}>();
const selectedCount = computed(() =>
@@ -26,10 +36,67 @@ const selectedCount = computed(() =>
);
const executeDisabled = computed(() => props.busy || selectedCount.value === 0);
/** 来源级失败(解析/文件/RPA 触发):必须可见,防止计数全 0 却无任何解释。 */
const failedSources = computed(() =>
(props.sources ?? []).filter((source) => source.error_code || source.error_message),
);
/** 筛选与全选状态(表格交互本地态,勾选集合仍由父级持有)。 */
const keyword = ref('');
const resultFilter = ref<'all' | 'executable' | 'blocked' | 'not_matured'>('all');
function isBlocked(item: TransferPrecheckItem): boolean {
return String(item.result).startsWith('blocked_');
}
/** 勾选可用范围:可执行(可生成调拨)或可恢复阻断(可重查 ERP)。 */
function isSelectable(item: TransferPrecheckItem): boolean {
return item.result === 'executable';
}
function isCheckable(item: TransferPrecheckItem): boolean {
return isSelectable(item) || isBlocked(item);
}
/** 可重查行:可恢复阻断 + 可执行(已可执行也允许重查核对最新库存)。 */
function isRequeryable(item: TransferPrecheckItem): boolean {
return isBlocked(item) || item.result === 'executable';
}
const filtered = computed(() =>
props.items.filter((item) => {
const kw = keyword.value.trim().toLowerCase();
if (kw) {
const haystack = [item.material_no, item.material_name, item.invoice_no, item.lot_no]
.map((value) => String(value ?? '').toLowerCase());
if (!haystack.some((value) => value.includes(kw))) return false;
}
if (resultFilter.value === 'executable' && item.result !== 'executable') return false;
if (resultFilter.value === 'blocked' && !isBlocked(item)) return false;
if (resultFilter.value === 'not_matured' && item.result !== 'not_matured') return false;
return true;
}),
);
const filteredInvoiceNos = computed(() => filtered.value.map((item) => item.invoice_no));
const allFilteredSelected = computed(() =>
filteredInvoiceNos.value.length > 0 && filteredInvoiceNos.value.every((no) => props.selected.has(no)),
);
const selectedRequeryableCount = computed(() =>
filtered.value.filter((item) => isRequeryable(item) && props.selected.has(item.invoice_no)).length,
);
function toggleAll(): void {
emit('toggle-all', filteredInvoiceNos.value, !allFilteredSelected.value);
}
function requerySelected(): void {
const nos = filtered.value
.filter((item) => isRequeryable(item) && props.selected.has(item.invoice_no))
.map((item) => item.invoice_no);
if (nos.length) emit('requery', nos);
}
function isChecked(item: TransferPrecheckItem): boolean {
return props.selected.has(item.invoice_no);
}
@@ -41,11 +108,31 @@ function resultLabel(result: string): string {
blocked_quantity_mismatch: 'chat.transfer.resultBlocked',
blocked_inventory_not_found: 'chat.transfer.resultBlocked',
blocked_future_date: 'chat.transfer.resultBlocked',
erp_query_timeout: 'chat.transfer.resultUnknown',
external_query_timeout: 'chat.transfer.resultUnknown',
result_unknown: 'chat.transfer.resultUnknown',
};
return map[result] ?? 'chat.transfer.resultBlocked';
}
/** 阻断原因悬浮文案:已知结果码走 i18n 本地化;带明细后缀(如查询失败的底层原因)原样保留追加。 */
const REASON_I18N_KEYS: Record<string, string> = {
blocked_quantity_mismatch: 'chat.transfer.reasonQuantityMismatch',
blocked_inventory_not_found: 'chat.transfer.reasonInventoryNotFound',
blocked_external_query_failed: 'chat.transfer.reasonExternalQueryFailed',
blocked_future_date: 'chat.transfer.reasonFutureDate',
};
function reasonTitle(item: TransferPrecheckItem): string | undefined {
if (!isBlocked(item) || !item.reason) return undefined;
const key = REASON_I18N_KEYS[item.result];
if (!key) return item.reason;
const base = t(key);
const marker = ': ';
const detail = item.reason.includes(marker)
? item.reason.slice(item.reason.indexOf(marker) + marker.length).trim()
: '';
return detail ? `${base}:${detail}` : base;
}
</script>
<template>
@@ -73,22 +160,65 @@ function resultLabel(result: string): string {
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedQuantity') }}</div>
</div>
<div class="rounded-lg bg-surface-soft p-2 text-center">
<div class="text-lg font-black text-brand-600">{{ summary.estimated_erp_write_count }}</div>
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedErpWrites') }}</div>
<div class="text-lg font-black text-brand-600">{{ summary.estimated_external_write_count }}</div>
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedExternalWrites') }}</div>
</div>
</div>
<div class="overflow-x-auto">
<div
v-if="failedSources.length"
class="mb-3 rounded-lg border border-red-200 bg-red-50 p-3 text-xs text-red-700"
data-testid="transfer-precheck-source-errors"
>
<div class="mb-1 font-bold">{{ $t('chat.transfer.sourceErrorTitle') }}</div>
<div v-for="source in failedSources" :key="source.source_code" class="leading-5">
{{ source.source_code }}:{{ source.error_message || source.error_code }}
</div>
</div>
<div class="mb-2 flex flex-wrap items-center gap-2">
<input
v-model="keyword"
type="text"
class="w-56 rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
:placeholder="$t('chat.transfer.filterPlaceholder')"
data-testid="transfer-precheck-filter"
/>
<select v-model="resultFilter" class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary" data-testid="transfer-precheck-result-filter">
<option value="all">{{ $t('chat.transfer.filterAll') }}</option>
<option value="executable">{{ $t('chat.transfer.resultExecutable') }}</option>
<option value="blocked">{{ $t('chat.transfer.resultBlocked') }}</option>
<option value="not_matured">{{ $t('chat.transfer.resultNotMatured') }}</option>
</select>
<button
type="button"
class="rounded-lg border border-brand-200 bg-brand-50 px-3 py-1 text-xs font-bold text-brand-700 transition hover:bg-brand-100 disabled:cursor-not-allowed disabled:opacity-40"
:disabled="props.requeryBusy || selectedRequeryableCount === 0"
data-testid="transfer-precheck-requery-selected"
@click="requerySelected"
>
{{ $t('chat.transfer.requerySelected') }}{{ selectedRequeryableCount ? `(${selectedRequeryableCount})` : '' }}
</button>
</div>
<div class="overflow-x-auto">
<table class="w-full min-w-[1100px] text-xs" data-testid="transfer-precheck-table">
<thead>
<tr class="border-b border-default bg-surface-soft text-left text-[11px] text-muted">
<th class="p-2"></th>
<th class="p-2">
<input
type="checkbox"
:checked="allFilteredSelected"
data-testid="transfer-precheck-select-all"
@change="toggleAll"
/>
</th>
<th class="p-2">{{ $t('chat.transfer.colSource') }}</th>
<th class="p-2">{{ $t('chat.transfer.colInvoice') }}</th>
<th class="p-2">{{ $t('chat.transfer.colReceiptDate') }}</th>
<th class="p-2">{{ $t('chat.transfer.colMaterial') }}</th>
<th class="p-2">{{ $t('chat.transfer.colName') }}</th>
<th class="p-2">{{ $t('chat.transfer.colSpec') }}</th>
<th class="p-2">{{ $t('chat.transfer.colInvoice') }}</th>
<th class="p-2">{{ $t('chat.transfer.colFromWarehouse') }}</th>
<th class="p-2">{{ $t('chat.transfer.colFromBatch') }}</th>
<th class="p-2">{{ $t('chat.transfer.colFromQty') }}</th>
<th class="p-2">{{ $t('chat.transfer.colToWarehouse') }}</th>
<th class="p-2">{{ $t('chat.transfer.colToQty') }}</th>
@@ -97,8 +227,8 @@ function resultLabel(result: string): string {
</thead>
<tbody>
<tr
v-for="item in items"
:key="item.invoice_no"
v-for="item in filtered"
:key="`${item.source_code}|${item.invoice_no}|${item.material_no}|${item.receipt_date ?? ''}`"
class="border-b border-subtle"
:class="{ 'bg-surface-soft text-muted': !isSelectable(item) }"
:data-testid="`transfer-item-${item.invoice_no}`"
@@ -107,31 +237,47 @@ function resultLabel(result: string): string {
<input
type="checkbox"
:checked="isChecked(item)"
:disabled="!isSelectable(item) || busy"
:disabled="!isCheckable(item) || busy"
:data-testid="`transfer-check-${item.invoice_no}`"
@change="emit('toggle', item.invoice_no, ($event.target as HTMLInputElement).checked)"
/>
</td>
<td class="p-2">{{ item.source_code }}</td>
<td class="p-2 font-semibold">{{ item.invoice_no }}</td>
<td class="p-2">{{ item.receipt_date || '—' }}</td>
<td class="p-2">{{ item.material_no }}</td>
<td class="p-2">{{ item.material_name }}</td>
<td class="p-2">{{ item.specification }}</td>
<td class="p-2 font-semibold">{{ item.invoice_no }}</td>
<td class="p-2">{{ item.from_warehouse }}</td>
<td class="p-2">{{ deriveBatchNo(item.lot_no) }}</td>
<td class="p-2">{{ item.from_quantity ?? '—' }}</td>
<td class="p-2">{{ item.to_warehouse }}</td>
<td class="p-2">{{ item.to_quantity }}</td>
<td class="p-2">
<span
class="rounded-full px-2 py-0.5 font-bold"
:class="{
'bg-emerald-50 text-emerald-700': item.result === 'executable',
'bg-amber-50 text-amber-700': item.result === 'not_matured',
'bg-red-50 text-red-700': !isSelectable(item) && item.result !== 'not_matured',
}"
>
{{ $t(resultLabel(item.result)) }}
</span>
<div class="flex items-center gap-1">
<!-- 阻断原因经悬浮提示(title)透出:不占行高;可执行行也提供重查入口 -->
<span
class="rounded-full px-2 py-0.5 font-bold"
:class="{
'bg-emerald-50 text-emerald-700': item.result === 'executable',
'bg-amber-50 text-amber-700': item.result === 'not_matured',
'bg-red-50 text-red-700': !isSelectable(item) && item.result !== 'not_matured',
}"
:title="reasonTitle(item)"
data-testid="transfer-item-result"
>
{{ $t(resultLabel(item.result)) }}
</span>
<button
v-if="isRequeryable(item)"
type="button"
class="ml-1 rounded border border-brand-200 px-1 text-[10px] font-bold text-brand-700 transition hover:bg-brand-50 disabled:opacity-40"
:disabled="props.requeryBusy"
:data-testid="`transfer-requery-${item.invoice_no}`"
@click="emit('requery', [item.invoice_no])"
>
{{ $t('chat.transfer.requeryRow') }}
</button>
</div>
</td>
</tr>
</tbody>
@@ -141,7 +287,7 @@ function resultLabel(result: string): string {
<div class="mt-3 flex items-center justify-end gap-3 border-t border-subtle pt-3">
<span class="text-xs text-muted">
{{ $t('chat.transfer.selectedCount', { count: selectedCount }) }} ·
{{ $t('chat.transfer.estimatedErpWrites') }}:{{ summary.estimated_erp_write_count }}
{{ $t('chat.transfer.estimatedExternalWrites') }}:{{ summary.estimated_external_write_count }}
</span>
<button
type="button"
@@ -39,9 +39,9 @@ function reasonLabel(reason: string): string {
</div>
<!-- 已生成 ERP 单据:按单号聚合 + 可展开物料明细 -->
<div v-if="run.result.erp_documents.length" class="flex flex-col gap-2">
<div v-if="run.result.external_documents.length" class="flex flex-col gap-2">
<details
v-for="doc in run.result.erp_documents"
v-for="doc in run.result.external_documents"
:key="doc.document_no"
class="rounded-lg border border-default"
data-testid="transfer-erp-document"
@@ -58,7 +58,7 @@ describe('TransferSourceSelectCard', () => {
expect(wrapper.emitted('confirm')?.[0][0]).toEqual(['DBS-AWSBI', 'DBS-AWSSG', 'CRANE-SZ']);
});
it('“清空”清空已选实例', async () => {
it('“清空选择”清空已选实例', async () => {
const wrapper = mountCard();
await wrapper.find('[data-testid="transfer-source-select-visible"]').trigger('click');
await wrapper.find('[data-testid="transfer-source-clear"]').trigger('click');
@@ -66,6 +66,28 @@ describe('TransferSourceSelectCard', () => {
expect(wrapper.emitted('confirm')).toBeUndefined();
});
it('选中后上下文操作条原位替换选择辅助区,清空选择后还原', async () => {
// [断言意图] 未选中零死按钮(仅辅助区);有选中时批量操作条同槽位出现并带计数;
// 清空选择后还原辅助区——Gmail/Linear 式批量操作栏切换行为。
const wrapper = mountCard();
expect(wrapper.find('[data-testid="transfer-source-aids"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').exists()).toBe(false);
await wrapper.find('[data-testid="transfer-source-option-DBS-AWSBI"] input').setValue(true);
expect(wrapper.find('[data-testid="transfer-source-aids"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').text()).toContain('已选 1');
await wrapper.find('[data-testid="transfer-source-clear"]').trigger('click');
expect(wrapper.find('[data-testid="transfer-source-aids"]').exists()).toBe(true);
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').exists()).toBe(false);
expect(wrapper.emitted('confirm')).toBeUndefined();
});
it('D+1 规则提示收进 ⓘ 悬浮(title),不再平铺占宽', () => {
// [断言意图] 长规则文案通过原生 title 渐进披露,紧凑日期行不换行错位。
const wrapper = mountCard();
expect(wrapper.find('[data-testid="transfer-source-date-hint"]').attributes('title')).toBe('截止不超出 D+1 规则(业务日期前一天)');
});
it('“只选可重试”勾选无文件/失败来源', async () => {
const wrapper = mountCard();
await wrapper.find('[data-testid="transfer-source-select-retryable"]').trigger('click');
@@ -86,4 +108,33 @@ describe('TransferSourceSelectCard', () => {
await wrapper.find('[data-testid="transfer-source-batch-retry"]').trigger('click');
expect(wrapper.emitted('retry')?.[0][0]).toEqual(['DBS-AWSSG']);
});
it('已过期来源显示「文件已过期」徽标且可重试', async () => {
// [断言意图] 保留期已到的来源不得误报就绪(has_ready_file=false);
// expired 状态与 none/failed 一样允许重新触发收料 RPA。
const wrapper = mountCard({}, [
{ source_code: 'CRANE-EXP', display_name: '过期在途仓', platform: 'crane', enabled: true, has_ready_file: false, file_status: 'expired' },
]);
expect(wrapper.find('[data-testid="transfer-source-status-CRANE-EXP"]').text()).toBe('文件已过期');
expect((wrapper.find('[data-testid="transfer-source-retry-CRANE-EXP"]').element as HTMLButtonElement).disabled).toBe(false);
await wrapper.find('[data-testid="transfer-source-option-CRANE-EXP"] input').setValue(true);
await wrapper.find('[data-testid="transfer-source-batch-retry"]').trigger('click');
expect(wrapper.emitted('retry')?.[0][0]).toEqual(['CRANE-EXP']);
});
it('确认默认携带调拨类型 in_transit_to_hub', async () => {
// [断言意图] 类型 1 为缺省选中值,确认事件第三参回传类型。
const wrapper = mountCard();
await wrapper.find('[data-testid="transfer-source-option-DBS-AWSBI"] input').setValue(true);
await wrapper.find('[data-testid="transfer-source-confirm"]').trigger('click');
expect(wrapper.emitted('confirm')?.[0][2]).toBe('in_transit_to_hub');
});
it('调拨类型 2/3 占位禁用且不可选中', async () => {
// [断言意图] 一期仅开放类型 1;占位类型按钮 disabled,防止发起未支持链路。
const wrapper = mountCard();
expect((wrapper.find('[data-testid="transfer-type-option-hub_repair_out"]').element as HTMLButtonElement).disabled).toBe(true);
expect((wrapper.find('[data-testid="transfer-type-option-hub_to_hub"]').element as HTMLButtonElement).disabled).toBe(true);
expect((wrapper.find('[data-testid="transfer-type-option-in_transit_to_hub"]').element as HTMLButtonElement).disabled).toBe(false);
});
});
@@ -1,15 +1,19 @@
<!--
features/chat/components/messages/TransferSourceSelectCard.vue
用途:来源实例选择卡(决策 2/3/4:手工两步第一步)——按平台 DBS/Crane 分组勾选实例,
“确认范围并预检”发起预检。
选择调拨类型后“确认范围并预检”发起预检。
依赖:props.sources、i18n chat.transfer.*。
逻辑:平台仅分组不可直接执行;未选任何实例时确认按钮禁用。
逻辑:预检参数区(调拨类型 + 收料日期,确认时一并提交)→ 选择辅助/上下文操作条
(有选中时原位替换辅助区,承载批量重试/下载/清空选择)→ 平台分组来源列表
(平台仅分组不可直接执行)→ 底部唯一实心主按钮「确认范围并预检」(未选禁用);
调拨类型决定收料数据范围(类型 1 仅纳入 INVOICE 前缀 HOM/HOX/WTP),
类型 2/3 一期占位(禁用,后端同样 fail-closed)。
-->
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useMessage } from '@/shared/composables/useMessage';
import type { TransferSourceOption } from '../../types/transfer.types';
import type { TransferSourceOption, TransferType } from '../../types/transfer.types';
const props = defineProps<{
sources: TransferSourceOption[];
@@ -19,22 +23,39 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
confirm: [sourceCodes: string[]];
confirm: [sourceCodes: string[], dateRange?: { from?: string; to?: string }, transferType?: TransferType];
/** 批量重试收料 RPA:传来源编码列表 */
retry: [sourceCodes: string[]];
download: [sourceCodes: string[]];
}>();
const { warning: notifyWarning } = useMessage();
const { t } = useI18n();
const selected = ref<Set<string>>(new Set());
/** 收料日期范围(预检查询范围);截止不得超出 D+1 规则(后端卡控)。 */
const dateFrom = ref('');
const dateTo = ref('');
/** 调拨业务类型:决定本次预检纳入哪些收料数据;一期仅类型 1 开放。 */
const transferType = ref<TransferType>('in_transit_to_hub');
/** 类型选项元数据;enabled=false 为占位类型(UI 禁用 + 后端 fail-closed 双保险)。 */
const transferTypeOptions: Array<{ value: TransferType; enabled: boolean }> = [
{ value: 'in_transit_to_hub', enabled: true },
{ value: 'hub_repair_out', enabled: false },
{ value: 'hub_to_hub', enabled: false },
];
function transferTypeLabel(value: TransferType): string {
return t(`chat.transfer.transferType.${value}`);
}
const platforms = computed(() => [...new Set(props.sources.map((source) => source.platform))]);
const selectedCount = computed(() => selected.value.size);
/** 可重试判定:仅 待抓取(none) / 抓取失败(failed) 的来源可重试(ready/fetching 不重复触发)。 */
/** 可重试判定:仅 待抓取(none) / 抓取失败(failed) / 已过期(expired) 的来源可重试(ready/fetching 不重复触发)。 */
function isRetryable(source: TransferSourceOption): boolean {
return source.file_status === 'none' || source.file_status === 'failed';
return source.file_status === 'none' || source.file_status === 'failed' || source.file_status === 'expired';
}
/** 全部可重试来源。 */
@@ -50,6 +71,7 @@ const selectedHasReadyFile = computed(() =>
[...selected.value].some((code) => props.sources.find((s) => s.source_code === code)?.has_ready_file),
);
const confirmDisabled = computed(() => props.busy || selectedCount.value === 0 || !selectedHasReadyFile.value);
const downloadDisabled = computed(() => props.busy || !selectedHasReadyFile.value);
function toggle(sourceCode: string, checked: boolean) {
const next = new Set(selected.value);
@@ -96,6 +118,13 @@ function batchRetry() {
emit('retry', codes);
}
function downloadSelected(): void {
const codes = [...selected.value].filter(
(code) => props.sources.find((s) => s.source_code === code)?.has_ready_file,
);
if (codes.length) emit('download', codes);
}
function confirm() {
if (selectedCount.value === 0) {
notifyWarning(t('chat.transfer.needSelectSource'), t('chat.transfer.sourceSelectTitle'));
@@ -105,7 +134,7 @@ function confirm() {
notifyWarning(t('chat.transfer.needReadyFile'), t('chat.transfer.sourceSelectTitle'));
return;
}
emit('confirm', [...selected.value]);
emit('confirm', [...selected.value], { from: dateFrom.value || undefined, to: dateTo.value || undefined }, transferType.value);
}
</script>
@@ -114,7 +143,54 @@ function confirm() {
<h3 class="mb-1 text-sm font-bold text-primary">{{ $t('chat.transfer.sourceSelectTitle') }}</h3>
<p class="mb-3 text-xs text-muted">{{ $t('chat.transfer.sourceSelectHint') }}</p>
<div class="mb-3 flex flex-wrap items-center gap-2">
<!-- [ZONE 1] 预检参数区:调拨类型 + 收料日期同组(确认预检时一并提交,参数先行定范围)。 -->
<div class="mb-3 rounded-lg border border-subtle p-3" data-testid="transfer-source-params">
<p class="mb-2 text-[11px] font-bold text-muted">{{ $t('chat.transfer.precheckParams') }}</p>
<div class="flex flex-wrap items-center gap-2">
<span class="text-xs font-bold text-secondary">{{ $t('chat.transfer.transferTypeLabel') }}</span>
<button
v-for="option in transferTypeOptions"
:key="option.value"
type="button"
class="rounded-full border px-3 py-1 text-xs font-bold disabled:cursor-not-allowed disabled:opacity-40"
:class="transferType === option.value
? 'border-brand-600 bg-brand-600 text-white hover:bg-brand-700'
: 'border-brand-200 text-brand-700 hover:bg-brand-50'"
:disabled="busy || !option.enabled"
:title="option.enabled ? undefined : t('chat.transfer.transferTypeComingSoon')"
:data-testid="`transfer-type-option-${option.value}`"
@click="transferType = option.value"
>
{{ transferTypeLabel(option.value) }}
<span v-if="!option.enabled" class="ml-1 font-normal opacity-70">{{ t('chat.transfer.transferTypeComingSoon') }}</span>
</button>
</div>
<div class="mt-2 flex flex-wrap items-center gap-2">
<span class="text-xs font-bold text-secondary">{{ $t('chat.transfer.receiptDateLabel') }}</span>
<input
v-model="dateFrom"
type="date"
class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
data-testid="transfer-source-date-from"
/>
<span class="text-xs text-muted">~</span>
<input
v-model="dateTo"
type="date"
class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
data-testid="transfer-source-date-to"
/>
<!-- D+1 规则属低频说明:收进原生 title 悬浮(渐进披露),避免长文案挤压布局。 -->
<span
class="cursor-help text-xs text-muted"
:title="$t('chat.transfer.receiptDateHint')"
data-testid="transfer-source-date-hint"
>ⓘ</span>
</div>
</div>
<!-- [ZONE 2] 选择辅助/上下文操作条:有选中时原位替换辅助区(批量操作惯例),未选中零死按钮。 -->
<div v-if="selectedCount === 0" class="mb-3 flex flex-wrap items-center gap-2" data-testid="transfer-source-aids">
<button
type="button"
class="rounded-lg border border-brand-200 px-3 py-1.5 text-xs font-bold text-brand-700 hover:bg-brand-50 disabled:opacity-50"
@@ -133,28 +209,45 @@ function confirm() {
>
{{ $t('chat.transfer.selectRetryable') }}
</button>
<button
type="button"
class="rounded-lg bg-brand-600 px-3 py-1.5 text-xs font-bold text-white hover:bg-brand-700 disabled:opacity-50"
:disabled="batchRetryDisabled"
data-testid="transfer-source-batch-retry"
@click="batchRetry"
>
{{ $t('chat.transfer.batchRetry') }}
</button>
<button
type="button"
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-50"
:disabled="busy"
data-testid="transfer-source-clear"
@click="clearSelected"
>
{{ $t('chat.transfer.clearSources') }}
</button>
<span class="ml-auto text-xs text-muted">
</div>
<div
v-else
class="mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-brand-200 bg-brand-50 px-3 py-2"
data-testid="transfer-source-action-bar"
>
<span class="text-xs font-bold text-secondary">
{{ $t('chat.transfer.selectedSourceCount', { count: selectedCount }) }}
<span v-if="selectedRetryableCount > 0" class="text-amber-600"> · {{ $t('chat.transfer.selectedRetryableCount', { count: selectedRetryableCount }) }}</span>
</span>
<span class="ml-auto flex flex-wrap items-center gap-2">
<button
type="button"
class="rounded-lg border border-brand-200 px-3 py-1.5 text-xs font-bold text-brand-700 hover:bg-brand-50 disabled:opacity-50"
:disabled="batchRetryDisabled"
data-testid="transfer-source-batch-retry"
@click="batchRetry"
>
{{ $t('chat.transfer.batchRetry') }}
</button>
<button
type="button"
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-50"
:disabled="busy || downloadDisabled"
data-testid="transfer-source-download"
@click="downloadSelected"
>
{{ $t('chat.transfer.downloadFiles') }}
</button>
<button
type="button"
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-50"
:disabled="busy"
data-testid="transfer-source-clear"
@click="clearSelected"
>
{{ $t('chat.transfer.clearSources') }}
</button>
</span>
</div>
<div v-for="platform in platforms" :key="platform" class="mb-3 rounded-lg border border-subtle">
@@ -208,6 +301,13 @@ function confirm() {
>
{{ t('chat.transfer.fileFailed') }}
</span>
<span
v-else-if="source.file_status === 'expired'"
class="inline-flex items-center gap-1 rounded-full bg-orange-50 px-2 py-0.5 text-[10px] font-bold text-orange-700"
:data-testid="`transfer-source-status-${source.source_code}`"
>
{{ t('chat.transfer.fileExpired') }}
</span>
<span
v-else
class="inline-flex items-center gap-1 rounded-full bg-surface-strong px-2 py-0.5 text-[10px] font-bold text-muted"
@@ -230,8 +330,7 @@ function confirm() {
</div>
</div>
<div class="flex items-center justify-end gap-3 border-t border-subtle pt-3">
<span class="text-xs text-muted">{{ $t('chat.transfer.selectedCount', { count: selectedCount }) }}</span>
<div class="flex items-center justify-end border-t border-subtle pt-3">
<button
type="button"
class="rounded-lg bg-brand-600 px-4 py-1.5 text-sm font-bold text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
@@ -0,0 +1,27 @@
/**
* features/chat/components/messages/transferBatch.spec.ts
* 用途:覆盖批号转换规则。
* 依赖:transferBatch、vitest。
* 逻辑:WTP 前缀替换为 HOW;其余原样;空值安全。
*/
import { describe, expect, it } from 'vitest';
import { deriveBatchNo } from './transferBatch';
describe('transferBatch', () => {
it('replaces WTP prefix with HOW and keeps the rest', () => {
expect(deriveBatchNo('WTP26082728')).toBe('HOW26082728');
expect(deriveBatchNo('wtp26082728')).toBe('HOW26082728');
});
it('returns non-WTP values unchanged', () => {
expect(deriveBatchNo('HS000131')).toBe('HS000131');
expect(deriveBatchNo('4294235')).toBe('4294235');
});
it('returns empty string for empty input', () => {
expect(deriveBatchNo('')).toBe('');
expect(deriveBatchNo(null)).toBe('');
expect(deriveBatchNo(undefined)).toBe('');
});
});
@@ -0,0 +1,14 @@
/**
* features/chat/components/messages/transferBatch.ts
* 用途:在途调拨批号转换规则(拨出/拨入批号展示)。
* 依赖:无。
* 逻辑:原批号以 WTP 开头时替换前缀为 HOW 获得真实批号;其余规则不变、原样展示。
*/
/** 原批号(如 WMS 的 WTP26082728)→ 真实批号(HOW26082728);空值/非 WTP 原样返回。 */
export function deriveBatchNo(lotNo: string | null | undefined): string {
const value = String(lotNo ?? '').trim();
if (!value) return '';
if (value.toUpperCase().startsWith('WTP')) return `HOW${value.slice(3)}`;
return value;
}
@@ -23,7 +23,7 @@ const summary = {
expires_at: '',
counts: { file_invoice_count: 3, not_matured_count: 1, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
estimated_transfer_quantity: '2400',
estimated_erp_write_count: 2,
estimated_external_write_count: 2,
precheck_hash: 'sha256:x',
};
@@ -82,6 +82,27 @@ describe('TransferPrecheckCard', () => {
await wrapper.find('[data-testid="transfer-generate-button"]').trigger('click');
expect(wrapper.emitted('execute')?.[0][0]).toEqual(['INV-001']);
});
it('同 Invoice 跨收料日期拆票(重复 invoice_no)时,筛选后仅渲染匹配行', async () => {
// [断言意图] 回归防线(2026-09-21):拆票设计下 invoice_no 不再唯一,
// 行 key 若仍用 invoice_no 会出现重复 key,Vue 列表 diff 错乱导致
// 筛选后不匹配行残留/克隆(用户输入 HOX 仍见 SLC2PHX 行)。
// 行身份 = (来源, Invoice, 料号, 收料日期),key 必须用同一粒度。
const dupItems = [
{ source_code: 'CRANE', material_no: 'M-1', material_name: '机框', specification: '', invoice_no: 'HOX-1', receipt_date: '2026-09-11', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
{ source_code: 'CRANE', material_no: 'M-2', material_name: '护罩', specification: '', invoice_no: 'DUP-1', receipt_date: '2026-09-03', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
{ source_code: 'CRANE', material_no: 'M-2', material_name: '护罩', specification: '', invoice_no: 'DUP-1', receipt_date: '2026-09-04', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
];
const wrapper = mount(TransferPrecheckCard, {
props: { summary, items: dupItems, selected: new Set() },
...mountOptions,
});
expect(wrapper.findAll('tbody tr').length).toBe(3);
await wrapper.find('[data-testid="transfer-precheck-filter"]').setValue('HOX');
const rows = wrapper.findAll('tbody tr');
expect(rows.length).toBe(1);
expect(rows[0].text()).toContain('HOX-1');
});
});
describe('TransferResultCard', () => {
@@ -89,7 +110,7 @@ describe('TransferResultCard', () => {
run_no: 'RUN-1',
status: 'partial_failed',
result: {
erp_documents: [{
external_documents: [{
document_no: 'TRF-10001',
from_warehouse: 'DBS-TRANSIT',
to_warehouse: 'HUB-CN01',
@@ -31,7 +31,7 @@ const summary = {
expires_at: '',
counts: { file_invoice_count: 2, not_matured_count: 0, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
estimated_transfer_quantity: '2400',
estimated_erp_write_count: 2,
estimated_external_write_count: 2,
precheck_hash: 'sha256:abc',
};
@@ -54,7 +54,7 @@ describe('useChatTransfer', () => {
api.getTransferRun.mockResolvedValue({
run_no: 'RUN-20260806-1',
status: 'success',
result: { erp_documents: [], exceptions: [] },
result: { external_documents: [], exceptions: [] },
});
});
@@ -33,6 +33,7 @@ import type {
TransferRunResult,
TransferSourceOption,
TransferSourceProgress,
TransferType,
} from '../types/transfer.types';
export function useChatTransfer() {
@@ -59,12 +60,23 @@ export function useChatTransfer() {
const selectedCount = computed(() => selected.value.size);
const estimatedQuantity = computed(() => precheck.value?.estimated_transfer_quantity ?? '0');
/** 创建预检(缺文件时来源级阶段展示等待/失败) */
async function createPrecheck(sourceCodes: string[], businessDate?: string) {
/** 创建预检(缺文件时来源级阶段展示等待/失败);transferType 决定收料数据范围,缺省在途仓至HUB仓 */
async function createPrecheck(
sourceCodes: string[],
businessDate?: string,
dateRange?: { from?: string; to?: string },
transferType?: TransferType,
) {
busy.value = true;
error.value = '';
try {
const summary = await createTransferPrecheck({ source_codes: sourceCodes, business_date: businessDate });
const summary = await createTransferPrecheck({
source_codes: sourceCodes,
business_date: businessDate,
receipt_date_from: dateRange?.from,
receipt_date_to: dateRange?.to,
transfer_type: transferType,
});
precheckId.value = summary.precheck_id;
await refreshPrecheck();
return summary;
@@ -165,7 +177,7 @@ export function useChatTransfer() {
async function downloadErpInventory() {
if (!runNo.value) return null;
const result = await downloadTransferErpInventory(runNo.value);
saveBlob(result.blob, result.filename ?? `erp-inventory-${runNo.value}.csv`);
saveBlob(result.blob, result.filename ?? `external-inventory-${runNo.value}.csv`);
return result;
}
@@ -34,7 +34,7 @@ const detail: TransferPrecheckDetail = {
expires_at: '',
counts: { file_invoice_count: 3, not_matured_count: 1, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
estimated_transfer_quantity: '2400',
estimated_erp_write_count: 2,
estimated_external_write_count: 2,
precheck_hash: 'sha256:abc',
},
sources: [{ source_code: 'DBS-AWSBI', stage: 'file_ready', file_no: 'REC-1', file_version: 'v3' }],
@@ -49,7 +49,7 @@ const runResult = {
run_no: 'RUN-20260806-001',
status: 'success',
result: {
erp_documents: [{
external_documents: [{
document_no: 'TRF-10001',
from_warehouse: 'DBS-TRANSIT',
to_warehouse: 'HUB-CN01',
@@ -85,7 +85,7 @@ describe('in-transit-transfer e2e contract', () => {
transfer.toggleSelect('INV-002', false);
await transfer.execute();
expect(api.executeTransferPrecheck).toHaveBeenCalledWith('TPC-20260806-001', ['INV-001']);
expect(transfer.run.value?.result.erp_documents[0].document_no).toBe('TRF-10001');
expect(transfer.run.value?.result.external_documents[0].document_no).toBe('TRF-10001');
});
it('刷新恢复:重建 composable 后按 run_no 恢复最终结果(决策 17)', async () => {
@@ -93,7 +93,7 @@ describe('in-transit-transfer e2e contract', () => {
transfer.runNo.value = 'RUN-20260806-001';
await transfer.refreshRun();
expect(transfer.run.value?.status).toBe('success');
expect(transfer.run.value?.result.erp_documents[0].material_count).toBe(2);
expect(transfer.run.value?.result.external_documents[0].material_count).toBe(2);
});
it('下载:收料来源文件与 ERP 库存表(决策 21/22 前端入口)', async () => {
@@ -5,6 +5,9 @@
* 逻辑:卡片/组合式函数只消费这些稳定类型;状态与后端 13 状态集对齐。
*/
/** 调拨业务类型(与后端 TransferType 枚举一致;类型 2/3 一期占位未开放) */
export type TransferType = 'in_transit_to_hub' | 'hub_repair_out' | 'hub_to_hub';
/** 预检计数 */
export interface TransferPrecheckCounts {
file_invoice_count: number;
@@ -30,7 +33,7 @@ export interface TransferPrecheckSummary {
expires_at: string;
counts: TransferPrecheckCounts;
estimated_transfer_quantity: string;
estimated_erp_write_count: number;
estimated_external_write_count: number;
precheck_hash: string;
}
@@ -50,6 +53,7 @@ export interface TransferPrecheckItem {
reason?: string;
erp_document_no?: string | null;
raw_lines?: TransferRawLine[];
lot_no?: string;
}
/** 来源实例级进度(决策 18:来源隔离展示) */
@@ -104,7 +108,7 @@ export interface TransferRunResult {
run_no: string;
status: string;
result: {
erp_documents: ErpDocument[];
external_documents: ErpDocument[];
exceptions: TransferExceptionItem[];
};
}
@@ -156,8 +160,8 @@ export interface TransferSourceOption {
display_name: string;
platform: string;
enabled: boolean;
/** 收料文件状态:ready / fetching / failed / none(只读投影货代收料事实) */
file_status?: 'ready' | 'fetching' | 'failed' | 'none';
/** 收料文件状态:ready / fetching / failed / expired / none(只读投影货代收料事实) */
file_status?: 'ready' | 'fetching' | 'failed' | 'expired' | 'none';
/** 是否已有当前可用的收料文件(门禁:无 ready 文件禁止确认预检) */
has_ready_file?: boolean;
file_no?: string | null;
@@ -167,7 +171,7 @@ export interface TransferSourceOption {
/** 来源收料文件状态(门禁 + 状态标识 + 重试返回) */
export interface TransferSourceFileStatus {
source_code: string;
file_status: 'ready' | 'fetching' | 'failed' | 'none';
file_status: 'ready' | 'fetching' | 'failed' | 'expired' | 'none';
has_ready_file: boolean;
file_no?: string | null;
file_sha256?: string | null;
@@ -653,6 +653,22 @@ async function mountView(query: Record<string, string> = {}) {
moreActions: '更多操作',
inventorySource: '库存源',
},
lineActions: {
closeLine: '结案(不再发货)',
closeLineConfirm: '确认结案',
editLine: '编辑',
more: '更多操作',
},
inlineEdit: {
save: '保存',
cancel: '取消',
busy: '系统处理中,请稍后再修改',
},
releaseBar: {
label: '放行补录',
missingPrefix: '缺 ',
missingSuffix: ' 项放行信息',
},
workflowProgress: {
automatingFooterHint: '系统自动推进中',
},
@@ -682,6 +698,9 @@ async function mountView(query: Record<string, string> = {}) {
downloadInventory: '下载库存文件',
retryInventory: '重新获取库存',
releaseShortage: '库存缺口放行',
releaseShortageHint: '放行后本次发货按缺口处理。',
releaseReasonPlaceholder: '可填写放行原因(选填)',
releaseConfirm: '确认放行',
shortage: '库存不足',
pending: '库存匹配或通知文件尚未生成。',
},
@@ -733,6 +752,9 @@ async function mountView(query: Record<string, string> = {}) {
processGate: {
inventoryActions: {
retryInventoryPreparation: '重新获取库存(RPA)',
retryInventoryMatching: '重新匹配库存',
downloadInventoryFile: '下载库存文件',
releaseInventoryShortage: '库存缺口放行',
},
actionCodes: {
confirm_customer: '确认客户',
@@ -792,6 +814,27 @@ async function mountView(query: Record<string, string> = {}) {
return wrapper;
}
/**
* 打开通知准备行的更多操作菜单(⋯)。
* 核心逻辑:展示态行级动作(重试/放行/下载)已收纳进该菜单,入口按钮在表格行内。
*/
async function openLineOverflowMenu(wrapper: { get: (selector: string) => { trigger: (event: string) => Promise<void> } }, lineId: number | string) {
await wrapper.get(`[data-testid="review-fulfillment-line-more-${lineId}"]`).trigger('click');
await nextTick();
}
/**
* 断言行级菜单项已渲染并触发点击。
* 核心逻辑:菜单经 Teleport 渲染到 body,必须走 document.body 查询而不是 wrapper.find;
* 点击后 flushPromises 等待菜单收起与异步动作(下载/门禁提交)落位。
*/
async function clickLineMenuItem(lineId: number | string, action: string) {
const item = document.body.querySelector(`[data-testid="review-fulfillment-line-action-${action}-${lineId}"]`) as HTMLButtonElement | null;
expect(item, `行级菜单项 ${action}-${lineId} 应已渲染`).toBeTruthy();
item!.click();
await flushPromises();
}
/** 将共享 Case fixture 恢复为可编辑草稿,避免跨用例污染确认恢复态。 */
function resetActiveCaseFixture() {
activeCase.value = createActiveCaseFixture();
@@ -2677,16 +2720,17 @@ describe('ShippingOrderReviewView layout phase 1', () => {
expect(workspace.text()).toContain('PN-FROZEN');
expect(workspace.text()).toContain('DBS');
expect(wrapper.find('[data-testid="review-fulfillment-frozen-order"]').exists()).toBe(false);
expect(wrapper.get('[data-testid="review-fulfillment-line-download-1001"]').attributes('title'))
.toBeTruthy();
expect(wrapper.get('[data-testid="review-fulfillment-line-retry-preparation-1001"]').attributes('title'))
.toBeTruthy();
expect(wrapper.get('[data-testid="review-fulfillment-line-retry-matching-1001"]').exists()).toBe(true);
expect(wrapper.get('[data-testid="review-fulfillment-line-release-1001"]').exists()).toBe(true);
// 展示态行级动作收纳进更多菜单(⋯):逐项断言授权动作入口存在,不再有常显按钮。
await openLineOverflowMenu(wrapper, 1001);
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-download_inventory_file-1001"]')).toBeTruthy();
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_inventory_preparation-1001"]')).toBeTruthy();
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_inventory_matching-1001"]')).toBeTruthy();
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-release_inventory_shortage-1001"]')).toBeTruthy();
expect(workspace.text()).toContain('库存不足');
await wrapper.get('[data-testid="review-fulfillment-line-download-1001"]').trigger('click');
await clickLineMenuItem(1001, 'download_inventory_file');
expect(downloadWorkspaceShippingLineInventoryFileMock).toHaveBeenCalledWith('SN-FROZEN', 'SIF-LINE-DBS');
await wrapper.get('[data-testid="review-fulfillment-line-retry-preparation-1001"]').trigger('click');
await openLineOverflowMenu(wrapper, 1001);
await clickLineMenuItem(1001, 'retry_inventory_preparation');
expect(submitProcessGatePrimaryActionMock).toHaveBeenCalledWith(
expect.any(Object),
expect.objectContaining({
@@ -2696,7 +2740,8 @@ describe('ShippingOrderReviewView layout phase 1', () => {
);
// Gate 恢复受理后立即启动五阶段轮询,不依赖浏览器手动刷新。
expect(startWorkflowProgressPollingMock).toHaveBeenCalledTimes(1);
await wrapper.get('[data-testid="review-fulfillment-line-release-1001"]').trigger('click');
await openLineOverflowMenu(wrapper, 1001);
await clickLineMenuItem(1001, 'release_inventory_shortage');
expect(wrapper.get('[data-testid="review-release-inventory-dialog"]').text()).toContain('ODM ID');
expect(wrapper.get('[data-testid="review-release-inventory-dialog"]').text()).toContain('ODM-001');
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
@@ -2763,11 +2808,11 @@ describe('ShippingOrderReviewView layout phase 1', () => {
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
await flushPromises();
await wrapper.get('[data-testid="review-fulfillment-line-release-1001"]').trigger('click');
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
await dialog.find('textarea').setValue('客户确认分批发货');
await dialog.find('input').setValue('A-01');
await dialog.get('button.bg-amber-600').trigger('click');
// 缺字段短缺行:放行入口在更多菜单,必填补录在行内补录条完成(原因不再强制)。
await openLineOverflowMenu(wrapper, 1001);
await clickLineMenuItem(1001, 'release_inventory_shortage');
await wrapper.get('[data-testid="review-fulfillment-release-input-1001-102"]').setValue('A-01');
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1001"]').trigger('click');
await new Promise<void>((resolve) => setTimeout(resolve, 0));
await nextTick();
@@ -2823,11 +2868,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
await flushPromises();
await wrapper.get('[data-testid="review-fulfillment-line-release-1002"]').trigger('click');
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
await dialog.find('textarea').setValue('客户确认单行放行');
await dialog.find('input').setValue('A-01');
await dialog.get('button.bg-amber-600').trigger('click');
await openLineOverflowMenu(wrapper, 1002);
await clickLineMenuItem(1002, 'release_inventory_shortage');
await wrapper.get('[data-testid="review-fulfillment-release-input-1002-102"]').setValue('A-01');
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1002"]').trigger('click');
await new Promise<void>((resolve) => setTimeout(resolve, 0));
await nextTick();
@@ -2899,11 +2943,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
});
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
await wrapper.get('[data-testid="review-fulfillment-line-release-1003"]').trigger('click');
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
await dialog.find('textarea').setValue('客户确认分批发货');
await dialog.find('input').setValue('A-01');
await dialog.get('button.bg-amber-600').trigger('click');
await openLineOverflowMenu(wrapper, 1003);
await clickLineMenuItem(1003, 'release_inventory_shortage');
await wrapper.get('[data-testid="review-fulfillment-release-input-1003-102"]').setValue('A-01');
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1003"]').trigger('click');
await wrapper.get('[data-testid="review-lifecycle-stage-fulfillment_prep"]').findAll('button')[1].trigger('click');
resolvePostReleaseTask?.(taskDetail());
await new Promise<void>((resolve) => setTimeout(resolve, 0));
@@ -449,7 +449,18 @@ const isLifecycleFreightUpload = computed(() => lifecycleActiveStageCode.value =
const isLifecycleUploadComplete = computed(() => lifecycleActiveStageCode.value === 'upload_complete');
/** 正式任务已通知完成时,即使用户回看前置阶段也只能查看,不能再修改已产出通知。 */
const isCompletedFormalTask = computed(() => lifecycleCurrentStageCode.value === 'upload_complete');
const isReviewContentReadOnly = computed(() => isReadOnly.value || isCompletedFormalTask.value);
/**
* STP 自动建单进行中(等待入队/排队/执行):与 isProcessingAutomating 的 STP 分支同源。
* 期间表单只读——后端 `_locked_case` 同步拒绝内容写入(REVIEW_DRAFT_LOCKED_BY_AUTOMATION),
* 前端不再展示可编辑假象,避免用户误以为修改已生效。
*/
const isStpAutoCreateInProgress = computed(() => {
const stpStatus = String(activeCase.value?.automation?.status || '').trim().toLowerCase();
return !hasFormalOt.value && ['waiting_to_start', 'queued', 'running'].includes(stpStatus);
});
const isReviewContentReadOnly = computed(() => (
isReadOnly.value || isCompletedFormalTask.value || isStpAutoCreateInProgress.value
));
/** 二期编辑窗(D10):读正式任务 ui_state.edit_window;前端 fail-closed,锁定字段禁用/提示。 */
const formalEditWindow = computed(() => formalTaskDetail.value?.ui_state?.edit_window ?? null);
@@ -5319,7 +5330,7 @@ watch(
<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 v-if="formalPreparationOdmColumnVisible" class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.odmConflict.column') }}</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><template v-for="(line, lineIndex) in formalPreparationDisplayLines" :key="line.snapshot_line_id || `${line.reservation_id}-${line.part_number}`"><tr :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"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.reservation_id" type="text" class="w-28 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultReservation')" :data-testid="`review-fulfillment-line-edit-reservation-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.reservation_id || '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.part_number" type="text" class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultPartNumber')" :data-testid="`review-fulfillment-line-edit-part-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else class="block max-w-[220px] truncate" :title="line.part_number || '—'">{{ line.part_number || '—' }}</span></td><td class="whitespace-nowrap px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input :value="editingLine.required_qty" type="number" min="0" step="any" class="w-20 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.requiredQty')" :data-testid="`review-fulfillment-line-edit-qty-${line.snapshot_line_id}`" @input="updateInlineEditQty(($event.target as HTMLInputElement).value)" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.required_qty ?? '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="isInlineEditing(line) && inlineSourceOptions(line).length"><select class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-fulfillment-line-edit-source-${line.snapshot_line_id}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="editingLine?.source_code" :disabled="inlineEditSaving" @change="updateInlineEditSource(($event.target as HTMLSelectElement).value)"><option v-for="option in inlineSourceOptions(line)" :key="option.value" :value="option.value">{{ option.label }}</option></select></template><span v-else class="block max-w-[220px] truncate" :title="formalPreparationLineSource(line)">{{ formalPreparationLineSource(line) || '—' }}</span></td><td v-if="formalPreparationOdmColumnVisible" class="whitespace-nowrap px-3 py-2"><div v-if="(line.odm_values?.length || 0) > 1 && !formalPreparationSourceLocked" class="flex items-center gap-1" :data-testid="`review-line-odm-${line.snapshot_line_id || lineIndex}`"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-odm-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.odmConflict.title')" :value="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || line.chosen_odm_id || ''" @change="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.odmConflict.placeholder') }}</option><option v-for="value in line.odm_values" :key="value" :value="value">{{ value }}</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-odm-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || lineOdmBusy" :aria-label="t('chat.shippingOrderReLine truncated
<tbody><template v-for="(line, lineIndex) in formalPreparationDisplayLines" :key="line.snapshot_line_id || `${line.reservation_id}-${line.part_number}`"><tr :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"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.reservation_id" type="text" class="w-28 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultReservation')" :data-testid="`review-fulfillment-line-edit-reservation-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.reservation_id || '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.part_number" type="text" class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultPartNumber')" :data-testid="`review-fulfillment-line-edit-part-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else class="block max-w-[220px] truncate" :title="line.part_number || '—'">{{ line.part_number || '—' }}</span></td><td class="whitespace-nowrap px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input :value="editingLine.required_qty" type="number" min="0" step="any" class="w-20 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.requiredQty')" :data-testid="`review-fulfillment-line-edit-qty-${line.snapshot_line_id}`" @input="updateInlineEditQty(($event.target as HTMLInputElement).value)" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.required_qty ?? '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="isInlineEditing(line) && inlineSourceOptions(line).length"><select class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-fulfillment-line-edit-source-${line.snapshot_line_id}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="editingLine?.source_code" :disabled="inlineEditSaving" @change="updateInlineEditSource(($event.target as HTMLSelectElement).value)"><option v-for="option in inlineSourceOptions(line)" :key="option.value" :value="option.value">{{ option.label }}</option></select></template><span v-else class="block max-w-[220px] truncate" :title="formalPreparationLineSource(line)">{{ formalPreparationLineSource(line) || '—' }}</span></td><td v-if="formalPreparationOdmColumnVisible" class="whitespace-nowrap px-3 py-2"><div v-if="(line.odm_values?.length || 0) > 1 && !formalPreparationSourceLocked" class="flex items-center gap-1" :data-testid="`review-line-odm-${line.snapshot_line_id || lineIndex}`"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-odm-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.odmConflict.title')" :value="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || line.chosen_odm_id || ''" @change="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.odmConflict.placeholder') }}</option><option v-for="value in line.odm_values" :key="value" :value="value">{{ value }}</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-odm-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || lineOdmBusy" :aria-label="t('chat.shippingOrderReLine truncated
</table>
</div>
</div>
@@ -6143,6 +6154,8 @@ watch(
@adjudicate="({ suggestion, body }) => decideSuggestion(suggestion.suggestion_no, body)"
/>
<!-- 底栏只读不含 STP 运行锁(isStpAutoCreateInProgress):运行态已由 automating 单独承载
(隐藏全部写按钮并显示运行提示);叠加会让 footer 整体隐藏,运行提示永远不可见。 -->
<ReviewWorkbenchFooter
v-if="showOrderReviewEditor || isLifecycleIntakeParse"
:available-actions="availableActions"
@@ -6152,7 +6165,7 @@ watch(
:show-stp-retry="showObjectRetryOnFooter"
:auto-gate-hint="t(autoGateHintKey)"
:saving="saving"
:is-read-only="isReviewContentReadOnly"
:is-read-only="isReadOnly || isCompletedFormalTask"
:has-draft="Boolean(displayCase?.draft) || isLifecycleIntakeParse"
:unsaved-count="unsavedEditCount"
:flow-presentation="flowPresentation"