|
@ -27,6 +27,7 @@ import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
import org.nl.acs.opc.Device; |
|
|
import org.nl.acs.opc.Device; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.task.service.TaskService; |
|
|
import org.nl.acs.task.service.TaskService; |
|
|
|
|
|
import org.nl.acs.task.service.dto.TaskDto; |
|
|
import org.nl.acs.task.service.impl.TaskServiceImpl; |
|
|
import org.nl.acs.task.service.impl.TaskServiceImpl; |
|
|
import org.nl.modules.system.service.ParamService; |
|
|
import org.nl.modules.system.service.ParamService; |
|
|
import org.nl.modules.system.service.impl.ParamServiceImpl; |
|
|
import org.nl.modules.system.service.impl.ParamServiceImpl; |
|
@ -118,7 +119,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
if (arr[18] * 256 + arr[19] == 0) { |
|
|
if (arr[18] * 256 + arr[19] == 0) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//普通站点
|
|
|
//普通站点
|
|
@ -173,30 +174,40 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TaskDto task =taskService.findById(inst.getTask_id()); |
|
|
|
|
|
int start_height= ObjectUtil.isNotEmpty(task.getStart_height())?Integer.parseInt(task.getStart_height()):0; |
|
|
|
|
|
int next_height= ObjectUtil.isNotEmpty(task.getNext_height())?Integer.parseInt(task.getNext_height()):0; |
|
|
// Object reqWms = device.getExtraValue().get("reqWms");
|
|
|
// Object reqWms = device.getExtraValue().get("reqWms");
|
|
|
// if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
|
|
// if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
|
|
// JSONArray req = new JSONArray();
|
|
|
if(!StrUtil.startWith(task.getTask_code(), '-')){ |
|
|
// JSONObject map = new JSONObject();
|
|
|
JSONArray req = new JSONArray(); |
|
|
// map.put("vehicle_code", inst.getVehicle_code());
|
|
|
JSONObject map = new JSONObject(); |
|
|
// map.put("status", "1");
|
|
|
map.put("vehicle_code", inst.getVehicle_code()); |
|
|
// map.put("device_code", inst.getStart_point_code());
|
|
|
map.put("status", "1"); |
|
|
// map.put("task_code", inst.getTask_code());
|
|
|
map.put("device_code", inst.getStart_point_code()); |
|
|
// req.add(map);
|
|
|
map.put("task_code", inst.getTask_code()); |
|
|
// HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
|
|
req.add(map); |
|
|
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
// if (resp.getInteger("status") == 200) {
|
|
|
JSONObject resp = JSONObject.parseObject(httpResponse.body()); |
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
if (resp.getInteger("status") == 200) { |
|
|
// log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
|
|
|
start_height=resp.getInteger("start_height"); |
|
|
// } else {
|
|
|
next_height=resp.getInteger("next_height"); |
|
|
// log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code());
|
|
|
task.setStart_height(String.valueOf(start_height)); |
|
|
// }
|
|
|
task.setNext_height(String.valueOf(next_height)); |
|
|
// } else {
|
|
|
taskService.update(task); |
|
|
// log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,start_height,next_height); |
|
|
// }
|
|
|
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code()); |
|
|
// } else {
|
|
|
} else { |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code()); |
|
|
// }
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code()); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,start_height,next_height); |
|
|
|
|
|
} |
|
|
//取货完毕
|
|
|
//取货完毕
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
} else if (phase == 0x05) { |
|
|
} else if (phase == 0x05) { |
|
@ -245,13 +256,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
req.add(map); |
|
|
req.add(map); |
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code()); |
|
|
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code()); |
|
|
} else { |
|
|
} else { |
|
|
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code()); |
|
|
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code()); |
|
|
} |
|
|
} |
|
|
// } else {
|
|
|
// } else {
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0);
|
|
|
// }
|
|
|
// }
|
|
|
//到达放货点
|
|
|
//到达放货点
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
@ -299,7 +310,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
|
|
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
|
|
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
|
|
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
|
|
// if (resp.getInteger("status") == 200) {
|
|
|
// if (resp.getInteger("status") == 200) {
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0);
|
|
|
// log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
|
|
|
// log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code());
|
|
|
// } else {
|
|
|
// } else {
|
|
|
// log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
|
|
|
// log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
|
|
@ -308,7 +319,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
// log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
|
|
// log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
|
|
// }
|
|
|
// }
|
|
|
// } else {
|
|
|
// } else {
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
// }
|
|
|
// }
|
|
|
//放货完毕
|
|
|
//放货完毕
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
@ -355,13 +366,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
req.add(map); |
|
|
req.add(map); |
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); |
|
|
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); |
|
|
} else { |
|
|
} else { |
|
|
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
} |
|
|
} |
|
|
// } else {
|
|
|
// } else {
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0);
|
|
|
// }
|
|
|
// }
|
|
|
} |
|
|
} |
|
|
//到达位置点
|
|
|
//到达位置点
|
|
@ -370,13 +381,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
//1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
|
|
|
//1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
|
|
|
agvaddr = arr[18] * 256 + arr[19]; |
|
|
agvaddr = arr[18] * 256 + arr[19]; |
|
|
agvaddr_copy = agvaddr; |
|
|
agvaddr_copy = agvaddr; |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
} else if (phase == 0x50) {//进入交通灯区域
|
|
|
} else if (phase == 0x50) {//进入交通灯区域
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
} else if (phase == 0x51) {//离开交通灯区域
|
|
|
} else if (phase == 0x51) {//离开交通灯区域
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
} else if (phase == 0x67) {//agv异常
|
|
|
} else if (phase == 0x67) {//agv异常
|
|
|
// if (ikey == 0) {
|
|
|
// if (ikey == 0) {
|
|
@ -394,7 +405,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
// dto.setError_info(error_message);
|
|
|
// dto.setError_info(error_message);
|
|
|
// deviceErrorLogService.create(dto);
|
|
|
// deviceErrorLogService.create(dto);
|
|
|
// }
|
|
|
// }
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
last_error = error; |
|
|
last_error = error; |
|
|
} else if (phase == 0x70) { |
|
|
} else if (phase == 0x70) { |
|
|
//x坐标
|
|
|
//x坐标
|
|
|