From 8d558cb173873004cd8a0d6c12f37865f03d7a4f Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期三, 22 十月 2025 10:32:15 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs |  174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 170 insertions(+), 4 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 f8edb2f..9a57388 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"
@@ -48,6 +48,7 @@
 using WIDESEAWCS_QuartzJob.Service;
 using System.Net;
 using WIDESEAWCS_ISystemServices;
+using System.Security.Claims;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -104,17 +105,17 @@
                 case "1":  // 宸ヤ綔妯″紡锛�0鎵嬪姩銆�1鑷姩锛�
                            //鑾峰彇瀹炰緥
                     DeviceProDTO? RGV_DWorkingmode = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");        //浠诲姟绫诲瀷
-                      //绗竴姝ュ啓鍏ヤ换鍔�
+                                                                                                                                                //绗竴姝ュ啓鍏ヤ换鍔�
                     RgvSetLine(Commonstacker, RGV_DWorkingmode.DeviceProAddress, WriteRGVvalue);
                     break;
                 case "2":   //澶嶄綅鎿嶄綔锛�0涓嶅浣嶃��1澶嶄綅锛�
                     DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Resetoperation", "DeviceCommand");        //浠诲姟绫诲瀷
-                                                                                                                                                //绗竴姝ュ啓鍏ヤ换鍔�
+                                                                                                                                                    //绗竴姝ュ啓鍏ヤ换鍔�
                     RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, WriteRGVvalue);
                     break;
                 case "3":   //浠诲姟纭瀹屾垚锛�0涓嶇‘瀹氾紝1纭畾锛�
                     DeviceProDTO? RGV_taskcomplete = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_taskcomplete", "RGV_taskcomplete");        //浠诲姟绫诲瀷
-                                                                                                                                                //绗竴姝ュ啓鍏ヤ换鍔�
+                                                                                                                                                   //绗竴姝ュ啓鍏ヤ换鍔�
                     RgvSetLine(Commonstacker, RGV_taskcomplete.DeviceProAddress, WriteRGVvalue);
                     break;
                 case "4":   //浠诲姟绫诲瀷(4娓呴櫎)
@@ -205,6 +206,52 @@
             return webResponse.OK();
         }
 
+        /// <summary>
+        /// 涓�閿殏鍋�
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public WebResponseContent WriteOutbuttonpause(SaveModel saveModel)
+        {
+            WebResponseContent webResponse = new WebResponseContent();
+            List<AGVStation> rgvdata = _gvStationService.GetOutStroller();
+            foreach (AGVStation rgvstation in rgvdata)
+            {
+                string DeviceName = rgvstation.ChildPosiDeviceCode;    //璁惧鍚嶇О
+                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+                if (device == null) continue;
+                SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+
+                //鑾峰彇闇�瑕佸浣嶇殑璁惧
+                DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");        //澶嶄綅鎶ヨ淇℃伅
+                RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
+            }
+            return webResponse.OK();
+        }
+
+        /// <summary>
+        /// 涓�閿惎鍔�
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public WebResponseContent WriteOuttouchstart(SaveModel saveModel)
+        {
+            WebResponseContent webResponse = new WebResponseContent();
+            List<AGVStation> rgvdata = _gvStationService.GetOutStroller();
+            foreach (AGVStation rgvstation in rgvdata)
+            {
+                string DeviceName = rgvstation.ChildPosiDeviceCode;    //璁惧鍚嶇О
+                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+                if (device == null) continue;
+                SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+
+                //鑾峰彇闇�瑕佸浣嶇殑璁惧
+                DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");        //澶嶄綅鎶ヨ淇℃伅
+                RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)1);
+            }
+            return webResponse.OK();
+        }
+
 
 
         /// <summary>
@@ -224,7 +271,7 @@
         /// <param name="conveyorLine"></param>
         /// <param name="DeviceProDataBlock"></param>
         /// <returns></returns>
-        public static int GetLine(CommonConveyorLine Commonstacker, string DeviceProDataBlock)
+        public static int GetLine(SpeStackerCrane Commonstacker, string DeviceProDataBlock)
         {
             return Commonstacker.Communicator.Read<short>(DeviceProDataBlock);
         }
