From 622daae87d44c957a553411400b75f96442e65e0 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Wed, 20 Sep 2023 11:33:24 +0800 Subject: [PATCH] =?UTF-8?q?rev=20=E9=A9=B1=E5=8A=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ItemProtocol.java | 44 ++++++++++++------- .../StandardInspectSiteSmartDeviceDriver.java | 32 +++++++------- 2 files changed, 44 insertions(+), 32 deletions(-) diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java index ba8a1c8..48d9e9e 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java @@ -31,8 +31,8 @@ public class ItemProtocol { this.driver = driver; } - public String getWeight() { - return this.getOpcStringValue(item_weight); + public Float getWeight() { + return this.getOpcFloatValue(item_weight); } public String getProductCode() { @@ -47,32 +47,32 @@ public class ItemProtocol { return this.getOpcStringValue(item_product_specifications); } - public String getYear() { - return this.getOpcStringValue(item_year); + public Integer getYear() { + return this.getOpcIntegerValue(item_year); } - public String getMonth() { - return this.getOpcStringValue(item_month); + public Integer getMonth() { + return this.getOpcIntegerValue(item_month); } - public String getDay() { - return this.getOpcStringValue(item_day); + public Integer getDay() { + return this.getOpcIntegerValue(item_day); } - public String getHour() { - return this.getOpcStringValue(item_hour); + public Integer getHour() { + return this.getOpcIntegerValue(item_hour); } - public String getMinute() { - return this.getOpcStringValue(item_minute); + public Integer getMinute() { + return this.getOpcIntegerValue(item_minute); } - public String getSecond() { - return this.getOpcStringValue(item_second); + public Integer getSecond() { + return this.getOpcIntegerValue(item_second); } - public String getFlag() { - return this.getOpcStringValue(item_flag); + public Integer getFlag() { + return this.getOpcIntegerValue(item_flag); } @@ -97,6 +97,18 @@ public class ItemProtocol { } + + public Float getOpcFloatValue(String protocol) { + Float value = this.driver.getFloatValue(protocol); + if (value == null) { + //throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)}); + + } else { + return value; + } + return 0f; + } + public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); if (value == null) { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java index 23bc082..e07a73a 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java @@ -144,8 +144,8 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive Boolean islock = false; // 重量 - private String weight; - private String last_weight; + private Float weight; + private Float last_weight; // 产品名称 private String product_code; @@ -160,24 +160,24 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive private String last_product_specifications; // 时间 - private String year; - private String last_year; - private String month; - private String last_month; - private String day; - private String last_day; - private String hour; - private String last_hour; - private String minute; - private String last_minute; - private String second; - private String last_second; + private int year; + private int last_year; + private int month; + private int last_month; + private int day; + private int last_day; + private int hour; + private int last_hour; + private int minute; + private int last_minute; + private int second; + private int last_second; private String time; private String last_time; //气缸分离状态0-不分离,1分离 - private String flag; - private String last_flag; + private int flag; + private int last_flag; @Override public Device getDevice() {