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