From ad4da7489e3f17aba4adc53ef0744ab02d6a0ed2 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Sun, 18 Dec 2022 14:50:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maGang/MaGangConveyorDeviceDriver.java | 7 +++++++ .../org/nl/acs/task/service/TaskService.java | 7 +++++++ .../task/service/impl/TaskServiceImpl.java | 21 +++++++++++++++---- .../quartz/task/QueryXZAgvDeviceStatus.java | 4 ++-- 4 files changed, 33 insertions(+), 6 deletions(-) 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 0559be4..4008f8a 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 @@ -2,6 +2,7 @@ package org.nl.acs.device_driver.maGang; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import lombok.Data; @@ -185,6 +186,12 @@ public class MaGangConveyorDeviceDriver extends AbstractOpcDeviceDriver implemen return false; } else { this.instruction_require_time = date; + //查询任务表中是否有同一起点的任务 + List taskDtos = taskserver.queryTaskByStartDeviceCode(this.getDevice_code()); + //如果有就不生成任务 + if (ObjectUtil.isNotEmpty(taskDtos)) { + return false; + } List link_device_codes = this.getExtraDeviceCodes("link_device_code"); String next_device_code = ""; MaGangConveyorDeviceDriver maGangConveyorDeviceDriver; 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 10400b9..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 @@ -104,6 +104,13 @@ public interface TaskService { */ List queryTaskByDeviceCode(String device_code); + /** + * + * @param device_code + * @return + */ + List queryTaskByStartDeviceCode(String 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 4400827..5f4ebd3 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 @@ -248,7 +248,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { public List queryAllUnfinished(Map whereJson) { WQLObject wo = WQLObject.getWQLObject("acs_task"); JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0); - List list =arr.toJavaList(TaskDto.class); + List list = arr.toJavaList(TaskDto.class); return list; } @@ -273,6 +273,19 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { return list; } + @Override + public List queryTaskByStartDeviceCode(String start_device_code) { + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (task.getStart_device_code().equals(start_device_code)) { + list.add(task); + } + } + return list; + } + @Override public TaskDto queryTaskByLinkNum(String link_num) { return null; @@ -390,7 +403,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { } } WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); wo.insert(json); tasks.add(dto); @@ -492,7 +505,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { } if (ObjectUtil.isNotEmpty(this.findByStartCode(start_device_code)) - || ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) { + || ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) { throw new WDKException("已存在该起点或终点的任务!"); } if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) { @@ -523,7 +536,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { dto.setUpdate_by(currentUsername); WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); wo.update(json); diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryXZAgvDeviceStatus.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryXZAgvDeviceStatus.java index 63629b9..a905807 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryXZAgvDeviceStatus.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryXZAgvDeviceStatus.java @@ -107,8 +107,8 @@ public class QueryXZAgvDeviceStatus { if (!StrUtil.equals(kepType, task_type)) { maGangAgvDeviceDriver.writing("type", task_type); } - maGangAgvDeviceDriver.writing("x_coordinate", hisFormat.format(x) + ""); - maGangAgvDeviceDriver.writing("y_coordinate", hisFormat.format(y) + ""); + maGangAgvDeviceDriver.writing("x_coordinate", hisFormat.format(x)); + maGangAgvDeviceDriver.writing("y_coordinate", hisFormat.format(y)); } } }