From ca99141253f22243e6b7836f54947a95dcd912a3 Mon Sep 17 00:00:00 2001 From: psh Date: Thu, 18 Apr 2024 13:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E8=AF=BB=E5=86=99=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E5=8D=95=E5=AD=97=E6=AE=B5=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E4=B8=8D=E5=BD=B1=E5=93=8D=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basedriver/ssx_site/ItemProtocol.java | 63 ++++++++++++------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/ItemProtocol.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/ItemProtocol.java index a784c6f..0aef07b 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/ItemProtocol.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/ssx_site/ItemProtocol.java @@ -19,11 +19,11 @@ public class ItemProtocol { public static String item_weight = "weight"; public static String item_sub_tray = "sub_tray"; public static String item_mother_tray = "mother_tray"; - public static String item_error_code="error_code"; - public static String item_device_type="device_type"; - public static String item_frame_type="frame_type"; - public static String item_mother_type="mother_type"; - public static String item_sub_type="sub_type"; + public static String item_error_code = "error_code"; + public static String item_device_type = "device_type"; + public static String item_frame_type = "frame_type"; + public static String item_mother_type = "mother_type"; + public static String item_sub_type = "sub_type"; public static String item_to_command = "to_command"; public static String item_to_target = "to_target"; public static String item_to_task = "to_task"; @@ -54,9 +54,11 @@ public class ItemProtocol { public int getTask() { return this.getOpcIntegerValue(item_task); } + public double getWeight() { return this.getOpcFloatValue(item_weight); } + public String getSubTray() { return this.getOpcStringValue(item_sub_tray); } @@ -106,36 +108,46 @@ public class ItemProtocol { Boolean isonline; public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); - setIsonline(false); - } else { - setIsonline(true); - return value; + try { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + } catch (Exception e) { + } return 0; - } public String getOpcStringValue(String protocol) { - String value = this.driver.getStringValue(protocol); - if (value != null) { - return value; + try { + String value = this.driver.getStringValue(protocol); + if (value != null) { + return value; + } + } catch (Exception e) { + } return ""; } public float getOpcFloatValue(String protocol) { - Float value = this.driver.getDoubleValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; + try { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + } catch (Exception e) { + } return 0L; - } public static List getReadableItemDtos() { @@ -148,6 +160,11 @@ public class ItemProtocol { list.add(new ItemDto(item_sub_tray, "子托盘条码", "DB600.D4")); list.add(new ItemDto(item_mother_tray, "母托盘条码", "DB600.D4")); list.add(new ItemDto(item_error, "报警信号", "DB600.B5")); + list.add(new ItemDto(item_error_code, "超限/称重报警信号", "DB600.B6")); + list.add(new ItemDto(item_device_type, "称重信号", "DB600.B7")); + list.add(new ItemDto(item_frame_type, "检测框架信号", "DB600.B8")); + list.add(new ItemDto(item_mother_type, "母托信号", "DB600.B9")); + list.add(new ItemDto(item_sub_type, "子托信号", "DB600.B10")); return list; }