Browse Source

原自动门逻辑在驱动内导致找不到fix

master
psh 1 year ago
parent
commit
2c38877ed2
  1. 95
      acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 148
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

95
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<Instruction> 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 {
//上报异常信息

148
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", "正常");

Loading…
Cancel
Save