From 6c3738d337fe68c2008b38ad58861aa4b48d5530 Mon Sep 17 00:00:00 2001
From: DESKTOP-9BNTV8O <DESKTOP-9BNTV8O@163.com>
Date: 星期五, 13 十二月 2024 14:46:40 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/BllTransServer/RcsServer.cs    |   75 ++++++------
 Wms/WMS.BLL/BllTransServer/NoticeServer.cs |  211 +++++++++++++---------------------
 Wms/WMS.IBLL/IBllTransServer/IRcsServer.cs |    4 
 Wms/Model/InterFaceModel/HttpModel.cs      |    1 
 Wms/Wms/Controllers/DownApiController.cs   |   38 ++----
 5 files changed, 136 insertions(+), 193 deletions(-)

diff --git a/Wms/Model/InterFaceModel/HttpModel.cs b/Wms/Model/InterFaceModel/HttpModel.cs
index 8c6af90..b294bc9 100644
--- a/Wms/Model/InterFaceModel/HttpModel.cs
+++ b/Wms/Model/InterFaceModel/HttpModel.cs
@@ -850,6 +850,7 @@
     {
         public string code { get; set; }
         public string message { get; set; }
+        public string data { get; set; }
         public string reqCode { get; set; }
     }
     #endregion
diff --git a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
index 78fd9f2..59d0c0c 100644
--- a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
+++ b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs
@@ -175,25 +175,7 @@
                 {
                     #region 鍏ュ簱瀹屾垚
                     case "0":
-                        //鍏ュ簱鍗曟槑缁嗕俊鎭�
-                        var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo);
-                        if (noticeDetail == null)
-                        {
-                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曟槑缁嗕笉瀛樺湪!";
-                            return resultModel;
-                        }
-                        //鍏ュ簱鍗曚俊鎭�
-                        var notice = Db.Queryable<BllArrivalNotice>().First(w => w.ASNNo == noticeDetail.ASNNo);
-                        if (notice == null)
-                        {
-                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曚笉瀛樺湪!";
-                            return resultModel;
-                        }
-                        if (notice.Status == "3" || notice.Status == "4")
-                        {
-                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曞凡鎵ц瀹屾垚!";
-                            return resultModel;
-                        }
+                        
                         //鐩爣鍌ㄤ綅淇℃伅
                         var locatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0");
                         if (locatInfo == null)
@@ -201,51 +183,13 @@
                             resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!";
                             return resultModel;
                         }
+
                         //搴撳瓨鏄庣粏
                         var sd1 = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == taskInfo.PalletNo);
                         if (sd1 == null)
                         {
-                            sd1 = new DataStockDetail()
-                            {
-                                LotNo = noticeDetail.LotNo,
-                                LotText = noticeDetail.LotText,
-                                SupplierLot = noticeDetail.SupplierLot,
-                                SkuNo = noticeDetail.SkuNo,
-                                SkuName = noticeDetail.SkuName,
-                                Standard = noticeDetail.Standard,
-                                Qty = 1,
-                                LockQty = 0,
-                                FrozenQty = 0,
-                                InspectQty = 0,
-                                ASNNo = noticeDetail.ASNNo,
-                                ASNDetailNo = noticeDetail.Id,
-                                WareHouseNo = locatInfo.WareHouseNo,//鎵�灞炰粨搴�
-                                RoadwayNo = locatInfo.RoadwayNo,//鎵�灞炲贩閬�
-                                AreaNo = locatInfo.AreaNo,//鎵�灞炲尯鍩�
-                                LocatNo = locatInfo.LocatNo,//鍌ㄤ綅鍦板潃
-                                PalletNo = taskInfo.PalletNo,
-                                PalletNo2 = "",
-                                PalletNo3 = "",
-                                PalletTags = "0",
-                                CompleteTime = comTime,
-                                ProductionTime = null,
-                                ExpirationTime = null,
-                                Status = "0",
-                                InspectMark = "0",
-                                InspectStatus = "0",//寰呮楠�
-                                BitPalletMark = "0",
-                                PackagNo = "",
-                                IsBale = "0",
-                                IsBelt = "0",
-
-                                PalletStatus = "2",
-
-                                IsDel = "0",
-                                CreateUser = 0,
-                                CreateTime = comTime
-                            };
-                            //鎻掑叆搴撳瓨鏄庣粏
-                            Db.Insertable(sd1).ExecuteCommand();
+                            resultModel.Message = $"璇ユ《瀵瑰簲鐨勫簱瀛樹俊鎭笉瀛樺湪锛屾《鍙凤細{taskInfo.PalletNo}!";
+                            return resultModel;
                         }
                         else
                         {
@@ -253,8 +197,6 @@
                             sd1.LockQty = 0;
                             sd1.FrozenQty = 0;
                             sd1.InspectQty = 0;
-                            sd1.ASNNo = noticeDetail.ASNNo;
-                            sd1.ASNDetailNo = noticeDetail.Id;
                             sd1.WareHouseNo = locatInfo.WareHouseNo;//鎵�灞炰粨搴�
                             sd1.RoadwayNo = locatInfo.RoadwayNo;//鎵�灞炲贩閬�
                             sd1.AreaNo = locatInfo.AreaNo;//鎵�灞炲尯鍩�
@@ -266,37 +208,53 @@
                             //淇敼搴撳瓨鏄庣粏
                             Db.Updateable(sd1).ExecuteCommand();
                         }
