From c77b53b6abb018cd4a9653e64d213e7caed4b8b4 Mon Sep 17 00:00:00 2001
From: DESKTOP-9BNTV8O <DESKTOP-9BNTV8O@163.com>
Date: 星期五, 13 十二月 2024 10:32:31 +0800
Subject: [PATCH] Merge branch 'master' of http://47.95.120.53:8083/r/JC23WMS-2

---
 Wms/WMS.BLL/BllTransServer/RcsServer.cs |  131 ++++++++++++++++++++++---------------------
 Wms/Model/InterFaceModel/RCSModel.cs    |    2 
 2 files changed, 68 insertions(+), 65 deletions(-)

diff --git a/Wms/Model/InterFaceModel/RCSModel.cs b/Wms/Model/InterFaceModel/RCSModel.cs
index eb932b5..6319c9d 100644
--- a/Wms/Model/InterFaceModel/RCSModel.cs
+++ b/Wms/Model/InterFaceModel/RCSModel.cs
@@ -28,7 +28,7 @@
         public class Pallnetmsg
         {
             /// <summary>
-            /// 鐩爣浣嶇疆锛堣澶囨墍鍦ㄤ綅缃級
+            /// 璁惧鎵�鍦ㄤ綅缃紙璧峰浣嶇疆/鐩爣浣嶇疆锛�
             /// </summary>
             public string Location { get; set; }
             /// <summary>
diff --git a/Wms/WMS.BLL/BllTransServer/RcsServer.cs b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
index 2570700..25b3176 100644
--- a/Wms/WMS.BLL/BllTransServer/RcsServer.cs
+++ b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
@@ -28,16 +28,16 @@
         /// <param name="warehouseno">搴撳尯</param>
         /// <param name="type">鍙枡绫诲瀷</param>
         /// <returns></returns>
-        public void GetPalletNo(Pallnetmsg pallnetmsg,string url)
+        public void GetPalletNo(Pallnetmsg model,string url)
         {
             DataStockDetail pallet = new DataStockDetail();
             try
             {
-                if (string.IsNullOrEmpty(pallnetmsg.Location))
+                if (string.IsNullOrEmpty(model.Location))
                 {
-                    throw new Exception("璁惧浣嶇疆涓嶅彲涓虹┖");
+                    throw new Exception("璁惧鎵�鍦ㄤ綅缃笉鍙负绌�");
                 }
-                var locatInfo = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == pallnetmsg.Location);
+                var locatInfo = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.Location);
                 if (locatInfo == null)
                 {
                     throw new Exception("璁惧鍌ㄤ綅淇℃伅涓嶅瓨鍦�");
@@ -46,7 +46,7 @@
                 var urlMes = "";//鍥炰紶MES鐨勬帴鍙e湴鍧�
                 var noticeno = "0";//鍑哄叆搴撳崟鎹槑缁咺D
                 var sql = "select PalletNo,LocatNo from DataStockDetail where Status = '0'";
-                switch (pallnetmsg.Type)
+                switch (model.Type)
                 {
                     case "0"://鍙噣妗�
                         sql += $"and WareHouseNo = '{house}' and (AreaNo like '%01' or AreaNo like '%11' or AreaNo like '%21' or AreaNo like '%31') and PalletStatus = '0' order by CreateTime desc";
@@ -59,7 +59,7 @@
                         break;
                     case "1"://鍙枡妗讹紙娣锋枡锛�
                         //鍒ゆ柇鏄惁鏈夋壒娆″彿
-                        if (string.IsNullOrWhiteSpace(pallnetmsg.LotNo))
+                        if (string.IsNullOrWhiteSpace(model.LotNo))
                         {
                             throw new Exception("鎵规鍙蜂负绌猴紒");
                         }
@@ -73,7 +73,7 @@
                         }
                         noticeno = ArriveMes.Id.ToString();*/
                         //鏌ユ壘搴撳瓨涓槸鍚︽湁鍙敤鐨勬鎵规鐨勬贩鏂欐《
-                        sql= $@"select PalletNo,LocatNo from DataStockDetail where LotNo = '{pallnetmsg.LotNo}'and  (AreaNo like '%02' or AreaNo like '%12' or AreaNo like '%22' or AreaNo like '%32')
+                        sql= $@"select PalletNo,LocatNo from DataStockDetail where LotNo = '{model.LotNo}'and  (AreaNo like '%02' or AreaNo like '%12' or AreaNo like '%22' or AreaNo like '%32')
                                    and WareHouseNo = '{house}' and status = '0' and PalletStatus = '1' order by CompleteTime desc";
                         pallet = Db.Ado.SqlQuery<DataStockDetail>(sql).FirstOrDefault();
                         if (pallet == null)
@@ -85,12 +85,12 @@
                     case "2"://鍙枡妗讹紙涓嬫枡锛�
                         BllExportNoticeDetail bllSo = new BllExportNoticeDetail();
                         //鍒ゆ柇鏄惁鏈夋壒娆″彿
-                        if (string.IsNullOrWhiteSpace(pallnetmsg.LotNo))
+                        if (string.IsNullOrWhiteSpace(model.LotNo))
                         {
                             throw new Exception("鎵规鍙蜂负绌猴紒");
                         }
                         //鏌ユ壘鏄惁鏈夋鎵规鍑哄簱鍗�
-                        sql = $"select * from BllExportNoticeDetail where LotNo =  '{pallnetmsg.LotNo}' order by CreateTime desc";
+                        sql = $"select * from BllExportNoticeDetail where LotNo =  '{model.LotNo}' order by CreateTime desc";
                         bllSo = Db.Ado.SqlQuery<BllExportNoticeDetail>(sql).FirstOrDefault();
                         if (bllSo == null)
                         {
@@ -98,7 +98,7 @@
                         }
                         noticeno = bllSo.Id.ToString();
                         //鏌ユ壘搴撳瓨涓槸鍚︽湁姝ゆ壒娆$殑鍚堟牸涓嬫枡妗�
-                        sql = $@"select PalletNo,LocatNo from DataStockDetail where LotNo = '{pallnetmsg.LotNo}'and (AreaNo like '%03' or AreaNo like '%13' or AreaNo like '%23' or AreaNo like '%33')
+                        sql = $@"select PalletNo,LocatNo from DataStockDetail where LotNo = '{model.LotNo}'and (AreaNo like '%03' or AreaNo like '%13' or AreaNo like '%23' or AreaNo like '%33')
                                     and WareHouseNo = '{house}' and status = '0' and PalletStatus = '2' and InspectStatus = '1' order by CompleteTime desc";
                         pallet = Db.Ado.SqlQuery<DataStockDetail>(sql).FirstOrDefault();
                         if (pallet == null)
@@ -135,9 +135,9 @@
                             //    var task2 = new TaskDetial
                             //    {
                             //        Startport = item.LocatNo,
-                            //        Endport = pallnetmsg.Location,
+                            //        Endport = model.Location,
                             //        Pallno = item.PalletNo,
-                            //        Type = pallnetmsg.Type,
+                            //        Type = model.Type,
                             //        Crtype = "1",
                             //        Noticedetailno = int.Parse(noticeno),
                             //    };
@@ -154,9 +154,9 @@
                             var task2 = new TaskDetial
                             {
                                 Startport = item.LocatNo,
-                                Endport = pallnetmsg.Location,
+                                Endport = model.Location,
                                 Pallno = item.PalletNo,
-                                Type = pallnetmsg.Type,
+                                Type = model.Type,
                                 Crtype = "1",
                                 Noticedetailno = int.Parse(noticeno),
                             };
@@ -171,12 +171,12 @@
                 var task = new TaskDetial
                 {
                     Startport = pallet.LocatNo,//璧峰浣嶇疆
-                    Endport = pallnetmsg.Location,//鐩爣浣嶇疆
+                    Endport = model.Location,//鐩爣浣嶇疆
                     Pallno = pallet.PalletNo,//妗跺彿
-                    Type = pallnetmsg.Type,//妗剁被鍨�
+                    Type = model.Type,//妗剁被鍨�
                     Crtype = "1",
                     Noticedetailno = int.Parse(noticeno),
-                    LotNo = pallnetmsg.LotNo,
+                    LotNo = model.LotNo,
                 };
                 CreateLotTask(task, url);
                 return;
@@ -184,7 +184,7 @@
             catch (Exception ex)
             {
                 Db.Ado.RollbackTran();
-                throw ex;
+                throw new Exception(ex.Message);
             }
         }
 
@@ -289,96 +289,99 @@
         /// </summary>
         /// <param name="PalletNo"></param>
         /// <returns></returns>
-        public void ApplyLocatNo(Pallnetmsg pallnetmsg,string url)
+        public void ApplyLocatNo(Pallnetmsg model,string url)
         {
             var sql = $"select LocatNo from SysStorageLocat where status = '0'";
             var sql2 = "";
-            var house = "W01";//鈥︹�﹀彨妗朵綅缃紝鍚庣画鏍规嵁浣嶇疆鍏宠仈鎴栧畾涔夛紝鏉ュ垽鏂彨妗朵綅缃墍灞炶溅闂�
+            var houseNo = "";//鐢宠鍌ㄤ綅璁惧鎵�鍦ㄨ溅闂寸紪鍙�
             var noticeno = "0";//鍑哄叆搴撳崟鎹槑缁咺D
-            SysStorageLocat loction = new SysStorageLocat();
-            BllArrivalNoticeDetail ArriveMes = new BllArrivalNoticeDetail();
+            SysStorageLocat loction = new SysStorageLocat();//鐩爣鍌ㄤ綅淇℃伅
+            BllArrivalNoticeDetail noticeDetail = new BllArrivalNoticeDetail();//鍏ュ簱鍗曟槑缁�
             try
             {
-                //鍖哄煙淇℃伅
-                var areaInfo = Db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode == pallnetmsg.Location);
-                house = areaInfo.WareHouseNo;//鎵�灞炰粨搴�
-                switch (pallnetmsg.Type)
+                //璁惧鎵�鍦ㄥ偍浣嶄俊鎭�
+                var deviceLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == model.LotNo);
+                if (deviceLocatInfo == null)
                 {
-                    case "0"://鍑�妗剁敵璇峰偍浣�
-                        sql += $"and (AreaNo like '%01' or AreaNo like '%11' or AreaNo like '%21' or AreaNo like '%31') and WareHouseNo = '{house}'";
+                    throw new Exception($"鏈煡璇㈠埌璇ヨ澶囨墍鍦ㄥ偍浣嶄俊鎭紝Location:{model.Location}");
+                }
+                houseNo = deviceLocatInfo.WareHouseNo;//璁惧鎵�灞炶溅闂�
+                switch (model.Type)
+                {
+                    case "3"://娓呮礂璁惧鐢宠鍌ㄤ綅锛堝噣妗剁敵璇峰偍浣嶏級
+                        sql += $" and (AreaNo like '%01' or AreaNo like '%11' or AreaNo like '%21' or AreaNo like '%31') and WareHouseNo = '{houseNo}'";
                         loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault();
                         if (loction == null)
                         {
-                            throw new Exception("搴撳唴鏆傛棤绌轰綑鍑�妗跺偍浣�");
+                            throw new Exception("璇ヨ溅闂村噣妗跺尯鏆傛棤绌轰綑鍌ㄤ綅");
                         }
                         break;
-                    case "1"://娣锋枡妗剁敵璇峰偍浣�
+                    case "0"://鎺ユ枡璁惧鐢宠鍌ㄤ綅锛堟贩鏂欐《鐢宠鍌ㄤ綅锛�
                         //鍒ゆ柇鏄惁鏈夋壒娆″彿
-                        if (string.IsNullOrWhiteSpace(pallnetmsg.LotNo))
+                        if (string.IsNullOrWhiteSpace(model.LotNo))
                         {
                             throw new Exception("鎵规鍙蜂负绌猴紒");
                         }
                         //鏍¢獙姝ゆ壒娆℃槸鍚︽湁鍏ュ簱鍗�
                         /*sql2 = $"select * from BllArrivalNoticeDetail where LotNo =  '{pallnetmsg.LotNo}' order by CreateTime desc";
-                        ArriveMes = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql).FirstOrDefault();
-                        if (ArriveMes == null)
+                        noticeDetail = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql).FirstOrDefault();
+                        if (noticeDetail == null)
                         {
                             throw new Exception("璇ユ壒娆℃病鏈夊搴旂殑鍏ュ簱鍗�");
                         }
-                        noticeno = ArriveMes.Id.ToString();*/
-                        sql += $"and (AreaNo like '%02' or AreaNo like '%12' or AreaNo like '%22' or AreaNo like '%32') and WareHouseNo = '{house}'";
+                        noticeno = noticeDetail.Id.ToString();*/
+                        sql += $" and (AreaNo like '%02' or AreaNo like '%12' or AreaNo like '%22' or AreaNo like '%32') and WareHouseNo = '{houseNo}'";
                         loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault();
                         if (loction == null)
                         {
-                            throw new Exception("搴撳唴鏆傛棤绌轰綑娣锋枡妗跺偍浣�");
+                            throw new Exception("璇ヨ溅闂撮娣峰尯鏆傛棤绌轰綑鍌ㄤ綅");
                         }
                         break;
-                    case "2"://鍗婃垚鍝佹《鐢宠鍌ㄤ綅
+                    case "1"://娣锋枡璁惧鐢宠鍌ㄤ綅锛堝崐鎴愬搧妗剁敵璇峰偍浣嶏級
                         //鍒ゆ柇鏄惁鏈夋壒娆″彿
-                        if (string.IsNullOrWhiteSpace(pallnetmsg.LotNo))
+                        if (string.IsNullOrWhiteSpace(model.LotNo))
                         {
                             throw new Exception("鎵规鍙蜂负绌猴紒");
                         }
                         //鏍¢獙姝ゆ壒娆℃槸鍚︽湁鍏ュ簱鍗�
-                        sql2 = $"select * from BllArrivalNoticeDetail where LotNo =  '{pallnetmsg.LotNo}' order by CreateTime desc";
-                        ArriveMes = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql2).FirstOrDefault();
-                        if (ArriveMes == null)
+                        sql2 = $"select * from BllArrivalNoticeDetail where LotNo =  '{model.LotNo}' order by CreateTime desc";
+                        noticeDetail = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql2).FirstOrDefault();
+                        if (noticeDetail == null)
                         {
                             throw new Exception("璇ユ壒娆℃病鏈夊搴旂殑鍏ュ簱鍗�");
                         }
