diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java index 66ceecc9f..261abb188 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/ItemProtocol.java @@ -22,10 +22,14 @@ public class ItemProtocol { public static String item_action = "action"; //行走列 public static String item_walk_y = "walk_y"; - //报警 - public static String item_error = "error"; //任务号 public static String item_task = "task"; + //报警 + public static String item_error = "error"; + //x轴坐标 + public static String item_x_position = "x_position"; + //y轴坐标 + public static String item_y_position = "y_position"; //下发命令 public static String item_to_command = "to_command"; @@ -87,6 +91,14 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_onset); } + public float getX_position() { + return this.getOpcFloatValue(item_x_position); + } + + public float getY_position() { + return this.getOpcFloatValue(item_y_position); + } + Boolean isonline; @@ -113,8 +125,21 @@ public class ItemProtocol { return "0"; } + 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 static List getReadableItemDtos() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); list.add(new ItemDto(item_mode, "工作模式", "DB1.B1")); list.add(new ItemDto(item_move, "光电信号", "DB1.B2")); @@ -122,11 +147,13 @@ public class ItemProtocol { list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4")); list.add(new ItemDto(item_error, "报警信号", "DB1.B5")); list.add(new ItemDto(item_task, "任务号", "DB1.D6")); + list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL10")); + list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL14")); return list; } public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_to_command, "下发命令", "DB2.W0")); list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2")); list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4")); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 715c699b4..e21640c6f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -88,6 +88,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //任务号 int task = 0; int last_task = 0; + // x坐标 + float x_position = 0; + float last_x_position = 0; + // y坐标 + float y_position = 0; + float last_y_position = 0; int heartbeat = 0; int last_heartbeat = 0; @@ -163,6 +169,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i to_target = this.itemProtocol.getTo_target(); to_task = this.itemProtocol.getTo_task(); to_onset = this.itemProtocol.getTo_onset(); + x_position = this.itemProtocol.getX_position(); + y_position = this.itemProtocol.getY_position(); // if(heartbeat != last_heartbeat){ // logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat); // } @@ -244,6 +252,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); } + if (x_position != last_x_position) { + logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position:" + last_x_position + "->" + x_position); + } + if (y_position != last_y_position) { + logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position:" + last_y_position + "->" + y_position); + } update_instruction_status(); @@ -320,6 +336,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i last_to_command = to_command; last_to_target = to_target; last_to_onset = to_onset; + last_x_position = x_position; + last_y_position = y_position; } @@ -780,6 +798,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i jo.put("feedMessage", feedMessage); jo.put("driver_type", "siemens_conveyor"); jo.put("is_click", true); + jo.put("x", x_position); + jo.put("y", y_position); return jo; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java index 3c4e9834f..c0976344d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java @@ -36,6 +36,10 @@ public class ItemProtocol { public static String item_task1 = "task1"; //后工位任务号 public static String item_task2 = "task2"; + //x坐标 + public static String item_x_position = "x_position"; + //y坐标 + public static String item_y_position = "y_position"; //前工位下发命令 @@ -144,6 +148,14 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_onset2); } + public float getX_position() { + return this.getOpcFloatValue(item_x_position); + } + + public float getY_position() { + return this.getOpcFloatValue(item_y_position); + } + //是否有货 public int hasGoods(int move) { @@ -175,8 +187,22 @@ public class ItemProtocol { return "0"; } + 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 static List getReadableItemDtos() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0")); list.add(new ItemDto(item_mode, "工作模式", "DB1.B1")); list.add(new ItemDto(item_status, "设备状态", "DB1.B2")); @@ -189,11 +215,13 @@ public class ItemProtocol { list.add(new ItemDto(item_type, "任务类型", "DB1.B9")); list.add(new ItemDto(item_task1, "前工位任务号", "DB1.D10")); list.add(new ItemDto(item_task2, "后工位任务号", "DB1.D14")); + list.add(new ItemDto(item_x_position, "x坐标", "DB1.REAL20")); + list.add(new ItemDto(item_y_position, "y坐标", "DB1.REAL24")); return list; } public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(new ItemDto(item_to_command1, "前工位下发命令", "DB2.W0")); list.add(new ItemDto(item_to_onset1, "前工位下发起始站", "DB2.W2")); list.add(new ItemDto(item_to_target1, "前工位下发目标站", "DB2.W4")); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index bf98d8a25..524dbc068 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -104,6 +104,13 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl int last_task1 = 0; int task2 = 0; int last_task2 = 0; + //x坐标 + float x_position = 0; + float last_x_position = 0; + //y坐标 + float y_position = 0; + float last_y_position = 0; + int to_command1 = 0; int last_to_command1 = 0; int to_command2 = 0; @@ -194,6 +201,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl type = this.itemProtocol.getType(); task1 = this.itemProtocol.getTask1(); task2 = this.itemProtocol.getTask2(); + x_position = this.itemProtocol.getX_position(); + y_position = this.itemProtocol.getY_position(); to_command1 = this.itemProtocol.getTo_command1(); to_command2 = this.itemProtocol.getTo_command2(); heartbeat = this.itemProtocol.getHeartbeat(); @@ -312,6 +321,14 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl logServer.deviceItemValue(this.device_code, "task2", String.valueOf(task2)); logServer.deviceExecuteLog(this.device_code, "", "", "信号task2:" + last_task2 + "->" + task2); } + if (x_position != last_x_position) { + logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position:" + last_x_position + "->" + x_position); + } + if (y_position != last_y_position) { + logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position:" + last_y_position + "->" + y_position); + } update_instruction_status(); @@ -397,6 +414,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl last_to_task2 = to_task2; last_to_onset2 = to_onset2; last_to_target2 = to_target2; + last_x_position = x_position; + last_y_position = y_position; } public synchronized boolean task_check() { @@ -1164,6 +1183,8 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl jo.put("notCreateTaskMessage", notCreateTaskMessage); jo.put("notCreateInstMessage", notCreateInstMessage); jo.put("feedMessage", feedMessage); + jo.put("x", x_position); + jo.put("y", y_position); return jo; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index b3e1d9198..bfedc6cb0 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -341,7 +341,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("device_code", driver.getDevice().getDevice_code()); jo.put("device_name", driver.getDevice().getDevice_name()); jo.put("status", Math.min(3, driver.getMode())); - jo.put("y", driver.getWalk_y()); + jo.put("x", driver.getX_position()); + jo.put("y", driver.getY_position()); jo.put("error", driver.getError()); jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(driver.getError()))); } else if (device.getDeviceDriver() instanceof SlitTwoManipulatorDeviceDriver) { @@ -349,7 +350,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("device_code", driver.getDevice().getDevice_code()); jo.put("device_name", driver.getDevice().getDevice_name()); jo.put("status", Math.min(3, driver.getMode())); - jo.put("y", driver.getWalk_y()); + jo.put("x", driver.getX_position()); + jo.put("y", driver.getY_position()); jo.put("error", driver.getError()); jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(driver.getError()))); } else if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {