|
|
@ -27,6 +27,7 @@ import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
|
import org.nl.acs.opc.Device; |
|
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
|
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.modules.system.service.ParamService; |
|
|
|
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) { |
|
|
|
|
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
// if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) {
|
|
|
|
// JSONArray req = new JSONArray();
|
|
|
|
// JSONObject map = new JSONObject();
|
|
|
|
// map.put("vehicle_code", inst.getVehicle_code());
|
|
|
|
// map.put("status", "1");
|
|
|
|
// map.put("device_code", inst.getStart_point_code());
|
|
|
|
// map.put("task_code", inst.getTask_code());
|
|
|
|
// req.add(map);
|
|
|
|
// HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
|
|
|
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
|
|
|
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
|
|
|
// if (resp.getInteger("status") == 200) {
|
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
|
// log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code());
|
|
|
|
// } else {
|
|
|
|
// 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); |
|
|
|
// }
|
|
|
|
if(!StrUtil.startWith(task.getTask_code(), '-')){ |
|
|
|
JSONArray req = new JSONArray(); |
|
|
|
JSONObject map = new JSONObject(); |
|
|
|
map.put("vehicle_code", inst.getVehicle_code()); |
|
|
|
map.put("status", "1"); |
|
|
|
map.put("device_code", inst.getStart_point_code()); |
|
|
|
map.put("task_code", inst.getTask_code()); |
|
|
|
req.add(map); |
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
|
JSONObject resp = JSONObject.parseObject(httpResponse.body()); |
|
|
|
if (resp.getInteger("status") == 200) { |
|
|
|
start_height=resp.getInteger("start_height"); |
|
|
|
next_height=resp.getInteger("next_height"); |
|
|
|
task.setStart_height(String.valueOf(start_height)); |
|
|
|
task.setNext_height(String.valueOf(next_height)); |
|
|
|
taskService.update(task); |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,start_height,next_height); |
|
|
|
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code()); |
|
|
|
} else { |
|
|
|
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反馈)
|
|
|
|
} else if (phase == 0x05) { |
|
|
@ -245,13 +256,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
req.add(map); |
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
|
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()); |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
// } else {
|
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0);
|
|
|
|
// }
|
|
|
|
//到达放货点
|
|
|
|
//(需要WCS反馈)
|
|
|
@ -299,7 +310,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
|
|
|
// JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
|
|
|
// 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());
|
|
|
|
// } else {
|
|
|
|
// 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());
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
|
// }
|
|
|
|
//放货完毕
|
|
|
|
//(需要WCS反馈)
|
|
|
@ -355,13 +366,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
req.add(map); |
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
|
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()); |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
// } 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属性地址对应的满料位设备
|
|
|
|
agvaddr = arr[18] * 256 + arr[19]; |
|
|
|
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); |
|
|
|
} 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); |
|
|
|
} 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); |
|
|
|
} else if (phase == 0x67) {//agv异常
|
|
|
|
// if (ikey == 0) {
|
|
|
@ -394,7 +405,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
// dto.setError_info(error_message);
|
|
|
|
// deviceErrorLogService.create(dto);
|
|
|
|
// }
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); |
|
|
|
last_error = error; |
|
|
|
} else if (phase == 0x70) { |
|
|
|
//x坐标
|
|
|
|