From 6fb8a1794e6cc59beb82b9b5a6219cd11ad6e3ba Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Fri, 12 May 2023 09:16:19 +0800 Subject: [PATCH] =?UTF-8?q?rev=20=E5=A0=86=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 65 ++++++++++--------- .../siemens_conveyor/ItemProtocol.java | 16 +++++ .../SiemensConveyorDeviceDriver.java | 29 +++++++++ 3 files changed, 78 insertions(+), 32 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 994d28e52..df3562476 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -205,17 +205,18 @@ public class NDCAgvServiceImpl implements NDCAgvService { int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height()); int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height()); //默认取货放货高度都为0 - int type = Integer.parseInt(inst.getInstruction_type()); -// if (startHeight != 0 && nextHeight != 0) { -// //取货放货高度都不为0 -// type = 1; -// } else if (startHeight != 0 && nextHeight == 0) { -// //取货高度不为0 放货高度为0 -// type = 2; -// } else if (startHeight == 0 && nextHeight != 0) { -// //取货高度为0 放货高度不为0 -// type = 3; -// } + //int type = Integer.parseInt(inst.getInstruction_type()); + int type = 4; + if (startHeight != 0 && nextHeight != 0) { + //取货放货高度都不为0 + type = 1; + } else if (startHeight != 0 && nextHeight == 0) { + //取货高度不为0 放货高度为0 + type = 2; + } else if (startHeight == 0 && nextHeight != 0) { + //取货高度为0 放货高度不为0 + type = 3; + } int priority = Integer.parseInt(inst.getPriority()) + 128; DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); @@ -256,37 +257,37 @@ public class NDCAgvServiceImpl implements NDCAgvService { System.out.println(str); System.out.println(str1); -// byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, -// (byte) 0X00, (byte) 0X08, -// (byte) 0X00, (byte) 0X16, -// (byte) 0X00, (byte) 0X01, -// (byte) 0X00, (byte) 0X71, -// (byte) 0X00, (byte) 0X12, -// (byte) 0X01, prioritylow, -// (byte) 0X00, (byte) 0X01, -// (byte) ikeyhigh, (byte) ikeylow, -// (byte) ikeyhigh, (byte) ikeylow, -// (byte) typehigh, (byte) typelow, -// (byte) qhdhigh, (byte) qhdlow, -// (byte) fhdhigh, (byte) fhdlow, -// (byte) shhigh, (byte) shlow, -// (byte) nhhigh, (byte) nhlow -// }; - byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X12, + (byte) 0X00, (byte) 0X16, (byte) 0X00, (byte) 0X01, (byte) 0X00, (byte) 0X71, - (byte) 0X00, (byte) 0X0E, + (byte) 0X00, (byte) 0X12, (byte) 0X01, prioritylow, (byte) 0X00, (byte) 0X01, (byte) ikeyhigh, (byte) ikeylow, (byte) ikeyhigh, (byte) ikeylow, (byte) typehigh, (byte) typelow, (byte) qhdhigh, (byte) qhdlow, - (byte) fhdhigh, (byte) fhdlow + (byte) fhdhigh, (byte) fhdlow, + (byte) shhigh, (byte) shlow, + (byte) nhhigh, (byte) nhlow }; + +// byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, +// (byte) 0X00, (byte) 0X08, +// (byte) 0X00, (byte) 0X12, +// (byte) 0X00, (byte) 0X01, +// (byte) 0X00, (byte) 0X71, +// (byte) 0X00, (byte) 0X0E, +// (byte) 0X01, prioritylow, +// (byte) 0X00, (byte) 0X01, +// (byte) ikeyhigh, (byte) ikeylow, +// (byte) ikeyhigh, (byte) ikeylow, +// (byte) typehigh, (byte) typelow, +// (byte) qhdhigh, (byte) qhdlow, +// (byte) fhdhigh, (byte) fhdlow +// }; log.info("下发AGV作业指令 --{}", str1); log.info("下发AGV作业指令--{}", str); log.info("下发agv指令数据--{}", Bytes2HexString(b)); @@ -311,7 +312,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { (byte) 0X00, (byte) 0X6D, (byte) 0X00, (byte) 0X06, (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, + (byte) 0X01, (byte) 0X14, (byte) phasehigh, (byte) phaselow }; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java index 4820e9d2a..fe28d286b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/ItemProtocol.java @@ -85,6 +85,22 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_task); } + public int getTo_strap_times() { + return this.getOpcIntegerValue(item_to_strap_times); + } + + public int getTo_length() { + return this.getOpcIntegerValue(item_to_length); + } + + public int getTo_weight() { + return this.getOpcIntegerValue(item_to_weight); + } + + public int getTo_height() { + return this.getOpcIntegerValue(item_to_height); + } + Boolean isonline; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index e0d76c442..161d842a4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -111,6 +111,15 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme int to_task = 0; int last_to_task = 0; + int to_strap_times = 0; + int last_to_strap_times = 0; + int to_length = 0; + int last_to_length = 0; + int to_weight = 0; + int last_to_weight = 0; + int to_height = 0; + int last_to_height = 0; + int phase = 0; int index = 0; Boolean isonline = true; @@ -168,10 +177,26 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme to_target = this.itemProtocol.getTo_target(); to_task = this.itemProtocol.getTo_task(); heartbeat = this.itemProtocol.getHeartbeat(); + to_strap_times = this.itemProtocol.getTo_strap_times(); + to_length = this.itemProtocol.getTo_length(); + to_weight = this.itemProtocol.getTo_weight(); + to_height = this.itemProtocol.getTo_height(); // if(heartbeat != last_heartbeat){ // logServer.deviceExecuteLog(this.device_code, "", "", "heartbeat:" + last_heartbeat + "->" + heartbeat); // } + if (to_strap_times != last_to_strap_times) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_strap_times:" + last_to_strap_times + "->" + to_strap_times); + } + if (to_length != last_to_length) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_length:" + last_to_length + "->" + to_length); + } + if (to_weight != last_to_weight) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_weight:" + last_to_weight + "->" + to_weight); + } + if (to_height != last_to_height) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_height:" + last_to_height + "->" + to_height); + } if (to_command != last_to_command) { logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command); } @@ -362,6 +387,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme last_to_task = to_task; last_to_command = to_command; last_to_target = to_target; + last_to_strap_times = to_strap_times; + last_to_length = to_length; + last_to_weight = to_weight; + last_to_height = to_height; } private void shipDeviceUpdate() {