bklLiudl
2024-07-23 277bbae216debe7e6c04e8cc6ee6e1ba9763e14b
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
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
using BLL;
using Common;
using Model;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web.Script.Serialization;
using Json;
using Lib;
using System.Web.Mvc;
 
namespace WMS.Areas.Business.Controllers
{
    public class ErpInAjaxController : AjaxPage
    {
        // GET: Business/ErpInAjax
        public ActionResult GetErpInList()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<AjaxErpInList>(dd);
 
                if (models != null)
                {
                    DALErpIn provider = new DALErpIn();
                    PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
                    models.DepartGuid = this.LoginDepartNum;
                    List<Erp> entity = provider.GetList(models, ref pageInfo).ToList();
 
                    Session["TEMPDATA_CACHE_INSTORDETAIL"] = entity;
                    string json = JsonHelper.IListToJson<Erp>(entity, "List");
                    string pjson = ConvertJson.Serializer(pageInfo);
 
                    ReturnJson.AddProperty("Result", new JsonObject(json));
                    ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "响应成功");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult SelMatNos()
        {
            try
            {
                var guid = Request["aaa"];
                if (!string.IsNullOrEmpty(guid))
                {
                    List<ErpDetails> matList = new List<ErpDetails>();
                    // 判断缓存内是否包含此物料
                    if (Session["SEL_ERPIN_LIST"] != null)
                    {
                        matList = Session["SEL_ERPIN_LIST"] as List<ErpDetails>;
                        foreach (ErpDetails details in matList)
                        {
                            if (details.MatGuid == guid)
                            {
                                return Content(null);
                            }
                        }
                    }
                    else
                    {
                        Session["SEL_ERPIN_LIST"] = new List<ErpDetails>();
                    }
 
                    // 将物料编码添加到Session中
                    IDALMatNo provider = new DALMatNo();
                    Material matModel = provider.GetModel(guid);
                    ErpDetails newDetail = new ErpDetails
                    {
                        MatGuid = matModel.Guid,
                        MatNo = matModel.MatNo,
                        MatName = matModel.MatName,
                        MatType = matModel.MatType,
                        MatTypeId = matModel.MatTypeId
                    };
 
                    matList.Add(newDetail);
                    Session["SEL_ERPIN_LIST"] = matList;
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult EmptySession()
        {
            Session["SEL_ERPIN_LIST"] = null;
            return Content(null);
        }
 
        public ActionResult GetMatNos()
        {
            try
            {
                if (Session["SEL_ERPIN_LIST"] == null)
                {
                    return Content(null);
                }
 
                List<ErpDetails> matList = Session["SEL_ERPIN_LIST"] as List<ErpDetails>;
                string json = JsonHelper.IListToJson<ErpDetails>(matList, "List");
 
                ReturnJson.AddProperty("Result", new JsonObject(json));
                ReturnJson.AddProperty("Code", 1);
                ReturnJson.AddProperty("Message", "响应成功");
 
                return Content(this.ReturnJson.ToString());
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult IsCheckMatNo()
        {
            var Guid = Request["aaa"];
            try
            {
                if (!string.IsNullOrEmpty(Guid))
                {
                    DALErpIn provider = new DALErpIn();
                    if (!provider.IsExist(Guid))
                    {
                        ReturnJson.AddProperty("Code", 1);
                        ReturnJson.AddProperty("Message", "盘点出库指令已下发!");
                    }
                    else
                    {
                        return Content(null);
                    }
                }
 
                return Content(this.ReturnJson.ToString());
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult AddMat()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<ErpDetails>(dd);
 
                if (models != null)
                {
                    if (Session["SEL_ERPIN_LIST"] == null)
                    {
                        Session["SEL_ERPIN_LIST"] = new List<ErpDetails>();
                    }
 
                    List<ErpDetails> list = Session["SEL_ERPIN_LIST"] as List<ErpDetails>;
                    if (!list.IsEmpty())
                    {
                        foreach (ErpDetails detail in list)
                        {
                            if (detail.MatGuid == models.MatGuid)
                            {
                                models.guid = detail.guid;
                                list.Remove(detail);
                                break;
                            }
                        }
                    }
 
                    list.Add(models);
                    Session["SEL_ERPIN_LIST"] = list;
 
                    string json1 = JsonHelper.IListToJson<ErpDetails>(list, "List");
                    ReturnJson.AddProperty("Result", new JsonObject(json1));
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "响应成功");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult Add()
        {
            try
            {
                var dd = Request["entity"];
                var models = new JavaScriptSerializer().Deserialize<Erp>(dd);
                if (models != null)
                {
                    List<ErpDetails> list = Session["SEL_ERPIN_LIST"] as List<ErpDetails>;
                    if (list == null)
                    {
                        return Content(null);
                    }
                    models.DepartGuid = this.LoginDepartNum;
                    models.CreateUser = this.LoginUserCode;
                    models.Statu = "01";
 
                    // 验证入库单明细物料信息
                    foreach (ErpDetails detail in list)
                    {
                        if (string.IsNullOrEmpty(detail.LingNo) ||
                            string.IsNullOrEmpty(detail.CurQuant) ||
                            string.IsNullOrEmpty(detail.MatNo))
                        {
                            ReturnJson.AddProperty("Code", -1);
                            ReturnJson.AddProperty("Message", "物料信息缺失!");
                            return Content(this.ReturnJson.ToString());
                        }
                    }
 
                    DALErpIn dalErp = new DALErpIn();
                    if (string.IsNullOrEmpty(models.OrdNo))
                    {
                        if (dalErp.Add(models, list))
                        {
                            Session["SEL_ERPIN_LIST"] = null;
                            ReturnJson.AddProperty("Code", 1);
                            ReturnJson.AddProperty("Message", "添加订单成功");
                        }
                        else
                        {
                            ReturnJson.AddProperty("Code", -1);
                            ReturnJson.AddProperty("Message", "添加订单失败");
                        }
                    }
                    else
                    {
                        if (dalErp.Update(models, list))
                        {
                            Session["SEL_ERPIN_LIST"] = null;
                            ReturnJson.AddProperty("Code", 1);
                            ReturnJson.AddProperty("Message", "编辑订单成功");
                        }
                        else
                        {
                            ReturnJson.AddProperty("Code", -1);
                            ReturnJson.AddProperty("Message", "编辑订单失败");
                        }
                    }
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult DelProduct()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<ErpDetails>(dd);
 
                if (!string.IsNullOrEmpty(models.MatGuid))
                {
                    List<ErpDetails> listMat = Session["SEL_ERPIN_LIST"] as List<ErpDetails>;
 
                    for (int i = listMat.Count - 1; i >= 0; i--)
                    {
                        if (listMat[i].MatGuid == models.MatGuid)
                        {
                            if (!string.IsNullOrEmpty(listMat[i].guid))
                            {
                                DALErpIn dALErpIn = new DALErpIn();
                                dALErpIn.DelOrdDetail(listMat[i].guid);
                            }
 
                            listMat.Remove(listMat[i]);
                        }
                    }
 
                    Session["SEL_ERPIN_LIST"] = listMat;
                    string json1 = JsonHelper.IListToJson<ErpDetails>(listMat, "List");
                    ReturnJson.AddProperty("Result", new JsonObject(json1));
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "删除物料成功");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult CheckOrdStatus()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<Erp>(dd);
 
                if (models != null)
                {
                    IDALErpIn provider = new DALErpIn();
                    Erp entity = provider.GetModel(models.OrdNo);
 
                    if (entity.Statu == "等待执行")
                    {
                        ReturnJson.AddProperty("Code", 1);
                        ReturnJson.AddProperty("Message", "入库单可编辑");
                    }
                    else
                    {
                        ReturnJson.AddProperty("Code", -1);
                        ReturnJson.AddProperty("Message", "入库单状态已改变,不可编辑,请刷新页面");
                    }
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult GetDetail()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<AjaxErpInList>(dd);
 
                if (models != null)
                {
                    if (string.IsNullOrEmpty(models.OrdNo))
                    {
                        return Content(null);
                    }
 
                    models.DepartGuid = this.LoginDepartNum;
                    PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
                    DALErpInDetail detail = new DALErpInDetail();
                    List<ErpDetails> entity = detail.GetList(models).ToList();
 
                    Session["SEL_ERPIN_LIST"] = entity;
                    string json = JsonHelper.IListToJson<ErpDetails>(entity, "List");
                    string pjson = ConvertJson.Serializer(pageInfo);
 
                    ReturnJson.AddProperty("Result", new JsonObject(json));
                    ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "响应成功");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult GetMatNo()
        {
            try
            {
                var matNo = Request["aaa"];
                if (!string.IsNullOrEmpty(matNo))
                {
                    DALErpIn dALErpIn = new DALErpIn();
                    ErpDetails MatItem = dALErpIn.GetMatNo(matNo);
                    string json = JsonHelper.ObjectToJson<ErpDetails>(MatItem, "Mat");
                    ReturnJson.AddProperty("Result", new JsonObject(json));
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "查询成功!");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult GetDetails()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<AjaxErpInList>(dd);
 
                if (models != null)
                {
                    PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
 
                    DALErpInDetail detail = new DALErpInDetail();
                    models.DepartGuid = this.LoginDepartNum;
                    List<ErpDetails> entity = detail.GetList(models, ref pageInfo).ToList();
                    string json = JsonHelper.IListToJson<ErpDetails>(entity, "List");
                    string pjson = ConvertJson.Serializer(pageInfo);
 
                    ReturnJson.AddProperty("Result", new JsonObject(json));
                    ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "响应成功");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult Delete()
        {
            try
            {
                string dd = Request["list"];
                ArrayList models = new JavaScriptSerializer().Deserialize<ArrayList>(dd);
                string[] list = (string[])models.ToArray(typeof(string));
 
                if (models != null)
                {
                    IDALErpIn dalErp = new DALErpIn();
                    if (dalErp.DeleteOrdNo(list))
                    {
                        ReturnJson.AddProperty("Code", 1);
                        ReturnJson.AddProperty("Message", "删除订单成功");
                    }
                    else
                    {
                        ReturnJson.AddProperty("Code", 1);
                        ReturnJson.AddProperty("Message", "删除订单失败");
                    }
 
                    return Content(this.ReturnJson.ToString());
                }
 
                return Content(null);
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
        public ActionResult Init()
        {
            try
            {
                Session["TEMPDATA_CACHE_INSTORDETAIL"] = null;
                List<ErpMat> list = new List<ErpMat>();
                string json = JsonHelper.IListToJson<ErpMat>(list, "List");
                ReturnJson.AddProperty("Result", new JsonObject(json));
                ReturnJson.AddProperty("Code", 1);
                ReturnJson.AddProperty("Message", "响应成功");
                return Content(this.ReturnJson.ToString());
            }
            catch (Exception ex)
            {
                WriteFileLog(ex.Message.ToString(), System.Reflection.MethodBase.GetCurrentMethod());
                return Content(null);
            }
        }
 
 
 
 
 
 
 
        // GET: Business/ErpInAjax
        public ActionResult LoadDetail()
        {
            var dd = Request["ajaxdata"];
 
            var models = new JavaScriptSerializer().Deserialize<AjaxErpInInfo>(dd);
            if (models != null)
            {
 
                List<ErpMat> list = Session["TEMPDATA_CACHE_INSTORDETAIL"] as List<ErpMat>;
 
                PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
 
                list = list.IsEmpty() ? new List<ErpMat>() : list;
 
                pageInfo.RowCount = list.Count;
 
                list = list.IsEmpty() ? new List<ErpMat>() : ((from u in list
                                                               select u).Skip(pageInfo.PageSize * (pageInfo.PageIndex - 1)).Take(pageInfo.PageSize)).ToList();
 
 
                string json = JsonHelper.IListToJson<ErpMat>(list, "List");
                string pjson = ConvertJson.Serializer(pageInfo);
 
                ReturnJson.AddProperty("Result", new JsonObject(json));
                ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
                ReturnJson.AddProperty("Code", 1);
                ReturnJson.AddProperty("Message", "响应成功");
                ReturnJson.AddProperty("SubCode", 0);
                ReturnJson.AddProperty("SubMessage", "");
                return Content(this.ReturnJson.ToString());
            }
            return Content(null);
        }
        /// <summary>
        /// 获取物料下托盘和货位存放位置
        /// </summary>      
        /// <returns></returns>
        public ActionResult Getposition()
        {
            var OrdNo = Request["OrdNo"];
            var MatNo = Request["MatNo"];
 
            if (MatNo != null)
            {
 
                DALErpInDetail position = new DALErpInDetail();
                List<ErpMat> entity = position.Getposition(OrdNo, MatNo).ToList();//,ref pageInfo
                string json = JsonHelper.IListToJson<ErpMat>(entity, "List");
 
 
                ReturnJson.AddProperty("Result", new JsonObject(json));
                ReturnJson.AddProperty("Code", 1);
                ReturnJson.AddProperty("Message", "响应成功");
                ReturnJson.AddProperty("SubCode", 0);
                ReturnJson.AddProperty("SubMessage", "");
 
                return Content(this.ReturnJson.ToString());
            }
 
            return Content(null);
        }
        // GET: Business/ErpInAjax
        public ActionResult AddProduct()
        {
            var dd = Request["Entity"];
 
            var models = new JavaScriptSerializer().Deserialize<ErpMat>(dd);
 
            if (models != null)
            {
                List<ErpMat> list = Session["TEMPDATA_CACHE_INSTORDETAIL"] as List<ErpMat>;
 
                if (!list.IsEmpty())
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        ///< summary >
                        /// 如果物料编码相同则删除保存最新列
                        /// </ summary >
                        if (list[i].Palno == null)
                        {
                            list[i].Palno = "";
                        }
                        if (list[i].MatNo == models.MatNo/*&& list[i].Palno==models.Palno*/)
                        {
                            list.Remove(list[i]);
                            i--;
                        }
                    }
                    list.Add(models);
                    Session["TEMPDATA_CACHE_INSTORDETAIL"] = list;
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "响应成功");
                    ReturnJson.AddProperty("SubCode", 0);
                    ReturnJson.AddProperty("SubMessage", "");
 
                }
                else
                {
                    list = new List<ErpMat>();
                    list.Add(models);
                    Session["TEMPDATA_CACHE_INSTORDETAIL"] = list;
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "响应成功");
                    ReturnJson.AddProperty("SubCode", 0);
                    ReturnJson.AddProperty("SubMessage", "");
                }
 
                return Content(this.ReturnJson.ToString());
 
 
            }
            return Content(null);
        }
        public ActionResult Audite()
        {
            string dd = Request["ajaxdata"];
            if (dd != null)
            {
                var models = new JavaScriptSerializer().Deserialize<AjaxErpInInfo>(dd);
                ArrayList Matlist = new JavaScriptSerializer().Deserialize<ArrayList>(models.list);
                string[] list = (string[])Matlist.ToArray(typeof(string));
 
                IDALErpIn dalErp = new DALErpIn();
 
                bool value = false;
 
                value = dalErp.UpdateAudit(list, models.Operation, LoginUserCode);
                if (value)
                {
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "删除订单成功");
                }
                else
                {
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "删除订单失败");
                }
 
                ReturnJson.AddProperty("SubCode", 0);
                ReturnJson.AddProperty("SubMessage", "");
 
                return Content(this.ReturnJson.ToString());
 
 
            }
            return Content(null);
        }
        /// <summary>
        /// 入库单关单
        /// </summary>
        /// <returns></returns>
        public ActionResult Close()
        {
            string ordNo = Request["list"];
 
            // 验证单据状态
            DALErpIn provider = new DALErpIn();
            Erp entity = provider.GetModel(ordNo);
            if (entity.Statu == "正在执行")
            {
                #region 处理组盘信息
                // 判断是否存在正在执行的指令
                if (!provider.IsIpallets(ordNo))
                {
                    ReturnJson.AddProperty("Code", 0);
                    ReturnJson.AddProperty("Message", "存在执行中的任务指令,请先处理任务指令。");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                // 删除未执行的组盘信息
                provider.DelIpallets(ordNo);
                #endregion
 
                // 修改入库单状态
                bool bl = provider.UpdateClose(new string[] { ordNo }, "ER03");
                if (bl)
                {
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "关闭入库单成功");
                }
                else
                {
                    ReturnJson.AddProperty("Code", 1);
                    ReturnJson.AddProperty("Message", "关闭入库单失败");
                }
            }
            else
            {
                ReturnJson.AddProperty("Code", 0);
                ReturnJson.AddProperty("Message", "入库单状态已改变,不可关单。");
            }
 
            return Content(this.ReturnJson.ToString());
        }
        public ActionResult GetErpInDetail()
        {
            var dd = Request["ajaxdata"];
 
            var models = new JavaScriptSerializer().Deserialize<AjaxPurchaseMat>(dd);
 
            if (models != null)
            {
                PageInfo pageInfo = new PageInfo() { PageIndex = models.pageIndex, PageSize = models.pageSize };
 
                IDALPurchaseDetail detail = new DALPurchaseDetail();
                List<PurchaseMat> entity = detail.GetList(models, ref pageInfo).ToList();
 
                string json = JsonHelper.IListToJson<PurchaseMat>(entity, "List");
                string pjson = ConvertJson.Serializer(pageInfo);
 
                ReturnJson.AddProperty("Result", new JsonObject(json));
                ReturnJson.AddProperty("PageInfo", new JsonObject(pjson));
                ReturnJson.AddProperty("Code", 1);
                ReturnJson.AddProperty("Message", "响应成功");
                ReturnJson.AddProperty("SubCode", 0);
                ReturnJson.AddProperty("SubMessage", "");
 
                return Content(this.ReturnJson.ToString());
            }
            return Content(null);
 
        }
        ///<summary>
        ///托盘下拉框查询
        /// </summary>
        public ActionResult BindOption()
        {
            string Addre = Request["ajaxdata"];
            try
            {
                //DALErpIn addre = new DALErpIn();
                //List<ErpMat> entity = addre.GetList(Addre).ToList();
                //string json = JsonHelper.IListToJson<ErpMat>(entity,"list");
 
                // ReturnJson.AddProperty("Palno", new JsonObject(json));
                ReturnJson.AddProperty("Palno", LocalHelper.GetPalnoList(Addre, ""));
                return Json(this.ReturnJson.ToString());
 
 
            }
            catch (System.Exception)
            {
                return Content(null);
 
            }
        }
        public ActionResult AddIPalletBind()
        {
            string dd = Request["ajaxdata"];
            if (dd != null)
            {
                var models = new JavaScriptSerializer().Deserialize<AddPallet>(dd);
                DALErpIn dalErp = new DALErpIn();
 
                string messAgeStr = dalErp.AddIPalletBind(models.PalletNo, models.OrdNo, this.LoginUserCode, this.LoginDepartNum);
 
                ReturnJson.AddProperty("Code", 1);
                ReturnJson.AddProperty("Message", messAgeStr);
 
                return Content(this.ReturnJson.ToString());
            }
 
            return Content(null);
        }
    }
}