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 1/3] =?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() { From e8e37daeef9b1f455c6cac0bef186e702c8adca0 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Fri, 12 May 2023 09:58:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?rev=20phase=E5=80=BC=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java | 10 +++++----- .../basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index 9c1e50b4b..8d2af4734 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -434,19 +434,19 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); last_error = error; - } else if (phase == 0x71) { + } else if (phase == 0x70) { //x坐标 x = ikey; - } else if (phase == 0x72) { + } else if (phase == 0x71) { //y坐标 y = ikey; - } else if (phase == 0x73) { + } else if (phase == 0x72) { //车辆角度 angle = ikey; - } else if (phase == 0x74) { + } else if (phase == 0x73) { //agv电量 electric_qty = ikey; - } else if (phase == 0x75) { + } else if (phase == 0x74) { //三色灯状态 status = ikey; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index b73ac7526..ee99e3442 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -687,19 +687,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); last_error = error; - } else if (phase == 0x71) { + } else if (phase == 0x70) { //x坐标 x = ikey; - } else if (phase == 0x72) { + } else if (phase == 0x71) { //y坐标 y = ikey; - } else if (phase == 0x73) { + } else if (phase == 0x72) { //车辆角度 angle = ikey; - } else if (phase == 0x74) { + } else if (phase == 0x73) { //agv电量 electric_qty = ikey; - } else if (phase == 0x75) { + } else if (phase == 0x74) { //三色灯状态 status = ikey; } From 23e01676c9c82eddf1e49b922dee5bf9a3af9dc5 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Fri, 12 May 2023 10:31:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=20=E7=94=B3=E8=AF=B7=E6=8D=86=E6=89=8E?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java | 1 + 1 file changed, 1 insertion(+) 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 161d842a4..1a8477b8b 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 @@ -803,6 +803,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); if (ObjectUtil.isEmpty(instruction)) { message = "申请捆扎电气设备任务号:" + task + "未找到对应指令"; + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到对应指令"); return; // throw new RuntimeException("该电气任务号未找到对应指令!"); }