-                        noticeno = ArriveMes.Id.ToString();
-                        sql += $"and (AreaNo like '%03' or AreaNo like '%13' or AreaNo like '%23' or AreaNo like '%33') and WareHouseNo = '{house}'";
+                        noticeno = noticeDetail.Id.ToString();
+                        sql += $" and (AreaNo like '%03' or AreaNo like '%13' or AreaNo like '%23' or AreaNo like '%33') and WareHouseNo = '{houseNo}'";
                         loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault();
                         if (loction == null)
                         {
-                            throw new Exception("搴撳唴鏆傛棤绌轰綑鍗婃垚鍝佹《鍌ㄤ綅");
+                            throw new Exception("璇ヨ溅闂村崐鎴愬搧鍖烘殏鏃犵┖浣欏偍浣�");
                         }
                         break;
-                    case "3"://鑴忔《鐢宠鍌ㄤ綅
-                        sql += $"and (AreaNo like '%04' or AreaNo like '%14' or AreaNo like '%24' or AreaNo like '%34') and WareHouseNo = '{house}'";
+                    case "2"://涓嬫枡璁惧鐢宠鍌ㄤ綅锛堣剰妗剁敵璇峰偍浣嶏級
+                        sql += $" and (AreaNo like '%04' or AreaNo like '%14' or AreaNo like '%24' or AreaNo like '%34') and WareHouseNo = '{houseNo}'";
                         loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault();
                         if (loction == null)
                         {
-                            throw new Exception("搴撳唴鏆傛棤绌轰綑鑴忔《鍌ㄤ綅");
+                            throw new Exception("璇ヨ溅闂磋剰妗跺尯鏆傛棤绌轰綑鍌ㄤ綅");
                         }
                         break;
                 }
                 var task = new TaskDetial
                 {
-                    Startport = pallnetmsg.Location,
+                    Startport = model.Location,
                     Endport = loction.LocatNo,
-                    Pallno = pallnetmsg.PalletNo,
-                    Type = pallnetmsg.Type,
+                    Pallno = model.PalletNo,
+                    Type = model.Type,
                     Crtype = "0",
                     Noticedetailno = int.Parse(noticeno),
-                    LotNo = pallnetmsg.LotNo,
+                    LotNo = model.LotNo,
                 };
                 CreateLotTask(task,url);
             }
