|
|
@ -1,5 +1,6 @@ |
|
|
|
package org.nl.acs.device_driver.basedriver.agv.ndcone; |
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
@ -17,6 +18,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic |
|
|
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver; |
|
|
|
import org.nl.acs.device_driver.driver.AbstractDeviceDriver; |
|
|
|
import org.nl.acs.ext.wms.data.BaseRequest; |
|
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; |
|
|
|
import org.nl.acs.instruction.domain.Instruction; |
|
|
@ -26,6 +28,7 @@ import org.nl.acs.log.LokiLog; |
|
|
|
import org.nl.acs.log.LokiLogType; |
|
|
|
import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
|
import org.nl.acs.task.domain.Task; |
|
|
|
import org.nl.acs.task.service.TaskService; |
|
|
|
import org.nl.acs.task.service.impl.TaskServiceImpl; |
|
|
|
import org.nl.system.service.param.ISysParamService; |
|
|
@ -165,31 +168,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
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,0,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 { |
|
|
|
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
Task task =taskService.getById(inst.getTask_id()); |
|
|
|
BaseRequest request=new BaseRequest(); |
|
|
|
request.setRequestNo(IdUtil.simpleUUID()); |
|
|
|
request.setTaskId(task.getExt_task_id()); |
|
|
|
request.setPhase(String.valueOf(phase)); |
|
|
|
acsToWmsService.feedbackState(request); |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); |
|
|
|
} |
|
|
|
//到达取货等待点
|
|
|
|
//(需要WCS反馈)
|
|
|
|
} else if (phase == 0x04) { |
|
|
@ -229,31 +214,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
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", "2"); |
|
|
|
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,0,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 { |
|
|
|
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); |
|
|
|
} |
|
|
|
//到达放货等待点
|
|
|
|
//(需要WCS反馈)
|
|
|
|
} else if (phase == 0x06) { |
|
|
@ -290,30 +251,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
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", "3"); |
|
|
|
map.put("device_code", inst.getNext_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,0,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 { |
|
|
|
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); |
|
|
|
} |
|
|
|
|
|
|
|
//放货完毕
|
|
|
|
//(需要WCS反馈)
|
|
|
|
} else if (phase == 0x09) { |
|
|
@ -348,25 +287,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
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", "4"); |
|
|
|
map.put("device_code", inst.getNext_point_code()); |
|
|
|
map.put("task_code", inst.getTask_code()); |
|
|
|
req.add(map); |
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,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,0,0,0,0); |
|
|
|
} |
|
|
|
} |
|
|
|
//到达位置点
|
|
|
|
//(需要WCS反馈)
|
|
|
|