From 2d3ee03961d6cfbde70342e8a97bc7b05d0b0dc3 Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期一, 21 七月 2025 17:27:34 +0800 Subject: [PATCH] 优化代码, 封装货位锁和创建任务流程, 数据库事务等 --- device/OpcUaHelper.cs | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/device/OpcUaHelper.cs b/device/OpcUaHelper.cs index 555fea1..4f8922c 100644 --- a/device/OpcUaHelper.cs +++ b/device/OpcUaHelper.cs @@ -2,6 +2,7 @@ using Opc.Ua; using System; using Opc.Ua.Configuration; +using HH.WCS.Mobox3.DSZSH.util; namespace HH.WCS.Mobox3.DSZSH.device @@ -22,7 +23,7 @@ { try { - // 鍒涘缓涓�釜搴旂敤閰嶇疆瀵硅薄锛岀敤浜庤缃簲鐢ㄥ悕绉般�鍞竴鏍囪瘑銆佺被鍨嬨�璇佷功鍜屽畨鍏ㄧ瓥鐣�+ // 鍒涘缓涓�釜搴旂敤閰嶇疆瀵硅薄,鐢ㄤ簬璁剧疆搴旂敤鍚嶇О,鍞竴鏍囪瘑,绫诲瀷,璇佷功鍜屽畨鍏ㄧ瓥鐣� var config = new ApplicationConfiguration() { ApplicationName = "MyClient", @@ -48,18 +49,18 @@ // 楠岃瘉搴旂敤閰嶇疆瀵硅薄 await config.Validate(ApplicationType.Client); - // 璁剧疆璇佷功楠岃瘉浜嬩欢锛岀敤浜庤嚜鍔ㄦ帴鍙椾笉鍙椾俊浠荤殑璇佷功 + // 璁剧疆璇佷功楠岃瘉浜嬩欢,鐢ㄤ簬鑷姩鎺ュ彈涓嶅彈淇′换鐨勮瘉涔� if (config.SecurityConfiguration.AutoAcceptUntrustedCertificates) { config.CertificateValidator.CertificateValidation += (s, e) => { e.Accept = (e.Error.StatusCode == StatusCodes.BadCertificateUntrusted); }; } - // 鍒涘缓涓�釜搴旂敤瀹炰緥瀵硅薄锛岀敤浜庢鏌ヨ瘉涔�+ // 鍒涘缓涓�釜搴旂敤瀹炰緥瀵硅薄,鐢ㄤ簬妫�煡璇佷功 var application = new ApplicationInstance(config); // 妫�煡搴旂敤瀹炰緥瀵硅薄鐨勮瘉涔� bool check = await application.CheckApplicationInstanceCertificate(false, 2048); - // 鍒涘缓涓�釜浼氳瘽瀵硅薄锛岀敤浜庤繛鎺ュ埌 OPC UA 鏈嶅姟鍣�+ // 鍒涘缓涓�釜浼氳瘽瀵硅薄,鐢ㄤ簬杩炴帴鍒�OPC UA 鏈嶅姟鍣� EndpointDescription endpointDescription = CoreClientUtils.SelectEndpoint("opc.tcp://172.16.57.41:4840", true); EndpointConfiguration endpointConfiguration = EndpointConfiguration.Create(config); ConfiguredEndpoint endpoint = new ConfiguredEndpoint(null, endpointDescription, endpointConfiguration); -- Gitblit v1.9.1