From 0aac30d1c6f1ca0c2bf7662fb9ca4f0d98b3bca7 Mon Sep 17 00:00:00 2001 From: z8018 <1282578289@qq.com> Date: 星期一, 09 六月 2025 14:29:25 +0800 Subject: [PATCH] Merge branch 'qy0427' of http://115.159.85.185:8098/r/MeiXinLaiRui/ShenSuoGanKongZhi into qy0427 --- project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs index 12ee282..ca85a13 100644 --- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs +++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/AlarmResetHsyServer.cs @@ -1,5 +1,6 @@ 锘縰sing HslCommunication.WebSocket; using Newtonsoft.Json; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using SqlSugar; using System; using System.Collections; @@ -14,6 +15,7 @@ using WIDESEAWCS_DTO.Telescopic; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; +using WIDESEAWCS_QuartzJob; namespace WIDESEAWCS_TelescopicService { @@ -92,12 +94,35 @@ { return new WebResponseContent { Status = false, Message = "閰嶇疆椤� DepartmentID 鏃犳硶杞崲涓烘暣鏁�" }; } + var devices = GetDevicesByDeptId(deid); + + var query = BaseDal.QueryData(x => x.ResetStatus == true && x.Deptid== deid).ToList(); // 濡傛灉娌℃湁鎵惧埌绗﹀悎鏉′欢鐨勬暟鎹� if (query.Count == 0) { return new WebResponseContent { Status = false, Message = "娌℃湁瑕佸浣嶆暟鎹�" }; + } + try + { + var left = devices.Value.left.Communicator.Write<bool>("M105", true); //閲嶅惎鎶ヨ澶嶄綅 + Console.WriteLine($"宸︽姤璀︿俊鍙峰浣嶅啓鍏left}"); + } + catch (Exception) + { + + + } + try + { + var right = devices.Value.right.Communicator.Write<bool>("M105", true); + Console.WriteLine($"鍙虫姤璀︿俊鍙峰浣嶅啓鍏right}"); + } + catch (Exception) + { + + } foreach (var item in query) { @@ -168,5 +193,23 @@ 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