- 行不迁移:匹配记录降级为评估留痕(scope/counts/hash 留痕不拦执行), 匹配/重查原地刷新行并续行级新鲜度(updated_at) - 执行改按行:POST /items/execute 三层门禁(行级新鲜度 TTL/文件版本对账/写前复查), Run 留痕不绑匹配记录;消失行 blocked_file_removed fail-closed 入异常池 - 恢复处理收敛为行级重查(batch-resume 删除);待处理池补齐匹配窗口字段, 排序改业务稳定键(收料日期→Invoice→created_at,操作不再引起跳位) - 首页待办看板四队列:可调拨明细/待恢复异常/已人工关闭/结果未知;「最近预检」移除; 收料日期默认 T-1 并加输入期限制;「重新查询 ERP」更名「重查」 - 术语重构 precheck→match:表 transfer_matchings、列 matching_id/matching_no/matching_hash、 API /matchings、单号前缀 MTG、状态值 prechecking→matching(迁移 rn1a2b3c4d5e6,模块未上线无兼容层) - 修复 integration_connector mapping 扇出嵌套丢行缺陷;对账结论:0 vs 30/40/36 系收料仓库映射曾指向错误账套 TGHX(已改 TGHX1),探针留档 backend/tmp - 测试:后端 in_transit_transfer+api+connector 393 passed;前端 chat 713 passed;build ✓
132 lines
5.7 KiB
Vue
132 lines
5.7 KiB
Vue
<!--
|
||
features/chat/components/messages/TransferResultCard.vue
|
||
用途:结果卡——按 ERP 单号聚合(决策 20)、可展开物料明细、未生成单据异常区、
|
||
下载收料来源文件 / ERP 库存表(决策 21)。不展示执行审计入口(决策 19)。
|
||
依赖:props.run、i18n chat.transfer.*。
|
||
逻辑:<details> 展开/收起物料行;异常单独分区;两个下载按钮 + 异常 Excel。
|
||
-->
|
||
<script setup lang="ts">
|
||
import type { TransferRunResult } from '../../types/transfer.types';
|
||
|
||
defineProps<{
|
||
run: TransferRunResult;
|
||
}>();
|
||
|
||
const emit = defineEmits<{
|
||
downloadReceipt: [];
|
||
downloadErp: [];
|
||
downloadExceptions: [];
|
||
}>();
|
||
|
||
function reasonLabel(reason: string): string {
|
||
const map: Record<string, string> = {
|
||
blocked_quantity_mismatch: 'chat.transfer.resultBlocked',
|
||
blocked_inventory_not_found: 'chat.transfer.resultBlocked',
|
||
business_failed: 'chat.transfer.exceptionBusinessFailed',
|
||
technical_failed: 'chat.transfer.exceptionTechnicalFailed',
|
||
result_unknown: 'chat.transfer.resultUnknown',
|
||
matching_expired: 'chat.transfer.exceptionMatchExpired',
|
||
};
|
||
return map[reason] ?? 'chat.transfer.resultBlocked';
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-result-card">
|
||
<div class="mb-3 flex items-center justify-between">
|
||
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.resultTitle') }}</h3>
|
||
<span class="text-xs text-muted">{{ run.run_no }}</span>
|
||
</div>
|
||
|
||
<!-- 已生成 ERP 单据:按单号聚合 + 可展开物料明细 -->
|
||
<div v-if="run.result.external_documents.length" class="flex flex-col gap-2">
|
||
<details
|
||
v-for="doc in run.result.external_documents"
|
||
:key="doc.document_no"
|
||
class="rounded-lg border border-default"
|
||
data-testid="transfer-erp-document"
|
||
>
|
||
<summary class="flex cursor-pointer flex-wrap items-center justify-between gap-2 px-3 py-2 text-xs">
|
||
<span class="font-bold text-brand-700">{{ doc.document_no }}</span>
|
||
<span class="text-secondary">{{ doc.from_warehouse }} → {{ doc.to_warehouse }}</span>
|
||
<span class="text-muted">{{ $t('chat.transfer.materialCount', { count: doc.material_count }) }}</span>
|
||
<span class="font-bold text-secondary">{{ doc.total_quantity }}</span>
|
||
<span class="rounded-full bg-emerald-50 px-2 py-0.5 font-bold text-emerald-700">
|
||
{{ $t('chat.transfer.posted') }}
|
||
</span>
|
||
</summary>
|
||
<div class="border-t border-subtle px-3 py-2">
|
||
<table class="w-full text-xs" data-testid="transfer-erp-document-lines">
|
||
<thead>
|
||
<tr class="text-left text-[11px] text-muted">
|
||
<th class="p-1">{{ $t('chat.transfer.colMaterial') }}</th>
|
||
<th class="p-1">{{ $t('chat.transfer.colName') }}</th>
|
||
<th class="p-1">{{ $t('chat.transfer.colSpec') }}</th>
|
||
<th class="p-1">{{ $t('chat.transfer.colInvoice') }}</th>
|
||
<th class="p-1">{{ $t('chat.transfer.colToQty') }}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr v-for="line in doc.lines" :key="line.invoice_no" class="border-t border-subtle">
|
||
<td class="p-1">{{ line.material_no }}</td>
|
||
<td class="p-1">{{ line.material_name }}</td>
|
||
<td class="p-1">{{ line.specification }}</td>
|
||
<td class="p-1">{{ line.invoice_no }}</td>
|
||
<td class="p-1">{{ line.quantity }}</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</details>
|
||
</div>
|
||
<div v-else class="mb-3 rounded-lg bg-surface-soft p-3 text-xs text-muted">
|
||
{{ $t('chat.transfer.noDocuments') }}
|
||
</div>
|
||
|
||
<!-- 未生成 ERP 单据的异常区(决策 20 单独展示) -->
|
||
<div v-if="run.result.exceptions.length" class="mt-3" data-testid="transfer-exceptions-area">
|
||
<h4 class="mb-1 text-xs font-bold text-secondary">{{ $t('chat.transfer.exceptionsTitle') }}</h4>
|
||
<ul class="flex flex-col gap-1">
|
||
<li
|
||
v-for="exc in run.result.exceptions"
|
||
:key="exc.invoice_no"
|
||
class="rounded-lg bg-red-50 px-3 py-1.5 text-xs text-red-700"
|
||
data-testid="transfer-exception-item"
|
||
>
|
||
<span class="font-bold">{{ exc.invoice_no }}</span>
|
||
<span class="mx-1 text-red-400">·</span>{{ exc.source_code }} · {{ $t(reasonLabel(exc.reason)) }}
|
||
<div class="text-[11px] text-red-500">{{ exc.facts }}</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
|
||
<!-- 下载:收料来源文件 + ERP 库存表(决策 21);无审计入口(决策 19) -->
|
||
<div class="mt-3 flex flex-wrap gap-2 border-t border-subtle pt-3" data-testid="transfer-result-downloads">
|
||
<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"
|
||
data-testid="transfer-download-receipt"
|
||
@click="emit('downloadReceipt')"
|
||
>
|
||
{{ $t('chat.transfer.downloadReceiptFiles') }}
|
||
</button>
|
||
<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"
|
||
data-testid="transfer-download-erp"
|
||
@click="emit('downloadErp')"
|
||
>
|
||
{{ $t('chat.transfer.downloadErpInventory') }}
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft"
|
||
data-testid="transfer-download-exceptions"
|
||
@click="emit('downloadExceptions')"
|
||
>
|
||
{{ $t('chat.transfer.downloadExceptions') }}
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</template>
|