From 9b139ce92aa09f466c01111dd66af9347a34d865 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 02 七月 2025 17:23:51 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs"
index 5e18cd1..90b923f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs"
@@ -60,7 +60,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                var location = _locationRepository.QueryData(x => x.LocationStatus==(int)LocationEnum.Free).ToList();
+                var location = _locationRepository.QueryData(x => x.LocationStatus == (int)LocationEnum.Free).ToList();
                 if (location.Count == 0)
                 {
                     return content.Error("搴撳唴鏃犲彲鐢ㄥ簱浣�");
@@ -495,7 +495,7 @@
             try
             {
                 LogFactory.GetLog("AGV寮傚父淇℃伅").InfoFormat(true, $"璇锋眰鍙傛暟锛歿JsonConvert.SerializeObject(aGVDTO)}", "");
-                var task = BaseDal.QueryFirst(x => x.TaskNum ==Convert.ToInt32( aGVDTO.TaskNum));
+                var task = BaseDal.QueryFirst(x => x.TaskNum == Convert.ToInt32(aGVDTO.TaskNum));
                 if (task != null)
                 {
 
@@ -558,17 +558,18 @@
                 return "";
             }
         }
-
-        public WebResponseContent DeviceWarning(AGVDTO DTO)
+        private static readonly SemaphoreSlim _semaphoreUpdate = new SemaphoreSlim(1, 1);
+        public async Task<WebResponseContent> DeviceWarning(AGVDTO DTO)
         {
+            await _semaphoreUpdate.WaitAsync();
             WebResponseContent content = new WebResponseContent();
             try
             {
                 LogFactory.GetLog("AG涓婁紶鎶ヨ淇℃伅").InfoFormat(true, $"璇锋眰鍙傛暟锛歿JsonConvert.SerializeObject(DTO)}", "");
-                if (DTO.Message!= null)
+                if (DTO.Message != null)
                 {
-                    Dt_ErrorDescription description=_descriptionRepository.QueryFirst(x => x.Type == DTO.Message);
-                    if(description != null)
+                    Dt_ErrorDescription description = _descriptionRepository.QueryFirst(x => x.Type == DTO.Message);
+                    if (description != null)
                     {
                         _Socket.ErrorReport(description.ErrorCode, "A", "00");
                         _Socket.AddErrorMessage(description.ErrorCode, "AGV", "");
@@ -577,19 +578,23 @@
                     else
                     {
                         return content.Error("鏈瘑鍒姤璀︽簮");
-                    }   
+                    }
                 }
                 else
                 {
                     return content.Error("鏈帴鏀跺埌寮傚父淇℃伅");
-                }  
+                }
             }
             catch (Exception ex)
             {
                 LogFactory.GetLog("AG涓婁紶鎶ヨ淇℃伅").InfoFormat(true, $"璇锋眰鍙傛暟锛歿JsonConvert.SerializeObject(ex.Message)}", "");
                 return content.Error(ex.Message);
             }
-            
+            finally
+            {
+                _semaphoreUpdate.Release();
+            }
+
         }
         #endregion 澶栭儴鎺ュ彛鏂规硶
     }

--
Gitblit v1.9.3