import { buildUUID } from '../../../utils/uuid';
|
import { ApiAction, ApiActionPage } from '../../model/baseModel';
|
import {
|
InspectionListItem,
|
InspectionPageListGetResultModel,
|
InspectionPageParams,
|
} from '../model/warehoueseModel';
|
import { genAction, Api, genActionPage } from '../system';
|
import { useUserStore } from '/@/store/modules/user';
|
import { defHttp } from '/@/utils/http/axios';
|
|
/*
|
* 获取送检单分页列表
|
*/
|
export const getInspectionListByPage = async (params: InspectionPageParams) => {
|
let order = ''
|
if (params.order != undefined) {
|
order = params.order == 'descend' ? (params.field + ' desc') : params.field
|
}
|
let sqlcmd = '1=1';
|
if (params?.BILLCODE != undefined && params?.BILLCODE != '') {
|
sqlcmd += " And BILLCODE = '" + params?.BILLCODE + "'";
|
}
|
// if (params?.BILLDATE != undefined && params?.BILLDATE != '') {
|
// sqlcmd += "And BILLDATE like '%" + params?.BILLDATE + "%'";
|
// }
|
var option ={
|
UserId:useUserStore().getUserInfo.userId as string,
|
ByOrg:true,
|
OrgCode:useUserStore().getUserInfo.orgCode as string
|
}
|
const usParams = genAction('BIZ_ERP_IQC', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: order,
|
page: {
|
pageAble_T: 'string',
|
draw: 1,
|
pageIndex: params.page,
|
pageSize: params.pageSize,
|
},
|
option
|
},option);
|
//const rParams = genActionPage('V_BIZ_ERP_OTH_OUT_DTL', sqlcmd, params.page, params.pageSize,option);
|
return getInspectionListByPageAsync(usParams);
|
};
|
async function getInspectionListByPageAsync(params: any) {
|
const data = await defHttp.post(
|
{ url: Api.QueryUrl, params },
|
{
|
isTransformResponse: false,
|
},
|
);
|
const model = {
|
items: data.Data.page.data,
|
total: data.Data.page.totals,
|
};
|
return model;
|
}
|
|
export const SaveInspection = async (params: InspectionListItem, isUpdate: boolean) => {
|
let data;
|
if (isUpdate) {
|
data = await defHttp.post(
|
{ url: Api.UpdateEntity, params: genAction('Minsun.WMS_IQC_H', params) },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
},
|
);
|
} else {
|
params.ID = buildUUID(); //生成GUID
|
data = await defHttp.post(
|
{ url: Api.AddEntity, params: genAction('Minsun.WMS_IQC_H', params) },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
},
|
);
|
}
|
return data;
|
};
|
export const setBasStatus = (params: any) =>
|
defHttp.post(
|
{ url: Api.UpdateEntity, params: genAction('BIZ_ERP_IQC', params) },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
},
|
);
|
|
export const DeleteInspection = async (params: Recordable) => {
|
const usParams = genAction('Minsun.WMS_IQC_H', [params]);
|
return await defHttp.post(
|
{ url: Api.DeleteList, params: usParams },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
},
|
);
|
};
|