Files
qhmes/jeecgboot-vue3/src/views/xslmes/mesXslRawMaterialEntry/MesXslRawMaterialEntry.api.ts

65 lines
2.5 KiB
Vue
Raw Normal View History

import { defHttp } from '/@/utils/http/axios';
enum Api { list = '/xslmes/mesXslRawMaterialEntry/list',
save = '/xslmes/mesXslRawMaterialEntry/add',
edit = '/xslmes/mesXslRawMaterialEntry/edit',
deleteOne = '/xslmes/mesXslRawMaterialEntry/delete',
deleteBatch = '/xslmes/mesXslRawMaterialEntry/deleteBatch',
linkedRawMaterialCards = '/xslmes/mesXslRawMaterialEntry/linkedRawMaterialCards',
batchStockIn = '/xslmes/mesXslRawMaterialEntry/batchStockIn',
importExcel = '/xslmes/mesXslRawMaterialEntry/importExcel',
exportXls = '/xslmes/mesXslRawMaterialEntry/exportXls',
queryPrinters = '/xslmes/mesXslRawMaterialEntry/queryPrinters',
prepareNativePrint = '/xslmes/mesXslRawMaterialEntry/prepareNativePrint',
printPdf = '/xslmes/mesXslRawMaterialEntry/printPdf',
}
export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel;
/** 删除前:查询入场记录关联的已生成原材料卡片 */
export const getLinkedRawMaterialCards = (ids: string) =>
defHttp.get<MesXslRawMaterialCardBrief[]>({ url: Api.linkedRawMaterialCards, params: { ids } });
export interface MesXslRawMaterialCardBrief {
id?: string;
barcode?: string;
batchNo?: string;
materialName?: string;
splitDetailId?: string;
}
export const list = (params) => defHttp.get({ url: Api.list, params });
export const deleteOne = (params: { id: string; cascadeDeleteCards?: boolean }, handleSuccess?: () => void) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess?.();
});
};
export const batchDelete = (params: { ids: string; cascadeDeleteCards?: boolean }, handleSuccess?: () => void) => {
return defHttp.delete({ url: Api.deleteBatch, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess?.();
});
};
export const batchStockIn = (ids: string) =>
defHttp.put({ url: Api.batchStockIn, params: { ids } }, { joinParamsToUrl: true });
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params });
};
export const queryPrinters = () => defHttp.get({ url: Api.queryPrinters });
export const prepareNativePrint = (id: string) =>
defHttp.get({
url: Api.prepareNativePrint,
params: { id, _t: Date.now() },
});
/** id + 前端生成的 pdfBase64printerName 空则用默认队列 */
export const printPdf = (data: { id: string; printerName?: string; pdfBase64: string; fileName?: string }) =>
defHttp.post({ url: Api.printPdf, data, timeout: 3 * 60 * 1000 });