更新驱动
This commit is contained in:
@@ -14,6 +14,7 @@ public class ItemProtocol {
|
||||
public static String item_heartbeat = "heartbeat";
|
||||
public static String item_mode = "mode";
|
||||
public static String item_move = "move";
|
||||
public static String item_action = "action";
|
||||
public static String item_ioaction = "ioaction";
|
||||
public static String item_error = "error";
|
||||
public static String item_task = "task";
|
||||
@@ -36,6 +37,10 @@ public class ItemProtocol {
|
||||
return this.getOpcIntegerValue(item_mode);
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return this.getOpcIntegerValue(item_action);
|
||||
}
|
||||
|
||||
public int getMove() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
}
|
||||
@@ -86,19 +91,20 @@ public class ItemProtocol {
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB600.B7"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB600.D10"));
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB510.B0"));
|
||||
list.add(new ItemDto(item_mode, "工作状态", "DB510.B2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_move, "光电开关信号", "DB510.B3"));
|
||||
list.add(new ItemDto(item_action, "动作信号", "DB510.B4"));
|
||||
list.add(new ItemDto(item_error, "报警信号", "DB510.B7"));
|
||||
list.add(new ItemDto(item_task, "任务号", "DB510.D10"));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ItemDto> getWriteableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
|
||||
list.add(new ItemDto(item_to_command, "作业命令", "DB500.W2", Boolean.valueOf(true)));
|
||||
list.add(new ItemDto(item_to_target, "目标站", "DB500.W4"));
|
||||
list.add(new ItemDto(item_to_task, "任务号", "DB500.D8"));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,17 +52,7 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return getReadableItemDtos2();
|
||||
}
|
||||
|
||||
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;
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,10 +63,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
int error = 0;
|
||||
int move = 0;
|
||||
int task = 0;
|
||||
int action = 0;
|
||||
int last_mode = 0;
|
||||
int last_error = 0;
|
||||
int last_move = 0;
|
||||
int last_task = 0;
|
||||
int last_action = 0;
|
||||
Boolean isonline = true;
|
||||
int hasGoods = 0;
|
||||
String message = null;
|
||||
@@ -130,7 +132,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
try {
|
||||
String device_code = this.getDeviceCode();
|
||||
mode = this.itemProtocol.getMode();
|
||||
error = this.itemProtocol.getError();
|
||||
action = this.itemProtocol.getAction();
|
||||
error = this.itemProtocol.getError();
|
||||
move = this.itemProtocol.getMove();
|
||||
task = this.itemProtocol.getTask();
|
||||
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.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) {
|
||||
this.execute_log.setResource(this.devicecode, this.device.getDevice_name());
|
||||
this.execute_log.log("设备:" + device_code + ",last_move -> move:" + last_mode + "->" + move);
|
||||
|
||||
Reference in New Issue
Block a user