Prechádzať zdrojové kódy

修改西门子获取状态

Shun 2 rokov pred
rodič
commit
d7b81958bf

+ 1 - 0
README.md

@@ -576,4 +576,5 @@ while(true)
 2. mqtt 客户端新增断开事件
 3. mqtt 客户端服务端工具改造完成
 4. 新增采集、转发工具模版,更快的集成新的驱动
+5. 新增AllenBradley、Beckhoff、Mewtocol、Mitsubishi、Omron、Siemens 工具
 

+ 4 - 4
src/YSAI.Siemens/SiemensOperate.cs

@@ -111,7 +111,7 @@ namespace YSAI.Siemens
             string SN = Depart("On");
             try
             {
-                if (PlcS7 != null && PlcS7.IsConnected)
+                if (GetStatus().State)
                 {
                     return Break(SN, false, "已连接");
                 }
@@ -144,7 +144,7 @@ namespace YSAI.Siemens
             string SN = Depart("Off");
             try
             {
-                if (PlcS7 != null && PlcS7.IsConnected)
+                if (GetStatus().State)
                 {
                     if (tokenSource != null)
                     {
@@ -186,7 +186,7 @@ namespace YSAI.Siemens
             string SN = Depart("Read");
             try
             {
-                if (PlcS7 != null && PlcS7.IsConnected)
+                if (GetStatus().State)
                 {
                     //节点数据
                     ConcurrentDictionary<string, AddressValue> param = new ConcurrentDictionary<string, AddressValue>();
@@ -300,7 +300,7 @@ namespace YSAI.Siemens
             string SN = Depart("Write");
             try
             {
-                if (PlcS7 != null && PlcS7.IsConnected)
+                if (GetStatus().State)
                 {
                     //失败消息
                     List<string> FailMessage = new List<string>();

+ 1 - 1
src/YSAI.Siemens/YSAI.Siemens.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.360.35650</Version>
+    <Version>23.360.36030</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>

+ 1 - 1
src/YSAI.Ver.Manage.Tool/Program.cs

@@ -48,7 +48,7 @@ List<string> strings = new List<string>
     //"YSAI.Modbus",
     //"YSAI.Omron",
     //"YSAI.Opc",
-    //"YSAI.Siemens",
+    "YSAI.Siemens",
 #endif
 };