import { buildUUID } from '../../../utils/uuid';
|
import { ApiAction, ApiActionPage } from '../../model/baseModel';
|
import {
|
OhterwarehousePageListGetResultModel,
|
OtherdwarehousePageParams,
|
OtherdwarehouseDetailPageParams,
|
OhterwarehouseDetailPageListGetResultModel,
|
OtherdwarehouseDetailSNPageParams,
|
OhterwarehouseDetailSNPageListGetResultModel,
|
} 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 getOhterwarehouseListByPage = async (params: OtherdwarehousePageParams) => {
|
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 (!isNullOrEmpty(params?.STATUS)) {
|
sqlcmd += " And STATUS = '" + params?.STATUS + "'";
|
}
|
|
let option ={
|
UserId:useUserStore().getUserInfo.userId as string,
|
ByOrg:true,
|
OrgCode:useUserStore().getUserInfo.orgCode as string
|
}
|
const usParams = genAction('BIZ_ERP_OTH_IN', {
|
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 getOhterwarehouseListByPageAsync(usParams);
|
// const rParams = genActionPage('BIZ_ERP_OTH_IN', sqlcmd, params.page, params.pageSize,option);
|
// return getOhterwarehouseListByPageAsync(rParams);
|
};
|
async function getOhterwarehouseListByPageAsync(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 getOhterwarehouseDetailListByPage = async (params: OtherdwarehouseDetailPageParams) => {
|
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 (!isNullOrEmpty(params?.LINESTATUS)) {
|
sqlcmd += " And LINESTATUS = '" + params?.LINESTATUS + "'";
|
}
|
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_OTH_IN_DTL', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: 'BILLLINE*1 '+order,
|
page: {
|
pageAble_T: 'string',
|
draw: 1,
|
pageIndex: params.page,
|
pageSize: params.pageSize,
|
},
|
option
|
},option);
|
return getOhterwarehouseDetailListByPageAsync(usParams);
|
} else {
|
const usParams = genAction('V_BIZ_ERP_OTH_IN_DTL', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
order: 'BILLLINE*1',
|
option
|
},option);
|
return getOhterwarehouseDetailListByPageAsync(usParams);
|
}
|
};
|
async function getOhterwarehouseDetailListByPageAsync(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 getOhterwarehouseDetailListByPageAsync(params: ApiActionPage) {
|
// const data = await defHttp.post<ApiActionPage>(
|
// { url: Api.EntityPageList, params },
|
// {
|
// isTransformResponse: false,
|
// },
|
// );
|
// const model: OhterwarehouseDetailPageListGetResultModel = {
|
// items: data.Data.data,
|
// total: data.Data.totals,
|
// };
|
// return model;
|
// }
|
|
//条码详情
|
export const getOhterwarehouseDetailSNListByPage = async (params: OtherdwarehouseDetailSNPageParams) => {
|
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 LIKE '%" + params?.ITEM_CODE + "%'";
|
}
|
if (params?.BILLCODE != undefined && params?.BILLCODE != '') {
|
sqlcmd += " And BUSINESSCODE LIKE '%" + params?.BILLCODE + "%'";
|
}
|
if (params?.SN != undefined && params?.SN != '') {
|
sqlcmd += " And SN LIKE '%" + 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
|
}
|
if (!isNullOrEmpty(params.page)) {
|
const usParams = genAction('BIZ_ERP_OTH_IN_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 getOhterwarehouseDetailSNListByPageAsync(usParams);
|
} else {
|
const usParams = genAction('BIZ_ERP_OTH_IN_SN', {
|
QueryAble_T: '',
|
where: sqlcmd,
|
option
|
},option);
|
//const rParams = genActionPage('V_BIZ_ERP_OTH_OUT_DTL', sqlcmd, params.page, params.pageSize,option);
|
return getOhterwarehouseDetailSNListByPageAsync(usParams);
|
}
|
};
|
async function getOhterwarehouseDetailSNListByPageAsync(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;
|
}
|
|
// export const SaveEnterWarehouse = async (params: FinishedwarehouseListItem, isUpdate: boolean) => {
|
// let data;
|
// if (isUpdate) {
|
// data = await defHttp.post(
|
// { url: Api.UpdateEntity, params: genAction('Minsun.WMS_RECEIPT_H', params) },
|
// {
|
// errorMessageMode: 'none',
|
// isTransformResponse: false,
|
// },
|
// );
|
// } else {
|
// params.ID = buildUUID(); //生成GUID
|
// data = await defHttp.post(
|
// { url: Api.AddEntity, params: genAction('Minsun.WMS_RECEIPT_H', params) },
|
// {
|
// errorMessageMode: 'none',
|
// isTransformResponse: false,
|
// },
|
// );
|
// }
|
// return data;
|
// };
|
|
// export const DeleteEnterWarehouse = async (params: Recordable) => {
|
// const usParams = genAction('Minsun.WMS_RECEIPT_H', [params]);
|
// return await defHttp.post(
|
// { url: Api.DeleteList, params: usParams },
|
// {
|
// errorMessageMode: 'none',
|
// isTransformResponse: false,
|
// },
|
// );
|
// };
|
|
|
// export const SaveEnterWarehouse = async (params: OtherwarehouseListItem, isUpdate: boolean) => {
|
// let data;
|
// if (isUpdate) {
|
// data = await defHttp.post(
|
// { url: Api.UpdateEntity, params: genAction('Minsun.WMS_RECEIPT_H', params) },
|
// {
|
// errorMessageMode: 'none',
|
// isTransformResponse: false,
|
// },
|
// );
|
// } else {
|
// params.ID = buildUUID(); //生成GUID
|
// data = await defHttp.post(
|
// { url: Api.AddEntity, params: genAction('Minsun.WMS_RECEIPT_H', params) },
|
// {
|
// errorMessageMode: 'none',
|
// isTransformResponse: false,
|
// },
|
// );
|
// }
|
// return data;
|
// };
|
|
// export const DeleteEnterWarehouse = async (params: Recordable) => {
|
// const usParams = genAction('Minsun.WMS_RECEIPT_H', [params]);
|
// return await defHttp.post(
|
// { url: Api.DeleteList, params: usParams },
|
// {
|
// errorMessageMode: 'none',
|
// isTransformResponse: false,
|
// },
|
// );
|
// };
|
//下拉列表
|
// STATUSs 单据状态
|
export const optionsOListApi = async (params: Recordable) => {
|
const usParams = genAction('BIZ_ERP_OTH_IN+STATUSs', '');
|
return await defHttp.post(
|
{ url: Api.urlQueryEnum, params: usParams },
|
{
|
errorMessageMode: 'none',
|
isTransformResponse: false,
|
// apiUrl: globSetting.taskApiUrl
|
},
|
);
|
};
|