Browse Source

更新驱动

master
汪菘 2 years ago
parent
commit
d3fb58f370
  1. 22
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java
  2. 12
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java
  3. 9
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

22
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/ItemProtocol.java

@ -14,6 +14,7 @@ public class ItemProtocol {
public static String item_heartbeat = "heartbeat"; public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode"; public static String item_mode = "mode";
public static String item_move = "move"; public static String item_move = "move";
public static String item_action = "action";
public static String item_ioaction = "ioaction"; public static String item_ioaction = "ioaction";
public static String item_error = "error"; public static String item_error = "error";
public static String item_task = "task"; public static String item_task = "task";
@ -36,6 +37,10 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_mode); return this.getOpcIntegerValue(item_mode);
} }
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getMove() { public int getMove() {
return this.getOpcIntegerValue(item_move); return this.getOpcIntegerValue(item_move);
} }
@ -86,19 +91,20 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); list.add(new ItemDto(item_heartbeat, "心跳", "DB510.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true))); list.add(new ItemDto(item_mode, "工作状态", "DB510.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3")); list.add(new ItemDto(item_move, "光电开关信号", "DB510.B3"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B7")); list.add(new ItemDto(item_action, "动作信号", "DB510.B4"));
list.add(new ItemDto(item_task, "任务号", "DB600.D10")); list.add(new ItemDto(item_error, "报警信号", "DB510.B7"));
list.add(new ItemDto(item_task, "任务号", "DB510.D10"));
return list; return list;
} }
public static List<ItemDto> getWriteableItemDtos() { public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList(); ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true))); list.add(new ItemDto(item_to_command, "作业命令", "DB500.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4")); list.add(new ItemDto(item_to_target, "目标站", "DB500.W4"));
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8")); list.add(new ItemDto(item_to_task, "任务号", "DB500.D8"));
return list; return list;
} }

12
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDefination.java

@ -52,17 +52,7 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
@Override @Override
public List<ItemDto> getReadableItemDtos() { public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2(); return ItemProtocol.getReadableItemDtos();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B2", true));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B7"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D10"));
return list;
} }
@Override @Override

9
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -63,10 +63,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
int error = 0; int error = 0;
int move = 0; int move = 0;
int task = 0; int task = 0;
int action = 0;
int last_mode = 0; int last_mode = 0;
int last_error = 0; int last_error = 0;
int last_move = 0; int last_move = 0;
int last_task = 0; int last_task = 0;
int last_action = 0;
Boolean isonline = true; Boolean isonline = true;
int hasGoods = 0; int hasGoods = 0;
String message = null; String message = null;
@ -130,7 +132,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
try { try {
String device_code = this.getDeviceCode(); String device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode(); mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError(); action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove(); move = this.itemProtocol.getMove();
task = this.itemProtocol.getTask(); task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove(); hasGoods = this.itemProtocol.getMove();
@ -140,6 +143,10 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode); this.execute_log.log("设备:" + device_code + ",last_mode -> mode:" + last_mode + "->" + mode);
} }
if (action != last_action) {
this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
this.execute_log.log("设备:" + device_code + ",last_action -> action:" + last_action + "->" + action);
}
if (move != last_move) { if (move != last_move) {
this.execute_log.setResource(this.devicecode, this.device.getDevice_name()); this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
this.execute_log.log("设备:" + device_code + ",last_move -> move:" + last_mode + "->" + move); this.execute_log.log("设备:" + device_code + ",last_move -> move:" + last_mode + "->" + move);

Loading…
Cancel
Save