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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
using DAL;
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI;
using WebAPI.Models;
using WebAPI.Service;
 
namespace WebAPI.Controllers
{
    public class WEBSController : ApiController
    {
        public string sWhere = "";
        public WebServer webserver = new WebServer();
        public DataSet ds = new DataSet();
        private json objjson = new json();
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
        public WebS.WebService1 oWebs = new WebS.WebService1();
        public WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
 
 
 
        #region 提交生单处理方法
 
 
        #endregion
 
 
        #region 源单条码处理方法
 
        #region 生产入库    扫描源单条码
 
        /// <summary>
        /// 生产入库    扫描源单条码
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_SourceBarCode_ProductIn_Json")]
        [HttpGet]
        public object get_SourceBarCode_ProductIn_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                WebSoBar = oWebs.get_SourceBarCode_ProductIn(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = WebSoBar;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描源单条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
        #region 生产领料    扫描源单条码
 
 
        #endregion
 
        #region 销售出库    扫描源单条码
 
        /// <summary>
        /// 销售出库    扫描源单条码
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_SourceBarCode_SellOut_Json")]
        [HttpGet]
        public object get_SourceBarCode_SellOut_Json(Int64 HInterID, string HBillNo, string HBillType, string HSourceBillNo, string HSourceBillType, string HMaker, Int64 HFIFOWhID, Int64 HOWNERID)
        {
            try
            {
                WebSoBar = oWebs.get_SourceBarCode_SellOut(HInterID, HBillNo, HBillType, HSourceBillNo, HSourceBillType, HMaker, HFIFOWhID, HOWNERID, ref DBUtility.ClsPub.sErrInfo);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = WebSoBar;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描源单条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
        #region 委外出库    扫描源单条码
 
 
        #endregion
 
        #region 直接调拨    扫描源单条码
 
 
        #endregion
 
        #region 分步式调出    扫描源单条码
 
 
        #endregion
 
        #region 分步式调入    扫描源单条码
 
 
        #endregion
 
        #endregion
 
 
        #region 物料条码处理方法
 
        /// <summary>
        /// 物料条码文本框 扫码调用
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/Get_BarCode_Json")]
        [HttpGet]
        public Object get_BarCode_Json(string sBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockOrgID, string HScanStyle, string HCustom1, string HCustom2)
        {
            try
            {
                WebSoBar = oWebs.get_BarCode(sBarCode, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HStockOrgID, HScanStyle, HCustom1, HCustom2, ref DBUtility.ClsPub.sErrInfo);
                if (WebSoBar == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = WebSoBar;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
 
        #region 单据新增模块  获取单据列表信息处理方法
 
        /// <summary>
        /// 获取单据列表信息
        /// </summary>
        /// <returns></returns>
        [Route("WEBSController/GetBillEntryTmpList_Json")]
        [HttpGet]
        public object GetBillEntryTmpList(long HInterID, string HBillNo, string HBillType, Int64 HStockOrgID, string sMouldManagerCtl, string sFIFOCtl)
        {
            try
            {
                string sSimpleMode = "N";  //是否启用扫码简易模式,只显示已扫码源单记录(Y,N)
                string sReturn = "";
 
                //获取系统参数
                if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sReturn) == true)
                {
                    //判断是否启用器具管理(Y,N)
                    if (oSystemParameter.omodel.WMS_MouldManagerCtl == "Y")   //启用模治具管理
                    {
                        sMouldManagerCtl = "Y";
                    }
 
                    //判断是否启用先进先出管理(Y,N),是否启用扫码简易模式,只显示已扫码源单记录(Y,N)
                    if (HBillType == "1204")   //生产领料单
                    {
                        if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList == "Y")   //生产领料单-先进先出控制
                        {
                            sFIFOCtl = "Y";
                        }
                        if (oSystemParameter.omodel.Kf_MateOutBill_SimpleMode == "Y")   //生产领料单-扫码简易模式
                        {
                            sSimpleMode = "Y";
                        }
                    }
                    else if (HBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList == "Y"))   //销售出库单-先进先出控制
                    {
                        sFIFOCtl = "Y";
                    }
                    else if (HBillType == "1211" && (oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_EntrustOutBill_FIFOList == "Y"))   //委外出库单-先进先出控制
                    {
                        sFIFOCtl = "Y";
                    }
                    else if (HBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList == "Y"))   //直接调拨单-先进先出控制
                    {
                        sFIFOCtl = "Y";
                    }
                    else if (HBillType == "1250" && (oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOList == "Y"))   //分步式调出单-先进先出控制
                    {
                        sFIFOCtl = "Y";
                    }
 
                    DataSet ds = oCn.RunProcReturn("exec h_p_WMS_BillEntryTmpList_LayUI " + HInterID.ToString() + ",'" + HBillType + "','" + sMouldManagerCtl + "','" + sFIFOCtl + "','" + sSimpleMode + "'", "h_p_WMS_BillEntryTmpList_LayUI");
 
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    foreach (DataColumn col in ds.Tables[0].Columns)
                    {
                        Type dataType = col.DataType;
                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                    }
 
                    if (ds == null || ds.Tables[0].Rows.Count <= 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "没有返回任何记录!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "获取信息成功!";
                        objJsonResult.data = ds;
                        objJsonResult.list = columnNameList;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";返回物料明细列表时获取系统参数失败! " + sReturn;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "获取列表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
 
        #region 处理方法
 
 
        #endregion
 
 
 
 
    }
}