From a66bd3f01b8a673dc781120c10e2c6849913c58b Mon Sep 17 00:00:00 2001 From: psh Date: Wed, 20 Sep 2023 09:49:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E6=9B=B4=E6=96=B0&=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ItemProtocol.java | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 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..a3755cb 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 @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.List; @Slf4j -@Data public class ItemProtocol { @@ -32,47 +31,47 @@ public class ItemProtocol { } public String getWeight() { - return this.getOpcStringValue(item_weight); + return String.valueOf(this.getOpcFloatValue(item_weight)); } public String getProductCode() { - return this.getOpcStringValue(item_product_code); + return String.valueOf(this.getOpcStringValue(item_product_code)); } public String getBatchCode() { - return this.getOpcStringValue(item_batch_code); + return String.valueOf(this.getOpcStringValue(item_batch_code)); } public String getProductSpecifications() { - return this.getOpcStringValue(item_product_specifications); + return String.valueOf(this.getOpcStringValue(item_product_specifications)); } public String getYear() { - return this.getOpcStringValue(item_year); + return String.valueOf(this.getOpcIntegerValue(item_year)); } public String getMonth() { - return this.getOpcStringValue(item_month); + return String.valueOf(this.getOpcIntegerValue(item_month)); } public String getDay() { - return this.getOpcStringValue(item_day); + return String.valueOf(this.getOpcIntegerValue(item_day)); } public String getHour() { - return this.getOpcStringValue(item_hour); + return String.valueOf(this.getOpcIntegerValue(item_hour)); } public String getMinute() { - return this.getOpcStringValue(item_minute); + return String.valueOf(this.getOpcIntegerValue(item_minute)); } public String getSecond() { - return this.getOpcStringValue(item_second); + return String.valueOf(this.getOpcIntegerValue(item_second)); } public String getFlag() { - return this.getOpcStringValue(item_flag); + return String.valueOf(this.getOpcIntegerValue(item_flag)); } @@ -82,15 +81,21 @@ public class ItemProtocol { return move; } + public Boolean getIsonline() { + return isonline; + } + + public void setIsonline(Boolean isonline) { + this.isonline = isonline; + } + Boolean isonline; public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegerValue(protocol); + Integer value = this.driver.getIntegeregerValue(protocol); if (value == null) { -// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); - setIsonline(false); + } else { - setIsonline(true); return value; } return 0; @@ -108,6 +113,17 @@ public class ItemProtocol { return "0"; } + public float getOpcFloatValue(String protocol) { + float value = this.driver.getFloatValue(protocol); + if (value == 0) { + + } else { + return value; + } + return 0; + + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_product_code, "产品名称", "VB3251 "));