ACS请求LMS获取点位高度接口重新调整
This commit is contained in:
@@ -30,6 +30,7 @@ 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.dto.TaskDto;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
@@ -124,6 +125,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//
|
||||
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
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
@@ -168,16 +175,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
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);
|
||||
|
||||
data = getData(data, index, inst, task);
|
||||
//到达取货等待点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x04) {
|
||||
data = getData(data, index, inst, task);
|
||||
//取货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x05) {
|
||||
@@ -214,7 +217,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
|
||||
data = getData(data, index, inst, task);
|
||||
//到达放货等待点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x06) {
|
||||
@@ -251,7 +254,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0);
|
||||
data = getData(data, index, inst, task);
|
||||
|
||||
//放货完毕
|
||||
//(需要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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -68,10 +68,5 @@ public class BaseRequest {
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 阶段号
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -290,4 +290,16 @@ public class TaskDto implements Serializable {
|
||||
* 烘箱温度
|
||||
*/
|
||||
private String temperature;
|
||||
|
||||
/**
|
||||
* 起点高度
|
||||
*/
|
||||
private String start_height;
|
||||
|
||||
/**
|
||||
* 终点高度
|
||||
*/
|
||||
private String next_height;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user