-
-                        noticeDetail.CompleteQty += 1;//瀹屾垚鏁伴噺
-                        noticeDetail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
-                        if (noticeDetail.CompleteQty >= noticeDetail.Qty)
-                        {
-                            noticeDetail.Status = "2";
-                            noticeDetail.CompleteTime = comTime;
-                        }
-                        noticeDetail.UpdateUser = 0;
-                        noticeDetail.UpdateTime = comTime;
-                        //鏇存柊鍏ュ簱鍗曟槑缁�
-                        Db.Updateable(noticeDetail).ExecuteCommand();
-
-                        notice.UpdateUser = 0;
-                        notice.UpdateTime = comTime;
-                        if (notice.Status == "0")
-                        {
-                            notice.Status = "1";
-                        }
-                        var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.ASNNo == noticeDetail.ASNNo && m.Status != "2");
-                        if (asnDetailNum == 0)
-                        {
-                            notice.Status = "2";
-                            notice.CompleteTime = comTime;//瀹屾垚鏃堕棿
-                        }
-                        //鏇存柊鍏ュ簱鍗�
-                        Db.Updateable(notice).ExecuteCommand();
-
                         locatInfo.Status = "1";//鏈夌墿鍝�
                         //鏇存柊鍌ㄤ綅鐘舵��
                         Db.Updateable(locatInfo).ExecuteCommand();
+
+                        //鍏ュ簱鍗曟槑缁嗕俊鎭�
+                        var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo);
+                        if (noticeDetail != null)
+                        {
+                            //鍏ュ簱鍗曚俊鎭�
+                            var notice = Db.Queryable<BllArrivalNotice>().First(w => w.ASNNo == noticeDetail.ASNNo);
+                            if (notice == null)
+                            {
+                                resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曚笉瀛樺湪!";
+                                return resultModel;
+                            }
+                            if (notice.Status == "3" || notice.Status == "4")
+                            {
+                                resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曞凡鎵ц瀹屾垚!";
+                                return resultModel;
+                            }
+                            noticeDetail.CompleteQty += 1;//瀹屾垚鏁伴噺
+                            noticeDetail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴�
+                            if (noticeDetail.CompleteQty >= noticeDetail.Qty)
+                            {
+                                noticeDetail.Status = "2";
+                                noticeDetail.CompleteTime = comTime;
+                            }
+                            noticeDetail.UpdateUser = 0;
+                            noticeDetail.UpdateTime = comTime;
+                            //鏇存柊鍏ュ簱鍗曟槑缁�
+                            Db.Updateable(noticeDetail).ExecuteCommand();
+
+                            notice.UpdateUser = 0;
+                            notice.UpdateTime = comTime;
+                            if (notice.Status == "0")
+                            {
+                                notice.Status = "1";
+                            }
+                            var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.ASNNo == noticeDetail.ASNNo && m.Status != "2");
+                            if (asnDetailNum == 0)
+                            {
+                                notice.Status = "2";
+                                notice.CompleteTime = comTime;//瀹屾垚鏃堕棿
+                            }
+                            //鏇存柊鍏ュ簱鍗�
+                            Db.Updateable(notice).ExecuteCommand();
+                        }
 
                         #region 璐ㄦ璇烽獙锛屽幓鎺塎ES
                         //var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == noticeDetail.SkuNo && m.LotNo == noticeDetail.LotNo && m.SupplierLot == noticeDetail.SupplierLot);
