From bcd82055caf650b968eec0d79dbe877fee0ae712 Mon Sep 17 00:00:00 2001 From: Kimdiego2098 <2248356998@qq.com> Date: Sat, 11 Nov 2023 10:26:05 +0800 Subject: [PATCH] =?UTF-8?q?s7=E6=8F=A1=E6=89=8B=E5=A4=B1=E8=B4=A5=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=89=8B=E5=8A=A8=E5=85=B3=E9=97=AD=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Siemens/SiemensS7PLC.cs | 1 + .../ThingsGateway.Plugin.OPCUA/OPCUAServer/OPCUALogger.cs | 5 ++--- framework/Plugin/ThingsGateway.Plugin.Siemens/Siemens.cs | 7 +------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/framework/Foundation/ThingsGateway.Foundation.Adapter.Siemens/Siemens/SiemensS7PLC.cs b/framework/Foundation/ThingsGateway.Foundation.Adapter.Siemens/Siemens/SiemensS7PLC.cs index 43e1baa7d..5444694af 100644 --- a/framework/Foundation/ThingsGateway.Foundation.Adapter.Siemens/Siemens/SiemensS7PLC.cs +++ b/framework/Foundation/ThingsGateway.Foundation.Adapter.Siemens/Siemens/SiemensS7PLC.cs @@ -459,6 +459,7 @@ namespace ThingsGateway.Foundation.Adapter.Siemens if (!result1.IsSuccess) { Logger?.Warning($"{client.IP} : {client.Port}:ISO_TP握手失败-{result1.Message}"); + TcpClient.Close(); return; } var result2 = await SendThenResponseAsync(S7_PN); diff --git a/framework/Plugin/ThingsGateway.Plugin.OPCUA/OPCUAServer/OPCUALogger.cs b/framework/Plugin/ThingsGateway.Plugin.OPCUA/OPCUAServer/OPCUALogger.cs index dde8a2f2f..0300a67d7 100644 --- a/framework/Plugin/ThingsGateway.Plugin.OPCUA/OPCUAServer/OPCUALogger.cs +++ b/framework/Plugin/ThingsGateway.Plugin.OPCUA/OPCUAServer/OPCUALogger.cs @@ -48,10 +48,9 @@ public partial class OPCUAServer else { var message = formatter(state, exception); - _log.Log((Foundation.Core.LogLevel)(byte)logLevel, state, message, exception); - if (logLevel > Microsoft.Extensions.Logging.LogLevel.Information) + if (logLevel > Microsoft.Extensions.Logging.LogLevel.Warning) { - + _log.Log((Foundation.Core.LogLevel)(byte)logLevel, state, message, exception); } } } diff --git a/framework/Plugin/ThingsGateway.Plugin.Siemens/Siemens.cs b/framework/Plugin/ThingsGateway.Plugin.Siemens/Siemens.cs index 5bb85fc9f..c1c32400a 100644 --- a/framework/Plugin/ThingsGateway.Plugin.Siemens/Siemens.cs +++ b/framework/Plugin/ThingsGateway.Plugin.Siemens/Siemens.cs @@ -113,18 +113,13 @@ public abstract class Siemens : CollectBase return new(await _plc?.WriteAsync(address, value, cancellationToken)); } - - - - - - /// protected override void Dispose(bool disposing) { _plc?.Disconnect(); base.Dispose(disposing); } + /// protected override async Task> ReadAsync(string address, int length, CancellationToken cancellationToken) {