feat(shipping-notice): 增强发货通知与订单抽取功能,支持多进程处理与紧急停止
- 移除不再使用的 SHIPPING_NOTICE_LAYOUT_PARSER_REVISION 配置 - 在环境配置中新增 SHIPPING_NOTICE_WORKER_CONCURRENCY 和 SHIPPING_NOTICE_JOB_RUNNING_TIMEOUT_SECONDS - 实现发货通知 worker 进程,支持并发处理订单抽取任务 - 引入紧急停止功能,允许管理员在运行中控制订单解析状态 - 更新相关 API,支持读取与设置紧急停止状态 - 增强文档与代码注释,反映新的业务逻辑与功能要求
This commit is contained in:
1 parent
d0fe084999
commit
b352c281d5
149 files changed
+12550
-1874
No files matched your search
+97
-37
@@ -3,7 +3,8 @@
|
||||
* features/chat/components/shipping/ShippingOrderDocumentResultItem.vue
|
||||
* 用途:渲染单个 PDF 的订单抽取结果摘要,供详情抽屉按文档逐项展示。
|
||||
* 依赖:订单抽取文档 DTO、vue-i18n。
|
||||
* 逻辑:只显示用户可理解的业务字段;reason_code 优先 i18n,缺失时对 SHIPPING_NOTICE.* 回退通用提示;人工复核由上层统一跳转。
|
||||
* 逻辑:默认只展示状态/PO/行数/阻断原因;审计与补充信息收入详情折叠;
|
||||
* 「查看证据」与「人工复核」分别携带 focus+documentId;未知原因码回退通用文案并展开技术码。
|
||||
*/
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -15,9 +16,20 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
enterManualReview: [];
|
||||
enterManualReview: [payload?: { focus?: 'evidence' | 'draft'; documentId?: number }];
|
||||
}>();
|
||||
|
||||
/**
|
||||
* 向父级发出进入复核事件,并带上当前文档与入口焦点。
|
||||
* @param focus - evidence=查看证据;draft=人工复核草稿
|
||||
*/
|
||||
function emitEnterReview(focus: 'evidence' | 'draft') {
|
||||
emit('enterManualReview', {
|
||||
focus,
|
||||
documentId: Number(props.document.document_id || 0) || undefined,
|
||||
});
|
||||
}
|
||||
|
||||
const { t, te, locale } = useI18n();
|
||||
|
||||
const statusTone = computed(() => {
|
||||
@@ -60,6 +72,13 @@ const reasonLabel = computed(() => {
|
||||
if (code.startsWith('SHIPPING_NOTICE.')) {
|
||||
return t('chat.shippingOrderExtractionTechnicalFailureUserHint');
|
||||
}
|
||||
return t('chat.shippingOrderExtractionReasonUnknown');
|
||||
});
|
||||
const reasonTechnicalCode = computed(() => {
|
||||
const code = String(props.document.reason_code || '').trim();
|
||||
if (!code) return '';
|
||||
const key = `chat.shippingOrderExtractionReason.${code}`;
|
||||
if (te(key) || code.startsWith('SHIPPING_NOTICE.')) return '';
|
||||
return code;
|
||||
});
|
||||
const emailSupplementLabel = computed(() => {
|
||||
@@ -87,6 +106,18 @@ const retryStatusLabel = computed(() => {
|
||||
const key = `chat.shippingOrderExtractionRetryStatus.${status}`;
|
||||
return status && te(key) ? t(key) : '';
|
||||
});
|
||||
const routeTypeLabel = computed(() => {
|
||||
const code = String(props.document.route_type || '').trim();
|
||||
if (!code) return '';
|
||||
const key = `chat.shippingOrderExtractionRouteType.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
});
|
||||
const freezeSourceLabel = computed(() => {
|
||||
const code = String(props.document.freeze_source || '').trim();
|
||||
if (!code) return '';
|
||||
const key = `chat.shippingOrderExtractionFreezeSource.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
});
|
||||
const budgetCostLabel = computed(() => {
|
||||
if (!props.document.budget_cost) return '';
|
||||
return t('chat.shippingOrderExtractionBudgetCost', {
|
||||
@@ -105,6 +136,27 @@ const canEnterManualReview = computed(() => (
|
||||
props.document.available_actions.some((action) => action === 'review_candidate' || action === 'manual_review')
|
||||
));
|
||||
const canViewEvidence = computed(() => props.document.available_actions.includes('view_evidence'));
|
||||
|
||||
const hasAuditDetails = computed(() => Boolean(
|
||||
props.document.selection_batch
|
||||
|| props.document.group_key
|
||||
|| props.document.profile
|
||||
|| routeTypeLabel.value
|
||||
|| freezeSourceLabel.value
|
||||
|| (props.document.email_supplement?.status && props.document.email_supplement.status !== 'none')
|
||||
|| emailSupplementRelations.value.length
|
||||
|| (props.document.email_supplement?.conflict_count || 0) > 0
|
||||
|| retryStatusLabel.value
|
||||
|| budgetCostLabel.value
|
||||
|| (
|
||||
props.document.email_supplement?.reservation_id_status
|
||||
&& props.document.email_supplement.reservation_id_status !== 'none'
|
||||
)
|
||||
|| (
|
||||
props.document.email_supplement?.source_type_status
|
||||
&& props.document.email_supplement.source_type_status !== 'none'
|
||||
),
|
||||
));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -125,50 +177,23 @@ const canViewEvidence = computed(() => props.document.available_actions.includes
|
||||
<div v-if="['pending', 'routing', 'matching_profile', 'extracting', 'merging_supplement'].includes(document.status) || document.activity_event_code" class="mt-1 text-xs font-medium opacity-85">
|
||||
{{ statusActivityLabel }}
|
||||
</div>
|
||||
<!-- 核心业务结果:状态时间 + PO + 行数 -->
|
||||
<div class="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs opacity-85">
|
||||
<span v-if="activityTimeLabel">{{ activityTimeLabel }}</span>
|
||||
<span v-if="document.selection_batch">
|
||||
{{ t('chat.shippingOrderExtractionSelectionBatch', { batch: document.selection_batch }) }}
|
||||
</span>
|
||||
<span v-if="document.group_key">
|
||||
{{ t('chat.shippingOrderExtractionGroupKey', { key: document.group_key }) }}
|
||||
</span>
|
||||
<span v-if="document.po_number">
|
||||
{{ t('chat.shippingOrderExtractionPoNumber', { value: document.po_number }) }}
|
||||
</span>
|
||||
<span v-if="document.line_count > 0">
|
||||
{{ t('chat.shippingOrderExtractionLineCount', { count: document.line_count }) }}
|
||||
</span>
|
||||
<span v-if="document.profile">
|
||||
{{ t('chat.shippingOrderExtractionProfileSummary', {
|
||||
name: document.profile.name || document.profile.code,
|
||||
version: document.profile.version,
|
||||
}) }}
|
||||
</span>
|
||||
<span>
|
||||
{{ emailSupplementLabel }}
|
||||
</span>
|
||||
<span>
|
||||
{{ t('chat.shippingOrderExtractionEmailSupplementField.reservation') }}{{ reservationStatusLabel }}
|
||||
</span>
|
||||
<span>
|
||||
{{ t('chat.shippingOrderExtractionEmailSupplementField.sourceType') }}{{ sourceTypeStatusLabel }}
|
||||
</span>
|
||||
<span v-for="relation in emailSupplementRelations" :key="relation">
|
||||
{{ relation }}
|
||||
</span>
|
||||
<span v-if="document.email_supplement.conflict_count > 0">
|
||||
{{ t('chat.shippingOrderExtractionEmailSupplementConflictCount', { count: document.email_supplement.conflict_count }) }}
|
||||
</span>
|
||||
<span v-if="retryStatusLabel">
|
||||
{{ retryStatusLabel }}
|
||||
</span>
|
||||
<span v-if="budgetCostLabel">
|
||||
{{ budgetCostLabel }}
|
||||
</span>
|
||||
</div>
|
||||
<!-- 异常信息 -->
|
||||
<div v-if="reasonLabel" class="mt-2 text-xs font-medium opacity-90">
|
||||
{{ reasonLabel }}
|
||||
<details v-if="reasonTechnicalCode" class="mt-1 font-normal opacity-80">
|
||||
<summary class="cursor-pointer">{{ t('chat.shippingOrderExtractionReasonTechDetails') }}</summary>
|
||||
<code class="mt-1 block break-all text-[11px]">{{ reasonTechnicalCode }}</code>
|
||||
</details>
|
||||
</div>
|
||||
<ul v-if="reviewDetails.length" class="mt-2 space-y-1 text-xs font-medium opacity-90">
|
||||
<li v-for="detail in reviewDetails" :key="`${detail.line_number}-${detail.field_code || 'general'}`">
|
||||
@@ -181,12 +206,47 @@ const canViewEvidence = computed(() => props.document.available_actions.includes
|
||||
<div v-if="document.status === 'failed'" class="mt-1 text-xs font-medium opacity-90">
|
||||
{{ t('chat.shippingOrderExtractionTechnicalFailureUserHint') }}
|
||||
</div>
|
||||
<!-- 审计/补充详情:默认折叠,降低首屏密度 -->
|
||||
<details v-if="hasAuditDetails" class="mt-2 text-xs opacity-85">
|
||||
<summary class="cursor-pointer select-none font-medium">
|
||||
{{ t('chat.shippingOrderExtractionMoreDetails') }}
|
||||
</summary>
|
||||
<div class="mt-2 flex flex-wrap gap-x-4 gap-y-1">
|
||||
<span v-if="document.selection_batch">
|
||||
{{ t('chat.shippingOrderExtractionSelectionBatch', { batch: document.selection_batch }) }}
|
||||
</span>
|
||||
<span v-if="document.group_key">
|
||||
{{ t('chat.shippingOrderExtractionGroupKey', { key: document.group_key }) }}
|
||||
</span>
|
||||
<span v-if="document.profile">
|
||||
{{ t('chat.shippingOrderExtractionProfileSummary', {
|
||||
name: document.profile.name || document.profile.code,
|
||||
version: document.profile.version,
|
||||
}) }}
|
||||
</span>
|
||||
<span v-if="routeTypeLabel">{{ routeTypeLabel }}</span>
|
||||
<span v-if="freezeSourceLabel">{{ freezeSourceLabel }}</span>
|
||||
<span>{{ emailSupplementLabel }}</span>
|
||||
<span>
|
||||
{{ t('chat.shippingOrderExtractionEmailSupplementField.reservation') }}{{ reservationStatusLabel }}
|
||||
</span>
|
||||
<span>
|
||||
{{ t('chat.shippingOrderExtractionEmailSupplementField.sourceType') }}{{ sourceTypeStatusLabel }}
|
||||
</span>
|
||||
<span v-for="relation in emailSupplementRelations" :key="relation">{{ relation }}</span>
|
||||
<span v-if="document.email_supplement.conflict_count > 0">
|
||||
{{ t('chat.shippingOrderExtractionEmailSupplementConflictCount', { count: document.email_supplement.conflict_count }) }}
|
||||
</span>
|
||||
<span v-if="retryStatusLabel">{{ retryStatusLabel }}</span>
|
||||
<span v-if="budgetCostLabel">{{ budgetCostLabel }}</span>
|
||||
</div>
|
||||
</details>
|
||||
<div class="mt-2 flex flex-wrap gap-2">
|
||||
<button
|
||||
v-if="canViewEvidence"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
@click="emit('enterManualReview')"
|
||||
@click="emitEnterReview('evidence')"
|
||||
>
|
||||
<FileText class="h-3.5 w-3.5" />
|
||||
{{ t('chat.shippingOrderExtractionAction.view_evidence') }}
|
||||
@@ -195,7 +255,7 @@ const canViewEvidence = computed(() => props.document.available_actions.includes
|
||||
v-if="canEnterManualReview"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-md border border-current/20 px-2.5 py-1 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
|
||||
@click="emit('enterManualReview')"
|
||||
@click="emitEnterReview('draft')"
|
||||
>
|
||||
{{ t(`chat.shippingOrderExtractionAction.${document.available_actions.includes('review_candidate') ? 'review_candidate' : 'manual_review'}`) }}
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user