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