|
@ -30,6 +30,7 @@ import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.task.domain.Task; |
|
|
import org.nl.acs.task.domain.Task; |
|
|
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.system.service.param.ISysParamService; |
|
|
import org.nl.system.service.param.ISysParamService; |
|
|
import org.nl.config.SpringContextHolder; |
|
|
import org.nl.config.SpringContextHolder; |
|
@ -124,6 +125,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
//
|
|
|
//
|
|
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; |
|
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
String start_point=task.getStart_point_code(); |
|
|
|
|
|
String next_point=task.getNext_point_code(); |
|
|
|
|
|
|
|
|
//分配 车id
|
|
|
//分配 车id
|
|
|
//(不需要WCS反馈)
|
|
|
//(不需要WCS反馈)
|
|
|
if (phase == 0x02) { |
|
|
if (phase == 0x02) { |
|
@ -168,16 +175,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
Task task =taskService.getById(inst.getTask_id()); |
|
|
|
|
|
BaseRequest request=new BaseRequest(); |
|
|
data = getData(data, index, inst, task); |
|
|
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反馈)
|
|
|
//(需要WCS反馈)
|
|
|
} else if (phase == 0x04) { |
|
|
} else if (phase == 0x04) { |
|
|
|
|
|
data = getData(data, index, inst, task); |
|
|
//取货完毕
|
|
|
//取货完毕
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
} else if (phase == 0x05) { |
|
|
} else if (phase == 0x05) { |
|
@ -214,7 +217,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); |
|
|
data = getData(data, index, inst, task); |
|
|
//到达放货等待点
|
|
|
//到达放货等待点
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
} else if (phase == 0x06) { |
|
|
} else if (phase == 0x06) { |
|
@ -251,7 +254,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); |
|
|
data = getData(data, index, inst, task); |
|
|
|
|
|
|
|
|
//放货完毕
|
|
|
//放货完毕
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
@ -310,4 +313,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private byte[] getData(byte[] data, int index, Instruction inst, TaskDto task) { |
|
|
|
|
|
String next_point; |
|
|
|
|
|
String start_point; |
|
|
|
|
|
int next_height; |
|
|
|
|
|
int start_height; |
|
|
|
|
|
if(!"1".equals(task.getTask_type())&&!"2".equals(task.getTask_type())) { |
|
|
|
|
|
BaseRequest request = new BaseRequest(); |
|
|
|
|
|
request.setRequestNo(IdUtil.simpleUUID()); |
|
|
|
|
|
request.setTaskId(task.getExt_task_id()); |
|
|
|
|
|
JSONObject resp = JSONObject.parseObject(acsToWmsService.feedbackState(request)); |
|
|
|
|
|
if("200".equals(resp.getString("code"))){ |
|
|
|
|
|
start_height=(resp.getJSONObject("parameters").getInteger("start_height")-1)*1000; |
|
|
|
|
|
next_height=(resp.getJSONObject("parameters").getInteger("next_height")-1)*1000; |
|
|
|
|
|
start_point=resp.getJSONObject("parameters").getString("start_point"); |
|
|
|
|
|
next_point=resp.getJSONObject("parameters").getString("next_point"); |
|
|
|
|
|
task.setStart_height(String.valueOf(start_height)); |
|
|
|
|
|
task.setNext_height(String.valueOf(next_height)); |
|
|
|
|
|
task.setStart_point_code(start_point); |
|
|
|
|
|
task.setStart_device_code(start_point); |
|
|
|
|
|
task.setNext_point_code(next_point); |
|
|
|
|
|
task.setNext_device_code(next_point); |
|
|
|
|
|
int start_address=deviceService.queryAddressBydeviceCode(start_point); |
|
|
|
|
|
int next_address=deviceService.queryAddressBydeviceCode(next_point); |
|
|
|
|
|
taskService.update(task); |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, start_height, next_height); |
|
|
|
|
|
log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(),phase); |
|
|
|
|
|
}else{ |
|
|
|
|
|
log.info("指令号:{},phase:{},acs请求wms申请失败", inst.getInstruction_code(),phase); |
|
|
|
|
|
} |
|
|
|
|
|
}else { |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); |
|
|
|
|
|
} |
|
|
|
|
|
return data; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|