From f1345b3d285774f9223de2980c9a0d21a4dd085b Mon Sep 17 00:00:00 2001 From: wenjy Date: Tue, 30 Jan 2024 13:28:41 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20PLC=20=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=B7=BB=E5=8A=A0=E5=90=AF=E7=94=A8=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Config/PlcConfig.cs | 5 +++++ SlnMesnac.Plc/PlcPool.cs | 5 ++++- SlnMesnac.WPF/appsettings.json | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/SlnMesnac.Config/PlcConfig.cs b/SlnMesnac.Config/PlcConfig.cs index 9bb8d31..c061dd4 100644 --- a/SlnMesnac.Config/PlcConfig.cs +++ b/SlnMesnac.Config/PlcConfig.cs @@ -29,5 +29,10 @@ namespace SlnMesnac.Config /// PLC Key /// public string plcKey { get; set; } + + /// + /// 是否启用 + /// + public bool isFlage { get; set; } } } \ No newline at end of file diff --git a/SlnMesnac.Plc/PlcPool.cs b/SlnMesnac.Plc/PlcPool.cs index 476857b..55bb2c4 100644 --- a/SlnMesnac.Plc/PlcPool.cs +++ b/SlnMesnac.Plc/PlcPool.cs @@ -43,7 +43,10 @@ namespace SlnMesnac.Plc { foreach (var item in _appConfig.plcConfig) { - AddPlc(item.plcType, item.plcIp, item.plcPort, item.plcKey); + if (item.isFlage) + { + AddPlc(item.plcType, item.plcIp, item.plcPort, item.plcKey); + } } } else diff --git a/SlnMesnac.WPF/appsettings.json b/SlnMesnac.WPF/appsettings.json index 6a0c7e1..7c20653 100644 --- a/SlnMesnac.WPF/appsettings.json +++ b/SlnMesnac.WPF/appsettings.json @@ -27,14 +27,16 @@ "plcType": "MelsecBinaryPlc", "plcIp": "127.0.0.1", "plcPort": 6000, - "plcKey": "mcs" + "plcKey": "mcs", + "isFlage": false }, { "configId": 2, "plcType": "MelsecBinaryPlc", "plcIp": "127.0.0.1", "plcPort": 6000, - "plcKey": "cwss" + "plcKey": "cwss", + "isFlage": false } ] }