import { requestClient } from '#/api/request';
|
|
export type QrExportBizType =
|
| 'BAG_LABEL'
|
| 'BAG_BUSINESS'
|
| 'PALLET_LABEL'
|
| 'PALLET_BUSINESS'
|
| 'BATCH_LABEL'
|
| 'BATCH_BUSINESS';
|
|
export interface QrExportParams {
|
bizType: QrExportBizType;
|
uuid?: string;
|
batchId?: number;
|
}
|
|
export interface QrExportCount {
|
totalCount: number;
|
syncThreshold: number;
|
mode: 'SYNC' | 'ASYNC';
|
}
|
|
export interface QrExportTask {
|
id: number;
|
bizType: QrExportBizType;
|
taskName: string;
|
status: number;
|
statusName: string;
|
totalCount: number;
|
finishedCount: number;
|
progress: number;
|
fileSize?: number;
|
errorMsg?: string;
|
downloadable: boolean;
|
}
|
|
/** 兼容现有导出进度组件使用的类型名称。 */
|
export namespace MesProQrExportApi {
|
export type BizType = QrExportBizType;
|
export type ExportParams = QrExportParams;
|
export type ExportCount = QrExportCount;
|
export type ExportTask = QrExportTask;
|
}
|
|
export function countQrExport(params: QrExportParams) {
|
return requestClient.get<QrExportCount>('/mes/pro/qr-export/count', { params });
|
}
|
|
export const getQrExportCount = countQrExport;
|
|
export function submitQrExport(params: QrExportParams) {
|
return requestClient.post<QrExportTask>('/mes/pro/qr-export/task', params);
|
}
|
|
export const submitQrExportTask = submitQrExport;
|
|
export function getQrExportDownloadPath(id: number) {
|
return `/mes/pro/qr-export/task/download?id=${encodeURIComponent(id)}`;
|
}
|
|
export function getQrExportTask(id: number) {
|
return requestClient.get<QrExportTask>('/mes/pro/qr-export/task/get', { params: { id } });
|
}
|
|
export function cancelQrExportTask(id: number) {
|
return requestClient.post<boolean>(`/mes/pro/qr-export/task/cancel?id=${id}`);
|
}
|