Ben Lin
2024-08-28 0a8a3f71f2e50f0603077197d9b1971431a64b36
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
    },
  );
};