From 4b75167f197e1a197e99ac8fb05efa5bd08d652d Mon Sep 17 00:00:00 2001 From: yanps Date: Wed, 10 Jul 2024 17:52:11 +0800 Subject: [PATCH 1/9] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0LMS=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E4=BF=A1=E5=8F=B7=E5=88=B0=E8=A5=BF=E9=97=A8=E5=AD=90?= =?UTF-8?q?=E7=A7=B0=E9=87=8D=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 1022cafa8..a0a63744c 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 @@ -209,6 +209,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { LampThreecolorDeviceDriver lampThreecolorDeviceDriver; SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; PluggingUnpluggingMachineDeviceDriver pluggingUnpluggingMachineDeviceDriver; + SiemensWeightConveyorDeviceDriver siemensWeightConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); hongXiangStationDeviceDriver.writing(code, value); @@ -225,7 +226,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { pluggingUnpluggingMachineDeviceDriver = (PluggingUnpluggingMachineDeviceDriver) device.getDeviceDriver(); pluggingUnpluggingMachineDeviceDriver.writing(code, value); } - + if (device.getDeviceDriver() instanceof SiemensWeightConveyorDeviceDriver) { + siemensWeightConveyorDeviceDriver = (SiemensWeightConveyorDeviceDriver) device.getDeviceDriver(); + siemensWeightConveyorDeviceDriver.writing(code, value); + } } response.setStatus(200); From 22944ce7eaa39056c182e19ac9bfb5f1e1a30dfe Mon Sep 17 00:00:00 2001 From: lishuai <1793460677@qq.com> Date: Thu, 11 Jul 2024 08:42:17 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E5=A0=86=E5=8F=A0=E8=A1=8C=E6=9E=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=81=E6=97=A5=E5=BF=97=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=81=E5=AE=9A=E6=97=B6=E5=99=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/nl/acs/agv/QueryAGVStatus.java | 8 +- .../server/impl/XianGongAgvServiceImpl.java | 19 +- ...pedManipulatorManipulatorDeviceDriver.java | 257 +++++++++--------- .../service/InstructionService.java | 2 + .../service/impl/InstructionServiceImpl.java | 11 + .../task/service/impl/TaskServiceImpl.java | 14 +- .../quartz/task/AutoCleanLucenceLog.java | 1 - 7 files changed, 166 insertions(+), 146 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java index e7ab768c7..4ee62576e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java @@ -86,9 +86,11 @@ public class QueryAGVStatus { if (StrUtil.isNotEmpty(instructionCode)){ Device carCode = deviceAppService.findDeviceByCode(instructionCode); XgAgvCarDeviceDriver xgAgvCarDeviceDriver; - if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver){ - xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver(); - xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type())); + if (null != carCode) { + if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) { + xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver(); + xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type())); + } } } 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 415bd79ea..2651804b9 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 @@ -796,15 +796,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //放货前二次分配 if (address.contains("WAIT")) { String newPointCode = applyCCAgvTask(task_code, instructionDto); - LuceneLogDto logDto = LuceneLogDto.builder() - .content("叉车允许放货" + "新点位:" + newPointCode) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); + JSONObject map = new JSONObject(); map.put("status", 200); map.put("message", "允许叉车放货!" + "点位" + newPointCode); log.info("允许仙工AGV放货,设备号 - {}", newPointCode); + LuceneLogDto logDto = LuceneLogDto.builder() + .content("叉车允许放货" + "新点位:" + newPointCode + map ) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); return map; } //放货前等待 @@ -859,6 +860,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { .build(); logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); + //二次分配更新点位 + updataTask(instructionDto, jo.getString("data")); //请求成功调用叉车追加动作块 sendAddSequencesToCCAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto); return jo.getString("data"); @@ -882,7 +885,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { //追加订单封口 jo.put("complete", true); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code("追加叉车运单") + .device_code(instructionDto.getCarno()) .content("指令号:" + instructionCode + ",追加叉车运单参数:" + jo) .build(); logDto.setLog_level(4); @@ -903,8 +906,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { .timeout(20000) .execute(); LuceneLogDto logDto1 = LuceneLogDto.builder() - .device_code("叉车追加运单响应") - .content("指令号:" + instructionCode + ",下发追加诺宝叉车运单反馈参数:" + jo) + .device_code(instructionDto.getCarno()) + .content("指令号:" + instructionCode + ",下发追加诺宝叉车运单反馈参数:" + result) .build(); logDto1.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto1); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java index 1956493ce..c43eb1975 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java @@ -168,7 +168,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice } // 更新指令状态 if (mode == 3 && task > 0) { - if (null!=inst) { + if (null != inst) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code(); } updateInstructionStatus(); @@ -261,10 +261,10 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice } //放货完成 - if ( action == 4 && move == 0) { + if (action == 4 && move == 0) { if (inst != null) { try { - logServer.deviceExecuteLog(this.device_code,"","","放货完成"); + logServer.deviceExecuteLog(this.device_code, "", "", "放货完成"); finish_instruction(inst); Map map1 = new HashMap<>(); List list = new ArrayList(); @@ -278,19 +278,19 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice e.printStackTrace(); } feedMessage = ""; - }else { + } else { feedMessage = "universal_feedMessage5"; if (mode != 3) { - feedMessage = "universal_feedMessage1"; + feedMessage = "universal_feedMessage1"; } if (action != 8) { - feedMessage = "universal_feedMessage2"; + feedMessage = "universal_feedMessage2"; } if (move != 0) { - feedMessage = "universal_feedMessage3"; + feedMessage = "universal_feedMessage3"; } if (task == 0) { - feedMessage = "universal_feedMessage4"; + feedMessage = "universal_feedMessage4"; } } } @@ -312,20 +312,27 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice if (ObjectUtil.isEmpty(putDeviceCodeList)) { putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); } - //找终点为入库输送线工位任务类型为行架的任务 - for (int i = 0; i < getDeviceCodeList.size(); i++) { - String startDeviceCode = getDeviceCodeList.get(i); - //先查指令 - List taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); - List taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(taskDtoStream)) { - TaskDto taskDtoIns = taskDtoStream.get(0); - if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { - Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); - String interactionJson = taskDtoIns.getInteraction_json(); + //先查指令 + List instructionList = instructionService.findReadyIns(); + if (CollUtil.isNotEmpty(instructionList)) { + List instructionsReady = new ArrayList<>(); + Instruction instructionReady = null; + for (Instruction instruction : instructionList) { + if (getDeviceCodeList.contains(instruction.getStart_device_code())) { + instructionsReady.add(instruction); + } + } + if (CollUtil.isNotEmpty(instructionsReady)) { + List instructions = instructionsReady.stream().sorted(Comparator.comparing(Instruction::getCreate_time)).collect(Collectors.toList()); + instructionReady = instructions.get(0); + } + if (ObjectUtil.isNotEmpty(instructionReady)) { + TaskDto byTaskCode = taskserver.findByTaskCode(instructionReady.getTask_code()); + String interactionJson = byTaskCode.getInteraction_json(); + if (StrUtil.isNotEmpty(interactionJson)) { InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); - String start_device_code = taskDtoIns.getStart_device_code(); - String next_device_code = taskDtoIns.getNext_device_code(); + String start_device_code = byTaskCode.getStart_device_code(); + String next_device_code = byTaskCode.getNext_device_code(); Device startDevice = deviceAppService.findDeviceByCode(start_device_code); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); String start_addr = startDevice.getExtraValue().get("address").toString(); @@ -350,108 +357,108 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice Map map10 = new HashMap<>(); Map map11 = new HashMap<>(); try { - pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9,map10,map11,instruction.getVehicle_code()); + pushPLC(map1, map2, next_addr, map3, start_addr, map4, instructionReady.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9, map10, map11, instructionReady.getVehicle_code()); } catch (Exception e) { logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" - + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() - + ",指令终点:" + instruction.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage()); + + instructionReady.getInstruction_code() + ",指令起点:" + instructionReady.getStart_device_code() + + ",指令终点:" + instructionReady.getNext_device_code() + ",交互参数:" + interactionJsonDTO.toString() + ",指令执行失败:" + e.getMessage()); } this.setRequireSucess(true); return true; } - } else { - List taskDtos = taskserver.findByTrappedManipulatorReady(); - List taskDtosReady = new ArrayList<>(); - TaskDto taskDto = null; - if (CollUtil.isNotEmpty(taskDtos)) { - for (TaskDto taskDto1 : taskDtos) { - if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) { - taskDtosReady.add(taskDto1); - } + } + } else { + List taskDtos = taskserver.findByTrappedManipulatorReady(); + List taskDtosReady = new ArrayList<>(); + TaskDto taskDto = null; + if (CollUtil.isNotEmpty(taskDtos)) { + for (TaskDto taskDto1 : taskDtos) { + if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) { + taskDtosReady.add(taskDto1); } } - if (CollUtil.isNotEmpty(taskDtosReady)) { - List taskDtoList = taskDtosReady.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); - taskDto = taskDtoList.get(0); + } + if (CollUtil.isNotEmpty(taskDtosReady)) { + List taskDtoList = taskDtosReady.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList()); + taskDto = taskDtoList.get(0); + } + if (ObjectUtil.isNotEmpty(taskDto)) { + String interactionJson = taskDto.getInteraction_json(); + InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); + String start_device_code = taskDto.getStart_device_code(); + String next_device_code = taskDto.getNext_device_code(); + Device startDevice = deviceAppService.findDeviceByCode(start_device_code); + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + if (ObjectUtil.isEmpty(start_addr)) { + notCreateInstMessage = "universal_notCreateInstMessage1"; + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(next_addr)) { + notCreateInstMessage = "universal_notCreateInstMessage1"; + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); } - if (ObjectUtil.isNotEmpty(taskDto)) { - String interactionJson = taskDto.getInteraction_json(); - InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); - String start_device_code = taskDto.getStart_device_code(); - String next_device_code = taskDto.getNext_device_code(); - Device startDevice = deviceAppService.findDeviceByCode(start_device_code); - Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); - String start_addr = startDevice.getExtraValue().get("address").toString(); - String next_addr = nextDevice.getExtraValue().get("address").toString(); - if (ObjectUtil.isEmpty(start_addr)) { - notCreateInstMessage = "universal_notCreateInstMessage1"; - throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); - } - if (ObjectUtil.isEmpty(next_addr)) { - notCreateInstMessage = "universal_notCreateInstMessage1"; - throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); - } - BeltConveyorDeviceDriver beltConveyorDeviceDriver; - if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { - beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver(); - if (beltConveyorDeviceDriver.getMove() != 1&&beltConveyorDeviceDriver.getMode() != 2) { - notCreateInstMessage = "universal_notCreateInstMessage2"; - return false; - } - } - - String taskid = taskDto.getTask_id(); - String taskcode = taskDto.getTask_code(); - String start_point_code = taskDto.getStart_point_code(); - String route_plan_code = taskDto.getRoute_plan_code(); - String next_point_code = taskDto.getNext_point_code(); - Instruction instdto = new Instruction(); - packageData(instdto, route_plan_code, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code); - - try { - instructionService.create(instdto); - } catch (Exception e) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(device_code+"创建指令时出现异常:" + e.getMessage()) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver(); + if (beltConveyorDeviceDriver.getMove() != 1 && beltConveyorDeviceDriver.getMode() != 2) { + notCreateInstMessage = "universal_notCreateInstMessage2"; return false; } - //创建指令后修改任务状态 - taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); - taskserver.update(taskDto); - requireSucess = true; - - Map map1 = new HashMap<>(); - Map map2 = new HashMap<>(); - Map map3 = new HashMap<>(); - Map map4 = new HashMap<>(); - Map map5 = new HashMap<>(); - Map map6 = new HashMap<>(); - Map map7 = new HashMap<>(); - Map map8 = new HashMap<>(); - Map map9 = new HashMap<>(); - Map map10 = new HashMap<>(); - Map map11 = new HashMap<>(); - try { - pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9,map10, map11, taskDto.getVehicle_code()); - } catch (Exception e) { - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content(device_code+"创建指令时出现异常:" + e.getMessage()) - .build(); - logDto.setLog_level(2); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - this.setRequireSucess(true); - return true; - } else { - notCreateInstMessage = "universal_notCreateInstMessage"; } + + String taskid = taskDto.getTask_id(); + String taskcode = taskDto.getTask_code(); + String start_point_code = taskDto.getStart_point_code(); + String route_plan_code = taskDto.getRoute_plan_code(); + String next_point_code = taskDto.getNext_point_code(); + Instruction instdto = new Instruction(); + packageData(instdto, route_plan_code, taskid, taskcode, start_device_code, next_device_code, start_point_code, next_point_code); + + try { + instructionService.create(instdto); + } catch (Exception e) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code + "创建指令时出现异常:" + e.getMessage()) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + return false; + } + //创建指令后修改任务状态 + taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); + taskserver.update(taskDto); + requireSucess = true; + + Map map1 = new HashMap<>(); + Map map2 = new HashMap<>(); + Map map3 = new HashMap<>(); + Map map4 = new HashMap<>(); + Map map5 = new HashMap<>(); + Map map6 = new HashMap<>(); + Map map7 = new HashMap<>(); + Map map8 = new HashMap<>(); + Map map9 = new HashMap<>(); + Map map10 = new HashMap<>(); + Map map11 = new HashMap<>(); + try { + pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8, map9, map10, map11, taskDto.getVehicle_code()); + } catch (Exception e) { + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content(device_code + "创建指令时出现异常:" + e.getMessage()) + .build(); + logDto.setLog_level(2); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + this.setRequireSucess(true); + return true; + } else { + notCreateInstMessage = "universal_notCreateInstMessage"; } } return true; @@ -459,7 +466,6 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice } - private void pushPLC(Map map1, Map map2, String next_addr, Map map3, String start_addr, Map map4, String task, InteractionJsonDTO interactionJsonDTO, Map map5, Map map6, Map map7, Map map8, Map map9, Map map10, Map map11, String vehicleCode) { List list = new ArrayList(); @@ -511,7 +517,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice map11.put("value", vehicleCode); list.add(map11); } - Map map12 = new HashMap<>(); + Map map12 = new HashMap<>(); if (ObjectUtil.isNotEmpty(interactionJsonDTO.getBindingTimes())) { map12.put("code", "to_binding_times"); map12.put("value", interactionJsonDTO.getBindingTimes()); @@ -522,22 +528,23 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice this.writing(list); } - private void packageData(Instruction instdto, String route_plan_code, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code) { - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setCreate_by(SecurityUtils.getCurrentNickName()); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); - instdto.setInstruction_status("0"); - instdto.setExecute_device_code(device_code); - } + private void packageData(Instruction instdto, String route_plan_code, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code) { + instdto.setInstruction_id(IdUtil.simpleUUID()); + instdto.setRoute_plan_code(route_plan_code); + instdto.setTask_id(taskid); + instdto.setTask_code(taskcode); + instdto.setCreate_by(SecurityUtils.getCurrentNickName()); + instdto.setStart_device_code(start_device_code); + instdto.setNext_device_code(next_device_code); + instdto.setStart_point_code(start_point_code); + instdto.setNext_point_code(next_point_code); + instdto.setInstruction_status("0"); + instdto.setExecute_device_code(device_code); + } /** * 完成指令 + * * @param inst * @return * @throws Exception @@ -549,6 +556,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice /** * 下发信号 + * * @param list */ public void writing(List list) { @@ -591,6 +599,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice public String getToParam() { return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "."; } + @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java index a26f11e73..e7d89ad47 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -493,4 +493,6 @@ public interface InstructionService extends CommonService { List findByNextCode(String nextDeviceCode); + + List findReadyIns(); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index d5f91606d..65f143594 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -54,6 +54,7 @@ import org.nl.acs.task.TaskInstructionLock; import org.nl.acs.task.domain.Task; import org.nl.acs.task.enums.AgvSystemTypeEnum; 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.common.base.PageInfo; @@ -1945,6 +1946,16 @@ public class InstructionServiceImpl extends CommonServiceImpl findReadyIns() { + + //根据时间升序取第一个 + List instructionsList = instructions.stream() + .filter(item -> StrUtil.equals(item.getInstruction_type(), TaskTypeEnum.Truss_Task.getIndex()) + && StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.READY.getIndex())).collect(Collectors.toList()); + return instructionsList; + } + private boolean regional(String start_device_code, String next_device_code) { Device startdevice = deviceAppService.findDeviceByCode(start_device_code); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index ae8024ecc..fd7a48ad5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -236,7 +236,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme } @Override - public Map queryAll(Map whereJson, Pageable page) { + public Map queryAll( Map whereJson, Pageable page) { String task_code = (String) whereJson.get("task_code"); String vehicle_code = (String) whereJson.get("vehicle_code"); @@ -806,14 +806,8 @@ public class TaskServiceImpl extends CommonServiceImpl impleme this.addTaskToCache(dto); //反馈上位系统任务状态 - CompletableFuture.runAsync(() -> { - // 异步更新指令状态 - try { - this.feedWmsTaskStatus(entity); - } catch (Exception e) { - e.printStackTrace(); - } - }); + this.feedWmsTaskStatus(entity); + } @Override @@ -1641,9 +1635,9 @@ public class TaskServiceImpl extends CommonServiceImpl impleme //TODO 有需要根据上位系统反馈的信息再做进一步处理 CompletableFuture.runAsync(() -> { + acstowmsService.feedTaskStatus(ja); // 异步更新指令状态 try { - acstowmsService.feedTaskStatus(ja); } catch (Exception e) { e.printStackTrace(); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCleanLucenceLog.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCleanLucenceLog.java index 329254267..031848dec 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCleanLucenceLog.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCleanLucenceLog.java @@ -52,6 +52,5 @@ public class AutoCleanLucenceLog { TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); writer.deleteDocuments(termRangeQuery); writer.commit(); - writer.close(); } } From 3b4fdf64ddf7478580144e5d1fca88c56a685464 Mon Sep 17 00:00:00 2001 From: lishuai <1793460677@qq.com> Date: Thu, 11 Jul 2024 09:33:48 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/org/nl/ApplicationTest.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/test/java/org/nl/ApplicationTest.java b/acs2/nladmin-system/nlsso-server/src/test/java/org/nl/ApplicationTest.java index 76c4d83da..a2797c38e 100644 --- a/acs2/nladmin-system/nlsso-server/src/test/java/org/nl/ApplicationTest.java +++ b/acs2/nladmin-system/nlsso-server/src/test/java/org/nl/ApplicationTest.java @@ -9,6 +9,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.scheduling.annotation.Scheduled; import java.util.Scanner; +import java.util.concurrent.*; /** * @Author: lyd @@ -32,9 +33,9 @@ public class ApplicationTest { System.out.println("请输入第一个数:"); int c = scanner.nextInt(); //求最小值 - int min = (((a < b) ? a : b) < c) ?((a < b) ? a : b):c; + int min = (((a < b) ? a : b) < c) ? ((a < b) ? a : b) : c; //求最大值 - int max = (((a > b) ? a : b) > c) ?((a > b) ? a : b):c; + int max = (((a > b) ? a : b) > c) ? ((a > b) ? a : b) : c; //求中间值 int mid = a + b + c - max - min; //排序 @@ -50,10 +51,32 @@ public class ApplicationTest { } - @org.testng.annotations.Test + @Test void demo1() { + CompletableFuture future = CompletableFuture.supplyAsync(() -> { + try { + Thread.sleep(3000); // 假设这是一个耗时的操作 + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new IllegalStateException("Interrupted", e); + } + return "Result"; + }); - + try { + String result = future.get(2, TimeUnit.SECONDS); // 设置超时时间为2秒 + System.out.println(result); + } catch (CompletionException e) { + Throwable cause = e.getCause(); + if (cause instanceof TimeoutException) { + System.out.println("Operation timed out"); + } else { + throw e; // rethrow other exceptions + } + } catch (Exception e) { + throw new RuntimeException(e); + } } + } From b43a390a6f812c3e37f554acc0b104c6f7d2c0a3 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Sat, 13 Jul 2024 08:35:29 +0800 Subject: [PATCH 4/9] =?UTF-8?q?rev=20=E4=BC=98=E5=8C=96=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/AppRun.java | 3 ++ .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 1 - .../BoxStorageOutConveyorDeviceDriver.java | 2 - .../BoxSubvolumesConveyorDeviceDriver.java | 3 +- ...nishedProductOutBindLableDeviceDriver.java | 1 - .../ManipulatorCacheDeviceDriver.java | 1 - .../UnBoxLableConveyorDeviceDriver.java | 1 - .../OvenGantryManipulatorDeviceDriver.java | 16 +++---- .../org/nl/acs/opc/DeviceExecuteAutoRun.java | 15 ++++-- .../acs/opc/DeviceOpcSynchronizeAutoRun.java | 27 ++++++++++- .../nl/acs/socket/SocketListenerAutoRun.java | 24 +++++++++- .../config/thread/ThreadPoolExecutorUtil.java | 11 +++-- .../service/quartz/utils/ExecutionJob.java | 14 +++++- .../src/main/resources/config/application.yml | 46 ++++++++----------- .../src/main/resources/logback-spring.xml | 8 ++-- 15 files changed, 115 insertions(+), 58 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java index 38ce726a6..2e0ccd498 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java @@ -3,6 +3,7 @@ package org.nl; import cn.dev33.satoken.annotation.SaIgnore; import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; import com.alicp.jetcache.anno.config.EnableMethodCache; +import org.dromara.dynamictp.core.spring.EnableDynamicTp; import org.mybatis.spring.annotation.MapperScan; import org.nl.config.SpringContextHolder; import org.springframework.boot.SpringApplication; @@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController; */ @EnableAsync @RestController +@EnableDynamicTp @SpringBootApplication(exclude = { QuartzAutoConfiguration.class, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class @@ -33,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController; @EnableMethodCache(basePackages = "org.nl") @EnableCreateCacheAnnotation @MapperScan("org.nl.**.mapper") + public class AppRun { public static void main(String[] args) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 0a6972572..0832349e9 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -69,7 +69,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - final ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); TwoAgvPhase twoAgvPhase = new TwoAgvPhase(); String error_code = "0"; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index 0c5a6911b..fa33818d6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -45,7 +45,6 @@ import org.nl.config.thread.ThreadPoolExecutorUtil; import org.openscada.opc.lib.da.Server; import java.util.*; -import java.util.concurrent.ThreadPoolExecutor; /** * 一楼木箱入库站点 @@ -54,7 +53,6 @@ import java.util.concurrent.ThreadPoolExecutor; @Data @RequiredArgsConstructor public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); protected ItemProtocol itemProtocol = new ItemProtocol(this); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java index 0d8616910..f6ecfd3d2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java @@ -44,6 +44,7 @@ import org.nl.system.service.param.ISysParamService; import org.openscada.opc.lib.da.Server; import java.util.*; +import java.util.concurrent.Executor; import java.util.concurrent.ThreadPoolExecutor; /** @@ -53,7 +54,7 @@ import java.util.concurrent.ThreadPoolExecutor; @Data @RequiredArgsConstructor public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + private final static Executor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); protected ItemProtocol itemProtocol = new ItemProtocol(this); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java index 7398be39b..43585d2ef 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java @@ -53,7 +53,6 @@ import java.util.concurrent.ThreadPoolExecutor; @Data @RequiredArgsConstructor public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); protected ItemProtocol itemProtocol = new ItemProtocol(this); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDeviceDriver.java index 9fcc854c4..c3dd59eb2 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/manipulator_cache/ManipulatorCacheDeviceDriver.java @@ -26,7 +26,6 @@ import java.util.concurrent.ThreadPoolExecutor; @Slf4j @Data public class ManipulatorCacheDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); protected ItemProtocol itemProtocol = new ItemProtocol(this); //当前指令 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java index 37bf7ca51..e9bf657d8 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/UnBoxLableConveyorDeviceDriver.java @@ -51,7 +51,6 @@ import java.util.concurrent.ThreadPoolExecutor; @Data @RequiredArgsConstructor public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); protected ItemProtocol itemProtocol = new ItemProtocol(this); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index c7bca193b..d4c453b01 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -48,7 +48,7 @@ import org.nl.config.thread.ThreadPoolExecutorUtil; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; -import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.Executor; /** * 烘箱-行架机械手 @@ -79,7 +79,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i @Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); - final ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + final Executor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); //工作模式 int mode = 0; @@ -464,12 +464,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map3); this.writing(list); if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.submit(() -> { + EXECUTOR.execute(() -> { toOpenDoor(startdevice); }); } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.submit(() -> { + EXECUTOR.execute(() -> { toOpenDoor(nextdevice); }); } @@ -672,12 +672,12 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map3); this.writing(list); if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.submit(() -> { + EXECUTOR.execute(() -> { toOpenDoor(startdevice); }); } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.submit(() -> { + EXECUTOR.execute(() -> { toOpenDoor(nextdevice); }); } @@ -938,7 +938,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); - EXECUTOR.submit(() -> { + EXECUTOR.execute(() -> { toCloseDoor(device); }); } @@ -1040,7 +1040,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i LampThreecolorDeviceDriver lampThreecolorDeviceDriver; if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); - EXECUTOR.submit(() -> { + EXECUTOR.execute(() -> { toCloseDoor(nextDevice); }); if (StrUtil.isNotEmpty(taskDto.getOven_time())) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java index 2ec20e74e..88e66cf34 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java @@ -7,9 +7,12 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.udw.UnifiedDataAccessor; import org.nl.acs.udw.UnifiedDataAccessorFactory; import org.nl.config.thread.TheadFactoryName; +import org.nl.config.thread.ThreadPoolExecutorUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.*; @@ -30,7 +33,10 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { int multiple = cache_thread; int loop_time_millions = 100; - ExecutorService executorService; + + @Resource + private ThreadPoolExecutor executorService; + Map runs; public DeviceExecuteAutoRun() { @@ -43,7 +49,7 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { new ArrayBlockingQueue<>( queueLength), new TheadFactoryName() );*/ - this.executorService = new ThreadPoolExecutor( + /*this.executorService = new ThreadPoolExecutor( 50, 100, 1L, @@ -62,7 +68,8 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { } } } - ); + );*/ +// this.executorService= ThreadPoolExecutorUtil.getPoll(); this.runs = new LinkedHashMap(); this.runs = Collections.synchronizedMap(this.runs); } @@ -121,7 +128,7 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { this.runs.put(deviceDriver.getDeviceCode(), runnable); } runnable.setIndex(this.runs); - this.executorService.submit(runnable); + this.executorService.execute(runnable); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java index 65f5d3f38..f9023e4c5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java @@ -1,18 +1,24 @@ package org.nl.acs.opc; import cn.hutool.core.util.ObjectUtil; +import org.dromara.dynamictp.core.support.ThreadPoolBuilder; import org.nl.acs.auto.run.AbstractAutoRunnable; import org.nl.acs.opc.service.dto.OpcServerManageDto; import org.nl.config.thread.TheadFactoryName; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import javax.annotation.Resource; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import static org.dromara.dynamictp.common.em.QueueTypeEnum.MEMORY_SAFE_LINKED_BLOCKING_QUEUE; /** * OPC设备同步启动 @@ -22,7 +28,16 @@ import java.util.concurrent.Executors; public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable { public static boolean isRun = false; - ExecutorService executorService = Executors.newCachedThreadPool(); + ExecutorService executorService = ThreadPoolBuilder.newBuilder() + .threadPoolName("deviceOpc_thread") + .threadFactory("deviceOpc_thread") + .corePoolSize(2) + .maximumPoolSize(7) + .keepAliveTime(40) + .timeUnit(TimeUnit.SECONDS) + .workQueue(MEMORY_SAFE_LINKED_BLOCKING_QUEUE.getName(), 2000) + .buildDynamic(); + @Autowired private DeviceAppService deviceAppService; @Autowired @@ -80,6 +95,14 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable { public void after() { isRun = false; this.executorService.shutdownNow(); - this.executorService = Executors.newCachedThreadPool(); + this.executorService = ThreadPoolBuilder.newBuilder() + .threadPoolName("deviceOpc_thread") + .threadFactory("deviceOpc_thread") + .corePoolSize(2) + .maximumPoolSize(7) + .keepAliveTime(40) + .timeUnit(TimeUnit.SECONDS) + .workQueue(MEMORY_SAFE_LINKED_BLOCKING_QUEUE.getName(), 2000) + .buildDynamic(); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/socket/SocketListenerAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/socket/SocketListenerAutoRun.java index 119fc6239..05f26848f 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/socket/SocketListenerAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/socket/SocketListenerAutoRun.java @@ -1,6 +1,7 @@ package org.nl.acs.socket; import cn.hutool.core.util.StrUtil; +import org.dromara.dynamictp.core.support.ThreadPoolBuilder; import org.nl.acs.auto.run.AbstractAutoRunnable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,6 +15,9 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import static org.dromara.dynamictp.common.em.QueueTypeEnum.MEMORY_SAFE_LINKED_BLOCKING_QUEUE; /** * @author 20220102CG\noblelift @@ -22,7 +26,15 @@ import java.util.concurrent.Executors; public class SocketListenerAutoRun extends AbstractAutoRunnable implements SocketService { private static final Logger log = LoggerFactory.getLogger(SocketListenerAutoRun.class); private ServerSocket serverSocket = null; - private ExecutorService threadPool = Executors.newCachedThreadPool(); + private ExecutorService threadPool = ThreadPoolBuilder.newBuilder() + .threadPoolName("socketListener_thread") + .threadFactory("socketListener_thread") + .corePoolSize(2) + .maximumPoolSize(7) + .keepAliveTime(40) + .timeUnit(TimeUnit.SECONDS) + .workQueue(MEMORY_SAFE_LINKED_BLOCKING_QUEUE.getName(), 2000) + .buildDynamic(); private Map sockets = new HashMap(); private Map outputs = new HashMap(); @@ -91,7 +103,15 @@ public class SocketListenerAutoRun extends AbstractAutoRunnable implements Socke public void after() { System.out.println("清理工作。。。。。"); this.threadPool.shutdownNow(); - this.threadPool = Executors.newCachedThreadPool(); + this.threadPool = ThreadPoolBuilder.newBuilder() + .threadPoolName("socketListener_thread") + .threadFactory("socketListener_thread") + .corePoolSize(2) + .maximumPoolSize(7) + .keepAliveTime(40) + .timeUnit(TimeUnit.SECONDS) + .workQueue(MEMORY_SAFE_LINKED_BLOCKING_QUEUE.getName(), 2000) + .buildDynamic(); this.sockets = new HashMap(); this.outputs = new HashMap(); this.closeSocket(this.serverSocket); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java index c7f5954c7..ab73632f1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java @@ -16,10 +16,12 @@ package org.nl.config.thread; +import org.dromara.dynamictp.core.DtpRegistry; import org.nl.config.SpringContextHolder; import org.springframework.stereotype.Component; import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.Executor; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -31,8 +33,11 @@ import java.util.concurrent.TimeUnit; public class ThreadPoolExecutorUtil { - public static ThreadPoolExecutor getPoll(){ - AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class); + public static Executor getPoll(){ + + return DtpRegistry.getExecutor("dtpExecutor1"); + + /* AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class); return new ThreadPoolExecutor( properties.getCorePoolSize(), properties.getMaxPoolSize(), @@ -40,6 +45,6 @@ public class ThreadPoolExecutorUtil { TimeUnit.SECONDS, new ArrayBlockingQueue<>(properties.getQueueCapacity()), new TheadFactoryName() - ); + );*/ } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java index a646e42b0..da5af0594 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java @@ -7,6 +7,8 @@ import lombok.extern.slf4j.Slf4j; import org.nl.common.utils.RedisUtils; import org.nl.common.utils.ThrowableUtil; import org.nl.config.SpringContextHolder; +import org.nl.config.thread.AsyncTaskProperties; +import org.nl.config.thread.TheadFactoryName; import org.nl.config.thread.ThreadPoolExecutorUtil; import org.nl.system.service.quartz.ISysQuartzJobService; import org.nl.system.service.quartz.dao.SysQuartzJob; @@ -21,8 +23,10 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.quartz.QuartzJobBean; +import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; /** * @Author: / @@ -41,8 +45,16 @@ public class ExecutionJob extends TLogQuartzJobBean { /* @Autowired @Qualifier("threadPoolExecutor") private ThreadPoolExecutor EXECUTOR;*/ + static AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class); - private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); + private final static ThreadPoolExecutor EXECUTOR = new ThreadPoolExecutor( + properties.getCorePoolSize(), + properties.getMaxPoolSize(), + properties.getKeepAliveSeconds(), + TimeUnit.SECONDS, + new ArrayBlockingQueue<>(properties.getQueueCapacity()), + new TheadFactoryName() + );; @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml index b92ec5a2a..409f69f12 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -7,7 +7,6 @@ spring: check-template-location: false profiles: active: dev -# active: prod jackson: time-zone: GMT+8 data: @@ -44,7 +43,7 @@ spring: enable_lazy_load_no_trans: true dynamic: tp: - enabled: false # 是否启用 dynamictp,默认true + enabled: true # 是否启用 dynamictp,默认true enabledBanner: false # 是否启用 控制台banner,默认true enabledCollect: true # 是否开启监控指标采集,默认true collectorTypes: logging,test_collect # 监控数据采集器类型(logging | micrometer | internal_logging),默认micrometer @@ -57,30 +56,23 @@ spring: keepAliveTime: 60 runTimeout: 10000 queueTimeout: 100 - notifyItems: # 报警项,不配置自动会按默认值配置(变更通知、容量报警、活性报警、拒绝报警、任务超时报警) - - type: change - enabled: true - - - type: capacity # 队列容量使用率,报警项类型,查看源码 NotifyTypeEnum枚举类 - enabled: true - threshold: 80 # 报警阈值,默认70,意思是队列使用率达到70%告警 - interval: 120 # 报警间隔(单位:s),默认120 - - - type: liveness # 线程池活性 - enabled: true - threshold: 80 # 报警阈值,默认 70,意思是活性达到70%告警 - - - type: reject # 触发任务拒绝告警 - enabled: true - threshold: 100 # 默认阈值10 - - - type: run_timeout # 任务执行超时告警 - enabled: true - threshold: 100 # 默认阈值10 - - - type: queue_timeout # 任务排队超时告警 - enabled: true - threshold: 100 # 默认阈值10 + executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量 + - threadPoolName: dtpExecutor1 # 线程池名称,必填 + threadPoolAliasName: core_thread # 线程池别名,可选 + executorType: common # 线程池类型 common、eager、ordered、scheduled、priority,默认 common + corePoolSize: 10 # 核心线程数,默认1 + maximumPoolSize: 30 # 最大线程数,默认cpu核数 + queueCapacity: 1024 # 队列容量,默认1024 + queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类,默认VariableLinkedBlockingQueue + rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类,默认AbortPolicy + keepAliveTime: 30 # 空闲线程等待超时时间,默认60 + threadNamePrefix: core_thread # 线程名前缀,默认dtp + allowCoreThreadTimeOut: true # 是否允许核心线程池超时,默认false + waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计,优雅关闭线程池,默认true + awaitTerminationSeconds: 5 # 优雅关闭线程池时,阻塞等待线程池中任务执行时间,默认3,单位(s) + preStartAllCoreThreads: false # 是否预热所有核心线程,默认false + runTimeout: 2000 # 任务执行超时阈值,单位(ms),默认0(不统计) + queueTimeout: 1000 # 任务在队列等待超时阈值,单位(ms),默认0(不统计) task: pool: # 核心线程池大小 @@ -137,7 +129,7 @@ security: mybatis-plus: configuration: map-underscore-to-camel-case: false - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl mapper-locations: - classpath:org.nl.**.mapper/*.xml global-config: diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index 2d43eddc5..d17f7a81e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -69,11 +69,11 @@ https://juejin.cn/post/6844903775631572999 - - + + - + From 2e3bbf7bbb40f29fa96b5b359dd1632685a1f5df Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Sat, 13 Jul 2024 11:19:48 +0800 Subject: [PATCH 5/9] =?UTF-8?q?rev=20=E6=9B=B4=E6=96=B0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=BB=98=E8=AE=A4=E6=9C=80=E5=A4=A7=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=95=B0=EF=BC=8C=E6=8C=89=E7=85=A7PLC=20ip=E6=95=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BA=BF=E7=A8=8B=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java index f9023e4c5..69ee0c4cc 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java @@ -31,8 +31,8 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable { ExecutorService executorService = ThreadPoolBuilder.newBuilder() .threadPoolName("deviceOpc_thread") .threadFactory("deviceOpc_thread") - .corePoolSize(2) - .maximumPoolSize(7) + .corePoolSize(80) + .maximumPoolSize(100) .keepAliveTime(40) .timeUnit(TimeUnit.SECONDS) .workQueue(MEMORY_SAFE_LINKED_BLOCKING_QUEUE.getName(), 2000) @@ -56,6 +56,7 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable { @Override public void autoRun() throws Exception { { + //Thread.sleep(10000L); isRun = true; Map servers = this.opcServerManageService.queryAllServerMap(); @@ -98,8 +99,8 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable { this.executorService = ThreadPoolBuilder.newBuilder() .threadPoolName("deviceOpc_thread") .threadFactory("deviceOpc_thread") - .corePoolSize(2) - .maximumPoolSize(7) + .corePoolSize(80) + .maximumPoolSize(100) .keepAliveTime(40) .timeUnit(TimeUnit.SECONDS) .workQueue(MEMORY_SAFE_LINKED_BLOCKING_QUEUE.getName(), 2000) From ab5f7a82ebb1c0a40bfc38fc5cb985cd07e8ab4c Mon Sep 17 00:00:00 2001 From: tuqiang <437016993@qq.com> Date: Sat, 13 Jul 2024 18:13:34 +0800 Subject: [PATCH 6/9] =?UTF-8?q?rev:=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 160 +++++++------- .../OvenGantryManipulatorDeviceDriver.java | 208 ++++++++++++------ .../wms/service/impl/AcsToWmsServiceImpl.java | 38 ++-- .../service/impl/InstructionServiceImpl.java | 48 ++-- .../task/service/impl/TaskServiceImpl.java | 37 +++- .../lucene/service/dto/LuceneLogDto.java | 2 + .../src/views/monitor/logQuery/search.vue | 2 +- 7 files changed, 299 insertions(+), 196 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 0832349e9..8b49f8fc6 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -945,7 +945,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (phase == 0x77) { + } else if (phase == 0x4D) { if (agvaddr == 0) { agvaddr = agvaddr_copy; } @@ -1014,88 +1014,89 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); + } + } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code)) { + if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } + try { + manipulatorAgvStationDeviceDriver.writing(4); + } catch (Exception e) { + e.printStackTrace(); } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code2)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(4); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } - } - } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code2)) { - if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - - try { - manipulatorAgvStationDeviceDriver.writing(2); - } catch (Exception e) { - e.printStackTrace(); - } - if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("agvphase:" + phase + "反馈:" + data) - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") - .build(); - logDto.setLog_level(4); - luceneExecuteLogService.deviceExecuteLog(logDto); - } + if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else { + message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); } } + } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, start_device_code2)) { + if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); + + try { + manipulatorAgvStationDeviceDriver.writing(4); + } catch (Exception e) { + e.printStackTrace(); + } + if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else { + message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } + } else if (ObjectUtil.isNotEmpty(start_device_code) && StrUtil.equals(device_code, next_device_code2)) { + if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { + manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); + + try { + manipulatorAgvStationDeviceDriver.writing(2); + } catch (Exception e) { + e.printStackTrace(); + } + if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content("agvphase:" + phase + "反馈:" + data) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } else { + message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.getDeviceCode()) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } + } // else { // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // LuceneLogDto logDto = LuceneLogDto.builder() @@ -1105,7 +1106,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic // logDto.setLog_level(4); // luceneExecuteLogService.deviceExecuteLog(logDto); // } - } } // 取货完毕 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index d4c453b01..578e70d14 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -325,7 +325,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (ObjectUtil.isEmpty(putDeviceCodeList)) { putDeviceCodeList = this.getExtraDeviceCodes("put_device_code"); } - if(CollUtil.isEmpty(getDeviceCodeList) || getDeviceCodeList.size() == 0){ + if (CollUtil.isEmpty(getDeviceCodeList) || getDeviceCodeList.size() == 0) { notCreateInstMessage = "未设置取货点"; } TaskDto task = null; @@ -702,6 +702,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); hongXiangConveyorDeviceDriver.writing("to_close_door", "1"); } + /** * 判断经过的烘箱是否关门 */ @@ -875,6 +876,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); +// EXECUTOR.submit(() -> { + toOpenDoor(device); +// }); int mode = hongXiangConveyorDeviceDriver.getMode(); int door = hongXiangConveyorDeviceDriver.getDoor(); int action = hongXiangConveyorDeviceDriver.getAction(); @@ -914,19 +918,19 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } } else { - feedMessage = "行架机械手:"; - if (mode != 3) { - feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; - } - if (action != 1) { - feedMessage = feedMessage + "动作信号(action)不为取货中状态,"; - } - if (move != 0) { - feedMessage = feedMessage + "光电信号(move)不为无货状态,"; - } - if (task == 0) { - feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; - } + feedMessage = "行架机械手:"; + if (mode != 3) { + feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; + } + if (action != 1) { + feedMessage = feedMessage + "动作信号(action)不为取货中状态,"; + } + if (move != 0) { + feedMessage = feedMessage + "光电信号(move)不为无货状态,"; + } + if (task == 0) { + feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; + } } //取货完成关闭烘箱门 @@ -941,12 +945,43 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i EXECUTOR.execute(() -> { toCloseDoor(device); }); + int mode = hongXiangConveyorDeviceDriver.getMode(); + int door = hongXiangConveyorDeviceDriver.getDoor(); + int action = hongXiangConveyorDeviceDriver.getAction(); + int error1 = hongXiangConveyorDeviceDriver.getError1(); + int error = hongXiangConveyorDeviceDriver.getError(); + int move = hongXiangConveyorDeviceDriver.getMove(); + if (mode == 1 && door == 2 && action == 2 && error == 0 && error1 == 0 && move == 0) { + map.put("code", "to_command"); + map.put("value", "3"); + list.add(map); + this.writing(list); + this.setRequireActionSucess(true); + } else { + feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); + if (mode != 1) { + feedMessage = feedMessage + "工作模式(mode)信号未联机,"; + } + if (door != 2) { + feedMessage = feedMessage + "门状态(door)信号未关门,"; + } + if (action != 1) { + feedMessage = feedMessage + "允许取放(action)信号未允许取放,"; + } + if (move != 0) { + feedMessage = feedMessage + "取货位光电信号(move)不应该为有货状态,"; + } + if (error1 != 0) { + feedMessage = feedMessage + "故障(error1)信号出现故障,故障值:" + error1 + "。"; + } + } + } else { + map.put("code", "to_command"); + map.put("value", "3"); + list.add(map); + this.writing(list); + this.setRequireActionSucess(true); } - map.put("code", "to_command"); - map.put("value", "3"); - list.add(map); - this.writing(list); - this.setRequireActionSucess(true); } } else { feedMessage = "行架机械手:"; @@ -973,6 +1008,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); +// EXECUTOR.submit(() -> { + toOpenDoor(nextDevice); +// }); int mode = hongXiangConveyorDeviceDriver.getMode(); int door = hongXiangConveyorDeviceDriver.getDoor(); int action = hongXiangConveyorDeviceDriver.getAction(); @@ -1052,60 +1090,96 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i map.put("to_time_min", String.valueOf(minutes)); hongXiangConveyorDeviceDriver.writing(map); } - } - - if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver||nextDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { - if (!StrUtil.startWith(taskDto.getTask_code(), "-")) { - if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))) { - String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString(); - Device lampDevice = deviceAppService.findDeviceByCode(lamp); - if (ObjectUtil.isEmpty(lampDevice)) { - return; - } - if (lampDevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { - lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lampDevice.getDeviceDriver(); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(lampDevice.getDeviceDriver().getDeviceCode()) - .content("下发报警灯" + lamp + "报警信号") - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); - lampThreecolorDeviceDriver.writing("to_command", "1"); - } + int mode = hongXiangConveyorDeviceDriver.getMode(); + int door = hongXiangConveyorDeviceDriver.getDoor(); + int action = hongXiangConveyorDeviceDriver.getAction(); + int error1 = hongXiangConveyorDeviceDriver.getError1(); + int error = hongXiangConveyorDeviceDriver.getError(); + int move = hongXiangConveyorDeviceDriver.getMove(); + if (mode == 1 && door == 2 && action == 2 && error == 0 && error1 == 0 && move == 1) { + map.put("code", "to_command"); + map.put("value", "5"); + list.add(map); + this.writing(list); + this.setRequireActionSucess(true); + try { + finish_instruction(inst2); + } catch (Exception e) { + e.printStackTrace(); + } + feedMessage = ""; + } else { + feedMessage = "烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code(); + if (mode != 1) { + feedMessage = feedMessage + "工作模式(mode)信号未联机,"; + } + if (door != 2) { + feedMessage = feedMessage + "门状态(door)信号未关门,"; + } + if (action != 1) { + feedMessage = feedMessage + "允许取放(action)信号未允许取放,"; + } + if (move != 1) { + feedMessage = feedMessage + "放货位光电信号不应该为无货状态"; + } + if (error1 != 0) { + feedMessage = feedMessage + "故障(error1)信号出现故障。"; } } + } else { + map.put("code", "to_command"); + map.put("value", "5"); + list.add(map); + this.writing(list); + this.setRequireActionSucess(true); + try { + finish_instruction(inst2); + } catch (Exception e) { + e.printStackTrace(); + } + feedMessage = ""; + } +// if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver||nextDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { +// if (!StrUtil.startWith(taskDto.getTask_code(), "-")) { +// if (ObjectUtil.isNotEmpty(nextDevice.getExtraValue().get("link_three_lamp"))) { +// String lamp = nextDevice.getExtraValue().get("link_three_lamp").toString(); +// Device lampDevice = deviceAppService.findDeviceByCode(lamp); +// if (ObjectUtil.isEmpty(lampDevice)) { +// return; +// } +// if (lampDevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { +// lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) lampDevice.getDeviceDriver(); +// LuceneLogDto logDto = LuceneLogDto.builder() +// .device_code(lampDevice.getDeviceDriver().getDeviceCode()) +// .content("下发报警灯" + lamp + "报警信号") +// .build(); +// logDto.setLog_level(3); +// luceneExecuteLogService.deviceExecuteLog(logDto); +// lampThreecolorDeviceDriver.writing("to_command", "1"); +// } +// } +// } +// } - map.put("code", "to_command"); - map.put("value", "5"); - list.add(map); - this.writing(list); - this.setRequireActionSucess(true); - try { - finish_instruction(inst2); - } catch (Exception e) { - e.printStackTrace(); - } - feedMessage = ""; } - } } else { - feedMessage = "行架机械手:"; - if (mode != 3) { - feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; - } - if (action != 4) { - feedMessage = feedMessage + "动作信号(action)不为放货完成状态,"; - } - if (move != 0) { - feedMessage = feedMessage + "光电信号(move)不为无货状态,"; - } - if (task == 0) { - feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; - } + feedMessage = "行架机械手:"; + if (mode != 3) { + feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; + } + if (action != 4) { + feedMessage = feedMessage + "动作信号(action)不为放货完成状态,"; + } + if (move != 0) { + feedMessage = feedMessage + "光电信号(move)不为无货状态,"; + } + if (task == 0) { + feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; + } + } } } - } public synchronized boolean finish_instruction(Instruction inst) throws Exception { instructionService.finish(inst); @@ -1153,8 +1227,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i this.setMessage("信号连接异常!"); } String requireActionSucess = LangProcess.msg("universal_directives") + ":" + LangProcess.msg("universal_actionMessage4"); - if(this.requireActionSucess){ - requireActionSucess = LangProcess.msg("universal_directives") + ":" + LangProcess.msg("universal_actionMessage5"); + if (this.requireActionSucess) { + requireActionSucess = LangProcess.msg("universal_directives") + ":" + LangProcess.msg("universal_actionMessage5"); } map.put("device_name", this.getDevice().getDevice_name()); map.put("mode", mode); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 01c526ee6..d6a37a495 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -479,15 +479,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { luceneLogService.interfaceExecuteLog(luceneLogDto); } catch (Exception e) { JSONObject jsonObject = JSONObject.parseObject(result); - log.info("向lms申请套管工位请求----返回参数{}", result); + log.info("向lms申请套管工位请求----返回参数{}", e.getMessage()); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请失败"); + JSON.toJSONString(param), String.valueOf(result), "向lms申请套管工位请求失败"); luceneLogService.interfaceExecuteLog(luceneLogDto); - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, ApplyPlugPullSitResponse.class); } } @@ -517,12 +513,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { log.info("向LMS反馈子卷重量----返回参数{}", result); applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class); } catch (Exception e) { + String message = e.getMessage(); JSONObject jsonObject = JSONObject.parseObject(result); log.info("向LMS反馈子卷重量----返回参数{}", result); - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, ApplyfeedbackSubVolumeWeightResponse.class); + applyfeedbackSubVolumeWeightResponse = JSONObject.toJavaObject(jsonObject, ApplyfeedbackSubVolumeWeightResponse.class); + LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()), + JSON.toJSONString(param), message, "向LMS反馈子卷重量"); + luceneLogService.interfaceExecuteLog(luceneLogDto); } LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyfeedbackSubVolumeWeightRequest", String.valueOf(applyfeedbackSubVolumeWeightResponse.getCode()), JSON.toJSONString(param), String.valueOf(applyfeedbackSubVolumeWeightResponse.getMessage()), "ACS反馈LMS子卷重量"); @@ -550,16 +547,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { log.info("RGV工位上有货申请行架任务----返回参数{}", result); applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class); } catch (Exception e) { + String message = e.getMessage(); JSONObject jsonObject = JSONObject.parseObject(result); log.info("RGV工位上有货申请行架任务----返回参数{}", result); applyManipulatorActionResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class); LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyManipulatorActionResponse.getCode()), - JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "RGV工位上有货申请行架任务失败"); + JSON.toJSONString(param), message, "RGV工位上有货申请行架任务失败"); luceneLogService.interfaceExecuteLog(luceneLogDto); - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, ApplyManipulatorActionResponse.class); } LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyManipulatorAction", String.valueOf(applyManipulatorActionResponse.getCode()), JSON.toJSONString(param), String.valueOf(applyManipulatorActionResponse), "RGV工位上有货申请行架任务"); @@ -692,11 +686,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("actionFinishRequest2"); String url = wmsurl + addressDto.getMethods_url(); - log.info("actionFinishRequest2 - 设备工位取货完成反馈{}", jsonObject); - LuceneLogDto luceneLogDto = new LuceneLogDto(4,"actionFinishRequest2", "", - String.valueOf(jsonObject), - "", jsonObject.getString("task_code") + "设备工位取货完成反馈"); - luceneLogService.interfaceExecuteLog(luceneLogDto); try { execute = HttpRequest.post(url) .body(String.valueOf(jsonObject)) @@ -705,7 +694,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String msg = e.getMessage(); log.info("feedbackDie-----输出参数{}", msg); //网络不通 + LuceneLogDto luceneLogDto1 = new LuceneLogDto(4,"actionFinishRequest2", String.valueOf(execute.getStatus()), + String.valueOf(jsonObject), + String.valueOf(execute.body()), jsonObject.getString("task_code") + "设备工位取货完成反馈失败"); + luceneLogService.interfaceExecuteLog(luceneLogDto1); } + log.info("actionFinishRequest2 - 设备工位取货完成反馈{}", jsonObject); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"actionFinishRequest2", "", + String.valueOf(jsonObject), + "", jsonObject.getString("task_code") + "设备工位取货完成反馈"); + luceneLogService.interfaceExecuteLog(luceneLogDto); } catch (Exception e) { LuceneLogDto luceneLogDto = new LuceneLogDto(4,"actionFinishRequest2", String.valueOf(execute.getStatus()), JSON.toJSONString(execute.body()), diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 65f143594..4e674c810 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -499,12 +499,12 @@ public class InstructionServiceImpl extends CommonServiceImpl findByNextCode(String next_code) { - List instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code) ).collect(Collectors.toList()); + List instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code)).collect(Collectors.toList()); return instructionList; } @@ -1949,11 +1965,11 @@ public class InstructionServiceImpl extends CommonServiceImpl findReadyIns() { - //根据时间升序取第一个 - List instructionsList = instructions.stream() - .filter(item -> StrUtil.equals(item.getInstruction_type(), TaskTypeEnum.Truss_Task.getIndex()) - && StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.READY.getIndex())).collect(Collectors.toList()); - return instructionsList; + //根据时间升序取第一个 + List instructionsList = instructions.stream() + .filter(item -> StrUtil.equals(item.getInstruction_type(), TaskTypeEnum.Truss_Task.getIndex()) + && StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.READY.getIndex())).collect(Collectors.toList()); + return instructionsList; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index fd7a48ad5..dce19578c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -236,7 +236,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme } @Override - public Map queryAll( Map whereJson, Pageable page) { + public Map queryAll(Map whereJson, Pageable page) { String task_code = (String) whereJson.get("task_code"); String vehicle_code = (String) whereJson.get("vehicle_code"); @@ -977,6 +977,29 @@ public class TaskServiceImpl extends CommonServiceImpl impleme instdto.setStart_height(start_height); instdto.setNext_height(next_height); instdto.setAgv_action_type(acsTask.getAgv_action_type()); + if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) { + // task_type + //1、生箔; Itype=1:取空,取满,放空,放满; + //2、分切 Itype=3取满、取空、放满、放空; + //3、普通任务 Itype=2:取货、放货; + //4、叉车任务 + //5、输送任务 + //6、行架 + //7、立库 + if (StrUtil.equals(task_type, CommonFinalParam.ONE)) { + instdto.setAgv_inst_type(CommonFinalParam.ONE); + } else if (StrUtil.equals(task_type, "3")) { + instdto.setAgv_inst_type("2"); + } else if (StrUtil.equals(task_type, "2")) { + instdto.setAgv_inst_type("3"); + } else if (StrUtil.equals(task_type, "8")) { + instdto.setAgv_inst_type("2"); + } else { + log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type()); + } + } else { + instdto.setAgv_inst_type("4"); + } instructionservice.create2(instdto); acsTask.setTask_status(CommonFinalParam.ONE); this.update(acsTask); @@ -1633,17 +1656,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme JSONArray ja = new JSONArray(); ja.add(feed_jo); //TODO 有需要根据上位系统反馈的信息再做进一步处理 - - CompletableFuture.runAsync(() -> { - acstowmsService.feedTaskStatus(ja); - // 异步更新指令状态 - try { - } catch (Exception e) { - e.printStackTrace(); - } - }); - - + acstowmsService.feedTaskStatus(ja); } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java index e456df43e..28ba5196a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/lucene/service/dto/LuceneLogDto.java @@ -88,6 +88,8 @@ public class LuceneLogDto { + home; } + + public LuceneLogDto(final Integer log_level,final String method, final String status, final String requestparam, final String responseparam, final String content) { super(); diff --git a/acs2/nladmin-ui/src/views/monitor/logQuery/search.vue b/acs2/nladmin-ui/src/views/monitor/logQuery/search.vue index 269e34814..5e659c22f 100644 --- a/acs2/nladmin-ui/src/views/monitor/logQuery/search.vue +++ b/acs2/nladmin-ui/src/views/monitor/logQuery/search.vue @@ -18,7 +18,7 @@ style="width: 200px" @change="crud.toQuery" > - + Date: Sun, 14 Jul 2024 16:52:33 +0800 Subject: [PATCH 7/9] =?UTF-8?q?rev:=E7=83=98=E7=AE=B1=E5=B7=A5=E5=BA=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 43 +++++++++---------- .../OvenGantryManipulatorDeviceDriver.java | 24 +---------- .../PullTailManipulatorDeviceDriver.java | 2 +- .../wms/service/impl/AcsToWmsServiceImpl.java | 4 +- 4 files changed, 25 insertions(+), 48 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 8b49f8fc6..f7c30b7a5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -259,12 +259,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); - message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; + log.info("等待LMS系统进行确认允许取货,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption()); logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey) + .device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) + .content("等待LMS系统进行确认允许取货,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption()) .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -305,7 +304,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); - try { manipulatorAgvStationDeviceDriver.writing(2); } catch (Exception e) { @@ -320,11 +318,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "行架不允许取货条件"; - log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); + log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", manipulatorAgvStationDeviceDriver.getDeviceCode(), manipulatorAgvStationDeviceDriver.getAction(), ikey); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -766,12 +763,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic luceneExecuteLogService.deviceExecuteLog(logDto); } } else { - log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); - message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; - logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code()); + log.info("等待LMS系统进行确认允许取货,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDeviceCode(), standardOrdinarySiteDeviceDriver.getOption()); + message = "等待LMS系统进行确认允许取货,设备号:" + standardOrdinarySiteDeviceDriver.getDeviceCode() + ",option值:" + standardOrdinarySiteDeviceDriver.getOption(); + logServer.deviceExecuteLog(standardOrdinarySiteDeviceDriver.getDeviceCode(), "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code()); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) + .device_code(standardOrdinarySiteDeviceDriver.getDeviceCode()) + .content(standardOrdinarySiteDeviceDriver.getDevice_code() + "option值不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -804,7 +801,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) + .device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); @@ -1008,7 +1005,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); @@ -1035,7 +1032,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); @@ -1087,9 +1084,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); } else { - message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; + message = "设备号:" + manipulatorAgvStationDeviceDriver.getDevice_code() + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); @@ -1433,8 +1430,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); @@ -1861,8 +1858,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(this.getDeviceCode()) - .content(message) + .device_code(manipulatorAgvStationDeviceDriver.getDeviceCode()) + .content(manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1") .build(); logDto.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 578e70d14..0c970f40a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -463,16 +463,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map2); list.add(map3); this.writing(list); - if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.execute(() -> { - toOpenDoor(startdevice); - }); - } - if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.execute(() -> { - toOpenDoor(nextdevice); - }); - } this.setRequireSucess(true); return true; } else { @@ -671,16 +661,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i list.add(map2); list.add(map3); this.writing(list); - if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.execute(() -> { - toOpenDoor(startdevice); - }); - } - if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { - EXECUTOR.execute(() -> { - toOpenDoor(nextdevice); - }); - } this.setRequireSucess(true); notCreateInstMessage = ""; notCreateTaskMessage = ""; @@ -876,9 +856,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); -// EXECUTOR.submit(() -> { + EXECUTOR.execute(() -> { toOpenDoor(device); -// }); + }); int mode = hongXiangConveyorDeviceDriver.getMode(); int door = hongXiangConveyorDeviceDriver.getDoor(); int action = hongXiangConveyorDeviceDriver.getAction(); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java index f43d0b5fc..fe01c9995 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/pull_tail_manipulator/PullTailManipulatorDeviceDriver.java @@ -187,7 +187,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp x_position = this.itemProtocol.getX_position(); y_position = this.itemProtocol.getY_position(); - if (mode != last_mode) { + if (action != last_action) { requireSucess = false; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index d6a37a495..ccc9184cb 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -482,10 +482,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { log.info("向lms申请套管工位请求----返回参数{}", e.getMessage()); applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class); LuceneLogDto luceneLogDto = new LuceneLogDto(4, "applyPlugPullSiteRequest", String.valueOf(applyPlugPullSitResponse.getstatus()), - JSON.toJSONString(param), String.valueOf(result), "向lms申请套管工位请求失败"); + JSON.toJSONString(param), + String.valueOf(result), "向lms申请套管工位请求失败"); luceneLogService.interfaceExecuteLog(luceneLogDto); } - } return applyPlugPullSitResponse; } finally { From 484cfacee6f927d82192bdedacb52181172582d3 Mon Sep 17 00:00:00 2001 From: lishuai <1793460677@qq.com> Date: Sun, 14 Jul 2024 17:15:45 +0800 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=E6=89=AB=E6=8F=8F=E7=A0=81=E4=BD=8D?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=8C=87=E4=BB=A4=E4=BC=98=E5=8C=96=E3=80=81?= =?UTF-8?q?=E5=86=85=E5=8C=85=E9=97=B4=E4=BC=98=E5=8C=96=E3=80=81=E5=86=99?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E4=BC=98=E5=8C=96=E3=80=81lucence=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/nl/acs/agv/AgvWaitUtil.java | 2 +- .../driver/AbstractOpcDeviceDriver.java | 388 ++++++++++-------- .../BoxStorageOutConveyorDeviceDriver.java | 24 -- ...ConveyorWithScannerWeightDeviceDriver.java | 58 +-- ...TwoManipulatorManipulatorDeviceDriver.java | 13 +- .../StandardStackerDeviceDriver.java | 6 +- .../service/impl/InstructionServiceImpl.java | 2 +- .../nl/acs/opc/DeviceOpcProtocolRunable.java | 4 +- .../views/acs/device/driver/belt_conveyor.vue | 18 + 9 files changed, 276 insertions(+), 239 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java index b891df5ef..6ab6b5b78 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/AgvWaitUtil.java @@ -50,7 +50,7 @@ public class AgvWaitUtil { ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver; //agv诺宝对接位安全信号交互 - if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { + if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) { manipulatorAgvStationDeviceDriver.writing(2); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java index 25f555deb..225534d39 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java @@ -11,6 +11,10 @@ import org.openscada.opc.lib.da.ItemState; import org.springframework.beans.factory.annotation.Autowired; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver { UnifiedDataAccessor opcUdw; @@ -35,201 +39,223 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc public void checkcontrol(Map itemValues) throws Exception { - Group group = opcServerService.getServer(this.getOpcServer()); - Map write = new HashMap(); - Map readitems = new LinkedHashMap(); - List itemsString = new ArrayList(); - itemsString = new ArrayList<>(itemValues.keySet()); - Iterator is = itemsString.iterator(); - while (is.hasNext()) { - String string = (String) is.next(); + CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { - readitems.put(string, group.addItem(string)); - } catch (Exception e) { - e.printStackTrace(); - } - } - int i = 0; - while (true) { - //下发信号 - try { - if (i == 0) { - control(itemValues); - } else { - controlByNewConn(itemValues); - } + Group group = opcServerService.getServer(this.getOpcServer()); + Map write = new HashMap(); + Map readitems = new LinkedHashMap(); + List itemsString = new ArrayList(); + itemsString = new ArrayList<>(itemValues.keySet()); + Iterator is = itemsString.iterator(); - } catch (Exception e) { - e.printStackTrace(); - } - Map read = new HashMap(); - Map itemStatus = null; - boolean check = true; - try { - if (i > 0) { - group = opcServerService.getServer(this.getOpcServer()); - itemsString = new ArrayList<>(itemValues.keySet()); - Iterator nis = itemsString.iterator(); - - while (nis.hasNext()) { - String string = (String) nis.next(); - try { - readitems.put(string, group.addItem(string)); - } catch (Exception e) { - e.printStackTrace(); - } + while (is.hasNext()) { + String string = (String) is.next(); + try { + readitems.put(string, group.addItem(string)); + } catch (Exception e) { + e.printStackTrace(); } - itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0])); - - } else { - itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0])); - } - Set items = itemStatus.keySet(); - Iterator var15 = items.iterator(); - while (var15.hasNext()) { - Item item = (Item) var15.next(); - ItemState itemState = (ItemState) itemStatus.get(item); - Object value = OpcUtl.getValue(item, itemState); - read.put(item.getId(), value); } + int i = 0; + while (true) { + //下发信号 - Iterator var24 = itemsString.iterator(); + try { + if (i == 0) { + control(itemValues); + } else { + controlByNewConn(itemValues); + } - while (var24.hasNext()) { - String itemString = (String) var24.next(); - if (!ObjectUtl.isEquals(String.valueOf(itemValues.get(itemString)), String.valueOf(read.get(itemString)))) { + } catch (Exception e) { + e.printStackTrace(); + } + Map read = new HashMap(); + Map itemStatus = null; + boolean check = true; + try { + if (i > 0) { + group = opcServerService.getServer(this.getOpcServer()); + itemsString = new ArrayList<>(itemValues.keySet()); + Iterator nis = itemsString.iterator(); + + while (nis.hasNext()) { + String string = (String) nis.next(); + try { + readitems.put(string, group.addItem(string)); + } catch (Exception e) { + e.printStackTrace(); + } + } + itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0])); + + } else { + itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0])); + } + Set items = itemStatus.keySet(); + Iterator var15 = items.iterator(); + while (var15.hasNext()) { + Item item = (Item) var15.next(); + ItemState itemState = (ItemState) itemStatus.get(item); + Object value = OpcUtl.getValue(item, itemState); + read.put(item.getId(), value); + } + + Iterator var24 = itemsString.iterator(); + + while (var24.hasNext()) { + String itemString = (String) var24.next(); + if (!ObjectUtl.isEquals(String.valueOf(itemValues.get(itemString)), String.valueOf(read.get(itemString)))) { + check = false; + } + } + } catch (Exception e) { + e.printStackTrace(); check = false; } + + if (check) { + return ""; + } + + if (i > 0) { + ThreadUtl.sleep(100L); + } + + if (i >= 3) { +// log.info("写入次数超过3次而失败"); + throw new RuntimeException("写入次数超过3次而失败"); + } + ++i; } } catch (Exception e) { - e.printStackTrace(); - check = false; + Thread.currentThread().interrupt(); + throw new IllegalStateException("Interrupted", e); } - - if (check) { - return; + }); + try { + String result = future.get(2, TimeUnit.SECONDS); // 设置超时时间为2秒 + System.out.println(result); + } catch (CompletionException e) { + Throwable cause = e.getCause(); + if (cause instanceof TimeoutException) { + System.out.println("Operation timed out"); + } else { + throw e; // rethrow other exceptions } - - if (i > 0) { - ThreadUtl.sleep(100L); - } - - if (i >= 3) { -// log.info("写入次数超过3次而失败"); - throw new RuntimeException("写入次数超过3次而失败"); - } - ++i; + } catch (Exception e) { + throw new RuntimeException(e); } - } + } - public boolean controlByNewConn(Map itemValues) { + public boolean controlByNewConn (Map < String, Object > itemValues){ - Iterator> it = itemValues.entrySet().iterator(); + Iterator> it = itemValues.entrySet().iterator(); - ItemValue[] p2; - p2 = new ItemValue[itemValues.size()]; - int i = 0; - while (it.hasNext()) { - Map.Entry entry = it.next(); - System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue()); - p2[i] = new ItemValue(); - p2[i].setItem_code(entry.getKey()); - p2[i].setItem_value(entry.getValue()); - i++; - } - - return this.controlByNewConn(p2); - } - - public boolean control(Map itemValues) { - - Iterator> it = itemValues.entrySet().iterator(); - - ItemValue[] p2; - p2 = new ItemValue[itemValues.size()]; - int i = 0; - while (it.hasNext()) { - Map.Entry entry = it.next(); - System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue()); - p2[i] = new ItemValue(); - p2[i].setItem_code(entry.getKey()); - p2[i].setItem_value(entry.getValue()); - i++; - } - - return this.control(p2); - } - - - public boolean control(ItemValue[] itemValues) { - if (itemValues != null && itemValues.length != 0) { - String this_items = JsonUtl.parseWithoutException(itemValues); - boolean need_write = false; - StringBuilder sb = new StringBuilder(); - ItemValue[] var5 = itemValues; - int var6 = itemValues.length; - - for (int var7 = 0; var7 < var6; ++var7) { - ItemValue itemValue = var5[var7]; - String code = itemValue.getItem_code(); - Object udw_value = this.getUdwValue(code); - Object write_value = itemValue.getItem_value(); - sb.append(code); - sb.append(":"); - sb.append(JsonUtl.parseWithoutException(udw_value)); - sb.append(";"); - if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) { - need_write = true; - } else { - //log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value ); + ItemValue[] p2; + p2 = new ItemValue[itemValues.size()]; + int i = 0; + while (it.hasNext()) { + Map.Entry entry = it.next(); + System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue()); + p2[i] = new ItemValue(); + p2[i].setItem_code(entry.getKey()); + p2[i].setItem_value(entry.getValue()); + i++; } - } - // need_write = true; - if (need_write) { - Date date = new Date(); + return this.controlByNewConn(p2); + } + + public boolean control (Map < String, Object > itemValues){ + + Iterator> it = itemValues.entrySet().iterator(); + + ItemValue[] p2; + p2 = new ItemValue[itemValues.size()]; + int i = 0; + while (it.hasNext()) { + Map.Entry entry = it.next(); + System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue()); + p2[i] = new ItemValue(); + p2[i].setItem_code(entry.getKey()); + p2[i].setItem_value(entry.getValue()); + i++; + } + + return this.control(p2); + } + + + public boolean control (ItemValue[]itemValues){ + if (itemValues != null && itemValues.length != 0) { + String this_items = JsonUtl.parseWithoutException(itemValues); + boolean need_write = false; + StringBuilder sb = new StringBuilder(); + ItemValue[] var5 = itemValues; + int var6 = itemValues.length; + + for (int var7 = 0; var7 < var6; ++var7) { + ItemValue itemValue = var5[var7]; + String code = itemValue.getItem_code(); + Object udw_value = this.getUdwValue(code); + Object write_value = itemValue.getItem_value(); + sb.append(code); + sb.append(":"); + sb.append(JsonUtl.parseWithoutException(udw_value)); + sb.append(";"); + if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) { + need_write = true; + } else { + //log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value ); + } + } + // need_write = true; + + if (need_write) { + Date date = new Date(); /*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) { log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check); return false; }*/ - this.last_items = this_items; - this.sendTime = date; + this.last_items = this_items; + this.sendTime = date; /* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName()); this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items}); OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/ - OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); + OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); - opcServerService.writeInteger(this.getOpcServer(), itemValues); - UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); - ItemValue[] var17 = itemValues; - int var18 = itemValues.length; + opcServerService.writeInteger(this.getOpcServer(), itemValues); + UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); + ItemValue[] var17 = itemValues; + int var18 = itemValues.length; - for (int var19 = 0; var19 < var18; ++var19) { - ItemValue itemValue = var17[var19]; - String code = itemValue.getItem_code(); - Object value = itemValue.getItem_value(); - opcValueAccessor.setValue(code, value); + for (int var19 = 0; var19 < var18; ++var19) { + ItemValue itemValue = var17[var19]; + String code = itemValue.getItem_code(); + Object value = itemValue.getItem_value(); + opcValueAccessor.setValue(code, value); + } + } + + return true; + } else { + throw new RuntimeException("下发 无内容"); } } - return true; - } else { - throw new RuntimeException("下发 无内容"); - } - } - - public boolean controlByNewConn(ItemValue[] itemValues) { - if (itemValues != null && itemValues.length != 0) { - String this_items = JsonUtl.parseWithoutException(itemValues); - boolean need_write = false; - StringBuilder sb = new StringBuilder(); - ItemValue[] var5 = itemValues; - int var6 = itemValues.length; + public boolean controlByNewConn (ItemValue[]itemValues){ + if (itemValues != null && itemValues.length != 0) { + String this_items = JsonUtl.parseWithoutException(itemValues); + boolean need_write = false; + StringBuilder sb = new StringBuilder(); + ItemValue[] var5 = itemValues; + int var6 = itemValues.length; // for (int var7 = 0; var7 < var6; ++var7) { // ItemValue itemValue = var5[var7]; // String code = itemValue.getItem_code(); @@ -245,36 +271,36 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc // log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value ); // } // } - need_write = true; - if (need_write) { - Date date = new Date(); + need_write = true; + if (need_write) { + Date date = new Date(); /*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) { log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check); return false; }*/ - this.last_items = this_items; - this.sendTime = date; - OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); + this.last_items = this_items; + this.sendTime = date; + OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); - opcServerService.writeIntegerByNewConn(this.getOpcServer(), itemValues); + opcServerService.writeIntegerByNewConn(this.getOpcServer(), itemValues); - UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); - ItemValue[] var17 = itemValues; - int var18 = itemValues.length; + UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); + ItemValue[] var17 = itemValues; + int var18 = itemValues.length; - for (int var19 = 0; var19 < var18; ++var19) { - ItemValue itemValue = var17[var19]; - String code = itemValue.getItem_code(); - Object value = itemValue.getItem_value(); - opcValueAccessor.setValue(code, value); + for (int var19 = 0; var19 < var18; ++var19) { + ItemValue itemValue = var17[var19]; + String code = itemValue.getItem_code(); + Object value = itemValue.getItem_value(); + opcValueAccessor.setValue(code, value); + } + } + + return true; + } else { + throw new RuntimeException("下发 无内容"); } } - - return true; - } else { - throw new RuntimeException("下发 无内容"); } - } -} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index fa33818d6..e34ccb88a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -229,30 +229,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i log.debug("设备运转模式:等待工作"); break; case 2: - //申请任务 - if (move > 0 && task == 0 && !requireSucess) { - instruction_require(); - }else { - String remark = ""; - ; - if (mode != 2) { - remark = "universal_remark2"; - } - if (move != 0) { - remark = "universal_remark3"; - } - if (task != 0) { - remark = "universal_remark4"; - if (ObjectUtil.isNotEmpty(this.inst)) { - this.inst = null; - } - } - if (requireSucess) { - remark = "universal_remark5"; - } - this.setNotCreateInstMessage(remark); - //} - } break; case 25: if ( StrUtil.isEmpty(material_barcode)) { 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 fe1286642..6a0b61b4a 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 @@ -28,6 +28,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.led.led_screen.LedScreenDeviceDriver; import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.InteractionJsonDTO; import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; +import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver; import org.nl.acs.enums.StorageTypeEnum; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.history.ErrorUtil; @@ -298,9 +299,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv List toInstructions; //木箱入库申请入库任务 if (mode == 6 && !requireSucess) { - if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)) { + if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { message = "托盘条码为空、或者子卷码为空"; - }else { + } else { applyIn(StorageTypeEnum.BOX_IN.getType(), mode); } @@ -310,7 +311,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (mode == 7 && move == 1 && !requireSucess) { if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { message = "托盘条码为空、或者子卷码为空"; - }else { + } else { applyIn(StorageTypeEnum.STORAGE.getType(), mode); } @@ -321,7 +322,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (mode == 9 && move == 1 && !requireSucess) { if (container_type == 0 || StrUtil.isEmpty(barcode)) { message = "托盘类型为空"; - }else { + } else { applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); } } @@ -330,7 +331,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (mode == 18 && move == 1 && !requireSucess) { if (StrUtil.isEmpty(barcode)) { message = "托盘条码为空"; - }else { + } else { applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); } @@ -339,7 +340,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (mode == 23 && !requireSucess) { if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { message = "条码为空"; - }else { + } else { applyErrorHeight(); } @@ -406,7 +407,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (StrUtil.isNotEmpty(hand_barcode)) { param.put("vehicle_code", hand_barcode); } - if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) { param.put("vehicle_code", barcode); } if (StrUtil.isNotEmpty(material_barcode)) { @@ -473,7 +474,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (StrUtil.isNotEmpty(hand_barcode)) { param.put("vehicle_code", hand_barcode); } - if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) { param.put("vehicle_code", barcode); } if (StrUtil.isNotEmpty(material_barcode)) { @@ -589,7 +590,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (StrUtil.isNotEmpty(hand_barcode)) { param.put("vehicle_code", hand_barcode); } - if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) { param.put("vehicle_code", barcode); } param.put("type", type); @@ -645,7 +646,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (StrUtil.isNotEmpty(hand_barcode)) { param.put("vehicle_code", hand_barcode); } - if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) { + if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) { param.put("vehicle_code", barcode); } if (StrUtil.isNotEmpty(material_barcode)) { @@ -654,7 +655,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (StrUtil.isNotEmpty(hand_material_barcode)) { param.put("material_barcode", hand_material_barcode); } - if (mode == 7 && weight != 0){ + if (mode == 7 && weight != 0) { param.put("weight", weight); } param.put("type", type); @@ -796,21 +797,32 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv //判断有无出入库任务是相同路线 //判断有没有DDJ对接位出入库的指令 List byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); - if (CollUtil.isNotEmpty(byCodeAndExcute)){ - Iterator iterator = byCodeAndExcute.iterator(); - while (iterator.hasNext()) { - Instruction instruction = iterator.next(); - Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code()); - if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())){ - iterator.remove(); - } - } - } - if (CollUtil.isNotEmpty(byCodeAndExcute)){ - this.message="有DDJ对接位出入库的指令"; + if (CollUtil.isNotEmpty(byCodeAndExcute)) { + this.message = "有DDJ对接位出入库的指令"; requireSucess = false; return true; } + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); + BeltConveyorDeviceDriver beltConveyorDeviceDriver; + if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver(); + //判断对接位和关联站点光电信号 + getDeviceCodeList = beltConveyorDeviceDriver.getExtraDeviceCodes("link_device_code"); + if (CollUtil.isNotEmpty(getDeviceCodeList)) { + String linkDeviceCode = getDeviceCodeList.get(0); + Device linkDevice = deviceAppService.findDeviceByCode(linkDeviceCode); + BeltConveyorDeviceDriver linkDeviceDriver; + if (linkDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + linkDeviceDriver = (BeltConveyorDeviceDriver) linkDevice.getDeviceDriver(); + if ((beltConveyorDeviceDriver.getMode() == 0 || beltConveyorDeviceDriver.getMove() == 1) && (linkDeviceDriver.getMode() == 0 || linkDeviceDriver.getMove() == 1)) { + this.message = "DDJ对接位或关联输送线存在正在移动的货物或者未联机"; + requireSucess = false; + return true; + } + } + + } + } TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code()); if (ObjectUtil.isNotEmpty(dto)) { requireSucess = false; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java index 4ac8ed7ad..a27486c0e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/VolumeTwoManipulatorManipulatorDeviceDriver.java @@ -133,6 +133,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi //行架机械手申请任务成功标识 boolean requireSucess = false; + //行架请求动作标识 + boolean actionRequireSucess = false; private int instruction_finished_time_out; int branchProtocol = 0; @@ -185,9 +187,12 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi to_type = this.itemProtocol.getTo_type(); if (mode != last_mode) { - requireSucess = false; } + + if (action != last_action) { + actionRequireSucess = false; + } // 更新指令状态 if (mode == 3 && task > 0) { if (null!=inst) { @@ -196,13 +201,13 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi updateInstructionStatus(); } //四个点行架任务,满轴放货完成后调lms生成rgv任务 - if (action == 6 && task > 0 ){ + if (action == 6 && task > 0 && !actionRequireSucess ){ Integer actionType = ActionTypeEnum.RELEASE_FINISHING.getCode(); creatAGV(actionType,action); } //空载具取货完成 - if (action == 7 && task > 0 ){ + if (action == 7 && task > 0 && !actionRequireSucess ){ Integer actionType = ActionTypeEnum.IN_FINISHING.getCode(); creatAGV(actionType, action); } @@ -304,7 +309,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi map1.put("value", toCommand); list.add(map1); this.writing(list); - + this.actionRequireSucess = true; } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) 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 a06536da4..05b13c410 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 @@ -833,9 +833,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme map4.put("value", "0"); list.add(map4); Map map5 = new HashMap<>(); - map4.put("code", "to_task"); - map4.put("value", "0"); - list.add(map4); + map5.put("code", "to_task"); + map5.put("value", "0"); + list.add(map5); this.writing(list); message = null; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 4e674c810..8ab17083a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -1949,7 +1949,7 @@ public class InstructionServiceImpl extends CommonServiceImpl findByCodeAndExcute(String next_code) { - List instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code) || item.getStart_device_code().equals(next_code)).collect(Collectors.toList()); + List instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code) ).collect(Collectors.toList()); return instructionList; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index a1260357f..83103cb6c 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -203,7 +203,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC if (!UnifiedDataAppService.isEquals(value, his)) { OpcItemDto itemDto = this.getItem(itemId); if (true) { - this.logItemChanged(itemId, accessor_value, value, itemDto); +// this.logItemChanged(itemId, accessor_value, value, itemDto); } if(!ObjectUtil.isEmpty(value) || "".equals(value)){ accessor_value.setValue(itemId, value); @@ -416,7 +416,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC sb.append("key:" + relate + "value:" + obj + ";"); } if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time") && !itemDto.getItem_code().endsWith("consumption") - && !itemDto.getItem_code().endsWith("x") && !itemDto.getItem_code().endsWith("y")) { + && !itemDto.getItem_code().endsWith("x") && !itemDto.getItem_code().endsWith("y")) { // 存在上次点位值为null情况 则不记录日志 if(!(his instanceof Float) && !(value instanceof Float)){ LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue b/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue index 4768b3194..3022c52c0 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/belt_conveyor.vue @@ -49,6 +49,24 @@ + + + + + + + From 46bd8c83eef08baab68ae608e4c9d6205000987c Mon Sep 17 00:00:00 2001 From: liuxy Date: Mon, 15 Jul 2024 09:09:27 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix:=E6=96=B0-=E5=87=BA=E5=BA=93=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stat/service/impl/OutBillQueryServiceImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java index a4ebc5711..1d5ab32d4 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/stat/service/impl/OutBillQueryServiceImpl.java @@ -340,7 +340,18 @@ public class OutBillQueryServiceImpl implements OutBillQueryService { mp.put("销售订单", json.getString("sale_order_name")); mp.put("行号", ""); } + // 原销售订单 + if (ObjectUtil.isEmpty(jsonSub)) { + try { + mp.put("原销售订单", json.getString("sale_order_name").substring(0, json.getString("sale_order_name").indexOf("-"))); + mp.put("原行号", json.getString("sale_order_name").substring(json.getString("sale_order_name").indexOf("-") + 1, json.getString("sale_order_name").length())); + } catch (Exception e) { + mp.put("原销售订单", json.getString("sale_order_name")); + mp.put("原行号", ""); + } + } + try { mp.put("原销售订单", jsonSub.getString("sale_order_name").substring(0, jsonSub.getString("sale_order_name").indexOf("-"))); mp.put("原行号", jsonSub.getString("sale_order_name").substring(jsonSub.getString("sale_order_name").indexOf("-") + 1, jsonSub.getString("sale_order_name").length()));