From 09f0cc17bc5bcd6512888db336ac407a94c548d2 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Tue, 10 Sep 2024 14:28:11 +0800 Subject: [PATCH] =?UTF-8?q?rev=20=20=E6=9B=B4=E6=96=B0=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/acs/utils/ReadUtil.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/ReadUtil.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/ReadUtil.java index a958742..2d4255c 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/ReadUtil.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/ReadUtil.java @@ -110,16 +110,16 @@ public class ReadUtil { NodeId nodeId = new NodeId(2, key); //创建数据对象,此处的数据对象一定要定义类型,不然会出现类型错误,导致无法写入 DataValue nowValue = null; - if(NumberUtil.isNumber(String.valueOf(o))){ - nowValue = new DataValue(new Variant(Integer.valueOf(o.toString())), null, null); - } else if (NumberUtil.isNumber(String.valueOf(o))) { + if(NumberUtil.isDouble(String.valueOf(o))){ nowValue = new DataValue(new Variant(Double.valueOf(o.toString())), null, null); + } else if (NumberUtil.isNumber(String.valueOf(o))) { + nowValue = new DataValue(new Variant(Integer.valueOf(o.toString())), null, null); } else { nowValue = new DataValue(new Variant(String.valueOf(o)), null, null); } //写入节点数据 StatusCode statusCode = client.writeValue(nodeId, nowValue).join(); - System.out.println("结果:" + statusCode.isGood()); + System.out.println( key +" 信号写入结果:" + statusCode.isGood()); } client.disconnect(); }catch (Exception e) {