@@ -394,25 +352,7 @@
 
                     #region 鍑哄簱瀹屾垚
                     case "1":
-                        //鍑哄簱鍗曟槑缁嗕俊鎭�
-                        var exNoticeDetail = Db.Queryable<BllExportNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo);
-                        if (exNoticeDetail == null)
-                        {
-                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曟槑缁嗕笉瀛樺湪!";
-                            return resultModel;
-                        }
-                        //鍑哄簱鍗曚俊鎭�
-                        var exNotice = Db.Queryable<BllExportNotice>().First(w => w.SONo == exNoticeDetail.SONo);
-                        if (exNotice == null)
-                        {
-                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曚笉瀛樺湪!";
-                            return resultModel;
-                        }
-                        if (exNotice.Status == "4" || exNotice.Status == "5")
-                        {
-                            resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曞凡鎵ц瀹屾垚!";
-                            return resultModel;
-                        }
+
                         //璧峰鍌ㄤ綅淇℃伅
                         var startLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0");
                         if (startLocatInfo == null)
@@ -427,24 +367,6 @@
                             resultModel.Message = "搴撳瓨淇℃伅涓嶅瓨鍦�!";
                             return resultModel;
                         }
-                        //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲�
-                        exNoticeDetail.CompleteQty += sd2.Qty;
-                        Db.Updateable(exNoticeDetail).ExecuteCommand();
-
-                        exNotice.UpdateUser = 0;
-                        exNotice.UpdateTime = comTime;
-                        if (exNotice.Status == "0" || exNotice.Status == "1" || exNotice.Status == "2")
-                        {
-                            exNotice.Status = "3";//鏇存敼涓烘鍦ㄦ墽琛�
-                        }
-                        var num = Db.Queryable<BllExportNoticeDetail>().Count(m => m.IsDel == "0" && m.SONo == exNoticeDetail.SONo && m.CompleteQty < m.Qty);
-                        if (num <= 0)
-                        {
-                            exNotice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴�                            
-                        }
-                        //淇敼鍑哄簱鍗曚俊鎭�
-                        Db.Updateable(exNotice).ExecuteCommand();
-
                         sd2.Qty = 0;
                         sd2.LockQty = 0;
                         sd2.FrozenQty = 0;
@@ -462,7 +384,40 @@
                         startLocatInfo.Status = "0";//绌哄偍浣�
                         //淇敼璧峰鍌ㄤ綅鐘舵��
                         Db.Updateable(startLocatInfo).ExecuteCommand();
