From 61349f9bec181e2e2beabde5bf6cb12a44691286 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Tue, 12 Mar 2024 09:50:06 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E5=BD=A9=E6=B6=82=E6=9C=BA=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/nl/acs/device_driver/RouteUtil.java | 19 ---- .../maGang/MaGangConveyorDeviceDriver.java | 88 ++----------------- .../org/nl/acs/task/service/TaskService.java | 2 - .../task/service/impl/TaskServiceImpl.java | 8 -- 4 files changed, 8 insertions(+), 109 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RouteUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RouteUtil.java index f2179d4..2991b97 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RouteUtil.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RouteUtil.java @@ -51,25 +51,6 @@ public class RouteUtil { list.add(first_device_code + "02"); list.add(first_device_code + "01"); map.put(first_device_code + "01", list); - } else if (StrUtil.equals(next_device_code, "E02")) { - list = new ArrayList<>(); - list.add("E03"); - list.add("E04"); - list.add("E02"); - list.add("E03"); - list.add("E04"); - list.add("D01"); - map.put(first_device_code + "01", list); - list = new ArrayList<>(); - list.add("E02"); - list.add("E03"); - list.add("E04"); - list.add("D01"); - map.put(first_device_code + "02", list); - list = new ArrayList<>(); - list.add("E04"); - list.add("D01"); - map.put(first_device_code + "04", list); } } return map; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java index e26d6a8..c6e080f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/maGang/MaGangConveyorDeviceDriver.java @@ -66,11 +66,9 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class); private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); private Date feedHeartBeatTime = new Date(); private int feedHeartBeatTimeOut = 30000; - private int instruction_require_time_out = 3000; + private int instruction_require_time_out = 5000; int feedHeartbeat = 0; int last_feedHeartbeat = 0; @@ -132,7 +130,7 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen } } if (mode != last_mode) { - if (mode == 3 || mode == 4) { + if (mode == 3) { this.setRequireSucess(false); } } @@ -160,11 +158,6 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen if (mode == 3 && !requireSucess) { instruction_require(); } - - //3#彩涂机组申请任务 - if (mode == 4 && !requireSucess) { - instruction_require2(); - } } last_mode = mode; @@ -173,78 +166,18 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen last_action = action; } - public synchronized boolean instruction_require2() throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + public synchronized boolean instruction_require() throws Exception { + if (System.currentTimeMillis() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return false; } else { - this.instruction_require_time = date; - List link_device_codes = this.getExtraDeviceCodes("link_device_code"); - String next_device_code = ""; - MaGangConveyorDeviceDriver maGangConveyorDeviceDriver; - Device device = null; - - for (int i = 0; i < link_device_codes.size(); i++) { - String link_device_code = link_device_codes.get(i); - device = deviceAppservice.findDeviceByCode(link_device_code); - if (device.getDeviceDriver() instanceof MaGangConveyorDeviceDriver && !link_device_code.startsWith("D")) { - maGangConveyorDeviceDriver = (MaGangConveyorDeviceDriver) device.getDeviceDriver(); - if (maGangConveyorDeviceDriver.getMove() == 0) { - next_device_code = link_device_code; - break; - } - } - } - //查询任务表中是否有同一起点和终点的任务 - List taskDtos = taskserver.queryTaskByStartAndNextDeviceCode(this.getDevice_code(), next_device_code); + this.instruction_require_time = new Date(); + //查询任务表中是否有同一起点任务 + List taskDtos = taskserver.queryTaskByStartDeviceCode(this.getDevice_code()); //如果有就不生成任务 if (ObjectUtil.isNotEmpty(taskDtos)) { return false; } - String taskType = String.valueOf(device.getExtraValue().get("taskType")); - String start_device_code = this.getDevice().getDevice_code(); - if (StrUtil.isEmpty(next_device_code)) { - return false; - } - if (StrUtil.equals(taskType, "null") || StrUtil.isEmpty(taskType)) { - taskType = "0"; - } - TaskDto taskDto = new TaskDto(); - String now = DateUtil.now(); - taskDto.setTask_id(IdUtil.simpleUUID()); - taskDto.setTask_code("-" + CodeUtil.getNewCode("TASK_NO")); - taskDto.setTask_type(taskType); - taskDto.setRoute_plan_code("normal"); - taskDto.setTask_status("0"); - taskDto.setPriority("101"); - taskDto.setAgv_system_type("1"); - taskDto.setStart_device_code(start_device_code); - taskDto.setStart_point_code(start_device_code); - taskDto.setNext_point_code(next_device_code); - taskDto.setNext_point_code(next_device_code); - taskDto.setCreate_by(start_device_code); - taskDto.setUpdate_by(start_device_code); - taskDto.setUpdate_time(now); - taskDto.setCreate_time(now); - try { - taskserver.create(taskDto); - this.writing(1); - this.setRequireSucess(true); - } catch (Exception e) { - lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, "任务创建失败,原因:" + e.getMessage())); - } - return true; - } - } - - public synchronized boolean instruction_require() throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; List link_device_codes = this.getExtraDeviceCodes("link_device_code"); String next_device_code = ""; MaGangConveyorDeviceDriver maGangConveyorDeviceDriver; @@ -259,12 +192,7 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen } } } - //查询任务表中是否有同一起点和终点的任务 - List taskDtos = taskserver.queryTaskByStartAndNextDeviceCode(this.getDevice_code(), next_device_code); - //如果有就不生成任务 - if (ObjectUtil.isNotEmpty(taskDtos)) { - return false; - } + String taskType = String.valueOf(this.getExtraValue().get("taskType")); String start_device_code = this.getDevice().getDevice_code(); if (StrUtil.isEmpty(next_device_code)) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java index ab4e5dd..4b7f4bf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java @@ -111,8 +111,6 @@ public interface TaskService { */ List queryTaskByStartDeviceCode(String device_code); - List queryTaskByStartAndNextDeviceCode(String start_device_code,String next_device_code); - /** * 根据关联编号查询非立刻下发的关联任务 */ diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 815ea18..1d6057c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -287,14 +287,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { return list; } - @Override - public List queryTaskByStartAndNextDeviceCode(String start_device_code, String next_device_code) { - return Optional.ofNullable(tasks) - .orElse(new ArrayList<>()) - .stream() - .filter(taskDto -> taskDto.getStart_device_code().equals(start_device_code) && taskDto.getNext_device_code().equals(next_device_code)) - .collect(Collectors.toList()); - } @Override public TaskDto queryTaskByLinkNum(String link_num) {