import { ApiActionPage } from '../../model/baseModel';
|
import {
|
EnterWarehousePageListGetResultModel,
|
EnterWarehouseDetailPageListGetResultModel,
|
EnterWarehouseDetailSNPageListGetResultModel,
|
EnterWarehousePageParams,
|
EnterWarehouseDetailPageParams,
|
EnterWarehouseDetailSNPageParams,
|
} from '../model/warehoueseModel';
|
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 getEnterWarehouseListByPage = async (params: EnterWarehousePageParams) => {
|
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 like '%" + params?.BILLCODE + "%'";
|
}
|
if (params?.ERP_BILL_CODE != undefined && params?.ERP_BILL_CODE != '') {
|
sqlcmd += " And ERP_BILL_CODE like '%" + params?.ERP_BILL_CODE + "%'";
|
}
|
if (params?.BILLDATE != undefined && params?.BILLDATE != '') {
|
sqlcmd += " And BILLDATE > '" + params?.BILLDATE[0] + "'";
|
}
|
if (params?.BILLDATE != undefined && params?.BILLDATE != '') {
|
sqlcmd += " And BILLDATE < '" + params?.BILLDATE[1] + "'";
|
}
|
if (params?.STATUS != undefined && params?.STATUS != '') {
|
sqlcmd += " And STATUS = '" + params?.STATUS + "'";
|
}
|
if (params?.BIZTYPE != undefined && params?.BIZTYPE != '') {
|
sqlcmd += " And BIZTYPE = '" + params?.BIZTYPE + "'";
|
}
|
var option ={
|
UserId:useUserStore().getUserInfo.userId as string,
|
ByOrg:true,
|
OrgCode:useUserStore().getUserInfo.orgCode as string
|
}
|
// if (params?.BILLDATE != undefined && params?.BILLDATE != '') {
|
// sqlcmd += "And BILLDATE like '%" + params?.BILLDATE + "%'";
|
// }
|
const usParams = genAction('BIZ_ERP_RECEIPT', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: order,
|
page: {
|
pageAble_T: 'string',
|
draw: 1,
|
pageIndex: params.page,
|
pageSize: params.pageSize,
|
},
|
option
|
},option);
|
return getEnterWarehouseListByPageAsync(usParams);
|
// const rParams = genActionPage('BIZ_ERP_RECEIPT', sqlcmd, params.page, params.pageSize,option);
|
// return getEnterWarehouseListByPageAsync(rParams);
|
};
|
async function getEnterWarehouseListByPageAsync(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 getEnterWarehouseDetailListByPage = async (params: EnterWarehouseDetailPageParams) => {
|
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 like '%" + params?.BILLCODE + "%'";
|
}
|
if (params?.ITEM_CODE != undefined && params?.ITEM_CODE != '') {
|
sqlcmd += " And ITEM_CODE like '%" + params?.ITEM_CODE + "%'";
|
}
|
if (params?.STATUS != undefined && params?.STATUS != '') {
|
sqlcmd += " And STATUS = '" + params?.STATUS + "'";
|
}
|
if (params?.BIZTYPE != undefined && params?.BIZTYPE != '') {
|
sqlcmd += " And BIZTYPE = '" + params?.BIZTYPE + "'";
|
}
|
var option ={
|
UserId:useUserStore().getUserInfo.userId as string,
|
ByOrg:true,
|
OrgCode:useUserStore().getUserInfo.orgCode as string
|
}
|
if (!isNullOrEmpty(params.page)) {
|
const usParams = genAction('V_BIZ_ERP_RECEIPT_DTL', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: 'BILLLINE*1 '+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 getEnterWarehouseDetailListByPageAsync(usParams);
|
} else {
|
const usParams = genAction('V_BIZ_ERP_RECEIPT_DTL', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: 'BILLLINE*1',
|
option
|
},option);
|
//const rParams = genActionPage('V_BIZ_ERP_OTH_OUT_DTL', sqlcmd, params.page, params.pageSize,option);
|
return getEnterWarehouseDetailListByPageAsync(usParams);
|
}
|
};
|
async function getEnterWarehouseDetailListByPageAsync(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;
|
}
|
// async function getEnterWarehouseDetailListByPageAsync(params: ApiActionPage) {
|
// const data = await defHttp.post<ApiActionPage>(
|
// { url: Api.EntityPageList, params },
|
// {
|
// isTransformResponse: false,
|
// },
|
// );
|
// const model: EnterWarehouseDetailPageListGetResultModel = {
|
// items: data.Data.data,
|
// total: data.Data.totals,
|
// };
|
// return model;
|
// }
|
export const getEnterWarehouseDetailSNListByPage = async (params: EnterWarehouseDetailSNPageParams) => {
|
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 like '%" + params?.BILLCODE + "%'";
|
}
|
if (params?.ITEM_CODE != undefined && params?.ITEM_CODE != '') {
|
sqlcmd += " And ITEM_CODE like '%" + params?.ITEM_CODE + "%'";
|
}
|
if (params?.SN != undefined && params?.SN != '') {
|
sqlcmd += " And SN like '%" + params?.SN + "%'";
|
}
|
// if (params?.STATUS != undefined && params?.STATUS != '') {
|
// sqlcmd += " And STATUS = '" + params?.STATUS + "'";
|
// }
|
// if (params?.BIZTYPE != undefined && params?.BIZTYPE != '') {
|
// sqlcmd += " And BIZTYPE = '" + params?.BIZTYPE + "'";
|
// }
|
var option ={
|
UserId:useUserStore().getUserInfo.userId as string,
|
ByOrg:true,
|
OrgCode:useUserStore().getUserInfo.orgCode as string
|
}
|
if (!isNullOrEmpty(params.page)) {
|
const usParams = genAction('BIZ_ERP_RECEIPT_SN', {
|
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 getEnterWarehouseDetailSNListByPageAsync(usParams);
|
} else {
|
const usParams = genAction('BIZ_ERP_RECEIPT_SN', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
option
|
},option);
|
//const rParams = genActionPage('V_BIZ_ERP_OTH_OUT_DTL', sqlcmd, params.page, params.pageSize,option);
|
return getEnterWarehouseDetailSNListByPageAsync(usParams);
|
}
|
};
|
async function getEnterWarehouseDetailSNListByPageAsync(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_RECEIPT+STATUSs', '');
|
return await defHttp.post(
|
{ url: Api.urlQueryEnum, params: usParams },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
// apiUrl: globSetting.taskApiUrl
|
},
|
);
|
};
|
export const optionTypeListApi = async (params: Recordable) => {
|
const usParams = genAction('BIZ_ERP_RECEIPT+BIZTYPEs', '');
|
return await defHttp.post(
|
{ url: Api.urlQueryEnum, params: usParams },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
// apiUrl: globSetting.taskApiUrl
|
},
|
);
|
};
|