+                        //鍑哄簱鍗曟槑缁嗕俊鎭�
+                        var exNoticeDetail = Db.Queryable<BllExportNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo);
+                        if (exNoticeDetail != null)
+                        {
+                            //鍑哄簱鍗曚俊鎭�
+                            var exNotice = Db.Queryable<BllExportNotice>().First(w => w.SONo == exNoticeDetail.SONo);
+                            if (exNotice == null)
+                            {
+                                resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曚笉瀛樺湪!";
+                                return resultModel;
+                            }
+                            if (exNotice.Status == "4" || exNotice.Status == "5")
+                            {
+                                resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曞凡鎵ц瀹屾垚!";
+                                return resultModel;
+                            }
+                            exNotice.UpdateUser = 0;
+                            exNotice.UpdateTime = comTime;
+                            if (exNotice.Status == "0" || exNotice.Status == "1" || exNotice.Status == "2")
+                            {
+                                exNotice.Status = "3";//鏇存敼涓烘鍦ㄦ墽琛�
+                            }
+                            var num = Db.Queryable<BllExportNoticeDetail>().Count(m => m.IsDel == "0" && m.SONo == exNoticeDetail.SONo && m.CompleteQty < m.Qty);
+                            if (num <= 0)
+                            {
+                                exNotice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴�                            
+                            }
+                            //淇敼鍑哄簱鍗曚俊鎭�
+                            Db.Updateable(exNotice).ExecuteCommand();
 
+                            //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲�
+                            exNoticeDetail.CompleteQty += sd2.Qty;
+                            Db.Updateable(exNoticeDetail).ExecuteCommand();
+                        }                        
                         break;
                     #endregion
 
@@ -492,7 +447,7 @@
                             sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//鎵�灞炲贩閬�
                             sd3.AreaNo = endLocatInfo2.AreaNo;//鎵�灞炲尯鍩�
                             sd3.LocatNo = endLocatInfo2.LocatNo;//鍌ㄤ綅鍦板潃
-                            if (endLocatInfo2.AreaNo.Contains("01"))//娲佸噣鍖�
+                            if (endLocatInfo2.AreaNo.Contains("01"))//鍑�妗跺尯
                             {
                                 sd3.PalletStatus = "0";                               
                             }
diff --git a/Wms/WMS.BLL/BllTransServer/RcsServer.cs b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
index 2d43b3c..1576fe2 100644
--- a/Wms/WMS.BLL/BllTransServer/RcsServer.cs
+++ b/Wms/WMS.BLL/BllTransServer/RcsServer.cs
@@ -28,7 +28,7 @@
         /// <param name="warehouseno">搴撳尯</param>
         /// <param name="type">鍙枡绫诲瀷</param>
         /// <returns></returns>
-        public void GetPalletNo(Pallnetmsg model,string url)
+        public void GetPalletNo(Pallnetmsg model,string url,out string taskNo)
         {
             DataStockDetail pallet = new DataStockDetail();
             try
@@ -63,15 +63,6 @@
                         {
                             throw new Exception("鎵规鍙蜂负绌猴紒");
                         }
-                        /*BllArrivalNoticeDetail ArriveMes = new BllArrivalNoticeDetail();
-                        //鍒ゆ柇璇ユ壒娆℃槸鍚︽湁瀵瑰簲鍏ュ簱鍗�
-                        sql = $"select * from BllArrivalNoticeDetail where LotNo =  '{pallnetmsg.LotNo}' order by CreateTime desc";
-                        ArriveMes = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql).FirstOrDefault();
-                        if (ArriveMes == null)
-                        {
-                            throw new Exception("璇ユ壒娆℃病鏈夊搴旂殑鍏ュ簱鍗�");
-                        }
-                        noticeno = ArriveMes.Id.ToString();*/
                         //鏌ユ壘搴撳瓨涓槸鍚︽湁鍙敤鐨勬鎵规鐨勬贩鏂欐《
                         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";
@@ -160,7 +151,7 @@
                                 Crtype = "1",
                                 Noticedetailno = int.Parse(noticeno),
                             };
-                            CreateLotTask(task2, url);
+                            CreateLotTask(task2, url, out taskNo);
                             return;
                         }
                         break;
@@ -178,7 +169,7 @@
                     Noticedetailno = int.Parse(noticeno),
                     LotNo = model.LotNo,
                 };
-                CreateLotTask(task, url);
+                CreateLotTask(task, url, out taskNo);
                 return;
             }
             catch (Exception ex)
