Shun 2 лет назад
Родитель
Сommit
5d05b1260c
3 измененных файлов с 53 добавлено и 12 удалено
  1. 6 0
      README.md
  2. 1 1
      src/YSAI.DAQ/YSAI.Opc/YSAI.Opc.csproj
  3. 46 11
      src/YSAI.DAQ/YSAI.Test.All/Program.cs

+ 6 - 0
README.md

@@ -286,4 +286,10 @@ while(true)
 1. 解决OPCUA问题
 2. OPCUA版本更新
 
+#### 2023-10-11 ~ 2023-10-12
+1. 修改 OPCUA 订阅流程逻辑,解决超时问题
+2. 修改 OPCUA 工具显示问题
+3. OPCUA 工具新增 导出 Core 地址对象
+4. 版本更新
+
 

+ 1 - 1
src/YSAI.DAQ/YSAI.Opc/YSAI.Opc.csproj

@@ -5,7 +5,7 @@
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
 	  <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-	  <Version>1.0.0.24</Version>
+	  <Version>1.0.0.25</Version>
 	  <Authors>Shun</Authors>
 	  <Company>YSAI</Company>
 	  <Product>SCADA</Product>

+ 46 - 11
src/YSAI.DAQ/YSAI.Test.All/Program.cs

@@ -1,16 +1,19 @@
 
+using System.Collections.Concurrent;
 using YSAI.Core.data;
+using YSAI.Log;
 using YSAI.Opc.ua.client;
 using YSAI.Unility;
 
 
-
-Address address = JsonTool.StringToJsonEntity<Address>(FileTool.FileToString("C:\\Users\\Shun\\Desktop\\Address.json"));
+Address address = JsonTool.StringToJsonEntity<Address>(FileTool.FileToString("C:\\Users\\Shun\\Desktop\\[6032]Node_Address 202310120854271486.json"));
 
 
 OpcUaClientOperate opcUaClientOperate = OpcUaClientOperate.Instance(new OpcUaClientData.Basics
 {
-    ServerUrl = "opc.tcp://192.168.2.220:49320",
+    ServerUrl = "opc.tcp://127.0.0.1:8866/Opc.Ua.Service",
+    Password="ysai",
+    UserName="ysai",
     CustomName = "YSAI 性能测试",
 });
 Console.WriteLine(opcUaClientOperate.On().ToJson().JsonFormatting());
@@ -25,16 +28,48 @@ while (true)
 
 void OpcUaClientOperate_OnEvent(object? sender, EventResult e)
 {
-    if (e.RData != null)
-    {
-        Console.ForegroundColor = ConsoleColor.Green;
-        Console.WriteLine(e.RData.ToJson());
-    }
-    else
+    switch (e.RType)
     {
-        Console.ForegroundColor = ConsoleColor.Red;
-        Console.WriteLine(e.ToJson().JsonFormatting());
+        case YSAI.Core.@enum.ResultType.KeyValue:
+            ConcurrentDictionary<string,AddressValue> pairs=e.RData as ConcurrentDictionary<string,AddressValue>;
+            foreach (var item in pairs)
+            {
+                String str = String.Format("{0,-100}{1,-100}", item.Key, item.Value.Value);
+
+                LogHelper.Verbose(str);
+            }
+            break;
+        case YSAI.Core.@enum.ResultType.KeyValueArray:
+            break;
+        case YSAI.Core.@enum.ResultType.Json:
+            break;
+        case YSAI.Core.@enum.ResultType.Bytes:
+            break;
+        case YSAI.Core.@enum.ResultType.String:
+            break;
+        case YSAI.Core.@enum.ResultType.Dynamic:
+            break;
+        case YSAI.Core.@enum.ResultType.OperateResult:
+            break;
+        case YSAI.Core.@enum.ResultType.Enum:
+            break;
+        case YSAI.Core.@enum.ResultType.All:
+            break;
+        case YSAI.Core.@enum.ResultType.NULL:
+            break;
+        default:
+            break;
     }
+    //if (e.RData != null)
+    //{
+    //    Console.ForegroundColor = ConsoleColor.Green;
+    //    Console.WriteLine(e.RData.ToJson());
+    //}
+    //else
+    //{
+    //    Console.ForegroundColor = ConsoleColor.Red;
+    //    Console.WriteLine(e.ToJson().JsonFormatting());
+    //}
 }