From 97af976806b9b26de5a6acc220f5ab53a0ec608d Mon Sep 17 00:00:00 2001 From: tuqiang <437016993@qq.com> Date: Fri, 7 Jun 2024 18:11:58 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=96=B0=E5=A2=9E=E5=88=86=E5=88=87?= =?UTF-8?q?=E8=A1=8C=E6=9E=B6=E5=BC=82=E5=B8=B8=E4=BB=BB=E5=8A=A1=E4=B8=8B?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SlitTwoManipulatorDeviceDriver.java | 75 +++++++++++++++++++ .../device/driver/slit_two_manipulator.vue | 43 ++++++++++- 2 files changed, 117 insertions(+), 1 deletion(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 0a5e82120..067efb26a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -321,6 +321,24 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl return false; } else { this.instruction_head_time = date; + String link_device_code = String.valueOf(this.getDevice().getExtraValue().get("link_device_code")); + Device device = deviceAppservice.findDeviceByCode(link_device_code); + SlitTwoManipulatorDeviceDriver slitTwoManipulatorDeviceDriver; + if (device.getDeviceDriver()instanceof SlitTwoManipulatorDeviceDriver) { + slitTwoManipulatorDeviceDriver = (SlitTwoManipulatorDeviceDriver) device.getDeviceDriver(); + //如果禁用 + if (slitTwoManipulatorDeviceDriver.getIs_disable()==1){ + //就去走关联设备异常取放货工位的任务 任务生成成功返回true 就不会走下面正常生成任务的逻辑 + try { + flag = instruction_require2(); + } catch (Exception e) { + flag = false; + } + if (flag) { + return false; + } + } + } //抓取工位 if (ObjectUtil.isEmpty(getDeviceCodeList)) { getDeviceCodeList = this.getExtraDeviceCodes("get_device_code"); @@ -369,6 +387,63 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl return flag; } + //关联设备异常申请任务 + public synchronized boolean instruction_require2() { + boolean flag = false; + Date date = new Date(); + if (date.getTime() - this.instruction_head_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_head_time); + return false; + } else { + this.instruction_head_time = date; + //抓取工位 + if (ObjectUtil.isEmpty(getDeviceCodeList)) { + getDeviceCodeList = this.getExtraDeviceCodes("error_get_device_code"); + } + //放货工位 + if (ObjectUtil.isEmpty(putDeviceCodeList)) { + putDeviceCodeList = this.getExtraDeviceCodes("error_put_device_code"); + } + TaskDto task = null; + for (int i = 0; i < getDeviceCodeList.size(); i++) { + String startDeviceCode = getDeviceCodeList.get(i); + List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode); + if (ObjectUtil.isNotEmpty(taskDtos)) { + //按照优先级排序 优先级相等按照创建时间排序 + taskDtos = this.sortTask(taskDtos); + TaskDto taskDto = taskDtos.get(0); + truss_type = taskDto.getTruss_type(); + //查询任务是行架任务 + if (!StrUtil.equals(taskDto.getTask_type(), "6")) { + taskDto = null; + continue; + } + flag = this.executeReadyInst(taskDto); + } else { + List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); + if (ObjectUtil.isNotEmpty(taskDtoList)) { + //按照优先级排序 优先级相等按照创建时间排序 + taskDtoList = this.sortTask(taskDtoList); + for (int j = 0; j < taskDtoList.size(); j++) { + task = taskDtoList.get(j); + + // 9 行架任务 + if (ObjectUtil.isNotEmpty(task) && !StrUtil.equals(task.getTask_type(), "6")) { + task = null; + continue; + } + if (ObjectUtil.isNotEmpty(task)) break; + } + } + } + } + if (!ObjectUtil.isEmpty(task)) { + flag = this.executeReadyTask(task); + } + } + return flag; + } + //执行已有就绪指令 public synchronized boolean executeReadyInst(TaskDto taskDto) { //获取指令信息 diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/slit_two_manipulator.vue b/acs2/nladmin-ui/src/views/acs/device/driver/slit_two_manipulator.vue index c36ff2b32..7d167af7d 100644 --- a/acs2/nladmin-ui/src/views/acs/device/driver/slit_two_manipulator.vue +++ b/acs2/nladmin-ui/src/views/acs/device/driver/slit_two_manipulator.vue @@ -175,6 +175,45 @@ + + + + + + + + + + + + + + + + + + @@ -347,7 +386,9 @@ export default { is_release: true, link_device_code: [], get_device_code: [], - put_device_code: [] + put_device_code: [], + error_get_device_code: [], + error_put_device_code: [] }, rules: {} }