@@ -232,7 +223,8 @@
                         Crtype = "2",
                         Noticedetailno = 0,
                     };
-                    CreateLotTask(ztask,url);
+                    string taskNo = "";
+                    CreateLotTask(ztask, url, out taskNo);
 
                     statrtLocat.Status = "3";//鍑哄簱涓�
                     //淇敼璧峰鍌ㄤ綅鐘舵��
@@ -276,7 +268,8 @@
                     Noticedetailno = 0,
                     LotNo = "",
                 };
-                CreateLotTask(task,url);
+                string taskNo = "";
+                CreateLotTask(task,url, out taskNo);
             }
             catch (Exception ex)
             {
@@ -289,7 +282,7 @@
         /// </summary>
         /// <param name="PalletNo"></param>
         /// <returns></returns>
-        public void ApplyLocatNo(Pallnetmsg model,string url)
+        public void ApplyLocatNo(Pallnetmsg model,string url, out string taskNo)
         {
             var sql = $"select LocatNo from SysStorageLocat where status = '0'";
             var sql2 = "";
@@ -369,7 +362,7 @@
                     Noticedetailno = int.Parse(noticeno),
                     LotNo = model.LotNo,
                 };
-                CreateLotTask(task,url);
+                CreateLotTask(task, url, out taskNo);
             }
             catch (Exception ex)
             {
@@ -382,7 +375,7 @@
         /// </summary>
         /// <param name="req"></param>
         /// <returns></returns>
-        public void CreateLotTask(TaskDetial taskDetial,string url)
+        public void CreateLotTask(TaskDetial taskDetial,string url,out string taskNo)
         {
             try
             {
@@ -422,6 +415,20 @@
                         msg = "鑴忔《" + typeDesc + "浠诲姟";
                         break;
                 }
+                #region 鍌ㄤ綅淇℃伅
+                //璧峰鍌ㄤ綅鍦板潃淇℃伅
+                var startLoction = Db.Queryable<SysStorageLocat>().First(w => w.IsDel=="0" && w.LocatNo == taskDetial.Startport);
+                if (startLoction == null)
+                {
+                    throw new Exception($"璧峰鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦紝妗跺彿锛歿taskDetial.Startport}");
+                }
+                //鐩爣鍌ㄤ綅鍦板潃淇℃伅
+                var endLoction = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == taskDetial.Endport);
+                if (endLoction == null)
+                {
+                    throw new Exception($"鐩爣鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦紝妗跺彿锛歿taskDetial.Endport}");
+                }
+                #endregion
                 var sql = "";
                 var sql2 = "";
                 var ordertype = "3";
@@ -477,6 +484,7 @@
                     NoticeDetailNo = int.Parse(taskDetial.Noticedetailno.ToString()),
                     Msg = msg, //鍏抽敭淇℃伅
                 };
+                taskNo = logTaskEntry.TaskNo;
 
                 #region 鍛煎彨灏忚溅浠g爜
                 List<AgvSchedulingTask> agvTaskList = new List<AgvSchedulingTask>();
@@ -487,14 +495,12 @@
                 path1.positionCode = taskDetial.Startport;
                 if (taskDetial.Crtype == "1")//鍙《锛堟《鍑哄簱锛�
                 {
-                    path1.type = "00";
+                    path1.type = "05";
                 }
                 else//鐢宠鍌ㄤ綅锛堟《鍏ュ簱锛�
                 {
                     path1.type = "05";
                 }
-                
-
                 pahtList.Add(path1);
 
                 //鐩爣浣嶇疆
@@ -506,10 +512,10 @@
                 }
                 else//鐢宠鍌ㄤ綅锛堟《鍏ュ簱锛�
                 {
-                    path2.type = "00";
+                    path2.type = "05";
                 }
-
                 pahtList.Add(path2);
+
                 //涓嬭溅浠诲姟鍗�
                 AgvSchedulingTask agvTask = new AgvSchedulingTask();
                 agvTask.reqCode = logTaskEntry.TaskNo;//浠诲姟鍙�
