From 2c38877ed256fe1c8b214750ba83e9242201c74b Mon Sep 17 00:00:00 2001 From: psh Date: Thu, 11 Jan 2024 19:05:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=9F=E8=87=AA=E5=8A=A8=E9=97=A8=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=9C=A8=E9=A9=B1=E5=8A=A8=E5=86=85=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../run/OneNDCSocketConnectionAutoRun.java | 95 +++++++++++ .../agv/ndcone/AgvNdcOneDeviceDriver.java | 148 ------------------ 2 files changed, 95 insertions(+), 148 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 5c62fff..7caaf93 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -1,12 +1,15 @@ package org.nl.acs.auto.run; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; import org.nl.acs.device_driver.basedriver.agv.utils.SocketUtil; +import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutoDoorDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_elevator.StandardElevatorDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.service.InstructionService; @@ -127,6 +130,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { List insts = null; boolean link_flag = false; Device agv_device = null; + String old_device_code = null; if (carno != 0) { agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); } @@ -193,6 +197,97 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { }else if (phase == 0x51 && (agvaddr == 2421 || agvaddr == 2422 || agvaddr == 2423)) { if (SocketUtil.checkConnect(agvaddr, (byte) 0X00)) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + } else if (phase == 0x50) {//进入区域 + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + } + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + return; + } + + if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) { + StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver(); + + if (driver.getMode() != 0) { + flag = true; + } else { + String message = "自动门未联机,无法开门。"; + driver.setMessage(message); + logServer.deviceExecuteLog(device_code, "", "", message); + } + + if (flag) { + driver.writing(1); + driver.setMessage(""); + logServer.deviceExecuteLog(device_code, "", "", "允许开门。"); + } + + if (driver.getAction() == 1) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + } else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) { + StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver(); + + + } + + } else if (phase == 0x51) {//离开区域 + + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + } else { + device_code = old_device_code; + } + } + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + return; + } + + if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) { + StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver(); + + if (driver.getMode() != 0) { + flag = true; + } else { + String message = "自动门未联机,无法关门。"; + driver.setMessage(message); + logServer.deviceExecuteLog(device_code, "", "", message); + } + + if (flag) { + driver.writing(2); + driver.setMessage(""); + logServer.deviceExecuteLog(device_code, "", "", "允许关门。"); + } + + //百济没有2已关,0就当作已关门 + if (driver.getAction() == 0) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + } else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) { + StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver(); + + } } else { //上报异常信息 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index deaf5c3..3c05053 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -945,154 +945,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic agvaddr_copy = agvaddr; data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); - } else if (phase == 0x50) {//进入区域 - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; - } - if (agvaddr != 0) { - old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); - if (StrUtil.contains(old_device_code, "-")) { - String[] point = old_device_code.split("-"); - device_code = point[0]; - } else if (StrUtil.contains(old_device_code, ".")) { - String[] point = old_device_code.split("\\."); - device_code = point[0]; - } else { - device_code = old_device_code; - } - } - device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - return; - } - - if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) { - StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver(); - - if (driver.getMode() != 0) { -// if ("1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) -// ) { -// JSONObject form = new JSONObject(); -// form.put("vehicle_code", ""); -// form.put("status", 5); -// form.put("device_code", device_code); -// form.put("task_code", ""); -// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ -// add(form); -// }}); -// if (20000 == result.getIntValue("code")) { -// flag = true; -// } else { -// String resultMessage = result.getString("message"); -// this.message = resultMessage; -// String message = resultMessage + "无法开门。"; -// driver.setMessage(message); -// logServer.deviceExecuteLog(device_code, "", "", message); -// } -// } else { - flag = true; -// } - } else { - String message = "自动门未联机,无法开门。"; - driver.setMessage(message); - logServer.deviceExecuteLog(device_code, "", "", message); - } - - if (flag) { - driver.writing(1); - this.message = ""; - driver.setMessage(""); - logServer.deviceExecuteLog(device_code, "", "", "允许开门。"); - } - - if (driver.getAction() == 1) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - } - } else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) { - StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver(); - - - } - - } else if (phase == 0x51) {//离开区域 - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } - if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); - return; - } - if (agvaddr != 0) { - old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); - if (StrUtil.contains(old_device_code, "-")) { - String[] point = old_device_code.split("-"); - device_code = point[0]; - } else if (StrUtil.contains(old_device_code, ".")) { - String[] point = old_device_code.split("\\."); - device_code = point[0]; - } else { - device_code = old_device_code; - } - } - device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - return; - } - - if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) { - StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver(); - - if (driver.getMode() != 0) { -// if ("1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) -// ) { -// JSONObject form = new JSONObject(); -// form.put("vehicle_code", ""); -// form.put("status", 6); -// form.put("device_code", device_code); -// form.put("task_code", ""); -// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ -// add(form); -// }}); -// if (20000 == result.getIntValue("code")) { -// flag = true; -// } else { -// String resultMessage = result.getString("message"); -// this.message = resultMessage; -// String message = resultMessage + "无法关门。"; -// driver.setMessage(message); -// logServer.deviceExecuteLog(device_code, "", "", message); -// } -// } else { - flag = true; -// } - } else { - String message = "自动门未联机,无法关门。"; - driver.setMessage(message); - logServer.deviceExecuteLog(device_code, "", "", message); - } - - if (flag) { - driver.writing(2); - this.message = ""; - driver.setMessage(""); - logServer.deviceExecuteLog(device_code, "", "", "允许关门。"); - } - - //百济没有2已关,0就当作已关门 - if (driver.getAction() == 0) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - } - } else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) { - StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver(); - - - } } else if (phase == 0x67) {//agv异常 if (ikey == 0) { this.setErrorInfo(ikey, "0", "正常");