Merge branch 'dev' into runny827
feat(training): 新增精益培训视频与周任务管理 # Conflicts: # backend/app/models/__init__.py
This commit is contained in:
1 parent
85d27e9ffa
commit
91b7233872
812 files changed
+73763
-18908
No files matched your search
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* features/chat/api/transfer.api.ts
|
||||
* 用途:在途仓自动调拨 API 客户端(统一 requestJson / requestBlob,不重复造客户端)。
|
||||
* 依赖:@/shared/api/client(requestJson / requestBlob / BusinessError)、getAuthHeaders。
|
||||
* 逻辑:薄封装后端 /api/in-transit-transfer 全部端点;二进制下载走 requestBlob。
|
||||
*/
|
||||
import { requestBlob, requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type {
|
||||
TransferActionResult,
|
||||
TransferBacklogItem,
|
||||
TransferBacklogSummary,
|
||||
TransferExecuteResponse,
|
||||
TransferPrecheckDetail,
|
||||
TransferPrecheckSummary,
|
||||
TransferRunResult,
|
||||
TransferSourceFileStatus,
|
||||
TransferSourceOption,
|
||||
} from '../types/transfer.types';
|
||||
|
||||
const BASE = '/api/in-transit-transfer';
|
||||
|
||||
/** JSON 请求头:除鉴权外必须带 Content-Type: application/json,否则 Flask request.get_json 解析不到 body。 */
|
||||
const jsonHeaders = () => ({ 'Content-Type': 'application/json', ...getAuthHeaders() });
|
||||
|
||||
export interface CreatePrecheckPayload {
|
||||
source_codes: string[];
|
||||
business_date?: string;
|
||||
}
|
||||
|
||||
/** 创建预检(只读) */
|
||||
export const createTransferPrecheck = (payload: CreatePrecheckPayload) =>
|
||||
requestJson<TransferPrecheckSummary>(BASE + '/prechecks', {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
/** 恢复预检进度与明细 */
|
||||
export const getTransferPrecheck = (precheckId: string) =>
|
||||
requestJson<TransferPrecheckDetail>(`${BASE}/prechecks/${precheckId}`, {
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
|
||||
/** 确认选择范围并直接生成执行 Run */
|
||||
export const executeTransferPrecheck = (precheckId: string, invoiceNos: string[]) =>
|
||||
requestJson<TransferExecuteResponse>(`${BASE}/prechecks/${precheckId}/execute`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ invoice_nos: invoiceNos }),
|
||||
});
|
||||
|
||||
/** 恢复 Run 最终结果 */
|
||||
export const getTransferRun = (runNo: string) =>
|
||||
requestJson<TransferRunResult>(`${BASE}/runs/${runNo}`, {
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
|
||||
/** 请求停止剩余任务 */
|
||||
export const cancelTransferRun = (runNo: string, reason: string) =>
|
||||
requestJson<TransferActionResult>(`${BASE}/runs/${runNo}/cancel`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ reason }),
|
||||
});
|
||||
|
||||
/** 人工重试异常项(仅重新查询 ERP,新 Attempt) */
|
||||
export const retryTransferItem = (itemId: number) =>
|
||||
requestJson<TransferActionResult>(`${BASE}/items/${itemId}/retry`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ kind: 'erp_recheck' }),
|
||||
});
|
||||
|
||||
/** 人工关闭异常项 */
|
||||
export const manualCloseTransferItem = (itemId: number, reason: string) =>
|
||||
requestJson<TransferActionResult>(`${BASE}/items/${itemId}/manual-close`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ reason }),
|
||||
});
|
||||
|
||||
/** 下载收料来源文件(zip) */
|
||||
export const downloadTransferReceiptFiles = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/receipt-files`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 下载预检冻结的 ERP 库存表(csv) */
|
||||
export const downloadTransferErpInventory = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/erp-inventory`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 下载七 Sheet 异常 Excel */
|
||||
export const downloadTransferExceptions = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/exceptions.xlsx`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 待处理异常列表(可恢复/已关闭/结果未知 + 老化等级) */
|
||||
export const listTransferBacklog = () =>
|
||||
requestJson<TransferBacklogItem[]>(`${BASE}/backlog`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 待处理异常汇总(含 3/5/7 天老化分级) */
|
||||
export const getTransferBacklogSummary = () =>
|
||||
requestJson<TransferBacklogSummary>(`${BASE}/backlog/summary`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 来源实例列表(平台 DBS/Crane 仅分组,每来源附收料文件状态) */
|
||||
export const listTransferSources = () =>
|
||||
requestJson<TransferSourceOption[]>(`${BASE}/sources`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 对指定来源重新触发一次收料 RPA 抓取 */
|
||||
export const retryTransferSourceRpa = (sourceCode: string) =>
|
||||
requestJson<TransferSourceFileStatus>(`${BASE}/sources/${encodeURIComponent(sourceCode)}/retry-rpa`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
});
|
||||
Reference in new issue
Block a user