no message

main
HUOJIN\92525 2025-09-07 17:15:42 +08:00
parent 5d93f39d49
commit 58af5b1482
3 changed files with 35 additions and 16 deletions

View File

@ -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);

View File

@ -102,5 +102,5 @@ public interface KMReService {
/**
*
*/
String updateTuggerTrailerInfo(UpdateTuggerTrailerInfo updateTuggerTrailerInfo);
String updateTuggerTrailerInfoJson(UpdateTuggerTrailerInfo updateTuggerTrailerInfo);
}

View File

@ -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 {
}
/**
*
*