feat(freight-rpa): 批次R解耦编排层并切换 onhand/inbound 契约
将 RPA 编排收编至 freight_rpa,回调迁 /api/freight-rpa/*。 共享目录与 Worker 契约一次切换至 onhand/inbound/upload, 并补 outbound 骨架与 tt16 排程 job key 迁移。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
bf3154033b
commit
ffc0d4a430
147 files changed
+4221
-2678
No files matched your search
@@ -187,7 +187,7 @@ export const downloadShippingInventorySnapshot = async (snapshotId: number, fall
|
||||
|
||||
/** 货代库存配置统一接口;敏感凭据仅能写入,服务端不会回显。 */
|
||||
export const getShippingInventoryConfig = async () => Promise.all([
|
||||
requestJson<unknown[]>('/api/admin/shipping-notice/rpa-profiles', auth()),
|
||||
requestJson<unknown[]>('/api/admin/freight-rpa/rpa-profiles', auth()),
|
||||
requestJson<unknown[]>('/api/admin/shipping-notice/sources', auth()),
|
||||
requestJson<unknown[]>('/api/admin/shipping-notice/routing-rules', auth()),
|
||||
requestJson<unknown[]>('/api/admin/shipping-notice/external-mappings', auth()),
|
||||
@@ -326,11 +326,11 @@ export const createShippingParsingDraftFromTemporarySession = (sessionNo: string
|
||||
|
||||
/** 保存 RPA Profile;password 未传或为空时由服务端保留旧密文。 */
|
||||
export const saveShippingRpaProfile = (payload: Record<string, unknown>, id?: number) => requestJson<unknown>(
|
||||
`/api/admin/shipping-notice/rpa-profiles${id ? `/${id}` : ''}`,
|
||||
`/api/admin/freight-rpa/rpa-profiles${id ? `/${id}` : ''}`,
|
||||
{ method: id ? 'PUT' : 'POST', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
);
|
||||
export const deleteShippingRpaProfile = (id: number) => requestJson<void>(
|
||||
`/api/admin/shipping-notice/rpa-profiles/${id}`, { method: 'DELETE', ...auth() },
|
||||
`/api/admin/freight-rpa/rpa-profiles/${id}`, { method: 'DELETE', ...auth() },
|
||||
);
|
||||
|
||||
/** 保存 Inventory Source,服务端校验其 Driver 与 Profile 一致。 */
|
||||
|
||||
@@ -181,7 +181,7 @@ export interface RpaWorkerHeartbeatWorker {
|
||||
}
|
||||
|
||||
export interface RpaWorkerHeartbeatSummary {
|
||||
scope?: 'inventory' | 'receipt' | string;
|
||||
scope?: 'onhand' | 'inbound' | string;
|
||||
ready: boolean;
|
||||
message: string;
|
||||
detail_message?: string;
|
||||
@@ -195,7 +195,7 @@ export interface RpaWorkerHeartbeatSummary {
|
||||
workers: RpaWorkerHeartbeatWorker[];
|
||||
}
|
||||
|
||||
export const getAdminRpaWorkersStatus = (scope: 'inventory' | 'receipt' = 'inventory') =>
|
||||
export const getAdminRpaWorkersStatus = (scope: 'onhand' | 'inbound' = 'onhand') =>
|
||||
getJson<RpaWorkerHeartbeatSummary>(`/api/admin/rpa-workers/status?scope=${encodeURIComponent(scope)}`);
|
||||
|
||||
export type { DifyExecutionSnapshot, ScheduleRun, ScheduleTask, StepLog, TestScheduleRunResult, TestScheduleSqlResult };
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* features/admin/modules/schedules/components/DynamicTaskParamsForm.spec.ts
|
||||
* 用途:复现「货代库存 RPA」平台任务参数表单的渲染。
|
||||
* 背景:排程编辑弹窗选择 shipping-inventory-rpa 后,库存源多选字段不呈现,且弹窗按钮疑似失效。
|
||||
* 背景:排程编辑弹窗选择 freight-rpa-onhand 后,库存源多选字段不呈现,且弹窗按钮疑似失效。
|
||||
* 断言:给定带 source_codes(multi_select/options_source=shipping_inventory_sources) 的定义,
|
||||
* 挂载后应渲染「库存源」标签及动态选项,而不是抛错或渲染为空。
|
||||
*/
|
||||
@@ -20,7 +20,7 @@ vi.mock('@/features/admin/api/schedule.api', () => ({
|
||||
}));
|
||||
|
||||
const shippingInventoryRpaDefinition = {
|
||||
task_type: 'shipping-inventory-rpa',
|
||||
task_type: 'freight-rpa-onhand',
|
||||
label: '货代库存 RPA',
|
||||
label_key: 'admin.schedule.form.platformJobShippingInventory',
|
||||
description: '按计划从配置的库存源抓取库存数据,由 freight_rpa_worker 异步导出。',
|
||||
@@ -65,7 +65,7 @@ function mountForm() {
|
||||
});
|
||||
}
|
||||
|
||||
describe('DynamicTaskParamsForm (shipping-inventory-rpa)', () => {
|
||||
describe('DynamicTaskParamsForm (freight-rpa-onhand)', () => {
|
||||
beforeEach(() => vi.clearAllMocks());
|
||||
|
||||
it('renders the 库存源 label and the two dynamic options', async () => {
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ export function useScheduleAdminForm(
|
||||
// 历史货代 RPA 任务兼容:job_params 为空时把旧 api_body_template JSON 迁移进 schema 表单
|
||||
if (
|
||||
scheduleCreateForm.value.schedule_type === 'platform_job'
|
||||
&& scheduleCreateForm.value.platform_api_path === 'shipping-inventory-rpa'
|
||||
&& scheduleCreateForm.value.platform_api_path === 'freight-rpa-onhand'
|
||||
&& !(scheduleCreateForm.value.job_params && Object.values(scheduleCreateForm.value.job_params).some((v) => Array.isArray(v) ? v.length : v))
|
||||
&& (cfg.external_api?.body_template || '').trim()
|
||||
) {
|
||||
|
||||
+6
-5
@@ -50,11 +50,11 @@ export function useScheduleAdminRuns(
|
||||
);
|
||||
|
||||
const isInventoryRpaSchedule = computed(
|
||||
() => selectedScheduleJobKey.value === 'shipping-inventory-rpa',
|
||||
() => selectedScheduleJobKey.value === 'freight-rpa-onhand',
|
||||
);
|
||||
|
||||
const isReceiptRpaSchedule = computed(
|
||||
() => selectedScheduleJobKey.value === 'freight-receipt-rpa',
|
||||
() => selectedScheduleJobKey.value === 'freight-rpa-inbound',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -178,13 +178,14 @@ export function useScheduleAdminRuns(
|
||||
return raw ? formatDateTime(raw) : '-';
|
||||
});
|
||||
|
||||
/** 库存或收料排程工作台均展示 RPA Worker 心跳徽标。 */
|
||||
/** 在手(onhand)或入站(inbound)排程工作台均展示 RPA Worker 心跳徽标。 */
|
||||
const showsRpaWorkerStatus = computed(
|
||||
() => isInventoryRpaSchedule.value || isReceiptRpaSchedule.value,
|
||||
);
|
||||
|
||||
const rpaWorkerStatusScope = computed<'inventory' | 'receipt'>(() =>
|
||||
(isReceiptRpaSchedule.value ? 'receipt' : 'inventory'),
|
||||
// scope 取值与后端 /rpa-workers/status 约定一致(Task 11 起 onhand|inbound)。
|
||||
const rpaWorkerStatusScope = computed<'onhand' | 'inbound'>(() =>
|
||||
(isReceiptRpaSchedule.value ? 'inbound' : 'onhand'),
|
||||
);
|
||||
|
||||
const rpaWorkerLastHeartbeatAt = computed(() => {
|
||||
|
||||
@@ -16,7 +16,7 @@ export type ScheduleDataSourceType = 'database' | 'external_api';
|
||||
|
||||
/** 平台内置 Job key(与后端 registry 一致,仅作类型提示) */
|
||||
export type PlatformJobKey =
|
||||
| 'shipping-inventory-rpa'
|
||||
| 'freight-rpa-onhand'
|
||||
| 'faq-aggregate-hot'
|
||||
| 'fixed-assets-snapshot';
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@ import { normalizePlatformJobKey } from './schedule-job-key.utils';
|
||||
|
||||
describe('normalizePlatformJobKey', () => {
|
||||
it('保留规范化连字符 key', () => {
|
||||
expect(normalizePlatformJobKey('shipping-inventory-rpa')).toBe('shipping-inventory-rpa');
|
||||
expect(normalizePlatformJobKey('freight-rpa-onhand')).toBe('freight-rpa-onhand');
|
||||
});
|
||||
|
||||
it('下划线转连字符(历史小写别名)', () => {
|
||||
expect(normalizePlatformJobKey('shipping_inventory_rpa')).toBe('shipping-inventory-rpa');
|
||||
expect(normalizePlatformJobKey('freight_rpa_onhand')).toBe('freight-rpa-onhand');
|
||||
});
|
||||
|
||||
it('大小写不敏感', () => {
|
||||
expect(normalizePlatformJobKey('Shipping-Inventory-RPA')).toBe('shipping-inventory-rpa');
|
||||
expect(normalizePlatformJobKey('Freight-Rpa-Onhand')).toBe('freight-rpa-onhand');
|
||||
});
|
||||
|
||||
it('取完整内部路径最后一段', () => {
|
||||
expect(normalizePlatformJobKey('/api/internal/jobs/shipping-inventory-rpa')).toBe('shipping-inventory-rpa');
|
||||
expect(normalizePlatformJobKey('/api/internal/jobs/freight-rpa-onhand')).toBe('freight-rpa-onhand');
|
||||
});
|
||||
|
||||
it('去 query / hash / 首尾斜杠', () => {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* 逻辑:小写 → 去 query/hash → 去首尾斜杠 → 取路径最后一段 → 下划线转连字符。
|
||||
* 用途:openScheduleEditModal 读入 platform_api_path 时归一化,使「平台任务」下拉回显与
|
||||
* selectedPlatformTaskDefinition 的 task_type 精确匹配不受历史非规范存储值影响。
|
||||
* 后端在保存时已归一化,历史数据仍可能存下划线(shipping_inventory_rpa)、完整内部路径
|
||||
* (/api/internal/jobs/shipping-inventory-rpa)或大小写差异;前端此前用严格 === 字符串比较,
|
||||
* 后端在保存时已归一化,历史数据仍可能存下划线(freight_rpa_onhand)、完整内部路径
|
||||
* (/api/internal/jobs/freight-rpa-onhand)或大小写差异;前端此前用严格 === 字符串比较,
|
||||
* 一旦不匹配即静默隐藏参数表单(含库存源),本工具修复该匹配漏洞。
|
||||
*/
|
||||
export function normalizePlatformJobKey(value: string | null | undefined): string {
|
||||
|
||||
Reference in new issue
Block a user