@@ -518,7 +524,7 @@
                 agvTask.wbCode = "";
                 agvTask.positionCodePath = pahtList;//灏忚溅璺緞
                 agvTask.podCode = "";
-                agvTask.userCallCode = taskDetial.Endport;//鐩爣浣嶇疆
+                agvTask.userCallCode = "";//taskDetial.Endport;//鐩爣浣嶇疆
                 if (taskDetial.Crtype == "1")//鍙《锛堟《鍑哄簱锛�
                 {
                     agvTask.taskTyp = "Z3";//浠诲姟绫诲瀷 绾胯竟鍒版墭鐩樻敹闆嗗櫒 Z1锛� 鎵樼洏鍨涚敵璇峰叆搴� Z2
@@ -550,23 +556,14 @@
                         //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬�
                         logTaskEntry.IsSuccess = 1;
                         logTaskEntry.BackDate = DateTime.Now;
-                        logTaskEntry.Status = "1";
-                        if (taskDetial.Crtype == "0" || taskDetial.Crtype == "2")
-                        {
-                            sql = $"UPDATE SysStorageLocat SET Status = '2' where LocatNo = '{taskDetial.Endport}'";
-                            if (taskDetial.Type == "2")
-                            {
-                                sql2 = $"UPDATE DataStockDetail SET PalletStatus = '{taskDetial.Type}'" +
-                                $"where PalletNo = '{taskDetial.Pallno}'";
-                                Db.Ado.ExecuteCommand(sql2);
-                            }
-                        }
-                        else
-                        {
-                            sql = $"UPDATE SysStorageLocat SET Status = '3' where LocatNo = '{taskDetial.Startport}' ";
-                        }
+                        logTaskEntry.Status = "1";                        
                         Db.Insertable(logTaskEntry).ExecuteCommand();
-                        Db.Ado.ExecuteCommand(sql);
+
+                        startLoction.Status = "3";//鍑哄簱涓�
+                        Db.Updateable(startLoction).ExecuteCommand();
+
+                        endLoction.Status = "2";//鍏ュ簱涓�
+                        Db.Updateable(endLoction).ExecuteCommand();
                     }
                     if (agvModel.Code == "1")
                     {
diff --git a/Wms/WMS.IBLL/IBllTransServer/IRcsServer.cs b/Wms/WMS.IBLL/IBllTransServer/IRcsServer.cs
index cabe10d..de12641 100644
--- a/Wms/WMS.IBLL/IBllTransServer/IRcsServer.cs
+++ b/Wms/WMS.IBLL/IBllTransServer/IRcsServer.cs
@@ -14,7 +14,7 @@
         /// <param name="warehouseno">搴撳尯</param>
         /// <param name="type">鍙枡绫诲瀷</param>
         /// <returns></returns>
-        public void GetPalletNo(Pallnetmsg pallnetmsg, string url);
+        public void GetPalletNo(Pallnetmsg pallnetmsg, string url, out string taskNo);
 
         /// <summary>
         /// 灏嗗噣妗舵敼涓鸿剰妗跺苟鎷夊埌鑴忔《鍖�
@@ -34,6 +34,6 @@
         /// </summary>
         /// <param name="PalletNo"></param>
         /// <returns></returns>
-        public void ApplyLocatNo(Pallnetmsg pallnetmsg, string url);
+        public void ApplyLocatNo(Pallnetmsg pallnetmsg, string url ,out string taskNo);
     }
 }
