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 } ] }