Ben Lin
2024-07-04 68d75a540ec8b3168c3af956ea00b898036d92cd
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
97
98
99
100
101
import { buildUUID } from '../../../utils/uuid';
import { ApiAction, ApiActionPage } from '../../model/baseModel';
import {
  InspectionListItem,
  InspectionPageListGetResultModel,
  InspectionPageParams,
} from '../model/warehoueseModel';
import { genAction, Api, genActionPage } from '../system';
import { useUserStore } from '/@/store/modules/user';
import { defHttp } from '/@/utils/http/axios';
 
/*
 * 获取送检单分页列表
 */
export const getInspectionListByPage = async (params: InspectionPageParams) => {
  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?.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_IQC', {
    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 getInspectionListByPageAsync(usParams);
};
async function getInspectionListByPageAsync(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 SaveInspection = async (params: InspectionListItem, isUpdate: boolean) => {
  let data;
  if (isUpdate) {
    data = await defHttp.post(
      { url: Api.UpdateEntity, params: genAction('Minsun.WMS_IQC_H', params) },
      {
        errorMessageMode: 'none',
        isTransformResponse: false,
      },
    );
  } else {
    params.ID = buildUUID(); //生成GUID
    data = await defHttp.post(
      { url: Api.AddEntity, params: genAction('Minsun.WMS_IQC_H', params) },
      {
        errorMessageMode: 'none',
        isTransformResponse: false,
      },
    );
  }
  return data;
};
export const setBasStatus = (params: any) =>
defHttp.post(
  { url: Api.UpdateEntity, params: genAction('BIZ_ERP_IQC', params) },
  {
    errorMessageMode: 'none',
    isTransformResponse: false,
  },
);
 
export const DeleteInspection = async (params: Recordable) => {
  const usParams = genAction('Minsun.WMS_IQC_H', [params]);
  return await defHttp.post(
    { url: Api.DeleteList, params: usParams },
    {
      errorMessageMode: 'none',
      isTransformResponse: false,
    },
  );
};