From 28110912ca4803e5793f181517d7bf2d7a5ea2ad Mon Sep 17 00:00:00 2001
From: HuBingJie <3146306518@qq.com>
Date: 星期五, 05 十二月 2025 00:32:49 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs |  113 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 84 insertions(+), 29 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
index dddc198..17aa7d2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
@@ -50,6 +50,7 @@
 using WIDESEAWCS_ISystemServices;
 using System.Security.Claims;
 using WIDESEAWCS_Common.TaskEnum;
+using SqlSugar.Extensions;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -314,16 +315,26 @@
         public WebResponseContent WriteInNormal(SaveModel saveModel)
         {
             WebResponseContent content = new WebResponseContent();
-            Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish);
-            if (dt_Task == null)
+            try
             {
-               return WebResponseContent.Instance.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+                int taskNum = saveModel.MainData.FirstOrDefault(x => x.Key == "taskNum").Value.ObjToInt();
+
+                Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish && x.TaskNum == taskNum);
+                if (dt_Task == null)
+                {
+                    return content.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+                }
+                dt_Task.TaskState = (int)TaskInStatusEnum.RGV_InPickupFinish;
+                dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+                dt_Task.NextAddress = "1021";
+                _taskRepository.UpdateData(dt_Task);
+                return content.OK();
             }
-            dt_Task.TaskState = (int)TaskInStatusEnum.RGV_InPickupFinish;
-            dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
-            dt_Task.NextAddress = "1021";
-            _taskRepository.UpdateData(dt_Task);
-            return content;
+            catch (Exception ex)
+            {
+                return content.Error("姝e父鍏ュ簱璋冨彇寮傚父锛屽師鍥狅細" + ex.Message);
+                throw;
+            }
         }
         /// <summary>
         /// 鍏ュ簱寮傚父鎺掑嚭
@@ -331,44 +342,88 @@
         public WebResponseContent WriteInAbnormal(SaveModel saveModel)
         {
             WebResponseContent content = new WebResponseContent();
-            Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish);
-            if (dt_Task == null)
+            try
             {
-                return WebResponseContent.Instance.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+                int taskNum = saveModel.MainData.FirstOrDefault(x => x.Key == "taskNum").Value.ObjToInt();
+                Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish && x.TaskNum == taskNum);
+                if (dt_Task == null)
+                {
+                    return WebResponseContent.Instance.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+                }
+                dt_Task.TaskState = (int)TaskInStatusEnum.InexceptionalSelection;
+                dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+                _taskRepository.UpdateData(dt_Task);
+                return content.OK();
             }
-            dt_Task.TaskState = (int)TaskInStatusEnum.InexceptionalSelection;
-            dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
-            _taskRepository.UpdateData(dt_Task);
-            return content;
+            catch (Exception ex)
+            {
+                return content.Error("寮傚父鎺掗櫎璋冨彇寮傚父锛屽師鍥狅細" + ex.Message);
+                throw;
+            }
         }
 
 
 
         public static List<string> OutStationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115", "RGV118" };
-        public static List<string> InStationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115", "RGV118" };
+        public static List<string> InStationareaList = new List<string>() { "RGV101", "RGV103", "RGV105", "RGV108", "RGV109", "RGV104", "RGV107" };
         /// <summary>
         /// 鏌ョ湅鎶ヨ
         /// </summary>
