From 6ffe2ecd2108c21d17856ce2b38c6b93cbdbd99c Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Tue, 22 Nov 2022 11:04:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acs/device/service/impl/DeviceServiceImpl.java | 9 ++++++++- .../maGang/MaGangConveyorDeviceDriver.java | 13 ++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 8a3cdab..1a6f28f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -1123,7 +1123,14 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial "false".equalsIgnoreCase(json.getString("extra_value"))) { extraObj.put(json.getString("extra_code"), json.getBoolean("extra_value")); } else { - extraObj.put(json.getString("extra_code"), json.get("extra_value")); + boolean endsWith = json.getString("extra_value").endsWith("]"); + boolean startsWith = json.getString("extra_value").startsWith("["); + if (endsWith && startsWith){ + JSONArray extraValue = JSONArray.parseArray(json.getString("extra_value")); + extraObj.put(json.getString("extra_code"), extraValue); + } else { + extraObj.put(json.getString("extra_code"), json.get("extra_value")); + } } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java index 5c987bf..836a35e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java @@ -90,7 +90,6 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen int flag; - String device_code; @Override @@ -111,7 +110,7 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen action = this.itemProtocol.getItem_action(); error = this.itemProtocol.getItem_error(); if (mode != last_mode) { - if (mode == 3){ + if (mode == 3) { this.setRequireSucess(false); } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); @@ -150,7 +149,7 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen message = ""; Instruction instruction = null; List toInstructions; - if (mode == 3 && !requireSucess){ + if (mode == 3 && !requireSucess) { instruction_require(); } } @@ -174,21 +173,21 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen for (int i = 0; i < link_device_codes.size(); i++) { String link_device_code = link_device_codes.get(i); Device device = deviceAppservice.findDeviceByCode(link_device_code); - if (device.getDeviceDriver() instanceof MaGangConveyorDeviceDriver){ + if (device.getDeviceDriver() instanceof MaGangConveyorDeviceDriver) { maGangConveyorDeviceDriver = (MaGangConveyorDeviceDriver) device.getDeviceDriver(); - if (maGangConveyorDeviceDriver.getMove() == 0){ + if (maGangConveyorDeviceDriver.getMove() == 0) { next_device_code = link_device_code; break; } } } - if (StrUtil.isEmpty(next_device_code)){ + if (StrUtil.isEmpty(next_device_code)) { return false; } TaskDto taskDto = new TaskDto(); String now = DateUtil.now(); taskDto.setTask_id(IdUtil.simpleUUID()); - taskDto.setTask_code(CodeUtil.getNewCode("TASK_NO")); + taskDto.setTask_code("-" + CodeUtil.getNewCode("TASK_NO")); taskDto.setTask_type("1"); taskDto.setRoute_plan_code("normal"); taskDto.setTask_status("0");