From ac93c4092a21dbf0fa9cf8b9b1302f2d5d183f61 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 09 六月 2025 20:48:20 +0800
Subject: [PATCH] 修改提示字段

---
 project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs"
index df93e21..2bbe0da 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs"
@@ -14,6 +14,7 @@
 using WIDESEAWCS_DTO.Telescopic;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
 
 namespace WIDESEAWCS_TelescopicService
 {
@@ -89,6 +90,41 @@
             {
                 return new WebResponseContent { Status = false, Message = "娌℃湁瑕佸浣嶆暟鎹�" };
             }
+            // 鑾峰彇鎵�鏈変笉鍚岀殑 DeptId锛堟瘡涓唬琛ㄤ竴涓狿LC锛�
+            var deptIds = query.Select(x => x.Deptid).Distinct();
+
+            foreach (var deptId in deptIds)
+            {
+                try
+                {
+                    var devices = GetDevicesByDeptId(deptId);
+
+                    try
+                    {
+                        devices.Value.left.Communicator.Write<bool>("M105", true);
+                    }
+                    catch (Exception)
+                    {
+
+                       
+                    }
+                    try
+                    {
+                        devices.Value.right.Communicator.Write<bool>("M105", true);
+                    }
+                    catch (Exception)
+                    {
+
+                        
+                    }
+                    
+                }
+                catch (Exception ex)
+                {
+                    Console.WriteLine($"鍚� DeptId={deptId} 鐨凱LC鍐欏叆澶辫触锛�" + ex.Message);
+                    // 鍙互閫夋嫨缁х画鎴栦腑鏂�
+                }
+            }
             foreach (var item in query)
             {
                 item.ResetStatus = false;
@@ -151,6 +187,21 @@
                 return new WebResponseContent { Status = false, Message = ex.Message };
             }
         }
+        public (OtherDevice left, OtherDevice right)? GetDevicesByDeptId(int deptId)
+        {
+            // 宸﹁澶囧彿锛�1 -> 001锛�2 -> 003锛�3 -> 005...
+            int baseCode = 1 + (deptId - 1) * 2;
+            string leftCode = $"SSG{baseCode.ToString("D3")}";
+            string rightCode = $"SSG{(baseCode + 1).ToString("D3")}";
 
+            var left = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == leftCode);
+            var right = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == rightCode);
+
+
+            //if (left == null || right == null)
+            //    return null;
+
+            return (left, right);
+        }
     }
 }

--
Gitblit v1.9.3