From b2cc7bb7740e42e57cf50af02a8ca4b535cad484 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 11 三月 2026 17:02:21 +0800
Subject: [PATCH] 优化WMS接口逻辑

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs |   65 +++++++++++++++++++++++++-------
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturnMethod.cs                 |    2 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs             |   10 +++-
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturn.cs                       |    4 +
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs             |    4 ++
 5 files changed, 66 insertions(+), 19 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs"
index 9156ebf..4562f62 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs"
@@ -53,22 +53,59 @@
                 foreach (var item in items)
                 {
                     List<Dt_RGVLocationInfo> dt_RGVLocationInfos = BaseDal.QueryData(x => x.RoadwayNo == items.Key);//鏌ユ壘褰撳墠宸烽亾鍙疯揣浣�
-                    rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault();//鍒ゆ柇娴呮繁搴﹁揣浣嶆槸鍚︽湁璐�
-                    if (rGVLocationInfo != null)//娴呮繁搴﹁揣浣嶆湁璐э紝鎵炬繁娣卞害璐т綅鏄惁鏈夎揣
+                    if (item.LocationType == 1)
                     {
-                        if (item.LocationType == 1) break;//宸烽亾绫诲瀷涓哄崟鍚戯紝鐩存帴璺宠繃
-                        foreach (var locationInfo in rGVLocationInfos.Where(x => x.RoadwayNo == items.Key).OrderBy(x => x.Depth))
-                        {
-                            if (!dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.Depth > locationInfo.Depth).Any()) return locationInfo;
-                        }
-                        //rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).OrderBy(x => x.Depth).FirstOrDefault();//鎵炬祬娣卞害绌鸿揣浣�
-                        //if (rGVLocationInfo != null)
-                        //{
-                        //    if (dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault() == null)//鍒ゆ柇娣辨繁搴﹁揣浣嶆槸鍚︽湁璐�
-                        //        return rGVLocationInfo;
-                        //}
+                        rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault();//鍒ゆ柇娴呮繁搴﹁揣浣嶆槸鍚︽湁璐�
+                        if (rGVLocationInfo != null) break;
+                        return item;
                     }
-                    else return item;
+                    else
+                    {
+                        rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).OrderByDescending(x => x.Depth).FirstOrDefault();//鍒ゆ柇娴呮繁搴﹁揣浣嶆槸鍚︽湁璐�
+                        if (rGVLocationInfo != null)
+                        {
+                            rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).OrderBy(x => x.Depth).FirstOrDefault();
+                            if (rGVLocationInfo != null)
+                            {
+                                if (dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).Any()) rGVLocationInfo = null;
+                                else return rGVLocationInfo;
+                            }
+                            //var Depth = 0;
+                            //while (item.Depth - rGVLocationInfo.Depth != 0)
+                            //{
+                            //    if (rGVLocationInfo.Depth < item.Depth) Depth = rGVLocationInfo.Depth - 1;
+                            //    else Depth = rGVLocationInfo.Depth + 1;
+                            //    rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth == Depth).FirstOrDefault();
+                            //    if (rGVLocationInfo != null && rGVLocationInfo.LocationStatus == (int)LocationStatusEnum.Free) return rGVLocationInfo;
+                            //}
+                        }//鍒ゆ柇娴呮繁搴﹁揣浣嶆槸鍚︽湁璐�
+                        else return item;
+                    }
+
+                    //if (rGVLocationInfo != null)//娴呮繁搴﹁揣浣嶆湁璐э紝鎵炬繁娣卞害璐т綅鏄惁鏈夎揣
+                    //{
+                    //    if (item.LocationType == 1) break;//宸烽亾绫诲瀷涓哄崟鍚戯紝鐩存帴璺宠繃
+                    //    foreach (var locationInfo in rGVLocationInfos.Where(x => x.RoadwayNo == items.Key).OrderByDescending(x => x.Depth))
+                    //    {
+                    //        if (!dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.Depth < locationInfo.Depth).Any()) return locationInfo;
+                    //    }
+                    //    //rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).OrderBy(x => x.Depth).FirstOrDefault();//鎵炬祬娣卞害绌鸿揣浣�
+                    //    //if (rGVLocationInfo != null)
+                    //    //{
+                    //    //    if (dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault() == null)//鍒ゆ柇娣辨繁搴﹁揣浣嶆槸鍚︽湁璐�
+                    //    //        return rGVLocationInfo;
+                    //    //}
+                    //}
+                    //if (rGVLocationInfo == null)
+                    //{
+                    //    rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth > item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault();//鍒ゆ柇娴呮繁搴﹁揣浣嶆槸鍚︽湁璐�
+                    //    if (item.LocationType == 1) break;//宸烽亾绫诲瀷涓哄崟鍚戯紝鐩存帴璺宠繃
+                    //    foreach (var locationInfo in rGVLocationInfos.Where(x => x.RoadwayNo == items.Key).OrderByDescending(x => x.Depth))
+                    //    {
+                    //        if (!dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.Depth < locationInfo.Depth).Any()) return locationInfo;
+                    //    }
+                    //}
+                    //else return item;
                 }
             }
             #endregion
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturn.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturn.cs"
index b0f38c0..fa47dc9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturn.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturn.cs"
@@ -19,7 +19,9 @@
         /// <summary>
         /// 鍝嶅簲娑堟伅锛歴uccess-鎴愬姛锛屽紓甯歌繑鍥炶缁嗛敊璇師鍥�
         /// </summary>
-        public string msg { get; set; }
+        public string message { get; set; }
+
+        public string success { get; set; }
 
         /// <summary>
         /// 鍝嶅簲鏁版嵁锛屽浐瀹氫负绌�
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturnMethod.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturnMethod.cs"
index 4c33384..0cbc367 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturnMethod.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSReturnMethod.cs"
@@ -15,7 +15,7 @@
             return new WMSReturn
             {
                 code = content.Status ? successCode : failCode,
-                msg = content.Message ?? (content.Status ? "鎿嶄綔鎴愬姛" : "鎿嶄綔澶辫触"),
+                message = content.Message ?? (content.Status ? "鎿嶄綔鎴愬姛" : "鎿嶄綔澶辫触"),
                 data = content.Data
             };
         }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
index ca5fdbb..71e7fc8 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
@@ -356,8 +356,12 @@
                     boundCompleteFeedback.custStatus = "";
                     string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
                     agvContent = response.DeserializeObject<WMSReturn>();
-                    content.Data = agvContent;
-                    if (agvContent.code != 0) dt_Task.ExceptionMessage = agvContent.msg;
+                    content.OK(data: agvContent);
+                    if (agvContent.code != 200)
+                    {
+                        dt_Task.ExceptionMessage = agvContent.message;
+                        content.Error(agvContent.message);
+                    }
                 }
             }
             catch (Exception ex)
@@ -367,7 +371,7 @@
             finally
             {
                 _trackloginfoService.AddTrackLog(boundCompleteFeedback, content, "鍑哄叆搴撲换鍔$姸鎬佸弽棣圵MS", "", "");
-                if (agvContent != null && agvContent.code == 0 && Status == 2)
+                if (agvContent != null && agvContent.code == 200 && Status == 2)
                     BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
                 else
                     BaseDal.UpdateData(dt_Task);
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index c8eab5b..285947c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -187,6 +187,10 @@
             {
                 content.Error(ex.Message);
             }
+            finally
+            {
+                _trackloginfoService.AddTrackLog(taskDTOs, content, $"WMS涓嬪彂浠诲姟,", "", "");
+            }
             return content;
         }
 

--
Gitblit v1.9.3