diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java index fa75254ea..cc07cd5a9 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/ItemProtocol.java @@ -52,12 +52,12 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_task); } - public int getQty1() { - return this.getOpcIntegerValue(item_qty1); + public float getQty1() { + return this.getOpcFloatValue(item_qty1); } - public int getQty2() { - return this.getOpcIntegerValue(item_qty2); + public float getQty2() { + return this.getOpcFloatValue(item_qty2); } public int getToCommand() { @@ -66,6 +66,18 @@ public class ItemProtocol { Boolean isonline; + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); if (value == null) { @@ -84,7 +96,7 @@ public class ItemProtocol { list.add(new ItemDto(item_heartbeat, "心跳", "DB103.W0")); list.add(new ItemDto(item_mode, "工作状态", "DB103.W2")); list.add(new ItemDto(item_move1, "光电开关信号1", "DB103.W4")); - list.add(new ItemDto(item_move1, "光电开关信号2", "DB103.W6")); + list.add(new ItemDto(item_move2, "光电开关信号2", "DB103.W6")); list.add(new ItemDto(item_qty1, "工位1重量", "DB103.REAL8")); list.add(new ItemDto(item_qty2, "工位2重量", "DB103.REAL12")); list.add(new ItemDto(item_error, "报警信号", "DB103.W16")); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java index 77239aa69..91c7ef9e6 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java @@ -68,10 +68,10 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr int last_move1 = 0; int move2 = 0; int last_move2 = 0; - int qty1 = 0; - int last_qty1 = 0; - int qty2 = 0; - int last_qty2 = 0; + float qty1 = 0f; + float last_qty1 = 0f; + float qty2 = 0f; + float last_qty2 = 0f; int task = 0; int last_task = 0; @@ -122,7 +122,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr } } catch (Exception var17) { - + var17.printStackTrace(); } @@ -172,7 +172,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr private void feedbackQty() { ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); ApplyManipulatorActionResponse applyManipulatorActionResponse; - Instruction inst1 = checkInst(); + Instruction inst1 = instructionService.findByCode(String.valueOf(task)); String task_code = inst1.getTask_code(); applyManipulatorActionRequest.setType("2"); if (qty1 > 0) {