整理代码
This commit is contained in:
@@ -36,7 +36,7 @@ public class AgvController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送AGV任务
|
||||
* 推送出库任务
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -31,17 +31,6 @@ public interface IApiService
|
||||
* @return 返回入库口位置
|
||||
*/
|
||||
public MydoJob requestEnter(MydoJob mydoJob);
|
||||
/**
|
||||
* 获取任务列表
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
public List<MydoJob> getMydoJobList(MydoJob mydoJob);
|
||||
/**
|
||||
* 更新任务
|
||||
* @param mydoJob
|
||||
*/
|
||||
boolean updateMydoJob(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* WMS出库任务推送
|
||||
@@ -81,12 +70,25 @@ public interface IApiService
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
*
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
AjaxResult receiveAgvMoveJob(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest);
|
||||
|
||||
/**
|
||||
* 任务到达拣选口
|
||||
* @param agvFinishUrl
|
||||
* @param point
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
RequestLog finishMydoJob(String agvFinishUrl, String point, Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 发送agv开始状态
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendOutMydoJobStatus(Map<String, Object> param) ;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,11 @@ public class ApiServiceImpl implements IApiService {
|
||||
@Autowired
|
||||
private IAgvQueueService agvQueueService;
|
||||
|
||||
|
||||
/**
|
||||
* 请求入库
|
||||
* @param mydoJob
|
||||
* @return 返回入库口位置
|
||||
*/
|
||||
@Override
|
||||
public MydoJob requestEnter(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(REQUEST_ENTER, "请求入库", JSONUtil.toJsonStr(mydoJob));
|
||||
@@ -66,19 +70,12 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MydoJob> getMydoJobList(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GET_MYDOJOB_URL, "获取任务", JSONUtil.toJsonStr(mydoJob));
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
return JSONUtil.toList(JSONUtil.toJsonStr(bean.getData()), MydoJob.class);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发agv编码
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public GenAgvSchedulingTaskResponse genAgvSchedulingTask(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GEN_AGV_SCHEDULING_TASK, "生成AGV任务", JSONUtil.toJsonStr(genAgvSchedulingTaskRequest));
|
||||
@@ -91,12 +88,15 @@ public class ApiServiceImpl implements IApiService {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* agv执行状态返回接口
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AgvCallbackResponse agvCallback(AgvCallbackRequest request) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(request), "AGV任务执行通知");
|
||||
//requestLog.setRequestUrl("http://10.214.18.61:8089/external/log/outStockJob");
|
||||
AgvCallbackResponse response = new AgvCallbackResponse(0, "成功", "");
|
||||
try {
|
||||
agvCallbackInfo(request);
|
||||
@@ -114,6 +114,12 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* agv搬运作业
|
||||
*
|
||||
* @param genAgvSchedulingTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult receiveAgvMoveJob(GenAgvSchedulingTaskRequest genAgvSchedulingTaskRequest) {
|
||||
//todo 生成agvQueue队列
|
||||
@@ -126,11 +132,23 @@ public class ApiServiceImpl implements IApiService {
|
||||
return AjaxResult.error(genAgvSchedulingTaskResponse.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库到达拣选口
|
||||
* @param agvFinishUrl
|
||||
* @param endPoint
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public RequestLog finishMydoJob(String agvFinishUrl, String endPoint, Map<String, Object> param) {
|
||||
return requestLogService.getRequestLog(AGV_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
return requestLogService.getRequestLog(JOB_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送出库任务状态
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult sendOutMydoJobStatus(Map<String, Object> param) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(SEND_OUT_MYDOJOB_STATUS, "发送出库任务状态", JSONUtil.toJsonStr(param));
|
||||
@@ -141,7 +159,10 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理agv状态返回
|
||||
* @param request
|
||||
*/
|
||||
private void agvCallbackInfo(AgvCallbackRequest request) {
|
||||
String taskCode = request.getTaskCode();
|
||||
|
||||
@@ -178,7 +199,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
param.put("taskNo", agvQueue.getWmsTaskNo());
|
||||
param.put("trayCode", agvQueue.getWmsTraycode());
|
||||
//入库任务 暂无特殊逻辑
|
||||
RequestLog requestLog = requestLogService.getRequestLog(AGV_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JOB_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
agvQueue.setFinishTime(DateUtil.formatDateTime(new Date()));
|
||||
agvQueueService.updateAgvQueue(agvQueue);
|
||||
@@ -217,7 +238,7 @@ public class ApiServiceImpl implements IApiService {
|
||||
param.put("containerCode", agvQueue.getWmsTraycode());
|
||||
|
||||
//绑定点位和料架
|
||||
RequestLog requestLog = requestLogService.getRequestLog(AGV_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JOB_FINISH_URL, "agv任务完成", JSONUtil.toJsonStr(param));
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
//插入历史
|
||||
agvQueueService.insertHistory(agvQueue.getReqCode());
|
||||
@@ -254,6 +275,11 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送AGV任务
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult receiveOutMydoJob(MydoJob mydoJob) {
|
||||
AgvQueue agvQueue = new AgvQueue();
|
||||
@@ -279,6 +305,11 @@ public class ApiServiceImpl implements IApiService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消AGV任务
|
||||
* @param cancelTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CancelTaskResponse cancelTask(CancelTaskRequest cancelTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CANCEL_TASK_URL, "取消任务", JSONUtil.toJsonStr(cancelTaskRequest));
|
||||
@@ -286,21 +317,15 @@ public class ApiServiceImpl implements IApiService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续agv任务
|
||||
* @param continueTaskRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ContinueTaskResponse continueTask(ContinueTaskRequest continueTaskRequest) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CONTINUE_TASK_URL, "继续执行任务", JSONUtil.toJsonStr(continueTaskRequest));
|
||||
return BeanUtil.toBean(requestLog.getResponseBody(), ContinueTaskResponse.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateMydoJob(MydoJob mydoJob) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(GET_MYDOJOB_URL, "获取任务", JSONUtil.toJsonStr(mydoJob));
|
||||
String responseBody = requestLog.getResponseBody();
|
||||
InterfaceReceive bean = JSONUtil.toBean(responseBody, InterfaceReceive.class);
|
||||
if (bean.getCode() == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user