import { buildUUID } from '../../../utils/uuid';
|
import { ApiAction, ApiActionPage } from '../../model/baseModel';
|
import { isNullOrEmpty } from '/@/utils/is';
|
import {
|
SaleoutorderListItem,
|
SaleoutorderPageListGetResultModel,
|
SaleoutorderPageParams,
|
|
SaleoutorderDetailPageParams,
|
SaleoutorderDetailPageListGetResultModel,
|
SaleoutorderDetailSNPageParams,
|
SaleoutorderDetailSNPageListGetResultModel,
|
|
} from '../model/warehoueseModel';
|
import { genAction, Api, genActionPage } from '../system';
|
import { useUserStore } from '/@/store/modules/user';
|
import { defHttp } from '/@/utils/http/axios';
|
|
/*
|
* 获取生产领料分页列表
|
*/
|
export const getSaleoutorderListByPage = async (params: SaleoutorderPageParams) => {
|
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?.BILLDATE != undefined && params?.BILLDATE != '') {
|
sqlcmd += " And BILLDATE > '" + params?.BILLDATE[0] + "'";
|
}
|
if (params?.BILLDATE != undefined && params?.BILLDATE != '') {
|
sqlcmd += " And BILLDATE < '" + params?.BILLDATE[1] + "'";
|
}
|
if (!isNullOrEmpty(params?.STATUS)) {
|
sqlcmd += " And STATUS = '" + params?.STATUS + "'";
|
}
|
//下拉
|
// 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_SALE_OUT', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: order,
|
page: {
|
pageAble_T: 'string',
|
draw: 1,
|
pageIndex: params.page,
|
pageSize: params.pageSize,
|
}
|
},
|
option);
|
//const rParams = genActionPage('BIZ_ERP_SALE_OUT', sqlcmd, params.page, params.pageSize,option);
|
return getSaleoutorderListByPageAsync(usParams);
|
};
|
async function getSaleoutorderListByPageAsync(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 getSaleoutorderDetailListByPage = async (params: SaleoutorderDetailPageParams) => {
|
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?.ITEM_CODE != undefined && params?.ITEM_CODE != '') {
|
sqlcmd += " And ITEM_CODE = '" + params?.ITEM_CODE + "'";
|
}
|
// if (params?.OUTWAREHOUSECODE != undefined && params?.OUTWAREHOUSECODE != '') {
|
// sqlcmd += " And OUTWAREHOUSECODE = '" + params?.OUTWAREHOUSECODE + "'";
|
// }
|
// if (params?.INWAREHOUSECODE != undefined && params?.INWAREHOUSECODE != '') {
|
// sqlcmd += " And INWAREHOUSECODE = '" + params?.INWAREHOUSECODE + "'";
|
// }
|
if (!isNullOrEmpty(params?.LINESTATUS)) {
|
sqlcmd += " And LINESTATUS = '" + params?.LINESTATUS + "'";
|
}
|
var option ={
|
UserId:useUserStore().getUserInfo.userId as string,
|
ByOrg:true,
|
OrgCode:useUserStore().getUserInfo.orgCode as string
|
}
|
// const rParams = genActionPage('BIZ_ERP_SALE_OUT_DTL', sqlcmd, params.page, params.pageSize,option);
|
if (!isNullOrEmpty(params.page)) {
|
const usParams = genAction('V_BIZ_ERP_SALE_OUT_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 getSaleoutorderDetailListByPageAsync(usParams);
|
} else {
|
const usParams = genAction('V_BIZ_ERP_SALE_OUT_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 getSaleoutorderDetailListByPageAsync(usParams);
|
}
|
};
|
async function getSaleoutorderDetailListByPageAsync(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 getSaleoutorderDetailListByPageAsync(params: ApiActionPage) {
|
// const data = await defHttp.post<ApiActionPage>(
|
// { url: Api.EntityPageList, params },
|
// {
|
// isTransformResponse: false,
|
// },
|
// );
|
// const model: SaleoutorderDetailPageListGetResultModel = {
|
// items: data.Data.data,
|
// total: data.Data.totals,
|
// };
|
// return model;
|
// }
|
|
//条码详情
|
export const getSaleoutorderDetailSNListByPage = async (params: SaleoutorderDetailSNPageParams) => {
|
let order = ''
|
if (params.order != undefined) {
|
order = params.order == 'descend' ? (params.field + ' desc') : params.field
|
}
|
let sqlcmd = '1=1';
|
if (params?.ITEM_CODE != undefined && params?.ITEM_CODE != '') {
|
sqlcmd += " And ITEM_CODE = '" + params?.ITEM_CODE + "'";
|
}
|
if (params?.ORDER_NO != undefined && params?.ORDER_NO != '') {
|
sqlcmd += " And ORDER_NO = '" + params?.ORDER_NO + "'";
|
}
|
if (params?.SN != undefined && params?.SN != '') {
|
sqlcmd += " And SN = '" + params?.SN + "'";
|
}
|
if (!isNullOrEmpty(params?.STATUS)) {
|
sqlcmd += " And STATUS = '" + params?.STATUS + "'";
|
}
|
// 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 rParams = genActionPage('BIZ_ERP_SALE_OUT_SN', sqlcmd, params.page, params.pageSize,option);
|
if (!isNullOrEmpty(params.page)) {
|
const usParams = genAction('BIZ_ERP_SALE_OUT_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 getSaleoutorderDetailSNListByPageAsync(usParams);
|
} else {
|
const usParams = genAction('BIZ_ERP_SALE_OUT_SN', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
option
|
},option);
|
//const rParams = genActionPage('V_BIZ_ERP_OTH_OUT_DTL', sqlcmd, params.page, params.pageSize,option);
|
return getSaleoutorderDetailSNListByPageAsync(usParams);
|
}
|
};
|
async function getSaleoutorderDetailSNListByPageAsync(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 单据状态
|
export const optionsListApi = async (params: Recordable) => {
|
const usParams = genAction('BIZ_ERP_SALE_OUT+STATUSs', '');
|
return await defHttp.post(
|
{ url: Api.urlQueryEnum, params: usParams },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
// apiUrl: globSetting.taskApiUrl
|
},
|
);
|
};
|