Browse Source

add:增加自动门交互日志

master
龚宝雄 3 weeks ago
parent
commit
a7cdf38ff4
  1. 17
      acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 489
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  3. 7
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutoDoorDeviceDriver.java
  4. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java
  5. 20
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  6. 14
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/ExecutableDeviceDriver.java

17
acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -195,11 +195,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//电梯开门 //电梯开门
}else if (phase == 0x50 && (agvaddr == 2421 || agvaddr == 2422 || agvaddr == 2423)) { }else if (phase == 0x50 && (agvaddr == 2421 || agvaddr == 2422 || agvaddr == 2423)) {
if (SocketUtil.checkConnect(agvaddr, (byte) 0X0A)) { if (SocketUtil.checkConnect(agvaddr, (byte) 0X0A)) {
log.info("agv车号为"+carno+"接收到电梯开门信号");
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
} }
//电梯关门 //电梯关门
}else if (phase == 0x51 && (agvaddr == 2421 || agvaddr == 2422 || agvaddr == 2423)) { }else if (phase == 0x51 && (agvaddr == 2421 || agvaddr == 2422 || agvaddr == 2423)) {
if (SocketUtil.checkConnect(agvaddr, (byte) 0X00)) { if (SocketUtil.checkConnect(agvaddr, (byte) 0X00)) {
log.info("agv车号为"+carno+"接收到电梯关门信号");
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
} }
} else if (phase == 0x50) {//进入区域 } else if (phase == 0x50) {//进入区域
@ -224,22 +226,25 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) { if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) {
StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver(); StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver();
log.info("agv车号为"+carno+",进入自动门:"+device_code+"区域,请求开门中");
if (driver.getMode() != 0) { if (driver.getMode() != 0) {
flag = true; flag = true;
} else { } else {
String message = "自动门未联机,无法开门。"; String message = "自动门未联机,无法开门。";
driver.setMessage(message); driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message); logServer.deviceExecuteLog(device_code, "", "", message);
log.error("agv车号为"+carno+",进入自动门区域:"+"自动门:"+device_code+"未联机,无法开门。");
} }
if (flag) { if (flag) {
driver.writing(1); driver.writing(1);
driver.setMessage(""); driver.setMessage("");
log.info("agv车号为"+carno+",进入自动门区域"+"自动门:"+device_code+"已联机,允许开门。");
logServer.deviceExecuteLog(device_code, "", "", "允许开门。"); logServer.deviceExecuteLog(device_code, "", "", "允许开门。");
} }
log.info("自动门:"+device_code+"开门的action的值此时为:"+driver.getAction()+"该值应为1");
if (driver.getAction() == 1) { if (driver.getAction() == 1) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("自动门:"+device_code+"返回开门到位,"+"agv车号为"+carno+",进入自动门。");
} }
} else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) {
StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver(); StandardElevatorDeviceDriver driver = (StandardElevatorDeviceDriver) device.getDeviceDriver();
@ -269,23 +274,25 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) { if (device.getDeviceDriver() instanceof StandardAutoDoorDeviceDriver) {
StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver(); StandardAutoDoorDeviceDriver driver = (StandardAutoDoorDeviceDriver) device.getDeviceDriver();
log.info("agv车号为"+carno+",准备离开自动门:"+device_code+"区域,请求关门中");
if (driver.getMode() != 0) { if (driver.getMode() != 0) {
flag = true; flag = true;
} else { } else {
String message = "自动门未联机,无法关门。"; String message = "自动门未联机,无法关门。";
log.error("agv车号为"+carno+",准备离开自动门区域:"+"自动门:"+device_code+"未联机,无法关门。");
driver.setMessage(message); driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message); logServer.deviceExecuteLog(device_code, "", "", message);
} }
log.info("自动门:"+device_code+"关门的action的值此时为:"+driver.getAction()+"该值应为0");
if (flag) { if (flag) {
driver.writing(2); driver.writing(2);
driver.setMessage(""); driver.setMessage("");
log.info("自动门:"+device_code+"工作模式正常,"+"agv车号为"+carno+",写入关门信号2,准备离开自动门。");
logServer.deviceExecuteLog(device_code, "", "", "允许关门。"); logServer.deviceExecuteLog(device_code, "", "", "允许关门。");
} }
//百济没有2已关,0就当作已关门 //百济没有2已关,0就当作已关门
if (driver.getAction() == 0) { if (driver.getAction() == 0) {
log.info("自动门:"+device_code+"接收到agv写入2信号,返回action信号为0,交互成功,"+"agv车号为"+carno+",离开自动门。");
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
} }
} else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardElevatorDeviceDriver) {

489
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -106,9 +106,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
boolean link_flag = false; boolean link_flag = false;
if (ikey != 0) { if (ikey != 0) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
// if (ObjectUtil.isEmpty(inst)) { // if (ObjectUtil.isEmpty(inst)) {
// inst = instructionService.findByCode(String.valueOf(ikey)); // inst = instructionService.findByCode(String.valueOf(ikey));
// } // }
} }
if (!ObjectUtil.isEmpty(link_inst)) { if (!ObjectUtil.isEmpty(link_inst)) {
link_flag = true; link_flag = true;
@ -169,10 +169,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return; return;
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
StandardOrdinarySiteDeviceDriver driver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); StandardOrdinarySiteDeviceDriver driver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if ("true".equals(device.getExtraValue().get("wait")) if ("true".equals(device.getExtraValue().get("wait"))
&& !inst.getTask_code().startsWith("-") && !inst.getTask_code().startsWith("-")
&& "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) { && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
@ -181,13 +179,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 1); form.put("status", 1);
form.put("device_code", device_code); form.put("device_code", device_code);
form.put("task_code", inst.getTask_code()); form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{ JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form); add(form);
}}); }});
if (20000 == result.getIntValue("code")) { if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs成功,运行取货");
wcsFlag = true; wcsFlag = true;
} else { } else {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs返回异常,不允许取货,返回信息:"+result);
String resultMessage = result.getString("message"); String resultMessage = result.getString("message");
this.message = resultMessage; this.message = resultMessage;
String message = resultMessage + "不允许AGV取货。"; String message = resultMessage + "不允许AGV取货。";
@ -206,13 +206,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 1); form.put("status", 1);
form.put("device_code", device_code); form.put("device_code", device_code);
form.put("task_code", inst.getTask_code()); form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,开始反馈wcs...");
JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
add(form); add(form);
}}); }});
if (20000 == result.getIntValue("code")) { if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs成功,运行取货");
wmsFlag = true; wmsFlag = true;
} else { } else {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs返回异常,不允许取货,返回信息:"+result);
String resultMessage = result.getString("message"); String resultMessage = result.getString("message");
this.message = resultMessage; this.message = resultMessage;
String message = resultMessage + "不允许AGV取货。"; String message = resultMessage + "不允许AGV取货。";
@ -245,12 +248,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("device_code", device_code); form.put("device_code", device_code);
form.put("task_code", inst.getTask_code()); form.put("task_code", inst.getTask_code());
JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
add(form); add(form);}
}}); });
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,开始反馈wcs...");
if (20000 == result.getIntValue("code")) { if (20000 == result.getIntValue("code")) {
flag = true; flag = true;
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs成功,运行取货");
} else { } else {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达取货点,反馈wcs返回异常,不允许取货,返回信息:"+result);
String resultMessage = result.getString("message"); String resultMessage = result.getString("message");
this.message = resultMessage; this.message = resultMessage;
String message = resultMessage + "不允许AGV取货。"; String message = resultMessage + "不允许AGV取货。";
@ -384,48 +389,50 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 2); form.put("status", 2);
form.put("device_code", device_code); form.put("device_code", device_code);
form.put("task_code", inst.getTask_code()); form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv取货完成,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{ JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form); add(form);
}}); }});
if (20000 == result.getIntValue("code")) { if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv取货完成,反馈wcs成功");
wcsFlag = true; wcsFlag = true;
} else { } else {
log.info(device_code+":feedWcsAgvTaskStatus - agv取货完成,反馈wcs返回异常,不允许离开,返回信息:"+result);
String resultMessage = result.getString("message"); String resultMessage = result.getString("message");
this.message = resultMessage; this.message = resultMessage;
String message = resultMessage + "不允许AGV取货后离开。"; String message = resultMessage + "不允许AGV取货后离开。";
log.info("agv到达取货点,不允许AGV取货后离开。");
driver.setMessage(message); driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message); logServer.deviceExecuteLog(device_code, "", "", message);
} }
} else { } else {
wcsFlag = true; wcsFlag = true;
} }
// if ("true".equals(device.getExtraValue().get("reqWms"))
// if ("true".equals(device.getExtraValue().get("reqWms")) // && !inst.getTask_code().startsWith("-")
// && !inst.getTask_code().startsWith("-") // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) { // JSONObject form = new JSONObject();
// JSONObject form = new JSONObject(); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("status", 2);
// form.put("status", 2); // form.put("device_code", device_code);
// form.put("device_code", device_code); // form.put("task_code", inst.getTask_code());
// form.put("task_code", inst.getTask_code()); // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // add(form);
// add(form); // }});
// }}); //
// // if (20000 == result.getIntValue("code")) {
// if (20000 == result.getIntValue("code")) { // wmsFlag = true;
// wmsFlag = true; // } else {
// } else { // String resultMessage = result.getString("message");
// String resultMessage = result.getString("message"); // this.message = resultMessage;
// this.message = resultMessage; // String message = resultMessage + "不允许AGV取货后离开。";
// String message = resultMessage + "不允许AGV取货后离开。"; // driver.setMessage(message);
// driver.setMessage(message); // logServer.deviceExecuteLog(device_code, "", "", message);
// logServer.deviceExecuteLog(device_code, "", "", message); // }
// } // } else {
// } else {
wmsFlag = true; wmsFlag = true;
// } // }
if (wcsFlag && wmsFlag) { if (wcsFlag && wmsFlag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = ""; this.message = "";
@ -436,47 +443,45 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
// if (driver.getMode() != 0
// if (driver.getMode() != 0 // && driver.getMove() == 0) {
// && driver.getMove() == 0) { // if (!inst.getTask_code().startsWith("-")
// if (!inst.getTask_code().startsWith("-") // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) // && "true".equals(device.getExtraValue().get("reqWms"))) {
// && "true".equals(device.getExtraValue().get("reqWms"))) { // JSONObject form = new JSONObject();
// JSONObject form = new JSONObject(); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("status", 2);
// form.put("status", 2); // form.put("device_code", device_code);
// form.put("device_code", device_code); // form.put("task_code", inst.getTask_code());
// form.put("task_code", inst.getTask_code()); // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // add(form);
// add(form); // }});
// }}); //
// // if (20000 == result.getIntValue("code")) {
// if (20000 == result.getIntValue("code")) { // flag = true;
// flag = true; // } else {
// } else { // String resultMessage = result.getString("message");
// String resultMessage = result.getString("message"); // this.message = resultMessage;
// this.message = resultMessage; // String message = resultMessage + "不允许AGV取货后离开。";
// String message = resultMessage + "不允许AGV取货后离开。"; // driver.setMessage(message);
// driver.setMessage(message); // logServer.deviceExecuteLog(device_code, "", "", message);
// logServer.deviceExecuteLog(device_code, "", "", message); // }
// } // } else {
// } else {
flag = true; flag = true;
// } // }
// } else { // } else {
// String message = ""; // String message = "";
// if (driver.getMode() == 0) { // if (driver.getMode() == 0) {
// message += "站点未联机,"; // message += "站点未联机,";
// } else { // } else {
// if (driver.getMove() != 0) { // if (driver.getMove() != 0) {
// message += "站点有货,"; // message += "站点有货,";
// } // }
// } // }
// message += "不允许AGV取货后离开。"; // message += "不允许AGV取货后离开。";
// driver.setMessage(message); // driver.setMessage(message);
// logServer.deviceExecuteLog(device_code, "", "", message); // logServer.deviceExecuteLog(device_code, "", "", message);
// } // }
if (flag) { if (flag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = ""; this.message = "";
@ -490,29 +495,29 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (driver.getMode() != 0 if (driver.getMode() != 0
&& driver.getMove() == 0 && driver.getMove() == 0
&& driver.getNumber() == 0) { && driver.getNumber() == 0) {
// if (!inst.getTask_code().startsWith("-") // if (!inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())
// && "true".equals(device.getExtraValue().get("reqWms"))) { // && "true".equals(device.getExtraValue().get("reqWms"))) {
// JSONObject form = new JSONObject(); // JSONObject form = new JSONObject();
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("status", 2); // form.put("status", 2);
// form.put("device_code", device_code); // form.put("device_code", device_code);
// form.put("task_code", inst.getTask_code()); // form.put("task_code", inst.getTask_code());
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// add(form); // add(form);
// }}); // }});
// if (20000 == result.getIntValue("code")) { // if (20000 == result.getIntValue("code")) {
// flag = true; // flag = true;
// } else { // } else {
// String resultMessage = result.getString("message"); // String resultMessage = result.getString("message");
// this.message = resultMessage; // this.message = resultMessage;
// String message = resultMessage + "不允许AGV取货后离开。"; // String message = resultMessage + "不允许AGV取货后离开。";
// driver.setMessage(message); // driver.setMessage(message);
// logServer.deviceExecuteLog(device_code, "", "", message); // logServer.deviceExecuteLog(device_code, "", "", message);
// } // }
// } else { // } else {
flag = true; flag = true;
// } // }
} else { } else {
String message = ""; String message = "";
if (driver.getMode() == 0) { if (driver.getMode() == 0) {
@ -548,6 +553,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (agvaddr < 1) { if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
log.info(this.device_code+"agv地址参数有误,phase:" + phase);
return; return;
} }
if (agvaddr != 0) { if (agvaddr != 0) {
@ -584,48 +590,48 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 3); form.put("status", 3);
form.put("device_code", device_code); form.put("device_code", device_code);
form.put("task_code", inst.getTask_code()); form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv到达放货点,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{ JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form); add(form);
}}); }});
if (20000 == result.getIntValue("code")) { if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv到达放货点,反馈wcs成功,运行放货");
wcsFlag = true; wcsFlag = true;
} else { } else {
String resultMessage = result.getString("message"); String resultMessage = result.getString("message");
this.message = resultMessage; this.message = resultMessage;
String message = resultMessage + "不允许AGV放货。"; String message = resultMessage + "不允许AGV放货。";
log.info(device_code+":feedWcsAgvTaskStatus - agv到达放货点,反馈wcs返回异常,不允许放货,返回信息:"+result);
driver.setMessage(message); driver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message); logServer.deviceExecuteLog(device_code, "", "", message);
} }
} else { } else {
wcsFlag = true; wcsFlag = true;
} }
// if ("true".equals(device.getExtraValue().get("reqWms"))
// if ("true".equals(device.getExtraValue().get("reqWms")) // && !inst.getTask_code().startsWith("-")
// && !inst.getTask_code().startsWith("-") // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) { // JSONObject form = new JSONObject();
// JSONObject form = new JSONObject(); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("status", 3);
// form.put("status", 3); // form.put("device_code", device_code);
// form.put("device_code", device_code); // form.put("task_code", inst.getTask_code());
// form.put("task_code", inst.getTask_code()); // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // add(form);
// add(form); // }});
// }}); //
// // if (20000 == result.getIntValue("code")) {
// if (20000 == result.getIntValue("code")) { // wmsFlag = true;
// wmsFlag = true; // } else {
// } else { // String resultMessage = result.getString("message");
// String resultMessage = result.getString("message"); // this.message = resultMessage;
// this.message = resultMessage; // String message = resultMessage + "不允许AGV放货。";
// String message = resultMessage + "不允许AGV放货。"; // driver.setMessage(message);
// driver.setMessage(message); // logServer.deviceExecuteLog(device_code, "", "", message);
// logServer.deviceExecuteLog(device_code, "", "", message); // }
// } // } else {
// } else {
wmsFlag = true; wmsFlag = true;
// } // }
if (wcsFlag && wmsFlag) { if (wcsFlag && wmsFlag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = ""; this.message = "";
@ -636,40 +642,40 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (driver.getMode() != 0 && driver.getMove() == 0) {
if (driver.getMode() != 0 // if (!inst.getTask_code().startsWith("-")
&& driver.getMove() == 0) { // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())
// if (!inst.getTask_code().startsWith("-") // && "true".equals(device.getExtraValue().get("reqWms"))) {
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) // JSONObject form = new JSONObject();
// && "true".equals(device.getExtraValue().get("reqWms"))) { // form.put("vehicle_code", inst.getVehicle_code());
// JSONObject form = new JSONObject(); // form.put("status", 3);
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("device_code", device_code);
// form.put("status", 3); // form.put("task_code", inst.getTask_code());
// form.put("device_code", device_code); // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// form.put("task_code", inst.getTask_code()); // add(form);
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // }});
// add(form); //
// }}); // if (20000 == result.getIntValue("code")) {
// // flag = true;
// if (20000 == result.getIntValue("code")) { // } else {
// flag = true; // String resultMessage = result.getString("message");
// } else { // this.message = resultMessage;
// String resultMessage = result.getString("message"); // String message = resultMessage + "不允许AGV放货。";
// this.message = resultMessage; // driver.setMessage(message);
// String message = resultMessage + "不允许AGV放货。"; // logServer.deviceExecuteLog(device_code, "", "", message);
// driver.setMessage(message); // }
// logServer.deviceExecuteLog(device_code, "", "", message); // } else {
// }
// } else {
flag = true; flag = true;
// } // }
} else { } else {
String message = ""; String message = "";
if (driver.getMode() == 0) { if (driver.getMode() == 0) {
message += "站点未联机,"; message += "站点未联机,";
log.info(device_code+":站点未联机,不允许AGV放货。");
} else { } else {
if (driver.getMove() != 0) { if (driver.getMove() != 0) {
message += "站点有货,"; message += "站点有货,";
log.info(device_code+":站点有货,不允许AGV放货。");
} }
} }
message += "不允许AGV放货。"; message += "不允许AGV放货。";
@ -688,29 +694,29 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof FoldDiscSiteDeviceDriver) {
FoldDiscSiteDeviceDriver driver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver(); FoldDiscSiteDeviceDriver driver = (FoldDiscSiteDeviceDriver) device.getDeviceDriver();
if (driver.getMode() != 0) { if (driver.getMode() != 0) {
// if (!inst.getTask_code().startsWith("-") // if (!inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())
// && "true".equals(device.getExtraValue().get("reqWms"))) { // && "true".equals(device.getExtraValue().get("reqWms"))) {
// JSONObject form = new JSONObject(); // JSONObject form = new JSONObject();
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("status", 3); // form.put("status", 3);
// form.put("device_code", device_code); // form.put("device_code", device_code);
// form.put("task_code", inst.getTask_code()); // form.put("task_code", inst.getTask_code());
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// add(form); // add(form);
// }}); // }});
// if (20000 == result.getIntValue("code")) { // if (20000 == result.getIntValue("code")) {
// flag = true; // flag = true;
// } else { // } else {
// String resultMessage = result.getString("message"); // String resultMessage = result.getString("message");
// this.message = resultMessage; // this.message = resultMessage;
// String message = resultMessage + "不允许AGV放货。"; // String message = resultMessage + "不允许AGV放货。";
// driver.setMessage(message); // driver.setMessage(message);
// logServer.deviceExecuteLog(device_code, "", "", message); // logServer.deviceExecuteLog(device_code, "", "", message);
// } // }
// } else { // } else {
flag = true; flag = true;
// } // }
} else { } else {
String message = ""; String message = "";
if (driver.getMode() == 0) { if (driver.getMode() == 0) {
@ -776,48 +782,49 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
form.put("status", 4); form.put("status", 4);
form.put("device_code", device_code); form.put("device_code", device_code);
form.put("task_code", inst.getTask_code()); form.put("task_code", inst.getTask_code());
log.info(device_code+":feedWcsAgvTaskStatus - agv放货完成,开始反馈wcs...");
JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{ JSONObject result = acsToWmsService.feedWcsAgvTaskStatus(new JSONArray() {{
add(form); add(form);
}}); }});
if (20000 == result.getIntValue("code")) { if (20000 == result.getIntValue("code")) {
log.info(device_code+":feedWcsAgvTaskStatus - agv放货完成,反馈wcs成功,运行离开");
wcsFlag = true; wcsFlag = true;
} else { } else {
String resultMessage = result.getString("message"); String resultMessage = result.getString("message");
this.message = resultMessage; this.message = resultMessage;
String message = resultMessage + "不允许AGV放货后离开。"; String message = resultMessage + "不允许AGV放货后离开。";
driver.setMessage(message); driver.setMessage(message);
log.info(device_code+":feedWcsAgvTaskStatus - agv放货完成,反馈wcs返回异常,不允许离开,返回信息:"+result);
logServer.deviceExecuteLog(device_code, "", "", message); logServer.deviceExecuteLog(device_code, "", "", message);
} }
} else { } else {
wcsFlag = true; wcsFlag = true;
} }
// if ("true".equals(device.getExtraValue().get("reqWms"))
// if ("true".equals(device.getExtraValue().get("reqWms")) // && !inst.getTask_code().startsWith("-")
// && !inst.getTask_code().startsWith("-") // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) {
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())) { // JSONObject form = new JSONObject();
// JSONObject form = new JSONObject(); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("status", 4);
// form.put("status", 4); // form.put("device_code", device_code);
// form.put("device_code", device_code); // form.put("task_code", inst.getTask_code());
// form.put("task_code", inst.getTask_code()); // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // add(form);
// add(form); // }});
// }}); //
// // if (20000 == result.getIntValue("code")) {
// if (20000 == result.getIntValue("code")) { // wmsFlag = true;
// wmsFlag = true; // } else {
// } else { // String resultMessage = result.getString("message");
// String resultMessage = result.getString("message"); // this.message = resultMessage;
// this.message = resultMessage; // String message = resultMessage + "不允许AGV放货后离开。";
// String message = resultMessage + "不允许AGV放货后离开。"; // driver.setMessage(message);
// driver.setMessage(message); // logServer.deviceExecuteLog(device_code, "", "", message);
// logServer.deviceExecuteLog(device_code, "", "", message); // }
// } // } else {
// } else {
wmsFlag = true; wmsFlag = true;
// } // }
if (wcsFlag && wmsFlag) { if (wcsFlag && wmsFlag) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
this.message = ""; this.message = "";
@ -828,33 +835,32 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} }
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (driver.getMode() != 0 if (driver.getMode() != 0
&& driver.getMove() != 0) { && driver.getMove() != 0) {
// if (!inst.getTask_code().startsWith("-") // if (!inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())
// && "true".equals(device.getExtraValue().get("reqWms"))) { // && "true".equals(device.getExtraValue().get("reqWms"))) {
// JSONObject form = new JSONObject(); // JSONObject form = new JSONObject();
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("status", 4); // form.put("status", 4);
// form.put("device_code", device_code); // form.put("device_code", device_code);
// form.put("task_code", inst.getTask_code()); // form.put("task_code", inst.getTask_code());
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// add(form); // add(form);
// }}); // }});
// //
// if (20000 == result.getIntValue("code")) { // if (20000 == result.getIntValue("code")) {
// flag = true; // flag = true;
// } else { // } else {
// String resultMessage = result.getString("message"); // String resultMessage = result.getString("message");
// this.message = resultMessage; // this.message = resultMessage;
// String message = resultMessage + "不允许AGV放货后离开。"; // String message = resultMessage + "不允许AGV放货后离开。";
// driver.setMessage(message); // driver.setMessage(message);
// logServer.deviceExecuteLog(device_code, "", "", message); // logServer.deviceExecuteLog(device_code, "", "", message);
// } // }
// } else { // } else {
flag = true; flag = true;
// } // }
} else { } else {
String message = ""; String message = "";
if (driver.getMode() == 0) { if (driver.getMode() == 0) {
@ -882,29 +888,29 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (driver.getMode() != 0 if (driver.getMode() != 0
&& (driver.getMove() != 0 && (driver.getMove() != 0
|| driver.getNumber() != 0)) { || driver.getNumber() != 0)) {
// if (!inst.getTask_code().startsWith("-") // if (!inst.getTask_code().startsWith("-")
// && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue()) // && "1".equals(paramService.findByCode(AcsConfig.HASWMS).getValue())
// && "true".equals(device.getExtraValue().get("reqWms"))) { // && "true".equals(device.getExtraValue().get("reqWms"))) {
// JSONObject form = new JSONObject(); // JSONObject form = new JSONObject();
// form.put("vehicle_code", inst.getVehicle_code()); // form.put("vehicle_code", inst.getVehicle_code());
// form.put("status", 4); // form.put("status", 4);
// form.put("device_code", device_code); // form.put("device_code", device_code);
// form.put("task_code", inst.getTask_code()); // form.put("task_code", inst.getTask_code());
// JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{ // JSONObject result = acsToWmsService.feedAgvTaskStatus(new JSONArray() {{
// add(form); // add(form);
// }}); // }});
// if (20000 == result.getIntValue("code")) { // if (20000 == result.getIntValue("code")) {
// flag = true; // flag = true;
// } else { // } else {
// String resultMessage = result.getString("message"); // String resultMessage = result.getString("message");
// this.message = resultMessage; // this.message = resultMessage;
// String message = resultMessage + "不允许AGV放货后离开。"; // String message = resultMessage + "不允许AGV放货后离开。";
// driver.setMessage(message); // driver.setMessage(message);
// logServer.deviceExecuteLog(device_code, "", "", message); // logServer.deviceExecuteLog(device_code, "", "", message);
// } // }
// } else { // } else {
flag = true; flag = true;
// } // }
} else { } else {
String message = ""; String message = "";
if (driver.getMode() == 0) { if (driver.getMode() == 0) {
@ -931,7 +937,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
wcsFlag = false; wcsFlag = false;
} }
} }
if (flag) { if (flag) {
this.device_status = "IDLE"; this.device_status = "IDLE";
this.inst = null; this.inst = null;

7
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutoDoorDeviceDriver.java

@ -130,16 +130,13 @@ public class StandardAutoDoorDeviceDriver extends AbstractOpcDeviceDriver implem
public void writing(int command) { public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command; + "." + ItemProtocol.item_to_command;
String opcservcerid = this.getDevice().getOpc_server_id(); String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid); Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>(); Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command); itemMap.put(to_command, command);
ReadUtil.write(itemMap, server);
server.disconnect(); server.disconnect();
log.info("下发PLC信号:{},{}", to_command, command); log.info("自动门"+devicecode+"下发PLC信号:"+to_command+"值为:"+command);
System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command); //System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command);
} }
public synchronized void OpenOrClose(String type) { public synchronized void OpenOrClose(String type) {

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java

@ -74,7 +74,7 @@ public class ItemProtocol {
public int getOpcIntegerValue(String protocol) { public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol); Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) { if (value == null) {
//log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + "信号量同步异常,读取不到该plc数据项!");
setIsonline(false); setIsonline(false);
} else { } else {
setIsonline(true); setIsonline(true);

20
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -135,19 +135,23 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
hasGoods = this.itemProtocol.getMove(); hasGoods = this.itemProtocol.getMove();
if (devicecode.contains("F2TBJ")) { if (devicecode.contains("F2TBJ")) {
if (move != last_move) { if (move != last_move) {
log.info(this.devicecode + ",检测到货位信号的值由" + last_move + "->" + move); log.info(this.devicecode + ",二楼检测到货位信号的值由" + last_move + "->" + move);
} }
if (mode != last_mode) { if (mode != last_mode) {
log.info(this.devicecode + ",检测到货位工作模式的值由" + last_mode + "->" + mode); log.info(this.devicecode + ",二楼检测到工作模式的值由" + last_mode + "->" + mode);
} }
} }
if (move != last_move) { if (move != last_move) {
this.requireSucess = false; this.requireSucess = false;
log.info(this.devicecode + ",检测到货位信号值由" + last_move + "->" + move);
}
if (mode != last_mode) {
log.info(this.devicecode + ",检测到工作模式的值由" + last_mode + "->" + mode);
} }
} catch (Exception var17) { } catch (Exception var17) {
log.error(this.devicecode +"mode:"+last_mode + "->" + mode + "move:"+last_move + "->" + move+"执行点位同步出现异常");
return; return;
} }
if (!this.itemProtocol.getIsonline()) { if (!this.itemProtocol.getIsonline()) {
this.setIsonline(false); this.setIsonline(false);
this.setIserror(true); this.setIserror(true);
@ -170,15 +174,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
Instruction instruction = null; Instruction instruction = null;
List toInstructions; List toInstructions;
switch (mode) { switch (mode) {
case 1: // case 1:
log.debug("设备运转模式:等待工作"); // log.debug("设备运转模式:等待工作");
return; // return;
case 2: case 2:
if (!requireSucess) { if (!requireSucess) {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", this.devicecode); param.put("device_code", this.devicecode);
param.put("is_have", this.move); param.put("is_have", this.move);
log.info(this.devicecode + "检测到货位光电信号变动,开始反馈WMS"); log.info(this.devicecode + ",检测到货位信号的值由" + last_move + "->" + move+",开始反馈WMS...");
this.shipDeviceUpdate(param); this.shipDeviceUpdate(param);
} }
} }
@ -342,7 +346,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
JSONObject response = acsToWmsService.shipDeviceUpdate(param); JSONObject response = acsToWmsService.shipDeviceUpdate(param);
// if (20000 == response.getIntValue("code")) { // if (20000 == response.getIntValue("code")) {
this.requireSucess = true; this.requireSucess = true;
log.info(this.devicecode + "检测到货位光电信号变动,反馈WMS成功!"); log.info(this.devicecode + "反馈WMS光电信号成功!");
// } // }
} }
} }

14
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/ExecutableDeviceDriver.java

@ -5,13 +5,13 @@ import org.nl.acs.device_driver.DeviceDriver;
public interface ExecutableDeviceDriver extends DeviceDriver { public interface ExecutableDeviceDriver extends DeviceDriver {
default void executeAuto() { default void executeAuto() {
// try { // try {
// this.execute(); // this.execute();
// } catch (Throwable var6) { // } catch (Throwable var6) {
// String message = "线程调用异常:" + var6.getMessage(); // String message = "线程调用异常:" + var6.getMessage();
// Log.error(message); // Log.error(message);
// } finally { // } finally {
// } // }
this.execute(); this.execute();
} }

Loading…
Cancel
Save