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; }