From 815139c15ba938d79ad2ba14ddae6f635c37b085 Mon Sep 17 00:00:00 2001
From: lss <Lss@HanInfo>
Date: 星期四, 12 六月 2025 17:33:10 +0800
Subject: [PATCH] 优化

---
 HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs |   56 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
index a2e791d..d9a1195 100644
--- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
+++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
@@ -35,14 +35,14 @@
 
         #region 浣抽�鍚堣偉鎺ュ彛涓氬姟
 
-       
+
         public static object _lockCreateTask = new object();
         /// <summary>
         /// 绔嬪簱浠诲姟涓嬪彂=銆嬪垱寤轰换鍔�         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        
+
         internal static Result Createtask(CreateTask model)
         {
             Result result = new Result() { code = "0", msg = "鍒涘缓鎴愬姛" };
@@ -159,6 +159,7 @@
                             result.msg = $"Putin==> 浠诲姟璧风偣:{taskData.pickStation}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃";
                             LogHelper.Info($"Putin==> {result.msg}");
                             AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source);
+                            return result;
                         }
                     }
                     else if (taskData.taskType == 2)//鍏ュ簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟锛岃捣鐐归渶瑕佹湁鎵樼洏
@@ -598,7 +599,7 @@
                         }
                     }
                 }
-             
+
 
                 return result;
             }
@@ -988,7 +989,6 @@
             string areacode = "";
             var db = new SqlHelper<object>().GetInstance();
             #endregion
-
             try
             {
 
@@ -1210,8 +1210,9 @@
                                 loc = dploc.FindAll(a => a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM < 6).OrderByDescending(a => a.N_CURRENT_NUM).FirstOrDefault();
                                 if (loc == null)
                                 {
+                                    LogHelper.Info($"涓夋ゼ璐т綅鍙犵洏浣嶏紝閮藉凡缁忔湁閿佹垨鑰呭凡缁忓彔婊★紝璇锋鏌ヨ揣浣嶇姸鎬�);
                                     result.code = "1";
-                                    result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�;
+                                    result.msg = $"鍙犵洏璐т綅涓嶅彲鐢紝缁堢偣搴撳尯娌℃湁鍙敤璐т綅锛岃妫�煡閿佺姸鎬佸拰鏁伴噺";
                                     AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                                     return result;
                                 }
@@ -1222,9 +1223,9 @@
                             }
                             else
                             {
-
+                                // LogHelper.Info($"鏍规嵁璐т綅妤煎眰锛歿startloc.N_LAYER}锛屼粨搴撶紪鐮侊細{startloc.S_WH_CODE}锛岃揣浣嶅娉細鍙犵洏锛屾湭鎵惧埌鍙犵洏璐т綅");
                                 result.code = "1";
-                                result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�;
+                                result.msg = $"鍙犵洏璐т綅涓嶅彲鐢紝鏈壘鍒板彲鍙犵洏璐т綅";
                                 LogHelper.Info($"鏍规嵁璐т綅澶囨敞锛氬彔鐩橈紝璐т綅妤煎眰:{startloc.N_LAYER},璐т綅浠撳簱:{startloc.S_WH_CODE}锛屾壘涓嶅埌鍙犵洏璐т綅");
                                 AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source);
                                 return result;
@@ -1239,8 +1240,9 @@
                                 loc = KjDploc.FindAll(a => a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM < 6).OrderByDescending(a => a.N_CURRENT_NUM).FirstOrDefault();
                                 if (loc == null)
                                 {
+                                    LogHelper.Info($"鐗囪兌鍫嗗彔浣嶏紝閮藉凡缁忔湁閿佹垨鑰呭凡缁忓彔婊★紝璇锋鏌ヨ揣浣嶇姸鎬�);
                                     result.code = "1";
-                                    result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�;
+                                    result.msg = $"鍙犵洏璐т綅涓嶅彲鐢紝缁堢偣搴撳尯娌℃湁鍙敤璐т綅锛岃妫�煡閿佺姸鎬佸拰鏁伴噺";
                                     AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                                     return result;
                                 }
@@ -1274,7 +1276,7 @@
                             {
                                 result.code = "1";
                                 result.msg = $"鏍规嵁璧风偣浠撳簱缂栫爜锛歿startloc.S_WH_CODE}鏈壘鍒板搴旈厤缃枃浠�;
-                                LogHelper.Info($"Putin==> {result.msg}");
+                                LogHelper.Info($" {result.msg}");
                                 AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                                 return result;
                             }
@@ -1282,14 +1284,18 @@
 
                             //鍥炲簱璐т綅璁$畻搴撳尯璐т綅
                             loc = StorageCompute(itemcode, areacode);
-                            //if (loc == null)
-                            //{
-                            //    loc = emptyRow(areacode);
-                            //    if (loc == null)
-                            //    {
-                            //        LogHelper.Info($"搴撳尯锛歿areacode}娌℃湁绌烘帓");
-                            //    }
-                            //}
+                            if (loc == null)
+                            {
+                                loc = emptyRow(areacode);
+                                if (loc == null)
+                                {
+                                    result.code = "1";
+                                    result.msg = $"搴撳尯锛歿areacode}娌℃湁鍙敤璐т綅";
+                                    LogHelper.Info($" {result.msg}");
+                                    AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
+                                    // LogHelper.Info($"搴撳尯锛歿areacode}娌℃湁鍙敤璐т綅");
+                                }
+                            }
                             //else
                             //{
 
@@ -1404,11 +1410,11 @@
             #region 鍙橀噺
             string Start = "";
             string End = model.TargetLocation;
-            
+
             string areacode = "";
             string cntrcode = "";
             Location startloc = new Location();
-          //  startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType);
+            //  startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType);
             #endregion
 
             try
@@ -1434,10 +1440,10 @@
                             AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                             return result;
                         }
-                        
+
 
                         //璁$畻鍑哄簱鎵樼洏
-                        startloc = LocationHelper.GetLocByAreacode(areacode,model.CarrierType);
+                        startloc = LocationHelper.GetLocByAreacode(areacode, model.CarrierType);
                         if (startloc != null)
                         {
                             var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).First();
@@ -2374,7 +2380,7 @@
 
                             }
                         }
