no message
parent
5d93f39d49
commit
58af5b1482
|
|
@ -104,7 +104,7 @@ public class NioF3AppController {
|
|||
@AnonymousAccess
|
||||
public ResponseEntity<Object> updateTuggerTrailerInfo(@RequestBody UpdateTuggerTrailerInfo updateTuggerTrailerInfo) {
|
||||
try {
|
||||
kmReService.sendAgvTaskToContainer(UrlApi.updateTuggerTrailerInfo(), kmReService.updateTuggerTrailerInfo(updateTuggerTrailerInfo));
|
||||
kmReService.sendAgvTaskToContainer(UrlApi.updateTuggerTrailerInfo(), kmReService.updateTuggerTrailerInfoJson(updateTuggerTrailerInfo));
|
||||
return new ResponseEntity<>(ApiResult.success(), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.fail(e.getMessage()), HttpStatus.BAD_REQUEST);
|
||||
|
|
|
|||
|
|
@ -102,5 +102,5 @@ public interface KMReService {
|
|||
/**
|
||||
* 更新牵引车拖挂车信息
|
||||
*/
|
||||
String updateTuggerTrailerInfo(UpdateTuggerTrailerInfo updateTuggerTrailerInfo);
|
||||
String updateTuggerTrailerInfoJson(UpdateTuggerTrailerInfo updateTuggerTrailerInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ public class KMReServiceImpl implements KMReService {
|
|||
private final AgvTaskService agvTaskService;
|
||||
private final LesService lesService;
|
||||
|
||||
|
||||
/**
|
||||
* 容器入场Json
|
||||
*
|
||||
|
|
@ -216,7 +215,6 @@ public class KMReServiceImpl implements KMReService {
|
|||
return jsonObject.toJSONString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建叉车任务数据节点
|
||||
*/
|
||||
|
|
@ -408,7 +406,6 @@ public class KMReServiceImpl implements KMReService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 验证AgvTask响应
|
||||
*/
|
||||
|
|
@ -428,7 +425,6 @@ public class KMReServiceImpl implements KMReService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新AgvTask状态(成功)
|
||||
*/
|
||||
|
|
@ -485,34 +481,58 @@ public class KMReServiceImpl implements KMReService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String updateTuggerTrailerInfo(UpdateTuggerTrailerInfo updateTuggerTrailerInfo) {
|
||||
public String updateTuggerTrailerInfoJson(UpdateTuggerTrailerInfo updateTuggerTrailerInfo) {
|
||||
//参数验证
|
||||
validateUpdateTuggerTrailerInfo(updateTuggerTrailerInfo);
|
||||
|
||||
// 根据停靠点找到对应任务
|
||||
AgvTask agvTask = findBySlotCode(updateTuggerTrailerInfo.getSrcPositionCode());
|
||||
|
||||
return createTuggerTrailerInfoNode(agvTask, updateTuggerTrailerInfo.getDollyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验更新请求参数
|
||||
*/
|
||||
private void validateUpdateTuggerTrailerInfo(UpdateTuggerTrailerInfo updateTuggerTrailerInfo) {
|
||||
if (StringUtils.isEmpty(updateTuggerTrailerInfo.getSrcPositionCode())) {
|
||||
throw new BadRequestException("起点必填");
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(updateTuggerTrailerInfo.getDollyList())) {
|
||||
throw new BadRequestException("器具必填");
|
||||
}
|
||||
//根据点位找到当前到站的AGV任务;
|
||||
AgvTask agvTask = agvTaskService.findBySlotCode(updateTuggerTrailerInfo.getSrcPositionCode(), BizStatus.MOVE, "TUGGER_MOVE");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据途径点查找AGV任务
|
||||
*/
|
||||
private AgvTask findBySlotCode(String srcPositionCode) {
|
||||
AgvTask agvTask = agvTaskService.findBySlotCode(srcPositionCode, BizStatus.MOVE, "TUGGER_MOVE");
|
||||
if (agvTask == null) {
|
||||
throw new BadRequestException(updateTuggerTrailerInfo.getSrcPositionCode() + "点未匹配到任务");
|
||||
throw new BadRequestException(srcPositionCode + "点位未匹配到任务");
|
||||
}
|
||||
return agvTask;
|
||||
}
|
||||
|
||||
private String createTuggerTrailerInfoNode(AgvTask agvTask, List<Dolly> dollyList) {
|
||||
JSONObject jsonObject = new JSONObject(true);
|
||||
//请求 id
|
||||
String requestId = String.valueOf(System.currentTimeMillis());
|
||||
jsonObject.put("requestId", requestId);
|
||||
jsonObject.put("requestId", String.valueOf(System.currentTimeMillis()));
|
||||
//当前执行作业id
|
||||
jsonObject.put("missionCode", agvTask.getId());
|
||||
//当前执行任务的小车号
|
||||
jsonObject.put("robotId", "");
|
||||
//拖挂车数量
|
||||
jsonObject.put("tugCount", updateTuggerTrailerInfo.getDollyList().size());
|
||||
jsonObject.put("tugCount", dollyList.size());
|
||||
//拖挂车类型集
|
||||
List<String> tugModels = updateTuggerTrailerInfo.getDollyList().stream().map(Dolly::getDolly).collect(Collectors.toList());
|
||||
|
||||
List<String> tugModels = dollyList.stream()
|
||||
.map(Dolly::getDolly)
|
||||
.collect(Collectors.toList());
|
||||
jsonObject.put("tugModels", tugModels);
|
||||
//是否同步继续(放行)任务
|
||||
jsonObject.put("resumeMission", true);
|
||||
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
|
|
@ -593,7 +613,6 @@ public class KMReServiceImpl implements KMReService {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue