From ddf73d75e8464400a9fe9a33152aa268614308aa Mon Sep 17 00:00:00 2001 From: yanps Date: Sat, 18 Jan 2025 13:23:10 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E4=B8=80=E6=9C=9F=E5=88=86=E5=88=87?= =?UTF-8?q?=E8=A1=8C=E6=9E=B6=E4=B8=8B=E5=8F=91=E6=8C=87=E4=BB=A4=E4=BC=98?= =?UTF-8?q?=E5=8C=96,=E4=BA=8C=E6=9C=9F=E8=AE=BE=E5=A4=87=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SlitTwoManipulatorDeviceDriver.java | 7 +++++ .../server/impl/XianGongAgvServiceImpl.java | 7 +++-- .../BeltConveyorDeviceDriver.java | 10 ++++--- .../conveyor/belt_conveyor/ItemProtocol.java | 4 +-- ...ConveyorWithScannerWeightDeviceDriver.java | 16 +++++++----- .../scanner_weight_conveyor/ItemProtocol.java | 8 +++--- .../ReturnGoodManipulatorDeviceDriver.java | 4 ++- .../StandardStackerDeviceDriver.java | 3 ++- .../org/nl/acs/utils/DeviceErrorUtil.java | 26 +++++++++++++++++++ 9 files changed, 64 insertions(+), 21 deletions(-) create mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DeviceErrorUtil.java 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 0f318ce3e..3b394ef83 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 @@ -678,6 +678,13 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } if (!ObjectUtil.isEmpty(taskDto)) { + if (taskDto.getStart_device_code().endsWith("X")) { + Boolean result = this.checkIsSafe(taskDto.getStart_device_code(), taskDto); + if (!result) { + notCreateInstMessage = "该设备存在上工位任务,此任务无法执行!"; + return false; + } + } flag = this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList); if (flag) { notCreateInstMessage = ""; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index 8128bbfd3..82d7610eb 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -245,10 +245,13 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + instCode + "/withdrawal"; + agvurl = agvurl + ":" + agvport + "/terminate"; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("id", instCode); + jsonObject.put("disableVehicle", false); log.info("删除agv指令请求agvurl:{}", agvurl); HttpResponse result = HttpRequest.post(agvurl) - //超时,毫秒 + .body(jsonObject.toJSONString()) .timeout(20000) .execute(); log.info("删除agv指令请求反馈:{}", result); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index 787f16f92..f6b115d05 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -40,6 +40,7 @@ import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.acs.utils.DeviceErrorUtil; import org.nl.common.utils.SecurityUtils; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; @@ -144,8 +145,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements /** * 下发命令 */ - int to_command = 0; - int last_to_command = 0; + String to_command = null; + String last_to_command = null; /** * 下发目标站 */ @@ -335,13 +336,14 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } catch (Exception var17) { this.iserror = true; + message = "读取信号值时出现异常"; + String extracted = DeviceErrorUtil.extracted(var17); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(this.device_code + "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null") + .content(this.device_code + extracted + ",报错信息:" + var17.getMessage()) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); - message = "读取信号值时出现异常"; var17.printStackTrace(); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java index 4fed8c6d8..8a7cd386f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java @@ -121,8 +121,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_target); } - public int getTo_command() { - return this.getOpcIntegerValue(item_to_command); + public String getTo_command() { + return this.getOpcStringValue(item_to_command); } public int getTo_container_type() { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index a14a687de..23f5158de 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -49,6 +49,7 @@ import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.taskscreen.service.TaskScreenService; +import org.nl.acs.utils.DeviceErrorUtil; import org.nl.common.exception.BadRequestException; import org.nl.common.utils.SecurityUtils; import org.nl.config.SpringContextHolder; @@ -114,11 +115,11 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv int to_command = 0; int last_to_command = 0; - int to_target = 0; - int last_to_target = 0; + String to_target = null; + String last_to_target = null; - int to_task = 0; - int last_to_task = 0; + String to_task = null; + String last_to_task = null; int to_container_type = 0; int last_to_container_type = 0; @@ -144,7 +145,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv String last_barcode = null; - //子卷条码 + //木箱条码 String material_barcode = null; String last_material_barcode = null; @@ -409,9 +410,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } } catch (Exception e) { this.iserror = true; + String extracted = DeviceErrorUtil.extracted(e); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null") + .content(this.device_code + extracted + ",报错信息:" + e.getMessage()) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1102,7 +1104,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv this.writing(list); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(device_code + inst.getInstruction_code() + "再次下发电气信号") + .content(device_code + instdto.getInstruction_code() + "再次下发电气信号") .build(); luceneExecuteLogService.deviceExecuteLog(logDto); try { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java index 63b171efa..858495909 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java @@ -132,16 +132,16 @@ public class ItemProtocol { public Float getWeight(){ return this.getOpcFloatValue(item_weight); } - public int getTo_task() { - return this.getOpcIntegerValue(item_to_task); + public String getTo_task() { + return this.getOpcStringValue(item_to_task); } public int getTo_command() { return this.getOpcIntegerValue(item_to_command); } - public int getTo_target() { - return this.getOpcIntegerValue(item_to_target); + public String getTo_target() { + return this.getOpcStringValue(item_to_target); } public int getContainer_type(){ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java index b5338e5d7..556dbaa80 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java @@ -39,6 +39,7 @@ import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskTypeEnum; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.acs.utils.DeviceErrorUtil; import org.nl.common.exception.BadRequestException; import org.nl.common.utils.SecurityUtils; import org.nl.config.SpringContextHolder; @@ -228,9 +229,10 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } catch (Exception e) { this.iserror = true; + String extracted = DeviceErrorUtil.extracted(e); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) - .content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null") + .content(this.device_code + extracted + ",报错信息:" + e.getMessage()) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java index ea2ca5484..2cd4c7dc4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java @@ -885,7 +885,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } else { //维修解警后重新向堆垛机下发指令 Instruction instructionErro = checkInst(); - if (ObjectUtil.isNotEmpty(instructionErro) && InstructionStatusEnum.BUSY.getIndex().equals(instructionErro.getInstruction_status()) && StrUtil.isNotEmpty(instructionErro.getExecute_code())) { + if (ObjectUtil.isNotEmpty(instructionErro) && InstructionStatusEnum.BUSY.getIndex().equals(instructionErro.getInstruction_status()) + && StrUtil.isNotEmpty(instructionErro.getExecute_code())) { if (StrUtil.isEmpty(instructionErro.getExecute_message())) { String start_device_code = instructionErro.getStart_device_code(); Device startDevice = deviceAppService.findDeviceByCode(start_device_code); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DeviceErrorUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DeviceErrorUtil.java new file mode 100644 index 000000000..9297549a6 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/utils/DeviceErrorUtil.java @@ -0,0 +1,26 @@ +package org.nl.acs.utils; + +import lombok.extern.slf4j.Slf4j; +import org.nl.common.logging.annotation.Log; + +@Slf4j +public class DeviceErrorUtil { + + public static String extracted(Exception var17) { + StringBuffer errorStack = new StringBuffer(); + errorStack.append("
【异常堆栈:"); + int x = 0; + StackTraceElement[] stackTrace = var17.getStackTrace(); + if (stackTrace != null && stackTrace.length > 0) { + for (StackTraceElement stack : stackTrace) { + x++; + errorStack.append(stack.toString().replaceAll("<", ">")).append("
"); + if (x > 10) { + break; + } + } + } + return errorStack.append("】").toString(); + } + +}