-            catch (Exception)
+            catch (Exception ex)
             {
-
-                throw;
+                throw new Exception(ex.Message);
             }
         }
 
@@ -393,33 +396,33 @@
             {
                 //寮�鍚簨鍔�
                 Db.BeginTran();
-                var na = "";
+                var typeDesc = "";
                 switch (taskDetial.Crtype)
                 {
                     case "0":
-                        na = "鍏ュ簱";
+                        typeDesc = "鍏ュ簱";
                         break;
                     case "1":
-                        na = "鍑哄簱";
+                        typeDesc = "鍑哄簱";
                         break;
                     case "2":
-                        na = "绉诲簱";
+                        typeDesc = "绉诲簱";
                         break;
                 }
-                var bz = "";
+                var msg = "";
                 switch (taskDetial.Type)
                 {
                     case "0":
-                        bz = "鍑�妗�"+na+"浠诲姟";
+                        msg = "鍑�妗�"+ typeDesc + "浠诲姟";
                         break;
                     case "1":
-                        bz = "棰勬贩鏂欐《" + na + "浠诲姟";
+                        msg = "棰勬贩鏂欐《" + typeDesc + "浠诲姟";
                         break;
                     case "2":
-                        bz = "鍗婃垚鍝佹枡妗�" + na + "浠诲姟";
+                        msg = "鍗婃垚鍝佹枡妗�" + typeDesc + "浠诲姟";
                         break;
                     case "3":
-                        bz = "鑴忔《" + na + "浠诲姟";
+                        msg = "鑴忔《" + typeDesc + "浠诲姟";
                         break;
                 }
                 var sql = "";
@@ -475,7 +478,7 @@
                     OrderType = ordertype,//鍗曟嵁绫诲瀷 0 鍏ュ簱 1 鍑哄簱 3鍏朵粬
                     Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚
                     NoticeDetailNo = int.Parse(taskDetial.Noticedetailno.ToString()),
-                    Msg = bz, //鍏抽敭淇℃伅
+                    Msg = msg, //鍏抽敭淇℃伅
                 };
 
                 #region 鍛煎彨灏忚溅浠g爜

--
Gitblit v1.8.0