diff --git a/Wms/Wms/Controllers/DownApiController.cs b/Wms/Wms/Controllers/DownApiController.cs
index d422a58..830a24a 100644
--- a/Wms/Wms/Controllers/DownApiController.cs
+++ b/Wms/Wms/Controllers/DownApiController.cs
@@ -658,7 +658,6 @@
         public IActionResult GetPalletNo(Pallnetmsg pallmsg)
         {
             var logStr = $@".\log\AGV\AGV鐢宠鍙《" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
-            var result = new ErpModel { Success = -1, Message = "", };
             try
             {
                 var jsonData = JsonConvert.SerializeObject(pallmsg);
@@ -666,25 +665,21 @@
 
                 if (string.IsNullOrWhiteSpace(pallmsg.Location))
                 {
-                    result.Message = "鍙枡浣嶇疆涓虹┖锛�";
-                    return Ok(result);
+                    return Ok(new AgvResultModel { code = "1", message = "鍙枡浣嶇疆涓虹┖锛�", data = "", reqCode = "" });
                 }
                 if (string.IsNullOrWhiteSpace(pallmsg.Type))
                 {
-                    result.Message = "浠诲姟绫诲瀷涓虹┖锛�";
-                    return Ok(result);
+                    return Ok(new AgvResultModel { code = "1", message = "浠诲姟绫诲瀷涓虹┖锛�", data = "", reqCode = "" });
                 }
-                _rcsserver.GetPalletNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
-                result.Success = 0;
-                result.Message = "鍙《鎴愬姛锛�";
-                return Ok(result);
+                string taskNo = "";
+                _rcsserver.GetPalletNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask, out taskNo);
+                return Ok(new AgvResultModel { code = "0", message = "鍙《鎴愬姛", data = taskNo, reqCode = "" });
             }
             catch (Exception e)
             {
                 LogFile.SaveLogToFile($"AGV鐢宠鍙《寮傚父锛�( {e.Message} ),", logStr);
 
-                result.Message = e.Message;
-                return Ok(result);
+                return Ok(new AgvResultModel { code = "1", message = e.Message, data = "", reqCode = "" });
             }
         }
         /// <summary>
@@ -758,7 +753,6 @@
         {
             var logStr = $@".\log\AGV\AGV鐢宠鍌ㄤ綅" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
 
-            var result = new ErpModel { Success = -1, Message = "" };
             try
             {
                 var jsonData = JsonConvert.SerializeObject(pallmsg);
@@ -766,30 +760,26 @@
 
                 if (string.IsNullOrWhiteSpace(pallmsg.Location))
                 {
-                    result.Message = "鐢宠浣嶇疆涓虹┖锛�";
-                    return Ok(result);
+                    return Ok(new AgvResultModel { code = "1", message = "鐢宠浣嶇疆涓虹┖锛�", data = "", reqCode = "" });
                 }
                 if (string.IsNullOrWhiteSpace(pallmsg.Type))
                 {
-                    result.Message = "浠诲姟绫诲瀷涓虹┖锛�";
-                    return Ok(result);
+                    return Ok(new AgvResultModel { code = "1", message = "浠诲姟绫诲瀷涓虹┖锛�", data = "", reqCode = "" });
                 }
                 if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                 {
-                    result.Message = "鐢宠鎵樼洏鍙蜂负绌猴紒";
-                    return Ok(result);
+                    return Ok(new AgvResultModel { code = "1", message = "鐢宠鎵樼洏鍙蜂负绌猴紒", data = "", reqCode = "" });
                 }
-                _rcsserver.ApplyLocatNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
-                result.Success = 0;
-                result.Message = "鐢宠鍌ㄤ綅鎴愬姛锛�";
-                return Ok(result);
+                string taskNo = "";
+                _rcsserver.ApplyLocatNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask, out taskNo);
+                
+                return Ok(new AgvResultModel { code = "0", message = "鐢宠鍌ㄤ綅鎴愬姛锛�", data = taskNo, reqCode = "" });
             }
             catch (Exception e)
             {
                 LogFile.SaveLogToFile($"AGV鐢宠鍌ㄤ綅寮傚父锛�( {e.Message} ),", logStr);
 
-                result.Message = e.Message;
-                return Ok(result);
+                return Ok(new AgvResultModel { code = "1", message = e.Message, data = "", reqCode = "" });
             }
         }
 

--
Gitblit v1.8.0