王 垚
2022-09-26 e4e1d2b2c1f13cd89514e59eb42fc50f1332262e
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers
{
    /**
     * 找货单单
     */
    public class LookingForBillController : ApiController
    {
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        public WebServer webserver = new WebServer();
 
 
        /// <summary>
        /// 根据包装单 返回此包装单内的相关信息
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/getPackUnionBillList")]
        [HttpGet]
        public object getPackUnionBillList(string HBarCode_Pack)
        {
            try
            {
                ds = getPackUnionBillList_s(HBarCode_Pack);
                if (ds == null || Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "扫码成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 根据实物条码验证状态
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/getPackUnionBillListDetailed")]
        [HttpGet]
        public object getPackUnionBillListDetailed(string HBarCode)
        {
            try
            {
                ds = getPackUnionBillListDetailed_s(HBarCode);
                if (ds == null || Pub_Class.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString();
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 下架找货单根据销售订单 返回此销售订单内的相关信息
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/getSellOrderList")]
        [HttpGet]
        public object getSellOrderList(string HSourceBillNo)
        {
            try
            {
                ds = getSellOrderList_s(HSourceBillNo);
                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 = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 上架归还单根据实物条码 返回相关信息
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/getBarCodeDetails")]
        [HttpGet]
        public object getBarCodeDetails(string HBarCode)
        {
            try
            {
                string sWhere = " Where HBarCode = '" + HBarCode.Trim() + "'";
                ds = getBarCodeDetails_s(sWhere);
                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 = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 生成下架找货单
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/set_SaveLookingForBill_Json")]
        [HttpPost]
        public object set_SaveLookingForBill_Json([FromBody] JObject oMain)
        {
            string oMainData = oMain["oMain"].ToString();
            string HJiaYe = oMain["HJiaYe"].ToString();
            oMainData = oMainData.Substring(8, oMainData.Length - 9);
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            try
            {
                ListModels oListModels = new ListModels();
                List<LookingForBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LookingForBill>>(oMainData);
                //保存人员
                string saveGroupEmpsql = $"exec h_p_saveGroupEmp '{list[0].HMaker}','{list[0].HGroupID}',{HJiaYe.Split(',')[0]},{HJiaYe.Split(',')[1]},'{HJiaYe}'";
                oCN.RunProc(saveGroupEmpsql);
                oCN.BeginTran();
                //var mainSql1 = "Insert Into Kf_LookingForReturnBillMain " +
                //    "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HCreateBy)" +
                //    " values" +
                //    "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HSourceInterID + ",'" + list[0].HSourceBillNo + "','" + list[0].HMaker + "')";
                var mainSql = "Insert Into Kf_LookingForBillMain " +
                    "(HInterID,HBillNo,HSourceInterID,HSourceBillNo,HWhID,HWhName,HSPID,HSPName,HGroupID,HGroup" +
                    ",HSourceID,HSource,HCreateBy,HJiaYe)" +
                    " values" +
                    "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HSourceInterID + ",'" + list[0].HSourceBillNo + "'," + list[0].HWHID + ",'" + list[0].HWHName + "'," + list[0].HSPID + ",'" + list[0].HSPName + "'," + list[0].HGroupID + ",'" + list[0].HGroup + "',"
                    + list[0].HSourceID + ",'" + list[0].HSource + "','" + list[0].HMaker + "','" + HJiaYe + "')";
                oCN.RunProc(mainSql);
                for (int i = 0; i < list.Count; i++)
                {
                    var subSql = "Insert Into Kf_LookingForBillSub " +
                    "(HWHID,HWHName,HSPID,HSPName,HMTONo,HQty,HMaterID,HMaterName,HMaterNumber,HMaterModel,HBarCode,HGroupID,HGroup,HSourceID,HSource,HCreateBy,HMainItemID)" +
                    " values" +
                    "(" + list[i].HWHID + ",'" + list[i].HWHName + "'," + list[i].HSPID + ",'" + list[i].HSPName + "','" + list[i].HMTONo + "'," + list[i].HQty + ","
                    + list[i].HMaterID + ",'" + list[i].HMaterName + "','" + list[i].HMaterNumber + "','" + list[i].HMaterModel + "','" + list[i].HBarCode + "',"
                    + list[i].HGroupID + ",'" + list[i].HGroup + "'," + list[i].HSourceID + ",'" + list[i].HSource + "','" + list[i].HMaker + "',(select HItemID from Kf_LookingForBillMain where HBillNo = '" + list[i].HBillNo + "'))";
                    oCN.RunProc(subSql);
                    var barCodeSql = "update Gy_BarCodeBill set HStatus='裁切中-" + list[i].HSource + "' where HBarCode = '" + list[i].HBarCode + "'";
                    oCN.RunProc(barCodeSql);
                }
                oCN.Commit();
                //反写金蝶销售订单的找货组和找货时间
                oCN.RunProc("exec h_p_IFCLD_DataBackToSeOrderFindGoodsTime " + list[0].HInterID);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "生成找货单成功!单据号为:" + list[0].HBillNo;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 生成上架归还单
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/set_SaveLookingForReturnBill_Json")]
        [HttpPost]
        public object set_SaveLookingForReturnBill_Json([FromBody] JObject oMain)
        {
            string oMainData = oMain["oMain"].ToString();
            oMainData = oMainData.Substring(8, oMainData.Length - 9);
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            try
            {
                List<LookingForBill> lsmain = new List<LookingForBill>();
                ListModels oListModels = new ListModels();
                List<LookingForBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LookingForBill>>(oMainData);
                string flag = "";
                oCN.BeginTran();
                var mainSql = "Insert Into Kf_LookingForReturnBillMain " +
                    "(HInterID,HBillNo,HWhID,HWhName,HSPID,HSPName,HGroupID,HGroup" +
                    ",HSourceID,HSource,HCreateBy)" +
                    " values" +
                    "(" + list[0].HInterID + ",'" + list[0].HBillNo + "'," + list[0].HWHID + ",'" + list[0].HWHName + "'," + list[0].HSPID + ",'" + list[0].HSPName + "'," + list[0].HGroupID + ",'" + list[0].HGroup + "',"
                    + list[0].HSourceID + ",'" + list[0].HSource + "','" + list[0].HMaker + "')";
                oCN.RunProc(mainSql);
                for (int i = 0; i < list.Count; i++)
                {
                    var subSql = "Insert Into Kf_LookingForReturnBillSub " +
                    "(HWHID,HWHName,HSPID,HSPName,HMTONo,HQty,HMaterID,HMaterName,HMaterNumber,HMaterModel,HBarCode,HGroupID,HGroup,HSourceID,HSource,HCreateBy,HMainItemID)" +
                    " values" +
                    "(" + list[i].HWHID + ",'" + list[i].HWHName + "'," + list[i].HSPID + ",'" + list[i].HSPName + "','" + list[i].HMTONo + "'," + list[i].HQty + ","
                    + list[i].HMaterID + ",'" + list[i].HMaterName + "','" + list[i].HMaterNumber + "','" + list[i].HMaterModel + "','" + list[i].HBarCode + "',"
                    + list[i].HGroupID + ",'" + list[i].HGroup + "'," + list[i].HSourceID + ",'" + list[i].HSource + "','" + list[i].HMaker + "',(select HItemID from Kf_LookingForReturnBillMain where HBillNo = '" + list[i].HBillNo + "'))";
                    oCN.RunProc(subSql);
                    var barCodeSql = "update Gy_BarCodeBill set HStatus='" + list[i].HSPName + "-" + list[i].HWHName + "' where HBarCode = '" + list[i].HBarCode + "'";
                    oCN.RunProc(barCodeSql);
                    //判断是否是托条码
                    if (JudgeIsBarCode_s(list[i].HBarCode))
                    {
                        //如果是托条码更新托条码中的实物条码
                        //返回托条码中的实物条码
                        ds = GetHBarCode_s(list[i].HBarCode);
                        int HCount = Pub_Class.ClsPub.isInt(ds.Tables[0].Rows.Count);
                        for (int j = 0; j < HCount; j++)
                        {
                            string HSonBarCode = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[j][0]);
                            var SonBarCodeSql = "update Gy_BarCodeBill set HStatus='" + list[i].HSPName + "-" + list[i].HWHName + "' where HBarCode = '" + HSonBarCode + "'";
                            oCN.RunProc(SonBarCodeSql);
                        }
                    }
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "生成归还单成功!单据号为:" + list[0].HBillNo;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "上传失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 根据仓位二维码带出仓库仓位相关信息
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/getSpName_Json")]
        [HttpGet]
        public object getSpName_Json(string HBarCode)
        {
            try
            {
                string[] sArray = HBarCode.Remove(0, 3).Split(';');
                long HSpID = DBUtility.ClsPub.isLong(sArray[1]);
                long HWHID = DBUtility.ClsPub.isLong(sArray[0]);
                string sWhere = " Where HWHID = " + HWHID + " and HItemID = " + HSpID + "";
                ds = getSpName_Json_s(sWhere);
                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 = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 启用mes仓位,根据老仓库转换成新仓库
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/GetSpNameMES_Json")]
        [HttpGet]
        public object GetSpNameMES_Json(string HERPWHID)
        {
            try
            {
                ds = GetSpNameMES_Json_s(HERPWHID);
                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 = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        /// <summary>
        /// 待发区找货根据源单号 返回相关信息
        /// </summary>
        /// <returns></returns>
        //[Route("LookingFor/getWaitingLookingFor")]
        //[HttpGet]
        //public object GetWaitingLookingFor(string HBillType,string HBillNo,string HSourceBillNo,string HCreateBy,string BenginHCreateDate,string EndHCreateDate)
        //{
        //    try
        //    {
        //        ds = GetWaitingLookingFor_s(HBillType, HBillNo, HSourceBillNo, HCreateBy, BenginHCreateDate, EndHCreateDate);
        //        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 = "1";
        //            objJsonResult.count = 1;
        //            objJsonResult.Message = "返回记录成功!";
        //            objJsonResult.data = ds.Tables[0];
        //            return objJsonResult;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        objJsonResult.code = "0";
        //        objJsonResult.count = 0;
        //        objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
        //        objJsonResult.data = null;
        //        return objJsonResult;
        //    }
        //}
 
        /// <summary>
        /// 上下架单列表
        /// </summary>
        /// <returns></returns>
        [Route("LookingFor/GetLookingForBillList")]
        [HttpGet]
        public object GetLookingForBillList(string HBillType, string sWhere)
        {
            try
            {
                if (HBillType == "ZHXJ")
                {
                    ds = GetLookingForBillListXJ_s(sWhere);
                }
                else if (HBillType == "ZHSJ")
                {
                    ds = GetLookingForBillListSJ_s(sWhere);
                }
                else
                {
                    ds = GetLookingForBillList_s(sWhere);
                }
                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 = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        //销售出库源单查货-根据销售订单查找实物所在库位
        [Route("LookingFor/GetSellOutFindSP")]
        [HttpGet]
        public object GetSellOutFindSP(string HbillNo)//h_p_Xs_SellOutFindSP
        {
            try
            {
                ds = GetSellOutFindSP_s(HbillNo);
                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 = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
 
        #region sql语句
 
        public static DataSet getPackUnionBillList_s(string HBarCode_Pack)
        {
            return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Kf_getPackUnionBillList " + "'" + HBarCode_Pack + "'", "h_p_Kf_getPackUnionBillList");
        }
 
        public static DataSet getPackUnionBillListDetailed_s(string HBarCode)
        {
            return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Kf_getPackUnionBillListDetailed " + "'" + HBarCode + "'", "h_p_Kf_getPackUnionBillListDetailed");
        }
 
        public static DataSet getSellOrderList_s(string HSourceBillNo)
        {
            //同步销售订单
            new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO '" + HSourceBillNo + "'", "h_p_IFCLD_ERPSourceBillToLocal_SEOrderToICMO");
            string sWhere = " Where HSourceBillNo = '" + HSourceBillNo.Trim() + "'";
            return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_getSellOrderList_s " + sWhere, "h_v_getSellOrderList_s");
        }
 
        public static DataSet getBarCodeDetails_s(string sWhere)
        {
            return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_getBarCodeDetails_s " + sWhere, "h_v_getBarCodeDetails_s");
        }
 
        //根据仓位二维码带出仓库仓位相关信息
        public static DataSet getSpName_Json_s(string sWhere)
        {
            return new SQLHelper.ClsCN().RunProcReturn("select HWHID,* from h_v_IF_StockPlace " + sWhere, "h_v_IF_StockPlace");
        }
 
        //启用mes仓位,根据老仓库转换成新仓库
        public static DataSet GetSpNameMES_Json_s(string HERPWHID)
        {
            return new SQLHelper.ClsCN().RunProcReturn("select HMESWHID,HMESWHNAME from Gy_ERPWHRelationMESWH where HERPWHID = " + HERPWHID + "", "Gy_ERPWHRelationMESWH");
        }
 
        //下架找货单列表
        public static DataSet GetLookingForBillListXJ_s(string sWhere)
        {
            return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_lookForBillListXJ ", "h_v_lookForBillListXJ");
        }
 
        //上架归还单列表
        public static DataSet GetLookingForBillListSJ_s(string sWhere)
        {
            return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_lookForBillListSJ ", "h_v_lookForBillListSJ");
        }
 
        //上下架单列表
        public static DataSet GetLookingForBillList_s(string sWhere)
        {
            return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_lookForBillList where 1 = 1 " + sWhere, "h_v_lookForBillList");
        }
 
        //判断是否是托条码
        public static bool JudgeIsBarCode_s(string HBarCode)
        {
            DataSet ds;
            ds = new SQLHelper.ClsCN().RunProcReturn("Select HBarCodeType from Gy_BarCodeBill WITH (NOLOCK) Where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill");
            if (Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) == "托盘条码")
                return true;
            else
            {
                return false;
            }
        }
 
        //返回托条码中的实物条码
        public static DataSet GetHBarCode_s(string HBarCode)
        {
            return new SQLHelper.ClsCN().RunProcReturn("select HBarCode from Sc_PackUnionBillMain a inner join Sc_PackUnionBillSub b on a.HInterID = b.HInterID Where a.HBarCode_Pack = '" + HBarCode + "'", "Sc_PackUnionBillMain");
        }
 
        //根据销售订单查找实物所在库位
        public static DataSet GetSellOutFindSP_s(string HbillNo)
        {
            return new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Xs_SellOutFindSP '" + HbillNo + "'", "h_p_Xs_SellOutFindSP");
        }
 
        //测试专用接口
        [Route("LookingFor/Test")]
        [HttpGet]
        public object Test(string HbillNo)//h_p_Xs_SellOutFindSP
        {
            DataSet ds;
            ds = new SQLHelper.ClsCN().RunProcReturn("EXEC h_p_Xs_SellOutFindSP '" + HbillNo + "'", "h_p_Xs_SellOutFindSP");
 
            if (Pub_Class.ClsPub.isLong(ds.Tables[0].Rows.Count) >= 0)
            {
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "true!";
                objJsonResult.data = ds.Tables[0];//ds.Tables[0].Rows[1][0]
                return objJsonResult;
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "false!";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
 
 
        #endregion
 
    }
}