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
using BLL;
using BLL.DAL;
using BLL.IDAL;
using Common;
using Json;
using Lib;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using System.Web.Script.Serialization;
 
namespace wms.Areas.Business.Controllers
{
    public class IPalletMatOutAjaxController : AjaxPage
    {
        [LoginFilter]
        public ActionResult GetList()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<AjaxPalletMatOutList>(dd);
                if (models != null)
                {
                    PageInfo pageInfo = new PageInfo()
                    {
                        PageIndex = models.pageIndex,
                        PageSize = models.pageSize
                    };
                    models.DepartGuid = this.LoginDepartNum;
                    IDALPalletMatOut provider = new DALPalletMatOut();
                    List<PltOut> entity = provider.GetList(models, ref pageInfo).ToList();
 
                    string json = JsonHelper.IListToJson<PltOut>(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);
            }
        }
 
 
        [LoginFilter]
        public ActionResult PalletOut()
        {
            try
            {
                var dd = Request["ajaxdata"];
                var models = new JavaScriptSerializer().Deserialize<PalletMatOut>(dd);
                if (models == null)
                {
                    return Content(null);
                }
 
                int r = -1;
                DALPalletMatOut pmo = new DALPalletMatOut();
                if (!pmo.IsCanPalletOut(models.Palno, models.LocationCode))
                {
                    ReturnJson.AddProperty("Code", -1);
                    ReturnJson.AddProperty("Message", "请检查托盘是否存在或库位状态!");
 
                    return Content(this.ReturnJson.ToString());
                }
 
                // 验证托盘类型 A3高度托盘禁止出往C口
                if (models.AccessCode == "03") 
                {
                    if (models.Palno.Contains("A3")) 
                    {
                        ReturnJson.AddProperty("Code", -1);
                        ReturnJson.AddProperty("Message", "A3类型的托盘禁止出往C口!");
                        return Content(this.ReturnJson.ToString());
                    }
                }
 
                
                DALWMSApi dalWMSApi = new DALWMSApi();
                dalWMSApi.Send(models.Palno, models.LocationCode, models.AccessCode);
                // 插入改变出库库位状态
                //pub.InsertPicking("", models.Palno, models.LocationCode);
                DAL_Pub pub = new DAL_Pub();
                pub.UpdateLocationState(models.LocationCode, "04");
 
                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);
            }
        }
    }
 
}