-                       
+
                     }
                     else
                     {
@@ -2416,14 +2422,14 @@
             DeviceInfoModel device = new DeviceInfoModel();
 
             List<DeviceInfos> deviceInfos = new List<DeviceInfos>();//鍙犵洏鏈烘姤閿欎俊鎭�-           // List<AgvInfos> agvInfos = new List<AgvInfos>();//agv鎶ラ敊淇℃伅
+                                                                    // List<AgvInfos> agvInfos = new List<AgvInfos>();//agv鎶ラ敊淇℃伅
 
             //鑾峰彇鍐呭瓨涓彔鐩樻満鐨勬姤閿欎俊鎭�             foreach (var dpjInfo in DeviceProcess.DpjInfoDirectory)
             {
                 deviceInfos.Add(new DeviceInfos() { Device = dpjInfo.Value.DeviceName, DeviceInfo = dpjInfo.Value.ErrorInfo });
             }
-          //  device.DeviceInfos = deviceInfos;
+            //  device.DeviceInfos = deviceInfos;
             //鑾峰彇杞﹁締鎶ヨ淇℃伅
             var agvDeviceInfo = db.Queryable<HangChaAGV>().ToList();
             if (agvDeviceInfo.Count > 0)
@@ -2503,7 +2509,7 @@
 
         #region 鍚堣偉浣抽�涓氬姟鏂规硶
 
-        
+
         /// <summary>
         /// 鎵樼洏鍏ュ簱绠楁硶 
         /// </summary>

--
Gitblit v1.9.1