@@ -241,6 +288,125 @@
         }
 
 
+        /// <summary>
+        /// 鏌ョ湅鎶ヨ
+        /// </summary>
+        public WebResponseContent ReadAlarminformation(SaveModel saveModel)
+        {
+            WebResponseContent webResponse = new WebResponseContent();
+            string DeviceName = saveModel.DelKeys[0].ToString();    //璁惧鍚嶇О
+            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+            if (device == null) return webResponse.Error();
+            SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+            DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Faultcode", "ReadDeviceCommand");
+            int baoj = GetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress);
+            string alarmMessage = "";
+            if (DeviceName == "RGV118")
+            {
+                 alarmMessage = GetAlarmMessage(baoj);
+            }
+            else if (DeviceName == "RGV111" || DeviceName == "RGV116")
+            {
+                 alarmMessage = GetAlarmMessage2(baoj);
+            }
+            else if (DeviceName == "RGV110" || DeviceName == "RGV112" || DeviceName == "RGV114" || DeviceName == "RGV115")
+            {
+                 alarmMessage = GetAlarmMessage3(baoj);
+            }
 
+
+            return webResponse.OK(data: alarmMessage);
+        }
+
+        // 鎶ヨ浠g爜鏄犲皠鏂规硶
+        private string GetAlarmMessage(int alarmCode)
+        {
+            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, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"}
+            };
+
+            return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
+        }
+
+
+        private string GetAlarmMessage2(int alarmCode)
+        {
+            var alarmMessages = new Dictionary<int, string>
+    {
+        {0, "鏃犳姤璀�"},
+        {1, "RGV灏忚溅鎬ュ仠琚寜涓�"},
+        {2, "鍓嶈繘闄愪綅鎶ヨ"},
+        {3, "鍚庨��闄愪綅鎶ヨ"},
+        {4, "PLC鎽稿潡鏁呴殰"},
+        {5, "PLC鎵╁睍妯″潡鏁呴殰"},
+        {6, "鎵爜瀹氫綅鏁呴殰"},
+        {7, "RGV闀挎椂闂寸┖杞晠闅�"},
+        {8, "鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰"},
+        {9, "涓庢�绘帶閫氳鏁呴殰"},
+        {10, "琛岃蛋鍙橀鍣ㄦ晠闅�"},
+        {11, "娑插帇鍗曞厓杩囪浇淇濇姢鏁呴殰"},
+        {12, "娑插帇涓婂崌瓒呮椂鎶ヨ"},
+        {13, "娑插帇涓嬮檷瓒呮椂鎶ヨ"},
+        {14, "鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ"},
+        {15, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
+        {16, "鍙栬揣妫�娴嬩笉鍒拌揣鐗╂姤璀�"}
+    };
+
+            return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
+        }
+
+        private string GetAlarmMessage3(int alarmCode)
+        {
+            var alarmMessages = new Dictionary<int, string>
+    {
+        {0, "鏃犳姤璀�"},
+        {1, "RGV灏忚溅鎬ュ仠琚寜涓�"},
+        {2, "鍓嶈繘闄愪綅鎶ヨ"},
+        {3, "鍚庨��闄愪綅鎶ヨ"},
+        {4, "PLC鎽稿潡鏁呴殰"},
+        {5, "PLC鎵╁睍妯″潡鏁呴殰"},
+        {6, "RGV闀挎椂闂寸┖杞晠闅�"},
+        {7, "鐩殑鍦颁笉绛変簬瀹為檯浣嶇疆鏁呴殰"},
+        {8, "涓庢�绘帶閫氳鏁呴殰"},
+        {9, "琛岃蛋鍙橀鍣ㄦ晠闅�"},
+        {10, "鍙栬揣鏃惰嚜韬湁璐х墿鎶ヨ"},
+        {11, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
+        {12, "鍋滄鏃朵綅缃繃鍐叉姤璀�"}
+    };
+
+            return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";
+        }
     }
 }

--
Gitblit v1.9.3