-        public bool AQMReadAlarminform(int tasktype)
+        public static string AQMReadAlarminform()
         {
-            var deviceList = tasktype == 1 ? InStationareaList : OutStationareaList;
-
-            foreach (string deviceName in deviceList)
-            {
+            string deviceName = "RGV101";
                 IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceName);
-                if (device == null) return false;
+                if (device == null) return null;
 
                 SpeStackerCrane stacker = (SpeStackerCrane)device;
                 DeviceProDTO? faultInfo = GetRGVDeviceProDTO(stacker, deviceName, "RGV_Faultcode", "ReadDeviceCommand");
                 int alarmCode = GetLine(stacker, faultInfo.DeviceProAddress);
 
-                if (alarmCode != 0)
-                {
-                    return true;
-                }
-            }
+            var alarmMessages = new Dictionary<int, string>
+{
+    {0, "鏃犳姤璀�"},
+    {1, "RGV灏忚溅鎬ュ仠琚寜涓�"},
+    {2, "姝h浆闆疯揪鎶ヨ"},
+    {3, "鍙嶈浆闆疯揪鎶ヨ"},
+    {4, "鍓嶈繘闄愪綅鎶ヨ"},
+    {5, "鍚庨��闄愪綅鎶ヨ"},
+    {6, ""},
+    {7, "PLC妯″潡鏁呴殰"},  // 淇锛氭懜鍧� 鈫� 妯″潡
+    {8, "PLC鎵╁睍妯″潡鏁呴殰"},
+    {9, "绉伴噸妯″潡鏁呴殰"},
+    {10, "鎵爜瀹氫綅鏁呴殰"},
+    {11, "RGV闀挎椂闂寸┖杞晠闅�"},
+    {12, "鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰"},
+    {13, "涓庢�绘帶閫氳鏁呴殰"},
+    {14, "鍓嶉浄杈惧睆钄借鍛�"},
+    {15, "鍚庨浄杈惧睆钄借鍛�"},
+    {16, "琛岃蛋鍙橀鍣ㄦ晠闅�"},
+    {17, "浼哥缉鍙夊彉棰戝櫒鏁呴殰"},
+    {18, "娑插帇鍗曞厓杩囪浇淇濇姢鏁呴殰"},
+    {19, "娑插帇涓婂崌瓒呮椂鎶ヨ"},
+    {20, "娑插帇涓嬮檷瓒呮椂鎶ヨ"},
+    {21, "浼哥缉鍙変几鍑鸿秴鏃舵姤璀�"},
+    {22, "浼哥缉鍙夌缉鍥炶秴鏃舵姤璀�"},
+    {23, "澶栧舰妫�娴嬫姤璀�"},
+    {24, "绉伴噸瓒呴噸鎶ヨ"},
+    {25, "璐у弶浼稿嚭鏋侀檺闄愪綅鎶ヨ"},
+    {26, "璐у弶缂╁洖鏋侀檺闄愪綅鎶ヨ"},
+    {27, "鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ"},
+    {28, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
+    {29, "璐у弶鏈洖鍒板垵濮嬩綅鎶ヨ"},
+    {30, "瑙﹀彂浠呯Щ鍔ㄥ懡浠ゆ椂璐у弶涓嶅湪鍒濆浣嶆姤璀�"},
+    {31, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"},
+    {32, "琛岃蛋杞存病鍒颁綅绂佹璐у弶浼稿嚭"},
+    {33, "鍙栬揣寮傚父鎶ヨ"},
+    {34, "鏀捐揣寮傚父鎶ヨ"},
+    {35, "澶栧瀷妫�娴�-鍓嶈秴鍑烘姤璀�"},
+    {36, "澶栧瀷妫�娴�-鍚庤秴鍑烘姤璀�"},
+    {37, "澶栧瀷妫�娴�-宸﹁秴鍑烘姤璀�"},
+    {38, "澶栧瀷妫�娴�-鍙宠秴鍑烘姤璀�"},
+    {39, "澶栧瀷妫�娴�-涓婅秴鍑烘姤璀�"}
+};
 
-            return false;
+            return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
         }
 
 
@@ -385,7 +440,7 @@
             DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Faultcode", "ReadDeviceCommand");
             int baoj = GetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress);
             string alarmMessage = "";
-            if (DeviceName == "RGV118")
+            if (DeviceName == "RGV118" || DeviceName == "RGV101")
             {
                  alarmMessage = GetAlarmMessage(baoj);
             }

--
Gitblit v1.9.3