feat(shipping-notice,receipt-report): 新增收料报表功能并优化发货通知流程

清理废弃的shipping xfa ocr automark相关代码和job配置
新增收料报表管理的前端页面、路由和侧边栏入口
新增后端收料报表配置接口、数据库模型和RPA脚本
优化发货通知流程的重试策略,将shipping相关job默认不自动重试
移除废弃的库存源确认相关逻辑,更新流程门禁规则
重构订单模板的值适配器模块,新增坐标OCR值适配器
清理前端shipping菜单和action的废弃选项
更新相关文档和测试用例,调整.gitignore忽略规则
This commit is contained in:
hugo committed 2026-08-20 20:23:10 +08:00
1 parent 260465b72d
commit 1b6483a4ea
466 files changed
+32115 -33796

No files matched your search

@@ -0,0 +1,24 @@
/**
* features/workspace/api/receipt-report.api.spec.ts
* 用途:锁定收料报表列表与下载地址的工作台契约。
* 依赖:receipt-report.api、vitest。
* 逻辑:普通接收人只能经工作台受控下载,不拼接对象存储地址。
*/
import { describe, expect, it } from 'vitest';
import {
listFailedReceiptRpaUnits, receiptReportDownloadUrl, resendReceiptReportFile, retryReceiptRpaUnit,
} from './receipt-report.api';
describe('receiptReportDownloadUrl', () => {
it('uses the workspace authorization endpoint instead of an object storage URL', () => {
// 关键断言:浏览器只能使用后端鉴权下载代理,不能得到 MinIO bucket/key。
expect(receiptReportDownloadUrl(42)).toBe('/api/workspace/receipt-report-files/42/download');
});
it('keeps manual compensation routes in the admin namespace', () => {
expect(String(listFailedReceiptRpaUnits)).toContain('receipt-rpa-units?status=failed');
expect(String(retryReceiptRpaUnit)).toContain('/api/admin/receipt-rpa-units/');
expect(String(resendReceiptReportFile)).toContain('/api/admin/receipt-report-files/');
});
});
@@ -0,0 +1,71 @@
/**
* features/workspace/api/receipt-report.api.ts
* 用途:工作台收料归档列表与受控下载 API。
* 依赖:requestJson、getAuthHeaders。
* 逻辑:列表由服务端按当前接收人/管理员授权裁剪;下载始终经过工作台鉴权代理。
*/
import { requestJson } from '@/shared/api/client';
import { getAuthHeaders } from '@/shared/utils/auth';
export type ReceiptReportFile = {
id: number;
original_filename: string;
content_type?: string | null;
file_size: number;
sha256: string;
source_code?: string | null;
warehouse_id?: string | null;
schedule_run_no?: string | null;
archive_expires_at?: string | null;
created_at?: string | null;
download_url: string;
};
export type ReceiptRpaUnit = {
id: number;
source_code: string;
warehouse_id?: string | null;
status: string;
error_code?: string | null;
error_message?: string | null;
retry_of_id?: number | null;
schedule_run_id: number;
created_at?: string | null;
finished_at?: string | null;
};
/**
* 读取当前用户有权查看的收料原文件列表。
* 核心逻辑:不接收 user_id 或对象存储参数,服务端以当前会话和排程接收人关系授权。
* @returns 脱敏归档元数据和受控下载地址。
*/
export const listWorkspaceReceiptReportFiles = (limit = 100) => requestJson<{ items: ReceiptReportFile[] }>(
`/api/workspace/receipt-report-files?limit=${encodeURIComponent(String(limit))}`,
{ headers: getAuthHeaders() },
);
/**
* 返回一个收料文件的受控下载地址。
* 核心逻辑:禁止把 MinIO bucket 或 object key 暴露到浏览器。
* @param fileId - 收料归档文件主键。
* @returns 由后端再次校验接收人权限的下载路径。
*/
export const receiptReportDownloadUrl = (fileId: number) => `/api/workspace/receipt-report-files/${encodeURIComponent(String(fileId))}/download`;
/** 管理员读取失败收料单元;普通用户不调用此管理端接口。 */
export const listFailedReceiptRpaUnits = () => requestJson<{ items: ReceiptRpaUnit[] }>(
'/api/admin/receipt-rpa-units?status=failed&limit=100', { headers: getAuthHeaders() },
);
/** 管理员以必填原因新建失败单元的独立人工重试事实。 */
export const retryReceiptRpaUnit = (unitId: number, reason: string) => requestJson<unknown>(
`/api/admin/receipt-rpa-units/${encodeURIComponent(String(unitId))}/retry`,
{ method: 'POST', headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' }, body: JSON.stringify({ reason }) },
);
/** 管理员仅重发已归档文件的企微消息,不会重新导出。 */
export const resendReceiptReportFile = (fileId: number) => requestJson<unknown>(
`/api/admin/receipt-report-files/${encodeURIComponent(String(fileId))}/resend`,
{ method: 'POST', headers: getAuthHeaders() },
);
@@ -2,13 +2,12 @@
* features/workspace/api/shipping-tasks.api.ts
* 用途:工作台发货任务 / 我的待办 API 客户端。
* 依赖:shared/api/client、chat shipping.api(履约写操作暂复用)。
* 逻辑:My Todos 与徽标走本文件;submit-decision / 下载 / 人工上传仍委托 shipping.api。
* 逻辑:My Todos 与徽标走本文件;下载与人工上传凭据登记复用 shipping.api。
*/
import { requestJson } from '@/shared/api/client';
import type { ShippingTaskSummary } from '@/features/chat/types/shipping.api.types';
import {
markWorkspaceShippingManualUploaded,
submitWorkspaceShippingDecision,
workspaceShippingExportUrl,
} from '@/features/chat/api/shipping.api';
import { downloadWorkspaceShippingExcelFile } from '@/features/chat/shipping/shippingDownload';
@@ -62,6 +61,5 @@ export function countWorkspaceShippingMyTodos() {
export {
downloadWorkspaceShippingExcelFile,
markWorkspaceShippingManualUploaded,
submitWorkspaceShippingDecision,
workspaceShippingExportUrl,
};