fix(shipping-notice,admin-schedule,frontend): 修复发货通知与后台排程的业务bug并优化各模块功能

1.  后端发货通知模块:
    清空重试任务旧状态避免残留,新增RPA进度回调接口
    优化库存匹配性能,修复人工确认校验逻辑与登录弹窗遮挡问题
    新增排程worker启动脚本,清理冗余环境配置与缓存查询开销
2.  前端后台排程模块:
    新增任务key归一化工具兼容历史格式,修复参数表单隐藏问题
    添加加载错误处理,更新多语言文案替换裸JSON占位符
This commit is contained in:
hugo committed 2026-08-26 22:05:25 +08:00
1 parent 1e5aedb9ed
commit 06c18b3c7c
81 files changed
+3301 -424

No files matched your search

@@ -0,0 +1,83 @@
/**
* features/admin/modules/schedules/components/DynamicTaskParamsForm.spec.ts
* 用途:复现「货代库存 RPA」平台任务参数表单的渲染。
* 背景:排程编辑弹窗选择 shipping-inventory-rpa 后,库存源多选字段不呈现,且弹窗按钮疑似失效。
* 断言:给定带 source_codes(multi_select/options_source=shipping_inventory_sources) 的定义,
* 挂载后应渲染「库存源」标签及动态选项,而不是抛错或渲染为空。
*/
import { describe, expect, it, vi, beforeEach } from 'vitest';
import { flushPromises, mount } from '@vue/test-utils';
import { createI18n } from 'vue-i18n';
import DynamicTaskParamsForm from './DynamicTaskParamsForm.vue';
vi.mock('@/features/admin/api/schedule.api', () => ({
listAdminPlatformTaskOptions: vi.fn(() =>
Promise.resolve([
{ label: 'DSV 360 / Rooms BK HK', value: 'DSV360', description: 'dbs · fixed · W01' },
{ label: 'Crane Footprint', value: 'CRANE', description: 'crane · inventory_match · -' },
]),
),
}));
const shippingInventoryRpaDefinition = {
task_type: 'shipping-inventory-rpa',
label: '货代库存 RPA',
label_key: 'admin.schedule.form.platformJobShippingInventory',
description: '按计划从配置的库存源抓取库存数据,由 freight_rpa_worker 异步导出。',
description_key: 'admin.schedule.form.shippingInventoryJobHint',
category: 'shipping',
params_schema: [
{
key: 'source_codes',
type: 'multi_select',
label: '库存源',
label_key: 'admin.schedule.form.shippingInventorySources',
required: false,
default: [],
options_source: 'shipping_inventory_sources',
placeholder: '留空则导出全部启用库存源',
placeholder_key: 'admin.schedule.form.shippingInventorySourcesPlaceholder',
help: '选择需要执行的库存源;选项来自库存源配置,留空则全部执行。',
help_key: 'admin.schedule.form.shippingInventorySourcesHelp',
},
],
defaults: { source_codes: [] },
};
function mountForm() {
const i18n = createI18n({
legacy: false,
locale: 'zh-CN',
messages: {
'zh-CN': {
'admin.schedule.form.dynamicParamsAdvancedPlaceholder': '可选:粘贴高级 JSON 对象参数,例如添加 timeout_seconds 等键值对',
'admin.schedule.form.dynamicParamsAdvanced': '高级配置(JSON,可选)',
},
},
});
return mount(DynamicTaskParamsForm, {
props: {
definition: shippingInventoryRpaDefinition as any,
modelValue: { source_codes: [] },
valid: true,
},
global: { plugins: [i18n] },
});
}
describe('DynamicTaskParamsForm (shipping-inventory-rpa)', () => {
beforeEach(() => vi.clearAllMocks());
it('renders the 库存源 label and the two dynamic options', async () => {
const wrapper = mountForm();
await flushPromises();
expect(wrapper.text()).toContain('库存源');
expect(wrapper.text()).toContain('DSV 360 / Rooms BK HK');
expect(wrapper.text()).toContain('Crane Footprint');
expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true);
});
it('does not throw during mount/render given the definition', async () => {
expect(() => mountForm()).not.toThrow();
});
});
@@ -30,6 +30,7 @@ const emit = defineEmits<{
const { t, te } = useI18n();
/** options_source → 选项列表缓存(组件生命周期内共享,避免重复请求) */
const optionsCache = reactive<Record<string, PlatformTaskOption[]>>({});
const optionsLoading = reactive<Record<string, boolean>>({});
@@ -18,8 +18,8 @@ const showCreateModal = useScheduleCreateModalOpen();
<template>
<Teleport to="body">
<div v-if="showCreateModal" class="admin-modal-overlay items-center">
<div class="admin-modal-panel max-w-3xl">
<div class="flex items-center justify-between border-b border-subtle px-8 py-6">
<div class="admin-modal-panel max-h-[92vh] max-w-3xl min-h-0">
<div class="flex shrink-0 items-center justify-between border-b border-subtle px-8 py-6">
<h3 class="text-2xl font-bold tracking-tight text-primary">{{ admin.scheduleEditingId ? $t('admin.schedule.form.editTitle') : $t('admin.schedule.form.createTitle') }}</h3>
<button
class="rounded-full p-2 text-muted transition hover-surface-soft hover:text-secondary"
@@ -28,7 +28,7 @@ const showCreateModal = useScheduleCreateModalOpen();
✕
</button>
</div>
<div class="max-h-[72vh] space-y-5 overflow-y-auto px-8 py-6">
<div class="min-h-0 flex-1 space-y-5 overflow-y-auto px-8 py-6">
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<div>
<label class="mb-2 block text-sm font-medium text-secondary">{{ $t('admin.schedule.form.name') }}</label>
@@ -300,18 +300,31 @@ const showCreateModal = useScheduleCreateModalOpen();
</template>
</div>
<!-- 平台任务参数区:完全由注册表 params_schema 决定,无任务级 v-if -->
<div
v-if="admin.scheduleCreateForm.schedule_type === 'platform_job' && admin.selectedPlatformTaskDefinition"
class="mt-3"
>
<!-- 平台任务参数区:完全由注册表 params_schema 决定,无任务级 v-if。
外层仅按 schedule_type 判定(同步、必然为真),不依赖异步 definitions;
定义解析完成前显示加载提示,完成后立即渲染 DynamicTaskParamsForm(含库存源)。 -->
<div v-if="admin.scheduleCreateForm.schedule_type === 'platform_job'" class="mt-3">
<DynamicTaskParamsForm
v-if="admin.selectedPlatformTaskDefinition"
:definition="admin.selectedPlatformTaskDefinition"
:model-value="admin.scheduleCreateForm.job_params"
:valid="admin.platformJobParamsValid"
@update:model-value="admin.scheduleCreateForm.job_params = $event"
@update:valid="admin.platformJobParamsValid = $event"
/>
<div v-else-if="admin.platformTaskDefinitionsLoading || admin.platformTaskDefinitionsError" class="space-y-2 rounded-xl border border-blue-200 bg-blue-50/40 px-4 py-3 text-sm text-muted">
<p>{{ admin.platformTaskDefinitionsLoading
? $t('admin.schedule.form.dynamicParamsLoading')
: $t('admin.schedule.form.dynamicParamsLoadFailed') }}</p>
<button
v-if="admin.platformTaskDefinitionsError && !admin.platformTaskDefinitionsLoading"
type="button"
class="btn-secondary btn-sm"
@click="admin.loadPlatformTaskDefinitions"
>
{{ $t('admin.schedule.form.dynamicParamsRetry') }}
</button>
</div>
</div>
<div v-if="admin.scheduleTestResult" class="mt-4 rounded-2xl border border-emerald-200 bg-emerald-50/40 p-4">
@@ -463,7 +476,7 @@ const showCreateModal = useScheduleCreateModalOpen();
</div>
</div>
<div class="admin-modal-footer admin-modal-footer--muted justify-end gap-3 px-8 py-5">
<div class="admin-modal-footer admin-modal-footer--muted relative z-10 pointer-events-auto justify-end gap-3 px-8 py-5">
<button
type="button"
class="btn-secondary"
@@ -0,0 +1,26 @@
/**
* features/admin/modules/schedules/components/dynamicParamsLocale.spec.ts
* 回归防护:vue-i18n 会把 {xxx} 当作命名插值;若 locale 文案里出现裸 {(如示例 JSON),
* 会导致 $t() 在渲染 DynamicTaskParamsForm 时抛错("'multipliers' of null"/编译报错),
* 进而整套参数区无法渲染、弹窗按钮失效。本测试确保四语言该占位文案不含花括号。
*/
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
const LOCALES = ['zh-CN', 'zh-TW', 'en', 'th'];
describe('admin.schedule.form.dynamicParamsAdvancedPlaceholder', () => {
LOCALES.forEach((locale) => {
it(`${locale} must NOT contain message-compiler braces`, () => {
const text = readFileSync(resolve(__dirname, `../../../../../locales/${locale}/admin.json`), 'utf8');
const line = text
.split('\n')
.find((l) => l.includes('"dynamicParamsAdvancedPlaceholder"'));
expect(line, `missing key for ${locale}`).toBeTruthy();
// vue-i18n 编译器会把 { 视为插值起始,示例 JSON 的花括号会导致渲染抛错
expect(line!.includes('{')).toBe(false);
expect(line!.includes('}')).toBe(false);
});
});
});
@@ -18,6 +18,8 @@ export function createScheduleAdminState() {
const platformJobs = ref<PlatformJobOption[]>([]);
/** 平台任务完整契约(含 params_schema),供 DynamicTaskParamsForm 渲染 */
const platformTaskDefinitions = ref<PlatformTaskDefinition[]>([]);
const platformTaskDefinitionsLoading = ref(false);
const platformTaskDefinitionsError = ref(false);
const showDeleteConfirmDialog = ref(false);
const deleteConfirmTitle = ref('');
@@ -118,6 +120,8 @@ export function createScheduleAdminState() {
kbGroups,
platformJobs,
platformTaskDefinitions,
platformTaskDefinitionsLoading,
platformTaskDefinitionsError,
showDeleteConfirmDialog,
deleteConfirmTitle,
deleteConfirmMessage,
@@ -22,6 +22,7 @@ import {
type ScheduleCreateForm,
} from '../../types/schedule-admin.types';
import { buildScheduleConfigPayload } from '../../utils/schedule-form-payload.utils';
import { normalizePlatformJobKey } from '../../utils/schedule-job-key.utils';
import { useScheduleCronDesigner } from '../useScheduleCronDesigner';
import type { ScheduleAdminState } from './schedule-admin.state';
import type { ScheduleAdminLookups } from './useScheduleAdminLookups';
@@ -63,7 +64,10 @@ export function useScheduleAdminForm(
const selectedPlatformTaskDefinition = computed(() => {
const form = scheduleCreateForm.value;
if (form.schedule_type !== 'platform_job' || !form.platform_api_path) return null;
return platformTaskDefinitions.value.find((d) => d.task_type === form.platform_api_path) || null;
// 后端保存时经 normalize_job_key 归一化;历史数据可能存下划线/完整路径/大小写差异,
// 前端比较也归一化,避免严格 === 失配导致参数表单(含库存源)被静默隐藏。
const normalized = normalizePlatformJobKey(form.platform_api_path);
return platformTaskDefinitions.value.find((d) => normalizePlatformJobKey(d.task_type) === normalized) || null;
});
/**
@@ -71,8 +75,9 @@ export function useScheduleAdminForm(
* 核心逻辑:由 modal select @change 触发(不用 watch,防止编辑回填被覆盖)。
*/
const handlePlatformJobChange = (): void => {
const normalized = normalizePlatformJobKey(scheduleCreateForm.value.platform_api_path);
const definition = platformTaskDefinitions.value.find(
(d) => d.task_type === scheduleCreateForm.value.platform_api_path,
(d) => normalizePlatformJobKey(d.task_type) === normalized,
);
scheduleCreateForm.value.job_params = definition && Object.keys(definition.defaults || {}).length
? { ...definition.defaults }
@@ -237,11 +242,13 @@ export function useScheduleAdminForm(
data_source_type: task.schedule_type === 'data_pipeline'
? ((task.data_source_type || 'database') as ScheduleCreateForm['data_source_type'])
: null,
platform_api_path: task.schedule_type === 'platform_job' ? (task.platform_api_path || null) : null,
platform_api_path: task.schedule_type === 'platform_job'
? (normalizePlatformJobKey(task.platform_api_path) || null)
: null,
// 历史 FAQ 任务兼容:无 job_params 时把旧 dify_agent_id 迁移为 app_id
job_params: task.schedule_type === 'platform_job'
? (task.job_params
|| (task.platform_api_path === 'faq-aggregate-hot' && task.dify_agent_id
|| (normalizePlatformJobKey(task.platform_api_path) === 'faq-aggregate-hot' && task.dify_agent_id
? { app_id: task.dify_agent_id }
: null))
: null,
@@ -1,6 +1,9 @@
/**
* features/admin/modules/schedules/composables/schedule-admin/useScheduleAdminList.ts
* 任务列表加载、概览统计、启停/立即执行/删除与视图切换。
* 等待轮询策略:点「立即执行」后每 RUN_NOW_POLL_MS 刷新记录与列表,直到任务离开 running;
* 同一任务仅保留一个轮询(重复点击先清旧定时器)、上一轮未返回时跳过本轮,
* 并设 RUN_NOW_POLL_MAX_MS 上限,防止任务长时间不终态造成页面无限请求。
*/
import { computed } from 'vue';
import type { ComposerTranslation } from 'vue-i18n';
@@ -15,6 +18,11 @@ import { useMessage } from '@/shared/composables/useMessage';
import type { ScheduleAdminState } from './schedule-admin.state';
import type { ScheduleAdminRuns } from './useScheduleAdminRuns';
/** 立即执行后的等待轮询间隔 */
const RUN_NOW_POLL_MS = 5_000;
/** 等待轮询总上限:与服务端库存导出超时(默认 900s)对齐,超限后停止自动刷新提示手动查询 */
const RUN_NOW_POLL_MAX_MS = 15 * 60_000;
export function useScheduleAdminList(
state: ScheduleAdminState,
runs: Pick<ScheduleAdminRuns, 'viewScheduleRuns'>,
@@ -30,6 +38,11 @@ export function useScheduleAdminList(
openDeleteConfirm,
} = state;
/** 各任务运行中的单实例等待轮询句柄(重复点「立即执行」复用同一句柄) */
const runNowPollTimers = new Map<number, ReturnType<typeof setInterval>>();
/** 正在执行的等待轮询任务(上一轮未返回时跳过 tick,防请求堆叠) */
const runNowPollsInFlight = new Set<number>();
const scheduleEnabledCount = computed(() => schedules.value.filter((item) => item.enabled).length);
const scheduleDisabledCount = computed(() => schedules.value.filter((item) => !item.enabled).length);
const scheduleRunningCount = computed(() => schedules.value.filter((item) => item.last_status === 'running').length);
@@ -77,17 +90,37 @@ export function useScheduleAdminList(
msg.error(err?.message || t('admin.schedule.msg.runNowFailed'));
return;
}
await runs.viewScheduleRuns(taskId);
await runs.viewScheduleRuns(taskId, true);
await loadSchedules();
// 同一任务只保留一个等待轮询:重复点击先停旧定时器,避免多路 interval 并行放大请求频率
const previousPoll = runNowPollTimers.get(taskId);
if (previousPoll) clearInterval(previousPoll);
let elapsedMs = 0;
const pollInterval = setInterval(async () => {
await runs.viewScheduleRuns(taskId);
await loadSchedules();
const target = schedules.value.find((s: ScheduleTask) => s.id === taskId);
if (target && target.last_status && target.last_status !== 'running') {
clearInterval(pollInterval);
// 上一轮尚未返回时跳过本轮;慢后端下每轮耗时可能超过间隔,跳过可避免请求逐轮堆叠
if (runNowPollsInFlight.has(taskId)) return;
runNowPollsInFlight.add(taskId);
try {
await runs.viewScheduleRuns(taskId, true);
await loadSchedules();
elapsedMs += RUN_NOW_POLL_MS;
const target = schedules.value.find((s: ScheduleTask) => s.id === taskId);
const terminal = !!target?.last_status && target.last_status !== 'running';
const timedOut = elapsedMs >= RUN_NOW_POLL_MAX_MS;
if (terminal || timedOut) {
clearInterval(pollInterval);
runNowPollTimers.delete(taskId);
if (timedOut && !terminal) {
msg.warning(t('admin.schedule.msg.runNowWaitTimeout'));
}
}
} finally {
runNowPollsInFlight.delete(taskId);
}
}, 5000);
}, RUN_NOW_POLL_MS);
runNowPollTimers.set(taskId, pollInterval);
};
const setScheduleEnabled = async (taskId: number, enabled: boolean) => {
@@ -8,7 +8,15 @@ import { getKbGroups } from '@/features/kb/api/kb.api';
import type { ScheduleAdminState } from './schedule-admin.state';
export function useScheduleAdminLookups(state: ScheduleAdminState) {
const { agents, users, kbGroups, platformJobs, platformTaskDefinitions } = state;
const {
agents,
users,
kbGroups,
platformJobs,
platformTaskDefinitions,
platformTaskDefinitionsLoading,
platformTaskDefinitionsError,
} = state;
const loadAgents = async (): Promise<void> => {
try {
@@ -55,11 +63,16 @@ export function useScheduleAdminLookups(state: ScheduleAdminState) {
* 核心逻辑:GET /api/admin/platform-tasks/definitions,供 DynamicTaskParamsForm 按 schema 渲染。
*/
const loadPlatformTaskDefinitions = async (): Promise<void> => {
platformTaskDefinitionsLoading.value = true;
platformTaskDefinitionsError.value = false;
try {
platformTaskDefinitions.value = await listAdminPlatformTaskDefinitions();
} catch (e) {
console.error('Failed to load platform task definitions', e);
platformTaskDefinitions.value = [];
platformTaskDefinitionsError.value = true;
} finally {
platformTaskDefinitionsLoading.value = false;
}
};
@@ -1,8 +1,11 @@
/**
* features/admin/modules/schedules/composables/schedule-admin/useScheduleAdminRuns.ts
* 执行批次列表:筛选、列宽、展开详情、Excel 下载与指标派生。
* 执行批次列表:筛选、列宽、展开详情、Excel 下载、指标派生与 RPA Worker 心跳轮询。
* 轮询策略(历史查询与监控职责分离):执行记录列表是纯历史查询,仅切任务/查询/重置时按需加载;
* RPA Worker 在线状态是监控信号,仅在库存排程工作台模式下每 RPA_WORKER_STATUS_POLL_MS 静默轮询一次,
* 后台标签页暂停、请求未返回时跳过(防堆叠),使「在线/离线」徽标及时反映心跳。
*/
import { computed, watch, type Ref } from 'vue';
import { computed, onBeforeUnmount, watch, type Ref } from 'vue';
import type { ComposerTranslation } from 'vue-i18n';
import { listAdminScheduleRuns, adminRunInventoryRawZipUrl, getAdminRpaWorkersStatus } from '@/features/admin/api/schedule.api';
import { useMessage } from '@/shared/composables/useMessage';
@@ -33,6 +36,7 @@ export function useScheduleAdminRuns(
scheduleRunColumnDefs,
resizingScheduleCol,
expandedScheduleRunId,
scheduleViewMode,
} = state;
const syncScheduleRunColumnLabels = () => {
@@ -162,21 +166,63 @@ export function useScheduleAdminRuns(
return latest ? formatDateTime(String(latest)) : '-';
});
const refreshRpaWorkerStatus = async () => {
/**
* 拉取 RPA Worker 心跳状态概览(刷新「在线/离线」徽标与最后心跳时间)。
* @param silent - 静默模式:由后台轮询调用,不翻转 loading,避免徽标每轮闪烁「加载中」
*/
const refreshRpaWorkerStatus = async (silent = false) => {
if (!isInventoryRpaSchedule.value) {
rpaWorkerStatus.value = null;
return;
}
rpaWorkerStatusLoading.value = true;
if (!silent) rpaWorkerStatusLoading.value = true;
try {
rpaWorkerStatus.value = await getAdminRpaWorkersStatus();
} catch {
rpaWorkerStatus.value = null;
} finally {
rpaWorkerStatusLoading.value = false;
if (!silent) rpaWorkerStatusLoading.value = false;
}
};
// ── RPA Worker 心跳轮询(监控信号,仅库存排程) ─────────────────────────
// 心跳由 Worker 每约 20s 上报一次(服务端 TTL 默认 90s),UI 每 10s 刷新即足够;
// 2s 固定轮询只有少量时间点在变化,属于对无变化数据的过度请求。
const RPA_WORKER_STATUS_POLL_MS = 10_000;
/** 是否需要前台轮询心跳:仅工作台模式且当前排程为库存类(该徽标仅在此时可见) */
const shouldPollRpaWorkerStatus = computed(
() => scheduleViewMode.value === 'workbench' && isInventoryRpaSchedule.value && !!selectedScheduleId.value,
);
let rpaStatusPollTimer: ReturnType<typeof setInterval> | null = null;
let rpaStatusPollInFlight = false;
const stopRpaStatusPolling = () => {
if (rpaStatusPollTimer) {
clearInterval(rpaStatusPollTimer);
rpaStatusPollTimer = null;
}
};
const startRpaStatusPolling = () => {
stopRpaStatusPolling();
if (!shouldPollRpaWorkerStatus.value) return;
rpaStatusPollTimer = setInterval(async () => {
// 后台标签页不轮询;上一次请求未返回时跳过本轮,防止请求堆叠与旧响应覆盖
if (document.hidden || rpaStatusPollInFlight) return;
rpaStatusPollInFlight = true;
try {
await refreshRpaWorkerStatus(true);
} finally {
rpaStatusPollInFlight = false;
}
}, RPA_WORKER_STATUS_POLL_MS);
};
watch(shouldPollRpaWorkerStatus, startRpaStatusPolling, { immediate: true });
onBeforeUnmount(stopRpaStatusPolling);
const todayStart = () => {
const d = new Date();
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}T00:00:00`;
@@ -192,7 +238,12 @@ export function useScheduleAdminRuns(
scheduleRunStartedBefore.value = todayEnd();
};
const viewScheduleRuns = async (taskId: number) => {
/**
* 加载指定排程的执行记录并顺带刷新 RPA Worker 心跳状态。
* @param taskId - 排程任务 ID
* @param silentRpaStatusRefresh - 静默刷新心跳(用于「立即执行」等待轮询),不翻转 loading 徽标避免闪烁
*/
const viewScheduleRuns = async (taskId: number, silentRpaStatusRefresh = false) => {
selectedScheduleId.value = taskId;
scheduleRunsLoading.value = true;
if (!scheduleRunStartedAfter.value && !scheduleRunStartedBefore.value) {
@@ -208,7 +259,7 @@ export function useScheduleAdminRuns(
params.started_before = new Date(scheduleRunStartedBefore.value).toISOString();
}
selectedScheduleRuns.value = await listAdminScheduleRuns(taskId, params);
await refreshRpaWorkerStatus();
await refreshRpaWorkerStatus(silentRpaStatusRefresh);
} finally {
scheduleRunsLoading.value = false;
}
@@ -0,0 +1,35 @@
/**
* features/admin/modules/schedules/utils/schedule-job-key.utils.spec.ts
* 验证 normalizePlatformJobKey 与后端 schedule_contract.normalize_job_key 语义一致,
* 确保 selectedPlatformTaskDefinition 对历史非规范 platform_api_path 仍能命中参数契约。
*/
import { describe, expect, it } from 'vitest';
import { normalizePlatformJobKey } from './schedule-job-key.utils';
describe('normalizePlatformJobKey', () => {
it('保留规范化连字符 key', () => {
expect(normalizePlatformJobKey('shipping-inventory-rpa')).toBe('shipping-inventory-rpa');
});
it('下划线转连字符(历史小写别名)', () => {
expect(normalizePlatformJobKey('shipping_inventory_rpa')).toBe('shipping-inventory-rpa');
});
it('大小写不敏感', () => {
expect(normalizePlatformJobKey('Shipping-Inventory-RPA')).toBe('shipping-inventory-rpa');
});
it('取完整内部路径最后一段', () => {
expect(normalizePlatformJobKey('/api/internal/jobs/shipping-inventory-rpa')).toBe('shipping-inventory-rpa');
});
it('去 query / hash / 首尾斜杠', () => {
expect(normalizePlatformJobKey('/faq-aggregate-hot?x=1#frag')).toBe('faq-aggregate-hot');
});
it('空值与 null 返回空串', () => {
expect(normalizePlatformJobKey('')).toBe('');
expect(normalizePlatformJobKey(null)).toBe('');
expect(normalizePlatformJobKey(undefined)).toBe('');
});
});
@@ -0,0 +1,26 @@
/**
* features/admin/modules/schedules/utils/schedule-job-key.utils.ts
* 平台任务 key 归一化,与后端 schedule_contract.normalize_job_key 保持同一语义。
* 逻辑:小写 → 去 query/hash → 去首尾斜杠 → 取路径最后一段 → 下划线转连字符。
* 用途:openScheduleEditModal 读入 platform_api_path 时归一化,使「平台任务」下拉回显与
* selectedPlatformTaskDefinition 的 task_type 精确匹配不受历史非规范存储值影响。
* 后端在保存时已归一化,历史数据仍可能存下划线(shipping_inventory_rpa)、完整内部路径
* (/api/internal/jobs/shipping-inventory-rpa)或大小写差异;前端此前用严格 === 字符串比较,
* 一旦不匹配即静默隐藏参数表单(含库存源),本工具修复该匹配漏洞。
*/
export function normalizePlatformJobKey(value: string | null | undefined): string {
let raw = String(value || '').trim().toLowerCase();
// 取 query 之前
const queryIdx = raw.indexOf('?');
if (queryIdx >= 0) raw = raw.slice(0, queryIdx);
// 取 hash 之前
const hashIdx = raw.indexOf('#');
if (hashIdx >= 0) raw = raw.slice(0, hashIdx);
// 去首尾斜杠
raw = raw.replace(/^\/+|\/+$/g, '');
// 取最后一段路径
const lastSlash = raw.lastIndexOf('/');
if (lastSlash >= 0) raw = raw.slice(lastSlash + 1);
// 下划线转连字符
return raw.replace(/_/g, '-');
}
@@ -126,6 +126,8 @@ export const getWorkspaceShippingTask = (taskNo: string) =>
export const getWorkspaceShippingFreightNoticeGroups = (taskNo: string) =>
requestJson<ShippingFreightNoticeGroupsResponse>(
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/freight-notice-groups`,
// [PERF] Priority Hints:货代上传聚合仅在对应阶段工作面展示,非首屏关键路径。
{ priority: 'low' },
);
/**
@@ -316,7 +318,8 @@ export const getWorkspaceShippingProcessingWorkItem = async (
) => {
const raw = await requestJson<Record<string, unknown>>(
`/api/workspace/shipping-processing/work-items/${encodeURIComponent(workItemType)}/${encodeURIComponent(workItemNo)}`,
{ signal },
// [PERF] Priority Hints:轮询接口让位于首屏关键请求(run/case/task 详情)。
{ signal, priority: 'low' },
);
const normalized = normalizeShippingProcessingProjection(raw);
if (!normalized) {
@@ -752,7 +755,8 @@ export const reparseWorkspaceShippingOrderReviewDocument = (caseNo: string, reas
export const getWorkspaceShippingOrderReviewEvidence = (caseNo: string, signal?: AbortSignal) =>
requestJson<{ case_no: string; items: ShippingOrderReviewEvidence[] }>(
`/api/workspace/shipping-notice/order-review-cases/${encodeURIComponent(caseNo)}/evidence`,
{ signal },
// [PERF] Priority Hints:证据摘要非首屏关键路径,让位于 run/case/task 详情。
{ signal, priority: 'low' },
);
/**
@@ -972,6 +976,8 @@ export const getWorkspaceShippingOrderReviewIntakeParseContext = (caseNo: string
export const getWorkspaceShippingOrderReviewQueue = (runNo: string) =>
requestJson<ShippingOrderReviewQueue>(
`/api/workspace/shipping-notice/order-review-queue/${encodeURIComponent(runNo)}`,
// [PERF] Priority Hints:队列仅驱动导航/阶段摘要,非主编辑区关键路径。
{ priority: 'low' },
);
/** 用户展开状态卡时获取脱敏进度时间线;不返回节点或Workflow诊断数据。 */
@@ -24,9 +24,6 @@ const props = defineProps<{
stageLabelKey?: string | null;
stageInconsistent?: boolean;
hasFormalOt?: boolean;
shippingNoticeNo?: string | null;
userStatus?:
| 'running'
| 'waiting_human'
@@ -73,7 +70,7 @@ const { t, te } = useI18n();
*/
const stageLabel = computed(() => {
if (props.loading) {
return t('chat.shippingOrderReview.caseSwitchLoading');
return t('chat.shippingOrderReview.currentProcessing.stageLoading');
}
if (props.stageInconsistent) {
return t('chat.shippingOrderReview.currentProcessing.stateInconsistent');
@@ -365,16 +362,6 @@ type ReviewCurrentUserStatus =
{{ statusLabel }}
</dd>
</div>
<div
v-if="hasFormalOt && shippingNoticeNo"
class="flex flex-wrap gap-x-2"
>
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentTask.labelFormalSn') }}</dt>
<dd
class="font-mono"
data-testid="review-current-processing-ot"
>{{ shippingNoticeNo }}</dd>
</div>
</dl>
<p
@@ -168,8 +168,11 @@ function drawEvidenceHighlight(
context.strokeStyle = 'rgba(202, 138, 4, 0.95)';
context.setLineDash([]);
} else {
context.fillStyle = 'rgba(244, 63, 94, 0.18)';
context.strokeStyle = 'rgba(225, 29, 72, 0.95)';
// unavailable / invalid 证据高亮统一使用品牌色(对齐编辑画布匹配锚点的 sky/brand 蓝),
// 避免在纯文档预览上出现刺眼的红色,导致「模板预览图标颜色不一致」的观感。
// 说明:质量仅影响可信度提示,不改变「该处确有取值位置」的语义,故不再用警示红。
context.fillStyle = 'rgba(14, 165, 233, 0.22)';
context.strokeStyle = 'rgba(2, 132, 199, 0.95)';
context.setLineDash([3, 3]);
}
context.lineWidth = 2;
@@ -23,6 +23,8 @@ import {
REVIEW_DRAFT_VERSION_MISMATCH,
PROGRESS_POLL_MS,
summarizeDraftConflictDiff,
useShippingOrderReview,
@@ -924,7 +926,7 @@ describe('useShippingOrderReview build eligibility writes', () => {
expect(review.workflowProgressPolling.value).toBe(true);
expect(api.getProcessingWorkItem).toHaveBeenCalled();
await vi.advanceTimersByTimeAsync(2600);
await vi.advanceTimersByTimeAsync(PROGRESS_POLL_MS + 100);
await Promise.resolve();
expect(review.workflowProgressPolling.value).toBe(false);
@@ -971,7 +973,7 @@ describe('useShippingOrderReview build eligibility writes', () => {
const review = useShippingOrderReview();
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1', itemNo: 'WFI-1' });
await review.confirm();
await vi.advanceTimersByTimeAsync(2600);
await vi.advanceTimersByTimeAsync(PROGRESS_POLL_MS + 100);
// 关键断言:活动窗口内同步刷新 Case 与队列,让顶部五阶段读取到后端已推进的通知准备。
expect(api.getCase.mock.calls.length).toBeGreaterThanOrEqual(2);
@@ -1008,13 +1010,13 @@ describe('useShippingOrderReview build eligibility writes', () => {
const review = useShippingOrderReview({ onWorkflowRefresh });
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1', itemNo: 'WFI-1' });
await review.confirm();
await vi.advanceTimersByTimeAsync(2600);
await vi.advanceTimersByTimeAsync(PROGRESS_POLL_MS + 100);
await Promise.resolve();
expect(onWorkflowRefresh).toHaveBeenCalled();
// RPA 可重试失败不是工作流关闭;必须继续读取后续成功回调的 Projection。
expect(review.workflowProgressPolling.value).toBe(true);
await vi.advanceTimersByTimeAsync(2600);
await vi.advanceTimersByTimeAsync(PROGRESS_POLL_MS + 100);
await Promise.resolve();
expect(review.workflowProgressPolling.value).toBe(false);
review.stopWorkflowProgressPolling();
@@ -1118,7 +1120,7 @@ describe('useShippingOrderReview build eligibility writes', () => {
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1', itemNo: 'SWI-1' });
await review.reparseDocument('document_quality');
await vi.advanceTimersByTimeAsync(2600);
await vi.advanceTimersByTimeAsync(PROGRESS_POLL_MS + 100);
await Promise.resolve();
expect(review.reviewRun.value?.run_no).toBe('RUN-2');
@@ -1240,7 +1242,7 @@ describe('useShippingOrderReview build eligibility writes', () => {
await review.reparseDocument('document_quality');
await vi.advanceTimersByTimeAsync(0);
await Promise.resolve();
await vi.advanceTimersByTimeAsync(2600);
await vi.advanceTimersByTimeAsync(PROGRESS_POLL_MS + 100);
await Promise.resolve();
expect(review.reviewRun.value?.run_no).toBe('RUN-1');
@@ -71,6 +71,12 @@ export const REVIEW_DRAFT_VERSION_MISMATCH = 'SHIPPING.REVIEW_DRAFT_VERSION_MISM
/** ?????????? confirm ????? */
export const REVIEW_BUILD_ELIGIBILITY_BLOCKED = 'SHIPPING.REVIEW_BUILD_ELIGIBILITY_BLOCKED';
/**
* 自动推进轮询基础间隔:5 秒。自动化推进通常是分钟级,原 2.5 秒会对
* 单线程/低并发后端造成持续请求排队;页面不可见时轮询另会暂停。
*/
export const PROGRESS_POLL_MS = 5000;
/** ????????????/??????????? Case ??? */
export type DraftVersionConflict = {
localVersion: number;
@@ -394,7 +400,6 @@ export function useShippingOrderReview(options: { onWorkflowRefresh?: () => void
let contextItemNo = '';
let progressPollTimer: ReturnType<typeof window.setInterval> | null = null;
let reparseCaseRefreshTimer: ReturnType<typeof window.setInterval> | null = null;
const PROGRESS_POLL_MS = 2500;
/**
* 应用后端返回的完整 Case 快照。
@@ -435,6 +440,8 @@ export function useShippingOrderReview(options: { onWorkflowRefresh?: () => void
const targetDocumentId = currentStreamDocumentId();
if (!targetRunNo) return;
const tick = async () => {
// 页面不可见时暂停轮询(返回前台后下一拍自动恢复),避免后台标签持续占用服务端。
if (typeof document !== 'undefined' && document.hidden) return;
try {
const run = await getWorkspaceShippingOrderExtractionRun(targetRunNo);
extractionLifecycleProgress.value = run.lifecycle_progress || null;
@@ -520,6 +527,8 @@ export function useShippingOrderReview(options: { onWorkflowRefresh?: () => void
let lastLifecycleFingerprint = '';
const RUN_TERMINAL = new Set(['completed', 'partially_completed', 'failed', 'cancelled']);
const tick = async () => {
// 页面不可见时暂停轮询(返回前台后下一拍自动恢复),避免后台标签持续占用服务端。
if (typeof document !== 'undefined' && document.hidden) return;
try {
if (authoritativeOrderTaskNo.value) {
await refreshShippingProcessing();
@@ -828,7 +828,10 @@ export interface ShippingTaskSummary {
business_no?: string | null;
/** 通知单列表只读行摘要;库存数据由后端当前匹配事实投影,前端不得自行计算。 */
notice_line_summary?: Array<{
/** 项次展示值;来源由 line_no_source 标注,前端不得按行号自行回退。 */
line_no?: string | number | null;
/** 项次来源:field=冻结字段,customer_po_line_no=客户 PO 行号,sequence=系统行序。 */
line_no_source?: 'field' | 'customer_po_line_no' | 'sequence' | string | null;
part_number?: string | null;
customer_part_number?: string | null;
reservation_id?: string | null;
@@ -1483,6 +1486,10 @@ export interface ShippingTaskUiState {
/** 冻结订单行始终可读;不依赖库存文件或匹配结果。 */
frozen_order_lines?: Array<{
line_key?: string | null;
/** 项次展示值;来源由 line_no_source 标注。 */
line_no?: string | number | null;
/** 项次来源:field=冻结字段,customer_po_line_no=客户 PO 行号,sequence=系统行序。 */
line_no_source?: 'field' | 'customer_po_line_no' | 'sequence' | string | null;
reservation_id?: string | null;
part_number?: string | null;
required_qty?: string | number | null;
@@ -1500,6 +1507,10 @@ export interface ShippingTaskUiState {
has_match_result?: boolean;
lines?: Array<{
line_key?: string | null;
/** 项次展示值;来源由 line_no_source 标注。 */
line_no?: string | number | null;
/** 项次来源:field=冻结字段,customer_po_line_no=客户 PO 行号,sequence=系统行序。 */
line_no_source?: 'field' | 'customer_po_line_no' | 'sequence' | string | null;
reservation_id?: string | null;
part_number?: string | null;
required_qty?: string | number | null;
@@ -1622,7 +1633,10 @@ export interface ShippingFreightNoticeGroup {
export_file_name?: string | null;
available_actions?: string[];
lines: Array<{
/** 项次展示值;来源由 line_no_source 标注,前端不得按行号自行回退。 */
line_no?: string | number | null;
/** 项次来源:field=冻结字段,customer_po_line_no=客户 PO 行号,sequence=系统行序。 */
line_no_source?: 'field' | 'customer_po_line_no' | 'sequence' | string | null;
part_number?: string | null;
reservation_id?: string | null;
shipment_qty?: string | number | null;
@@ -2632,16 +2632,27 @@ describe('ShippingOrderReviewView layout phase 1', () => {
summary: {}, steps: [],
},
} as any);
// 完成面改版后按「已上传通知聚合」消费同一份 freight groups;仅 uploaded 通知进入完成面。
vi.mocked(taskApi.getWorkspaceShippingFreightNoticeGroups).mockResolvedValue({
po_number: 'PO-100',
items: [
{ business_no: 'WYC26082401', po_number: 'PO-100', upload_status: 'uploaded', export_file_name: 'WYC26082401.xlsx', lines: [
{ line_no: '00010', part_number: 'PART-A', reservation_id: 'RSV-A', qty: '2' },
] },
{ business_no: 'WYC26082402', po_number: 'PO-100', upload_status: 'pending', export_file_name: 'WYC26082402.xlsx', lines: [] },
],
} as any);
const wrapper = await mountView({ lifecycle_stage: 'upload_complete' });
await flushPromises();
const evidence = wrapper.get('[data-testid="review-lifecycle-upload-complete"]');
expect(evidence.text()).toContain('succeeded');
expect(evidence.text()).not.toContain('LATEST-FAILED');
// 只展示已上传通知(uploaded),未上传(pending)不进入完成面。
expect(evidence.text()).toContain('WYC26082401');
expect(evidence.text()).not.toContain('WYC26082402');
// 人工确认不再展示或依赖货代回执号,即使历史投影仍带有 freight_ref_no。
expect(evidence.text()).not.toContain('LEGACY-REF-MUST-NOT-BE-SHOWN');
expect(evidence.text()).not.toContain('failed');
expect(evidence.text()).not.toContain('LATEST-FAILED');
expect(wrapper.find('[data-testid="review-current-task-primary-action"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(false);
});
@@ -2894,7 +2905,8 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
expect(wrapper.find('[data-testid="review-confirm-outcome"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="retry-auto-progress-after-confirm"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="review-current-processing-ot"]').text()).toContain('SN-RECOVER-1');
// 发货通知单号与订单明细行绑定,不在任务级整单显示;当前任务卡不展示单条通知单号。
expect(wrapper.find('[data-testid="review-current-processing-ot"]').exists()).toBe(false);
}, 15000);
it('does not submit an action before the formal OT Gate projection arrives (UI-01)', async () => {
@@ -3168,7 +3180,8 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
await flushPromises();
expect(wrapper.find('[data-testid="review-confirm-create"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="review-current-processing-retry"]').exists()).toBe(false);
expect(wrapper.find('[data-testid="review-current-processing-ot"]').text()).toContain('SN-CONFIRM-PROGRESS-FAIL');
// 发货通知单号随订单明细绑定,不在任务级整单展示;当前任务卡不含单条通知单号。
expect(wrapper.find('[data-testid="review-current-processing-ot"]').exists()).toBe(false);
}, 15000);
});
@@ -16,7 +16,7 @@
<script setup lang="ts">
import { computed, defineAsyncComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Bot, Check, Crosshair, Download, MoreHorizontal, Plus, RefreshCw, Undo2, Copy, Trash2 } from 'lucide-vue-next';
import { Bot, Check, ChevronDown, Crosshair, Download, MoreHorizontal, Plus, RefreshCw, Undo2, Copy, Trash2 } from 'lucide-vue-next';
import { useI18n } from 'vue-i18n';
import { BusinessError } from '@/shared/api/client';
import { useMessage } from '@/shared/composables/useMessage';
@@ -2107,14 +2107,39 @@ const freightNoticeGroups = ref<ShippingFreightNoticeGroup[]>([]);
const freightNoticeGroupsLoading = ref(false);
const freightNoticeGroupsReason = ref<string | null>(null);
const freightNoticeGroupsLoadFailed = ref(false);
/** 右栏业务主身份必须是 business_no;技术 OT 仅用于内部追踪。 */
const currentShippingBusinessNo = computed(() => (
String(formalTaskDetail.value?.business_no || '').trim()
|| String(shippingProcessingProjection.value?.shippingNoticeNo || '').trim()
|| null
));
const selectedFreightBusinessNos = ref<string[]>([]);
const freightBatchBusy = ref<'download' | 'confirm' | 'rpa' | 'regenerate' | null>(null);
/**
* 通知完成面的只读聚合:同 PO 中已有上传成功证据(upload_status=uploaded)的发货通知。
* 核心逻辑:与货代上传面消费同一份 freightNoticeGroups,仅按终态过滤;未上传的
* 通知仍留在货代上传面处理,完成面不出现混淆态。
*/
const uploadedFreightNoticeGroups = computed(() =>
freightNoticeGroups.value.filter((item) =>
String(item.upload_status || '').trim().toLowerCase() === 'uploaded',
),
);
/** 批次留底下载:把已完成通知全部打包为 ZIP(复用后端 /shipping-notices/batch/export)。 */
const uploadingBatchArchive = ref(false);
async function downloadCompletedBatchArchive() {
const businessNos = uploadedFreightNoticeGroups.value
.map((item) => String(item.business_no || '').trim())
.filter(Boolean);
if (!businessNos.length || uploadingBatchArchive.value) return;
uploadingBatchArchive.value = true;
try {
await downloadWorkspaceShippingNoticeExportArchive(businessNos);
} catch (error) {
msg.warning(error instanceof Error ? error.message : t('chat.shippingOrderReview.workbench.resultNotReady'));
} finally {
uploadingBatchArchive.value = false;
}
}
/** 通知完成面的展开明细:同一时刻只展开一张通知(与货代上传面交互一致)。 */
const expandedCompletedNoticeNo = ref<string | null>(null);
function toggleCompletedNoticeLine(businessNo: string) {
expandedCompletedNoticeNo.value = expandedCompletedNoticeNo.value === businessNo ? null : businessNo;
}
const formalTaskDetailLoading = ref(false);
const formalTaskDetailLoadFailed = ref(false);
/**
@@ -2407,6 +2432,11 @@ async function runFreightBatchAction(action: 'download' | 'confirm' | 'rpa') {
} else {
await batchStartWorkspaceShippingNoticeRpaUpload(selectedFreightBusinessNos.value);
}
// 确认/RPA 后重拉同 PO 通知聚合,使通知完成面能立即呈现最新 uploaded 状态。
if (action === 'confirm' || action === 'rpa') {
const taskNo = String(confirmedNoticeTaskNo.value || '').trim();
if (taskNo) await loadFreightNoticeGroups(taskNo);
}
await Promise.all([loadFormalTaskDetail(), refreshShippingProcessing()]);
} catch (error) {
msg.warning(error instanceof Error ? error.message : t('chat.shippingOrderReview.workbench.resultNotReady'));
@@ -2438,6 +2468,9 @@ async function runFreightNoticeAction(
await submitFormalGateAction('regenerate_excel_artifact');
return;
}
// 确认/RPA 后重拉同 PO 通知聚合,使通知完成面能立即呈现最新 uploaded 状态。
const taskNo = String(confirmedNoticeTaskNo.value || '').trim();
if (taskNo) await loadFreightNoticeGroups(taskNo);
await Promise.all([loadFormalTaskDetail(), refreshShippingProcessing()]);
} catch (error) {
msg.warning(error instanceof Error ? error.message : t('chat.shippingOrderReview.workbench.resultNotReady'));
@@ -2461,13 +2494,14 @@ function canRunFreightNoticeAction(group: ShippingFreightNoticeGroup, actionCode
}
watch(
[confirmedNoticeTaskNo, workbenchMode, hasCreatedShippingTask, isLifecycleFreightUpload],
([taskNo, mode, created, isFreightUpload]) => {
[confirmedNoticeTaskNo, workbenchMode, hasCreatedShippingTask, isLifecycleFreightUpload, isLifecycleUploadComplete],
([taskNo, mode, created, isFreightUpload, isUploadComplete]) => {
const completed = String(displayCase.value?.current_stage?.code || '').trim().toLowerCase() === 'completed'
|| String(displayCase.value?.user_status || '').trim().toLowerCase() === 'completed';
// Notice 聚合只服务货代上传工作面;通知准备/文件切换不能为此扫描同 PO 全部 Notice。
if (taskNo && created && isFreightUpload) void loadFreightNoticeGroups(taskNo);
if (!isFreightUpload) {
// Notice 聚合服务货代上传与通知完成两个工作面;通知准备/文件切换不扫描同 PO 全部 Notice。
const needsNoticeGroups = isFreightUpload || isUploadComplete;
if (taskNo && created && needsNoticeGroups) void loadFreightNoticeGroups(taskNo);
if (!needsNoticeGroups) {
freightNoticeGroups.value = [];
selectedFreightBusinessNos.value = [];
}
@@ -2603,6 +2637,37 @@ function preparationLineCustomerPoLine(line: { line_key?: string | null; custome
return draftValueText || String(line.customer_po_line_no || '').trim() || '—';
}
/**
* 通知行项次展示:按后端 line_no_source 区分渲染。
* 核心逻辑:field=冻结字段真实值(普通展示);customer_po_line_no=客户 PO 行号(普通展示,
* 附带来源提示);sequence=系统行序(弱化样式 + 来源提示);缺失直接显示 —。
* 禁止前端按 position/序号自行推导业务项次。
*/
function freightLineNoDisplay(line: { line_no?: string | number | null; line_no_source?: string | null }): {
text: string;
muted: boolean;
title: string;
} {
const value = line.line_no ?? null;
if (value === null || value === '') return { text: '—', muted: false, title: '' };
const source = String(line.line_no_source || '').trim();
if (source === 'sequence') {
return {
text: String(value),
muted: true,
title: t('chat.shippingOrderReview.lifecycle.freightUpload.lineNoSourceSequence'),
};
}
if (source === 'customer_po_line_no') {
return {
text: String(value),
muted: false,
title: t('chat.shippingOrderReview.lifecycle.freightUpload.lineNoSourceCustomerPo'),
};
}
return { text: String(value), muted: false, title: '' };
}
async function confirmPreparationWave() {
const caseNo = String(activeCase.value?.case_no || '').trim();
const draftVersion = activeCase.value?.draft?.draft_version;
@@ -4068,7 +4133,7 @@ watch(
</details>
</div>
</div>
<table class="min-w-full text-left text-xs"><thead class="border-b border-default bg-surface-muted/30"><tr><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.lineNo') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.requiredQty') }}</th></tr></thead><tbody><tr v-for="line in group.lines" :key="`${group.business_no}-${line.line_no}-${line.part_number}`" class="border-b border-default last:border-0" data-testid="review-freight-upload-line"><td class="px-3 py-2">{{ line.line_no || '—' }}</td><td class="px-3 py-2">{{ line.part_number || '—' }}</td><td class="px-3 py-2">{{ line.reservation_id || '—' }}</td><td class="px-3 py-2">{{ line.shipment_qty || '—' }}</td></tr></tbody></table>
<table class="min-w-full text-left text-xs"><thead class="border-b border-default bg-surface-muted/30"><tr><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.lineNo') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.requiredQty') }}</th></tr></thead><tbody><tr v-for="line in group.lines" :key="`${group.business_no}-${line.line_no}-${line.part_number}`" class="border-b border-default last:border-0" data-testid="review-freight-upload-line"><td class="px-3 py-2"><span :class="freightLineNoDisplay(line).muted ? 'text-muted' : ''" :title="freightLineNoDisplay(line).title">{{ freightLineNoDisplay(line).text }}</span></td><td class="px-3 py-2">{{ line.part_number || '—' }}</td><td class="px-3 py-2">{{ line.reservation_id || '—' }}</td><td class="px-3 py-2">{{ line.shipment_qty || '—' }}</td></tr></tbody></table>
</div>
</div>
<p v-else class="mt-3 rounded-lg border border-default bg-surface-muted/50 p-3 text-xs text-secondary">{{ freightNoticeGroupsReason === 'po_missing' ? t('chat.shippingOrderReview.lifecycle.freightUpload.poMissing') : t('chat.shippingOrderReview.lifecycle.freightUpload.empty') }}</p>
@@ -4081,9 +4146,88 @@ watch(
>
<h2 class="text-sm font-semibold text-primary">{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.title') }}</h2>
<p class="mt-1 text-xs text-secondary">{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.subtitle') }}</p>
<div class="mt-3 rounded-lg border border-emerald-200 bg-surface/70 p-3 text-xs text-secondary dark:border-emerald-900">
<p v-if="formalTaskDetail.ui_state?.stage_context?.upload?.succeeded_attempt" class="mt-1">{{ t('chat.shippingOrderReview.lifecycle.upload.attempt', { status: formalTaskDetail.ui_state.stage_context.upload.succeeded_attempt.status || '-', mode: formalTaskDetail.ui_state.stage_context.upload.succeeded_attempt.mode || '-' }) }}</p>
<!-- 聚合头:本批已上传数量 + 留底下载(ZIP 打包全部已完成通知) -->
<div class="mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg border border-emerald-200 bg-surface px-3 py-2 text-xs dark:border-emerald-900" data-testid="review-upload-complete-toolbar">
<span class="font-medium text-emerald-900 dark:text-emerald-100">{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.batchCount', { count: uploadedFreightNoticeGroups.length }) }}</span>
<button
type="button"
class="rounded border border-emerald-300 px-2 py-1 font-medium text-emerald-700 hover:bg-emerald-50 disabled:opacity-50 dark:border-emerald-700 dark:text-emerald-200 dark:hover:bg-emerald-950/40"
:disabled="!uploadedFreightNoticeGroups.length || uploadingBatchArchive"
data-testid="review-upload-complete-batch-download"
@click="void downloadCompletedBatchArchive()"
>
{{ uploadingBatchArchive
? t('chat.shippingOrderReview.lifecycle.uploadComplete.batchDownloading')
: t('chat.shippingOrderReview.lifecycle.uploadComplete.batchDownload') }}
</button>
</div>
<div v-if="uploadedFreightNoticeGroups.length" class="mt-3 space-y-3" data-testid="review-upload-complete-groups">
<div
v-for="group in uploadedFreightNoticeGroups"
:key="group.business_no"
class="rounded-lg border border-emerald-200 bg-surface/70 dark:border-emerald-900"
data-testid="review-upload-complete-notice"
>
<!-- 单据行:identity + 状态 + 单张下载 + 展开明细 -->
<div class="flex flex-wrap items-center justify-between gap-3 border-b border-emerald-200/70 px-3 py-2 text-xs dark:border-emerald-900/70">
<div class="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1">
<span class="font-semibold text-primary">{{ group.business_no }}</span>
<span class="inline-flex items-center gap-1 font-medium text-emerald-700 dark:text-emerald-300">
<Check class="h-3.5 w-3.5" aria-hidden="true" />
{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.uploaded') }}
</span>
<span class="text-secondary">{{ group.po_number ? `PO: ${group.po_number}` : '' }}</span>
</div>
<div class="flex items-center gap-2">
<button
type="button"
class="rounded border border-emerald-300 px-2 py-1 font-medium text-emerald-700 hover:bg-emerald-50 dark:border-emerald-700 dark:text-emerald-200 dark:hover:bg-emerald-950/40"
data-testid="review-upload-complete-download"
@click="void downloadFreightNotice(group.business_no)"
>{{ t('chat.shippingOrderReview.lifecycle.freightUpload.download') }}</button>
<button
type="button"
class="inline-flex items-center gap-1 rounded border border-default px-2 py-1 font-medium text-primary hover:bg-surface disabled:opacity-50"
:aria-expanded="expandedCompletedNoticeNo === group.business_no"
:aria-label="expandedCompletedNoticeNo === group.business_no
? t('chat.shippingOrderReview.lifecycle.uploadComplete.collapse')
: t('chat.shippingOrderReview.lifecycle.uploadComplete.expand')"
data-testid="review-upload-complete-toggle-lines"
@click="toggleCompletedNoticeLine(group.business_no)"
>
{{ expandedCompletedNoticeNo === group.business_no
? t('chat.shippingOrderReview.lifecycle.uploadComplete.collapse')
: t('chat.shippingOrderReview.lifecycle.uploadComplete.expand') }}
<ChevronDown class="h-3.5 w-3.5 transition-transform" :class="{ 'rotate-180': expandedCompletedNoticeNo === group.business_no }" aria-hidden="true" />
</button>
</div>
</div>
<div v-if="expandedCompletedNoticeNo === group.business_no" class="space-y-2 px-3 pb-3 pt-2 text-xs" data-testid="review-upload-complete-lines">
<p v-if="group.export_file_name" class="text-secondary">{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.exportFile', { file: group.export_file_name }) }}</p>
<table class="min-w-full text-left">
<thead class="border-b border-default bg-surface-muted/30">
<tr>
<th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.lineNo') }}</th>
<th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th>
<th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th>
<th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.requiredQty') }}</th>
</tr>
</thead>
<tbody>
<tr v-for="line in group.lines" :key="`${group.business_no}-${line.line_no}-${line.part_number}`" class="border-b border-default last:border-0" data-testid="review-upload-complete-line">
<td class="px-3 py-2"><span :class="freightLineNoDisplay(line).muted ? 'text-muted' : ''" :title="freightLineNoDisplay(line).title">{{ freightLineNoDisplay(line).text }}</span></td>
<td class="px-3 py-2">{{ line.part_number || '—' }}</td>
<td class="px-3 py-2">{{ line.reservation_id || '—' }}</td>
<td class="px-3 py-2">{{ line.shipment_qty ?? '—' }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p v-else class="mt-3 rounded-lg border border-emerald-200 bg-surface/70 p-3 text-xs text-secondary dark:border-emerald-900">{{ t('chat.shippingOrderReview.lifecycle.uploadComplete.empty') }}</p>
</section>
<ReviewIntakeParsePanel
@@ -4514,8 +4658,6 @@ watch(
:task-no="displayCase?.confirmed_task_no || displayCase?.post_confirm_auto_progress?.task_no"
:confirmed-task-id="displayCase?.confirmed_task_id"
:show-admin-diagnosis="showAdminTaskMissingDiagnosis"
:has-formal-ot="shippingProcessingProjection?.hasFormalOt ?? hasFormalOt"
:shipping-notice-no="currentShippingBusinessNo"
:user-status="currentTaskUserStatus"
:retryable="visibleCurrentTaskRetryable"
:blocking-reason="currentTaskBlockingReason"
+6 -2
View File
@@ -2253,9 +2253,12 @@
"shippingInventorySourcesHelp": "Select the inventory sources to run; options come from the source config. Empty means all.",
"dynamicParamsSelectPlaceholder": "Please select",
"dynamicParamsOptionsLoading": "Loading options...",
"dynamicParamsLoading": "Loading platform task parameters…",
"dynamicParamsLoadFailed": "Failed to load platform task parameters. Please retry.",
"dynamicParamsRetry": "Reload",
"dynamicParamsNoOptions": "No options available",
"dynamicParamsAdvanced": "Advanced config (JSON, optional)",
"dynamicParamsAdvancedPlaceholder": "{\"timeout_seconds\": 300}",
"dynamicParamsAdvancedPlaceholder": "Optional: paste advanced JSON object params, e.g. add a timeout_seconds key",
"dynamicParamsAdvancedInvalid": "Advanced config JSON is invalid; fix it before it can be saved.",
"dynamicParamsJsonInvalid": "JSON is invalid; fix it before it can be saved.",
"dynamicParamsInvalid": "Fix invalid task parameters before saving.",
@@ -2438,6 +2441,7 @@
"headerLabelsJsonInvalid": "header_labels JSON format is invalid.",
"apiHeadersJsonInvalid": "API Headers JSON format is invalid.",
"runNowFailed": "Manual run failed",
"runNowWaitTimeout": "Timed out waiting for the run to finish (about 15 min); auto refresh stopped, query records manually",
"downloadExcelFailed": "Failed to download Excel",
"downloadInventoryRawZipFailed": "Failed to download raw inventory ZIP",
"deleteFailed": "Delete schedule failed"
@@ -3504,7 +3508,7 @@
"confirmReview": "Confirm review and add",
"correctionInvalid": "A line correction must be a JSON field object.",
"expectedRows": "Human truth (JSON array)",
"expectedRowsPlaceholder": "[{\"customer_po_line_no\": \"00010\", \"part_number\": \"PN-1\", \"qty\": \"3\"}]",
"expectedRowsPlaceholder": "Example line: customer_po_line_no=00010, part_number=PN-1, qty=3",
"expectedRowsHint": "Enter at least one human-confirmed line truth; do not copy the candidate output.",
"expectedRowsInvalid": "Truth must be a JSON array containing at least one non-empty line object.",
"expectedOrderFields": "Order field truth (JSON object)",
+3 -2
View File
@@ -1485,8 +1485,8 @@
"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": {"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", "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"},
"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", "selected": "{count} notices selected", "batchDownload": "Download selected", "batchRpa": "Batch RPA upload", "batchConfirm": "Confirm selected uploaded"},
"uploadComplete": {"title": "Notification completion", "subtitle": "Upload-success evidence is verified. This view is read only."},
"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"},
"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",
@@ -2218,6 +2218,7 @@
"adminDiagnosisStatus": "Status: task_missing",
"adminDiagnosisHint": "Use task audit / data repair. This page does not auto-recover.",
"stateInconsistent": "State syncing / inconsistent state data",
"stageLoading": "Updating status…",
"statusRunning": "System processing",
"statusFailedRetryable": "Failed — retry available",
"statusCompleted": "Completed",
+6 -2
View File
@@ -2149,9 +2149,12 @@
"shippingInventorySourcesHelp": "เลือกแหล่งสต็อกที่ต้องการรัน; ตัวเลือกมาจากการตั้งค่าแหล่งสต็อก เว้นว่าง = ทั้งหมด",
"dynamicParamsSelectPlaceholder": "กรุณาเลือก",
"dynamicParamsOptionsLoading": "กำลังโหลดตัวเลือก...",
"dynamicParamsLoading": "กำลังโหลดพารามิเตอร์งานแพลตฟอร์ม…",
"dynamicParamsLoadFailed": "โหลดพารามิเตอร์งานแพลตฟอร์มไม่สำเร็จ โปรดลองอีกครั้ง",
"dynamicParamsRetry": "โหลดใหม่",
"dynamicParamsNoOptions": "ไม่มีตัวเลือก",
"dynamicParamsAdvanced": "การตั้งค่าขั้นสูง (JSON, ไม่บังคับ)",
"dynamicParamsAdvancedPlaceholder": "{\"timeout_seconds\": 300}",
"dynamicParamsAdvancedPlaceholder": "ไม่บังคับ: วางพารามิเตอร์ JSON ขั้นสูง เช่น เพิ่มคีย์ timeout_seconds",
"dynamicParamsAdvancedInvalid": "รูปแบบ JSON ของการตั้งค่าขั้นสูงไม่ถูกต้อง จะไม่ถูกบันทึกจนกว่าจะแก้ไข",
"dynamicParamsJsonInvalid": "รูปแบบ JSON ไม่ถูกต้อง จะไม่ถูกบันทึกจนกว่าจะแก้ไข",
"dynamicParamsInvalid": "โปรดแก้ไขพารามิเตอร์งานที่ผิดพลาดก่อนบันทึก",
@@ -2307,6 +2310,7 @@
"headerLabelsJsonInvalid": "รูปแบบ JSON ของ header_labels ไม่ถูกต้อง",
"apiHeadersJsonInvalid": "รูปแบบ JSON ของ API Headers ไม่ถูกต้อง",
"runNowFailed": "การรันด้วยตนเองล้มเหลว",
"runNowWaitTimeout": "รอการรันเสร็จสิ้นเกินเวลาที่กำหนด (ประมาณ 15 นาที) หยุดรีเฟรชอัตโนมัติแล้ว โปรดค้นหาบันทึกด้วยตนเอง",
"downloadExcelFailed": "ดาวน์โหลด Excel ล้มเหลว",
"downloadInventoryRawZipFailed": "ดาวน์โหลด ZIP สต็อกดิบล้มเหลว",
"deleteFailed": "ลบตารางเวลาล้มเหลว"
@@ -3373,7 +3377,7 @@
"confirmReview": "ยืนยันการตรวจทานและเพิ่ม",
"correctionInvalid": "ค่าที่แก้ไขของรายการต้องเป็นออบเจ็กต์ฟิลด์ JSON",
"expectedRows": "ข้อมูลจริงที่ยืนยันโดยคน (อาร์เรย์ JSON)",
"expectedRowsPlaceholder": "[{\"customer_po_line_no\": \"00010\", \"part_number\": \"PN-1\", \"qty\": \"3\"}]",
"expectedRowsPlaceholder": "ตัวอย่าง: customer_po_line_no=00010, part_number=PN-1, qty=3 หนึ่งรายการ",
"expectedRowsHint": "กรอกข้อมูลจริงของรายการที่มนุษย์ยืนยันอย่างน้อยหนึ่งรายการ ห้ามคัดลอกผลลัพธ์ตัวเลือก.",
"expectedRowsInvalid": "ข้อมูลจริงต้องเป็นอาร์เรย์ JSON ที่มีอ็อบเจ็กต์รายการที่ไม่ว่างอย่างน้อยหนึ่งรายการ.",
"expectedOrderFields": "ข้อมูลจริงของฟิลด์คำสั่งซื้อ (ออบเจ็กต์ JSON)",
+3 -2
View File
@@ -1485,8 +1485,8 @@
"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": {"title": "เตรียมการแจ้ง", "subtitle": "จัดการตัวเลือกสต็อก ปัญหาการจับคู่ และการสร้างไฟล์แจ้งงานที่นี่", "frozenOrder": "คำสั่งซื้อที่ตรึงแล้ว", "inventorySource": "แหล่งสต็อก", "excel": "Excel การจัดส่ง", "downloadInventory": "ดาวน์โหลดไฟล์สินค้าคงคลัง", "retryInventory": "ดึงข้อมูลสต็อกอีกครั้ง", "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": "โหลดอีกครั้ง"},
"freightUpload": {"title": "อัปโหลดให้ผู้ให้บริการขนส่ง", "subtitle": "จัดกลุ่มตามใบแจ้งส่งสินค้า; แต่ละใบแจ้งส่งสินค้ามี Excel หนึ่งไฟล์", "loading": "กำลังโหลดใบแจ้งส่งสินค้า…", "loadFailed": "โหลดใบแจ้งส่งสินค้าไม่สำเร็จ โปรดลองรีเฟรช", "poMissing": "งานปัจจุบันยังไม่พบ PO จึงยังจัดกลุ่มใบแจ้งส่งสินค้าไม่ได้", "empty": "ไม่มีใบแจ้งส่งสินค้าที่อัปโหลดได้สำหรับ PO นี้", "download": "ดาวน์โหลด Excel", "lineNo": "รายการ", "selected": "เลือกแล้ว {count} ใบแจ้งส่งสินค้า", "batchDownload": "ดาวน์โหลดที่เลือก", "batchRpa": "อัปโหลด RPA แบบกลุ่ม", "batchConfirm": "ยืนยันว่าอัปโหลดแล้ว"},
"uploadComplete": {"title": "แจ้งเสร็จสิ้น", "subtitle": "ยืนยันหลักฐานความสำเร็จของการอัปโหลดแล้ว หน้านี้อ่านได้อย่างเดียว"},
"freightUpload": {"title": "อัปโหลดให้ผู้ให้บริการขนส่ง", "subtitle": "จัดกลุ่มตามใบแจ้งส่งสินค้า; แต่ละใบแจ้งส่งสินค้ามี Excel หนึ่งไฟล์", "loading": "กำลังโหลดใบแจ้งส่งสินค้า…", "loadFailed": "โหลดใบแจ้งส่งสินค้าไม่สำเร็จ โปรดลองรีเฟรช", "poMissing": "งานปัจจุบันยังไม่พบ PO จึงยังจัดกลุ่มใบแจ้งส่งสินค้าไม่ได้", "empty": "ไม่มีใบแจ้งส่งสินค้าที่อัปโหลดได้สำหรับ PO นี้", "download": "ดาวน์โหลด Excel", "lineNo": "รายการ", "lineNoSourceCustomerPo": "เลขบรรทัด PO ของลูกค้า", "lineNoSourceSequence": "ลำดับระบบ (ไม่พบเลขรายการภายใน)", "selected": "เลือกแล้ว {count} ใบแจ้งส่งสินค้า", "batchDownload": "ดาวน์โหลดที่เลือก", "batchRpa": "อัปโหลด RPA แบบกลุ่ม", "batchConfirm": "ยืนยันว่าอัปโหลดแล้ว"},
"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": "รับและแยกวิเคราะห์",
@@ -2218,6 +2218,7 @@
"adminDiagnosisStatus": "สถานะ: task_missing",
"adminDiagnosisHint": "ใช้การตรวจสอบงาน/ซ่อมข้อมูล ไม่กู้คืนอัตโนมัติในหน้านี้",
"stateInconsistent": "กำลังซิงก์สถานะ / ข้อมูลไม่สอดคล้อง",
"stageLoading": "กำลังอัปเดตสถานะ…",
"statusRunning": "ระบบกำลังประมวลผล",
"statusFailedRetryable": "ล้มเหลว — ลองใหม่ได้",
"statusCompleted": "เสร็จสิ้น",
+6 -2
View File
@@ -2364,9 +2364,12 @@
"shippingInventorySourcesHelp": "选择需要执行的库存源;选项来自库存源配置,留空则全部执行。",
"dynamicParamsSelectPlaceholder": "请选择",
"dynamicParamsOptionsLoading": "选项加载中...",
"dynamicParamsLoading": "正在加载平台任务参数…",
"dynamicParamsLoadFailed": "平台任务参数加载失败,请重试",
"dynamicParamsRetry": "重新加载",
"dynamicParamsNoOptions": "暂无可选项",
"dynamicParamsAdvanced": "高级配置(JSON,可选)",
"dynamicParamsAdvancedPlaceholder": "{\"timeout_seconds\": 300}",
"dynamicParamsAdvancedPlaceholder": "可选:粘贴高级 JSON 对象参数,例如添加 timeout_seconds 等键值对",
"dynamicParamsAdvancedInvalid": "高级配置 JSON 格式错误,修正后才会保存",
"dynamicParamsJsonInvalid": "JSON 格式错误,修正后才会保存",
"dynamicParamsInvalid": "请修正任务参数中的错误后再保存",
@@ -2549,6 +2552,7 @@
"headerLabelsJsonInvalid": "header_labels JSON 格式错误,请检查",
"apiHeadersJsonInvalid": "API Headers JSON 格式错误,请检查",
"runNowFailed": "手动执行失败",
"runNowWaitTimeout": "等待执行完成超时(约 15 分钟),已停止自动刷新,可手动查询记录",
"downloadExcelFailed": "下载 Excel 失败",
"downloadInventoryRawZipFailed": "下载原始库存包失败",
"deleteFailed": "删除排程失败"
@@ -3615,7 +3619,7 @@
"confirmReview": "确认复核并加入盲测",
"correctionInvalid": "明细更正值必须是 JSON 字段对象。",
"expectedRows": "人工真值(JSON 数组)",
"expectedRowsPlaceholder": "[{\"customer_po_line_no\": \"00010\", \"part_number\": \"PN-1\", \"qty\": \"3\"}]",
"expectedRowsPlaceholder": "示例:customer_po_line_no 为 00010、part_number 为 PN-1、qty 为 3 的一条明细",
"expectedRowsHint": "请输入至少一条人工确认的明细真值;不能复制候选结果。",
"expectedRowsInvalid": "真值必须是至少包含一条非空明细对象的 JSON 数组。",
"expectedOrderFields": "订单字段真值(JSON 对象)",
+3 -2
View File
@@ -1592,8 +1592,8 @@
"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": {"title": "通知准备", "subtitle": "库存候选、匹配异常和通知文件生成均在此阶段处理。", "frozenOrder": "冻结订单", "inventorySource": "库存源", "excel": "通知 Excel", "downloadInventory": "下载库存文件", "retryInventory": "重新获取库存", "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": "重新加载"},
"freightUpload": {"title": "货代上传", "subtitle": "按发货通知单聚合展示;每张发货通知单对应一张 Excel。", "loading": "正在加载发货通知…", "loadFailed": "发货通知加载失败,请刷新后重试。", "poMissing": "当前任务尚未识别到 PO,暂时无法聚合发货通知。", "empty": "当前 PO 暂无可上传的发货通知。", "download": "下载 Excel", "lineNo": "项次", "selected": "已选 {count} 个发货通知", "batchDownload": "批量下载", "batchRpa": "批量 RPA 上传", "batchConfirm": "批量确认已上传"},
"uploadComplete": {"title": "通知完成", "subtitle": "上传成功证据已核验,以下内容仅供查看。"},
"freightUpload": {"title": "货代上传", "subtitle": "按发货通知单聚合展示;每张发货通知单对应一张 Excel。", "loading": "正在加载发货通知…", "loadFailed": "发货通知加载失败,请刷新后重试。", "poMissing": "当前任务尚未识别到 PO,暂时无法聚合发货通知。", "empty": "当前 PO 暂无可上传的发货通知。", "download": "下载 Excel", "lineNo": "项次", "lineNoSourceCustomerPo": "客户 PO 行号", "lineNoSourceSequence": "系统行序(未识别到内部项次)", "selected": "已选 {count} 个发货通知", "batchDownload": "批量下载", "batchRpa": "批量 RPA 上传", "batchConfirm": "批量确认已上传"},
"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": "接收解析",
@@ -2337,6 +2337,7 @@
"adminDiagnosisStatus": "状态:task_missing",
"adminDiagnosisHint": "请通过任务审计/数据修复流程处理;本页不提供自动恢复。",
"stateInconsistent": "状态同步中 / 状态数据不一致",
"stageLoading": "正在更新状态…",
"statusRunning": "系统处理中",
"statusFailedRetryable": "失败可重试",
"statusCompleted": "已完成",
+6 -2
View File
@@ -2154,9 +2154,12 @@
"shippingInventorySourcesHelp": "選擇需要執行的庫存來源;選項來自庫存來源配置,留空則全部執行。",
"dynamicParamsSelectPlaceholder": "請選擇",
"dynamicParamsOptionsLoading": "選項載入中...",
"dynamicParamsLoading": "正在載入平台任務參數…",
"dynamicParamsLoadFailed": "平台任務參數載入失敗,請重試",
"dynamicParamsRetry": "重新載入",
"dynamicParamsNoOptions": "暫無可選項",
"dynamicParamsAdvanced": "進階配置(JSON,可選)",
"dynamicParamsAdvancedPlaceholder": "{\"timeout_seconds\": 300}",
"dynamicParamsAdvancedPlaceholder": "可選:貼上進階 JSON 物件參數,例如新增 timeout_seconds 等鍵值對",
"dynamicParamsAdvancedInvalid": "進階配置 JSON 格式錯誤,修正後才會儲存",
"dynamicParamsJsonInvalid": "JSON 格式錯誤,修正後才會儲存",
"dynamicParamsInvalid": "請修正任務參數中的錯誤後再儲存",
@@ -2312,6 +2315,7 @@
"headerLabelsJsonInvalid": "header_labels JSON 格式錯誤,請檢查",
"apiHeadersJsonInvalid": "API Headers JSON 格式錯誤,請檢查",
"runNowFailed": "手動執行失敗",
"runNowWaitTimeout": "等待執行完成逾時(約 15 分鐘),已停止自動重新整理,可手動查詢記錄",
"downloadExcelFailed": "下載 Excel 失敗",
"downloadInventoryRawZipFailed": "下載原始庫存包失敗",
"deleteFailed": "刪除排程失敗"
@@ -3378,7 +3382,7 @@
"confirmReview": "確認複核並加入盲測",
"correctionInvalid": "明細更正值必須是 JSON 欄位物件。",
"expectedRows": "人工真值(JSON 陣列)",
"expectedRowsPlaceholder": "[{\"customer_po_line_no\": \"00010\", \"part_number\": \"PN-1\", \"qty\": \"3\"}]",
"expectedRowsPlaceholder": "範例:customer_po_line_no 為 00010、part_number 為 PN-1、qty 為 3 的一筆明細",
"expectedRowsHint": "請輸入至少一筆人工確認的明細真值;不可複製候選結果。",
"expectedRowsInvalid": "真值必須是至少包含一個非空明細物件的 JSON 陣列。",
"expectedOrderFields": "訂單欄位真值(JSON 物件)",
+3 -2
View File
@@ -1485,8 +1485,8 @@
"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": {"title": "通知準備", "subtitle": "在此處處理庫存候選、匹配異常與通知檔產生。", "frozenOrder": "凍結訂單", "inventorySource": "庫存來源", "excel": "發貨 Excel", "downloadInventory": "下載庫存檔案", "retryInventory": "重新取得庫存", "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": "重新載入"},
"freightUpload": {"title": "貨代上傳", "subtitle": "按發貨通知單聚合展示;每張發貨通知單對應一張 Excel。", "loading": "正在載入發貨通知…", "loadFailed": "發貨通知載入失敗,請重新整理後重試。", "poMissing": "目前任務尚未識別到 PO,暫時無法聚合發貨通知。", "empty": "目前 PO 沒有可上傳的發貨通知。", "download": "下載 Excel", "lineNo": "項次", "selected": "已選 {count} 個發貨通知", "batchDownload": "批量下載", "batchRpa": "批量 RPA 上傳", "batchConfirm": "批量確認已上傳"},
"uploadComplete": {"title": "通知完成", "subtitle": "上傳成功證據已核驗,以下內容僅供查看。"},
"freightUpload": {"title": "貨代上傳", "subtitle": "按發貨通知單聚合展示;每張發貨通知單對應一張 Excel。", "loading": "正在載入發貨通知…", "loadFailed": "發貨通知載入失敗,請重新整理後重試。", "poMissing": "目前任務尚未識別到 PO,暫時無法聚合發貨通知。", "empty": "目前 PO 沒有可上傳的發貨通知。", "download": "下載 Excel", "lineNo": "項次", "lineNoSourceCustomerPo": "客戶 PO 行號", "lineNoSourceSequence": "系統行序(未識別到內部項次)", "selected": "已選 {count} 個發貨通知", "batchDownload": "批量下載", "batchRpa": "批量 RPA 上傳", "batchConfirm": "批量確認已上傳"},
"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": "接收解析",
@@ -2218,6 +2218,7 @@
"adminDiagnosisStatus": "狀態:task_missing",
"adminDiagnosisHint": "請透過任務審計/資料修復流程處理;本頁不提供自動恢復。",
"stateInconsistent": "狀態同步中 / 狀態資料不一致",
"stageLoading": "正在更新狀態…",
"statusRunning": "系統處理中",
"statusFailedRetryable": "失敗可重試",
"statusCompleted": "已完成",