恢复任务去除校验

This commit is contained in:
cbs 2025-06-20 15:37:21 +08:00
parent 23cc25e0d4
commit a049eae075
2 changed files with 50 additions and 33 deletions

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotSimulationPoseDTO;
import cn.iocoder.yudao.module.system.api.path.PathApi;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotDetailDTO;
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
@ -47,6 +48,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
@ -93,17 +95,15 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
private RobotInformationService informationService;
@Resource
private UserOperationLogService userOperationLogService;
@Lazy
private PathApi pathApi;
/*@Resource
private CommonApi commonApi;*/
@Resource
private UserOperationLogService userOperationLogService;
@Resource
private RobotMapStopService robotMapStopService;
@Resource
private RobotMapStopService mapStopService;
@Resource
private RobotTaskDetailService taskDetailService;
@ -264,6 +264,7 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
parkingSpotService.deleteParkingByMapId(positionMap.getId());
redisUtil.del("pngBase64");
redisUtil.del(FloorAreaConstant.FLOOR_AREA_ALL);
pathApi.pathInitData();
}
// 处理 PNG 文件

View File

@ -168,7 +168,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
@Resource
private RobotChargeLogMapper chargeLogMapper;
@Resource
private MoveToWaitMapper moveToWaitMapper;
@ -244,7 +244,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
List<RobotDimensionsDTO> list = informationMapper.selectRobotDimensions();
// commonApi.commonMethod(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
mqttUtils.pub(PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS,JSON.toJSONString(list));
mqttUtils.pub(PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS, JSON.toJSONString(list));
redisUtil.del(key);
// 返回
@ -487,7 +487,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
List<RobotDimensionsDTO> robotDimensions = informationMapper.selectRobotDimensions();
// commonApi.commonMethod(robotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
mqttUtils.pub(PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS,JSON.toJSONString(robotDimensions));
mqttUtils.pub(PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS, JSON.toJSONString(robotDimensions));
}
/**
@ -568,7 +568,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
List<RobotDimensionsDTO> robotDimensions = informationMapper.selectRobotDimensions();
// commonApi.commonMethod(robotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
mqttUtils.pub(PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS,JSON.toJSONString(robotDimensions));
mqttUtils.pub(PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS, JSON.toJSONString(robotDimensions));
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robotInformationDO.getMacAddress();
redisUtil.del(pose2dKey);
@ -1096,7 +1096,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
for (RobotInformationDO robotInformationDO : robotInformations) {
String topic = RobotTopicConstant.RCS_HEART_BEAT + robotInformationDO.getMacAddress();
// commonApi.commonMethod(new RobotRcsHeartBeatDTO(), topic);
mqttUtils.pub(topic,JSON.toJSONString(new RobotRcsHeartBeatDTO()));
mqttUtils.pub(topic, JSON.toJSONString(new RobotRcsHeartBeatDTO()));
}
}
@ -1146,7 +1146,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
public RobotTaskDetailActionLogDO closeTask(String robotNo) {
CleanAgvDTO build = CleanAgvDTO.builder().robotNo(robotNo).build();
// commonApi.commonMethod(build, PathPlanningTopicConstant.CLEAN_AGV);
mqttUtils.pub(PathPlanningTopicConstant.CLEAN_AGV,JSON.toJSONString(build));
mqttUtils.pub(PathPlanningTopicConstant.CLEAN_AGV, JSON.toJSONString(build));
RobotTaskDetailActionLogDO log = taskDetailActionLogService.getLastTaskByRobotNo(robotNo, CommandIdEnum.TASK.getType());
if (ObjectUtil.isEmpty(log) || ActionStatusEnum.DONE.getType().equals(log.getActionStatus())
|| ActionStatusEnum.CLOSE.getType().equals(log.getActionStatus())) {
@ -1179,13 +1179,13 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
String mac = getMacByRobotNo(robotNo);
robotCloseTaskDetail(actionLog.getTaskDetailId() + "", mac, actionLog.getCommandType());
if (!znConfigConstant.getIsSimulation() && ActionStatusEnum.DONE.getType().equals(actionLog.getActionStatus())) {
throw exception(TASK_CHECK_TASK_STATUS);
if (!znConfigConstant.getIsSimulation()) {
checkTaskDone(actionLog.getTaskDetailId() + "");
}
CleanAgvDTO build = CleanAgvDTO.builder().robotNo(robotNo).build();
// commonApi.commonMethod(build, PathPlanningTopicConstant.CLEAN_AGV);
mqttUtils.pub(PathPlanningTopicConstant.CLEAN_AGV,JSON.toJSONString(build));
mqttUtils.pub(PathPlanningTopicConstant.CLEAN_AGV, JSON.toJSONString(build));
Object o = checkTaskDetailExist(actionLog.getTaskDetailId());
@ -1266,7 +1266,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
log.info("任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
// commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
mqttUtils.pub( PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST,JSON.toJSONString(pathPlanningList));
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST, JSON.toJSONString(pathPlanningList));
}
private void resendToPPData(TaskToPathPlanningDTO pathPlanning, RobotTaskDetailActionLogDO actionLog, RobotInformationDO robotInformationDO, Boolean isRemote) {
@ -1294,8 +1294,8 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
* @param pathPlanning
*/
private void releaseTask(TaskToPathPlanningDTO pathPlanning) {
RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
releaseCheck(robotTaskDetail.getToLocationId(), robotTaskDetail.getRobotTaskId());
// RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
// releaseCheck(robotTaskDetail.getToLocationId(), robotTaskDetail.getRobotTaskId());
}
/**
@ -1304,13 +1304,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
* @param pathPlanning
*/
private void takeTask(TaskToPathPlanningDTO pathPlanning, Boolean isRemote) {
RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(), isRemote);
// RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
// takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(), isRemote);
}
public RobotTaskDetailDO checkTaskDone(String id) {
RobotTaskDetailDO robotTaskDetail = taskDetailMapper.selectById(id);
if (RobotTaskStageEnum.DONE.getType().equals(robotTaskDetail.getTaskStage())) {
if (RobotTaskStageEnum.DONE.getType().equals(robotTaskDetail.getTaskStage())
|| RobotTaskStageEnum.MANUALLY_COMPLETED.getType().equals(robotTaskDetail.getTaskStage()) ) {
throw exception(ROBOT_LAST_TASK_NO_EXISTS);
}
return robotTaskDetail;
@ -1324,24 +1325,39 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
private void takeReleaseTask(TaskToPathPlanningDTO pathPlanning, Boolean isRemote) {
RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
if (RobotTaskStageEnum.UN_START.getType().equals(robotTaskDetail.getTaskStage())
|| RobotTaskStageEnum.GO_TAKE.getType().equals(robotTaskDetail.getTaskStage())
|| RobotTaskStageEnum.TAKEING.getType().equals(robotTaskDetail.getTaskStage())) {
return;
}
String robotNo = pathPlanning.getRobotNoLimitationAreaDTOS().get(0).getRobotNo();
String mac = getMacByRobotNo(robotNo);
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + mac;
Object cargoDetected = redisUtil.get(cargoDetectedKey);
if (ObjectUtil.isNotEmpty(cargoDetected) && RobotStatusCodeConstant.CARGO_DETECTED.equals(Boolean.parseBoolean(String.valueOf(cargoDetected)))) {
//说明取货完成
takeDone(pathPlanning,robotTaskDetail);
} else if (!RobotTaskStageEnum.UN_START.getType().equals(robotTaskDetail.getTaskStage())
&& !RobotTaskStageEnum.GO_TAKE.getType().equals(robotTaskDetail.getTaskStage())
&& !RobotTaskStageEnum.TAKEING.getType().equals(robotTaskDetail.getTaskStage())) {
takeDone(pathPlanning,robotTaskDetail);
} else {
takeDone(pathPlanning, robotTaskDetail);
} else if (RobotTaskStageEnum.GO_RELEASE.getType().equals(robotTaskDetail.getTaskStage())
|| RobotTaskStageEnum.RELEASEING.getType().equals(robotTaskDetail.getTaskStage())) {
takeDone(pathPlanning, robotTaskDetail);
} else if (RobotTaskStageEnum.CLOSE.getType().equals(robotTaskDetail.getTaskStage())
|| RobotTaskStageEnum.EXCEPTION.getType().equals(robotTaskDetail.getTaskStage()) ) {
WareHouseLocationDO wareHouseLocation = wareHouseLocationMapper.selectById(robotTaskDetail.getFromLocationId());
if (ZeroOneEnum.ZERO.getType().equals(wareHouseLocation.getLocationUseStatus())) {
takeDone(pathPlanning, robotTaskDetail);
}
}
/*else {
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(), isRemote);
}
releaseCheck(robotTaskDetail.getToLocationId(), robotTaskDetail.getRobotTaskId());
releaseCheck(robotTaskDetail.getToLocationId(), robotTaskDetail.getRobotTaskId());*/
}
public void takeDone(TaskToPathPlanningDTO pathPlanning,RobotTaskDetailDO robotTaskDetail) {
public void takeDone(TaskToPathPlanningDTO pathPlanning, RobotTaskDetailDO robotTaskDetail) {
pathPlanning.setTakeLevel(null);
pathPlanning.setTakeGroupId(null);
pathPlanning.setTakeLocationNumber(null);
@ -1515,7 +1531,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
robotTask.setTopic(RobotTopicConstant.ROBOT_TASK_MOVE_TOPIC + mac);
robotTask.setExecutionType(ExecutionTypeEnum.CANCEL.getType());
// commonApi.commonMethod(robotTask, robotTask.getTopic());
mqttUtils.pub(robotTask.getTopic(),JSON.toJSONString(robotTask));
mqttUtils.pub(robotTask.getTopic(), JSON.toJSONString(robotTask));
}
/**
@ -1563,7 +1579,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
for (String robotNo : robotNos) {
String mac = getMacByRobotNo(robotNo);
// commonApi.commonMethod(robotSimulationPose, RobotTopicConstant.ROBOT_COMMAND_TOPIC + mac);
mqttUtils.pub(RobotTopicConstant.ROBOT_COMMAND_TOPIC + mac,JSON.toJSONString(robotSimulationPose));
mqttUtils.pub(RobotTopicConstant.ROBOT_COMMAND_TOPIC + mac, JSON.toJSONString(robotSimulationPose));
UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder()
.operateAction(str + robotNo)
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
@ -1688,7 +1704,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
CleanAgvDTO build = CleanAgvDTO.builder().robotNo(robotNo).build();
// commonApi.commonMethod(build, PathPlanningTopicConstant.CLEAN_AGV);
mqttUtils.pub(PathPlanningTopicConstant.CLEAN_AGV,JSON.toJSONString(build));
mqttUtils.pub(PathPlanningTopicConstant.CLEAN_AGV, JSON.toJSONString(build));
TaskToPathPlanningDTO pathPlanning = JSONUtil.toBean((String) o, TaskToPathPlanningDTO.class);
@ -1707,7 +1723,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
pathPlanningList.add(pathPlanning);
log.info("远遥任务转移, 任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
// commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST,JSON.toJSONString(pathPlanningList));
mqttUtils.pub(PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST, JSON.toJSONString(pathPlanningList));
}
/**