From e0f319785555eab2df5049739f2d6d32b282fd97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E7=9D=BF?= <774114798@qq.com> Date: Mon, 9 Dec 2024 11:05:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs | 3 +-- .../ProtectionDeviceHandle/ProtectionDeviceVersionHandle.cs | 2 +- .../TcpSocket/Server/DotNettyServerHandler.cs | 5 +++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs index bf1d2a0..72b14e2 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceRunInfoHandle.cs @@ -46,7 +46,6 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle _redisDataRepository = redisDataRepository; _dotNettyTcpServer.MessageReceived += OnMessageReceived; // 订阅事件 _deviceBoardStatesRedis = redisRepository; - } //Dictionary _deviceRunStates = new Dictionary(); //private ConcurrentDictionary _communicationStateCounts = new(); @@ -199,7 +198,7 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle } boardStates[0].Value = new BitArray(new byte[] { data[0] })[0] ? 0 : 1;//运行状态 boardStates[1].Value = new BitArray(new byte[] { data[0] })[1] ? 0 : 1;//报警状态 - boardStates[7].Value = new BitArray(new byte[] { data[1] })[0] ? 0 : 1; // 液晶状态 + boardStates[7].Value = new BitArray(new byte[] { data[1] })[7] ? 0 : 1; // 液晶状态 BitArray bit2 = new BitArray(new byte[] { data[2] }); boardStates[2].Value = bit2[0] ? 0 : 1; boardStates[3].Value = bit2[1] ? 0 : 1; diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceVersionHandle.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceVersionHandle.cs index b49e69d..1e07e55 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceVersionHandle.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/ProtectionDeviceHandle/ProtectionDeviceVersionHandle.cs @@ -33,7 +33,7 @@ namespace Yunda.SOMS.DataMonitoringServer.ProtectionDeviceHandle } private void OnMessageReceived(byte address, byte[] message, byte functionType) { - + if (functionType == 3)//装置版本信息报文 { string messageStr = BitConverter.ToString(message); diff --git a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs index 3fb127d..fc04fad 100644 --- a/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs +++ b/src/YunDa.Server/Yunda.ISAS.DataMonitoringServer/TcpSocket/Server/DotNettyServerHandler.cs @@ -6,6 +6,7 @@ using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; +using System.ComponentModel.Design; using System.Diagnostics; using System.Text; using System.Threading.Tasks; @@ -143,6 +144,10 @@ namespace Yunda.SOMS.DataMonitoringServer.TcpSocket.Server { try { + if (DateTime.Now.Hour == 0&&DateTime.Now.Minute == 5&& DateTime.Now.Second<30) + { + await SendCustomMessageAsync(ctx, address, 0, 4, 0);//发送版本信息请求 + } UpdateConnectionContext(address, ctx); await UpdateCommunicationStateCountAsync(address, ctx); }