import { genAction, Api, genActionPage } from '../system';
|
import { useUserStore } from '/@/store/modules/user';
|
import { defHttp } from '/@/utils/http/axios';
|
import { isNullOrEmpty } from '/@/utils/is';
|
|
/*
|
* 物料信息追溯
|
*/
|
|
export const getMaterialReqDetailSNListByPage = async (params: any) => {
|
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 ORDER_NO like '%" + params?.BILLCODE + "%'";
|
}
|
if (params?.ITEM_CODE != undefined && params?.ITEM_CODE != '') {
|
sqlcmd += " And ITEM_CODE like '%" + params?.ITEM_CODE + "%'";
|
}
|
if (params?.UPDATE_TIME!=undefined) {
|
sqlcmd += " And UPDATE_TIME >= '" + params?.UPDATE_TIME[0] + "'";
|
}
|
if (params?.UPDATE_TIME!=undefined) {
|
sqlcmd += " And UPDATE_TIME <= '" + params?.UPDATE_TIME[1] + "'";
|
}
|
//下拉
|
// 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
|
}
|
if(!isNullOrEmpty(params.page)){
|
const usParams = genAction('V_WMS_ITEM_EXT', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: order,
|
page: {
|
pageAble_T: 'string',
|
draw: 1,
|
pageIndex: params.page,
|
pageSize: params.pageSize,
|
}
|
},
|
option);
|
return getMaterialReqDetailSNListByPageAsync(usParams);
|
}else{
|
const usParams = genAction('V_WMS_ITEM_EXT', {
|
QueryAble_T: '',
|
where: sqlcmd
|
},
|
option);
|
return getMaterialReqDetailSNListByPageAsync(usParams);
|
}
|
// const rParams = genActionPage('BIZ_ERP_PROD_OUT_SN', sqlcmd, params.page, params.pageSize,option);
|
// return getMaterialReqDetailSNListByPageAsync(rParams);
|
};
|
async function getMaterialReqDetailSNListByPageAsync(params: any) {
|
const data = await defHttp.post(
|
{ url: Api.QueryUrl, params },
|
{
|
isTransformResponse: false,
|
},
|
);
|
let model = {}
|
if(isNullOrEmpty(data.Data.page)){
|
model = {
|
items: data.Data.Items,
|
};
|
}else{
|
model = {
|
items: data.Data.page.data,
|
total: data.Data.page.totals,
|
};
|
}
|
|
return model;
|
}
|
//下拉列表
|
// STATUSs 单据状态
|
// BIZTYPEs 单据类型
|
export const optionsListApi = async (params: Recordable) => {
|
const usParams = genAction('BIZ_ERP_PROD_OUT+STATUSs', '');
|
return await defHttp.post(
|
{ url: Api.urlQueryEnum, params: usParams },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
// apiUrl: globSetting.taskApiUrl
|
},
|
);
|
};
|