MQTT代码优化、展示车辆状态分类

This commit is contained in:
cbs 2025-05-17 09:10:14 +08:00
parent 26c26007d0
commit b82e992a31
29 changed files with 373 additions and 126 deletions

View File

@ -17,7 +17,7 @@ import java.util.List;
public interface PathPlanningApi {
String PREFIX = ApiConstants.PREFIX + "/config";
@PostMapping(PREFIX + "/synchronousPoint")
/*@PostMapping(PREFIX + "/synchronousPoint")
@Operation(summary = "同步ware_position_map_line的点位信息")
void synchronousPointToPP(@RequestBody PositionMapLinePathDTO relatedPathNode, @RequestParam("topic") String topic);
@ -28,5 +28,5 @@ public interface PathPlanningApi {
@PostMapping(PREFIX + "/synchronousLineObject")
@Operation(summary = "同步Object信息给PP")
void synchronousLineObject(@RequestBody Object obj, @RequestParam("topic") String topic);
void synchronousLineObject(@RequestBody Object obj, @RequestParam("topic") String topic);*/
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.mqtt.api.path.dto;
import lombok.Data;
@Data
public class PathToRobotArgDTO {
private Long floor;
private String areaId;
private String mapName;
private String poseId;
private PathToRobotArgPoseDTO pose2d;
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.mqtt.api.path.dto;
import lombok.Data;
@Data
public class PathToRobotArgPoseDTO {
private Double x;
private Double y;
private Double yaw;
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.mqtt.api.path.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PathToRobotDTO {
//这个实体类的信息,不能修改
//这个实体类的信息,不能修改
//这个实体类的信息,不能修改
//这个实体类的信息,不能修改
//这个实体类的信息,不能修改
//这个实体类的信息,不能修改
private String orderType;
private Integer isCommandEnd;
private String robotNo;
private String commandType;
private PathToRobotArgDTO arg;
}

View File

@ -18,7 +18,7 @@ public interface RobotTaskApi {
String PREFIX = ApiConstants.PREFIX + "/config";
@PostMapping(PREFIX + "/distribute/tasks")
/*@PostMapping(PREFIX + "/distribute/tasks")
@Operation(summary = "下发任务给车机")
void sendTaskToRobot(@Valid @RequestBody List<RobotAcceptTaskDTO> robotTaskDOS );
void sendTaskToRobot(@Valid @RequestBody List<RobotAcceptTaskDTO> robotTaskDOS );*/
}

View File

@ -55,7 +55,7 @@ public class RemoteControllerProcessor {
public void addCache(RemoteRobotTransferDTO dto) {
RemoteControllerSocketDTO remoteControllerSocketDTO = cache.get(remoteControllerIp);
log.info("缓存的数据 :{}", JSON.toJSONString(remoteControllerSocketDTO));
log.info("是否为空 :{}",ObjectUtil.isEmpty(remoteControllerSocketDTO));
if (ObjectUtil.isNotEmpty(remoteControllerSocketDTO)) {
try {
Socket socket = remoteControllerSocketDTO.getSocket();
@ -108,7 +108,7 @@ public class RemoteControllerProcessor {
String portHex = Integer.toHexString(dto.getRobotPort().intValue());
String portHexOne = portHex.substring(0, 2);
String portHexTwo = portHex.substring(2);
msg = msg + " " + portHexOne + " " + portHexTwo;
msg = msg + " " + portHexTwo + " " + portHexOne;
if (cockpitTimeOut > 0) {
msg = msg + " " + ONE + " " + Integer.toHexString(cockpitTimeOut);
} else {

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.remote.controller.admin.robot.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@ -10,6 +12,8 @@ import javax.validation.constraints.NotNull;
public class RemoteRobotChangeModeDTO {
@Schema(description = "远遥模式(0:自动模式, 1:手动模式, 2:自由模式)")
@NotNull(message = "请选择远遥模式")
@Max(value = 2,message = "请选择远遥模式")
@Min(value = 0,message = "请选择远遥模式")
private Integer remoteMode = 0;
@Schema(description = "车辆编号")

View File

@ -204,8 +204,8 @@ public class RemoteRobotServiceImpl implements RemoteRobotService {
RobotDistanceInformationDTO build =
RobotDistanceInformationDTO.builder().linearSpeed(floorZone.getLinearSpeed()).robotNo(data.getRobotNo())
.endDistance(data.getEndDistance()).nextRadian(data.getNextRadian()).message(msg).build();
processor.handleRequest(floorZone.getFloor() + "_" + floorZone.getArea(),
mac, JSONUtil.toJsonStr(build));
/*processor.handleRequest(floorZone.getFloor() + "_" + floorZone.getArea(),
mac, JSONUtil.toJsonStr(build));*/
}
/**

View File

@ -1,14 +1,20 @@
package cn.iocoder.yudao.module.remote.service.speed;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.module.system.api.remote.RemoteRobotMaxSpeedApi;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotMaxSpeedDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
@Slf4j
@Service
public class RemoteRobotMaxSpeedServiceImpl implements RemoteRobotMaxSpeedService{
@ -16,6 +22,9 @@ public class RemoteRobotMaxSpeedServiceImpl implements RemoteRobotMaxSpeedServic
@Resource
private RemoteRobotMaxSpeedApi remoteRobotMaxSpeedApi;
@Value("${remote.robot-max-speed:5}")
private int robotMaxSpeed;
@Override
public List<RemoteRobotMaxSpeedDTO> getRobotMaxSpeedPage() {
return remoteRobotMaxSpeedApi.getRobotMaxSpeedPage();
@ -23,6 +32,15 @@ public class RemoteRobotMaxSpeedServiceImpl implements RemoteRobotMaxSpeedServic
@Override
public void updateRobotMaxSpeedPage(List<RemoteRobotMaxSpeedDTO> list) {
for (RemoteRobotMaxSpeedDTO remoteRobotMaxSpeedDTO : list) {
int speed = ObjectUtil.isEmpty(remoteRobotMaxSpeedDTO.getMaxSpeed()) ? 0 : Integer.parseInt(remoteRobotMaxSpeedDTO.getMaxSpeed());
if (speed <= 0) {
throw exception(REMOTE_ROBOT_SPEED_EMPTY);
}else if (speed > robotMaxSpeed) {
String str = REMOTE_ROBOT_MAX_SPEED_LIMIT.getMsg() + " 最大限速为 " +robotMaxSpeed +" m/s";
throw exception0(REMOTE_ROBOT_MAX_SPEED_LIMIT.getCode(),str);
}
}
remoteRobotMaxSpeedApi.updateRobotMaxSpeedPage(list);
}

View File

@ -58,4 +58,5 @@ remote:
msg: AA 55 13 04 01 88 88 # 驾舱socket头信息
cockpit-time-out: 120 # 驾舱超时报警时间
industrial-control-time-out: 120 # 工控通信超时报警时间
robot-communication-time-out: 120 # 车辆通信超时报警时间
robot-communication-time-out: 120 # 车辆通信超时报警时间
robot-max-speed: 5 # 远遥控制车辆最大速度 m/s

View File

@ -59,4 +59,5 @@ remote:
cockpit-time-out: 120 # 驾舱超时报警时间
industrial-control-time-out: 120 # 工控通信超时报警时间
robot-communication-time-out: 120 # 车辆通信超时报警时间
robot-max-speed: 5 # 远遥控制车辆最大速度 m/s

View File

@ -39,4 +39,5 @@ remote:
msg: AA 55 13 04 01 88 88 # 驾舱socket头信息
cockpit-time-out: 120 # 驾舱超时报警时间
industrial-control-time-out: 120 # 工控通信超时报警时间
robot-communication-time-out: 120 # 车辆通信超时报警时间
robot-communication-time-out: 120 # 车辆通信超时报警时间
robot-max-speed: 5 # 远遥控制车辆最大速度 m/s

View File

@ -11,8 +11,5 @@ public class RobotStatusDataErrorDTO {
* 错误码
*/
public String errorCode;
/**
* 错误等级
*/
public String codeLevel;
}

View File

@ -301,6 +301,10 @@ public interface ErrorCodeConstants {
ErrorCode REMOTE_ROBOT_CONNECT_FAIL = new ErrorCode(1_002_053_017, "与远遥工控机连接失败");
ErrorCode REMOTE_TRANSFER_NOT_SAME_ROBOT = new ErrorCode(1_002_053_018, "任务转移车辆与发生异常的车辆,不能是同一台车");
ErrorCode REMOTE_ROBOT_HAVE_TASK = new ErrorCode(1_002_053_019, "此车辆有处理中的任务,不能进行任务转移。请选择其他车辆");
ErrorCode REMOTE_ROBOT_SPEED_EMPTY = new ErrorCode(1_002_053_020, "车辆速度必须大于0m/s");
ErrorCode REMOTE_ROBOT_MAX_SPEED_LIMIT = new ErrorCode(1_002_053_021, "车辆速度超过最大速度限制");
ErrorCode REMOTE_NOT_HAVE_SPEED = new ErrorCode(1_002_053_022, "查询不到车辆速度信息");
ErrorCode REMOTE_SPEED_MORE_THAN_ZERO = new ErrorCode(1_002_053_023, "车辆未停稳");
// ========== 车辆摄像头信息 1_002_054_001 ==========
ErrorCode CAMERA_NOT_EXISTS = new ErrorCode(1_002_054_001, "车辆摄像头信息不存在");

View File

@ -30,10 +30,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
@ -65,6 +63,7 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
@Override
public void robotReactiveStatus(String message) {
TenantContextHolder.setTenantId(1L);
log.info("切换地图 :{}",message);
RobotReactiveStatusDTO data = JSON.parseObject(message, RobotReactiveStatusDTO.class);
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + data.getMac();
String robotNo = robotInformationService.getRobotNoByMac(data.getMac());
@ -87,6 +86,9 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
map.put(robotNo,value);
redisUtil.hmset(value,map);
String speedKey = RobotTaskChcheConstant.ROBOT_SPEED_FORK_HEIGHT + robotNo;
redisUtil.set(speedKey, message);
// -- get 老的数据 - 看有没有 - 有的话 - 对比下 - 如果相同 - 更新hashMap中key的value
// - 如果不相同的话 - 更新当前redis数据 - 然后 - 根据老的数据 hashMapRedis 中删除 这个key的数据
// - 然后插入到 对应的区域的hashMap中
@ -110,46 +112,41 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
private void addRobotErrorMsg(RobotReactiveStatusDTO data) {
String robotNo = robotInformationService.getRobotNoByMac(data.getMac());
List<RobotStatusDataErrorDTO> errCode = data.getErrCode();
List<String> warnCodes =
errCode.stream().map(RobotStatusDataErrorDTO::getErrorCode).collect(Collectors.toList());
Set<String> warnCodes =
errCode.stream().map(RobotStatusDataErrorDTO::getErrorCode).collect(Collectors.toSet());
List<RobotWarnCodeMappingDO> robotWarnCodeMappingDOS =
warnCodeMappingMapper.selectList(new LambdaQueryWrapper<RobotWarnCodeMappingDO>()
.in(RobotWarnCodeMappingDO::getWarnCode, warnCodes));
if (ObjectUtil.isEmpty(robotWarnCodeMappingDOS)) {
log.info("查不对应编号的告警信息 :{}", JSON.toJSONString(warnCodes));
log.info("查不对应编号的告警信息 :{}", JSON.toJSONString(data));
return;
}
Map<String, List<RobotWarnCodeMappingDO>> warnCodeMapping =
robotWarnCodeMappingDOS.stream().collect(Collectors.groupingBy(RobotWarnCodeMappingDO::getWarnCode));
Map<String, RobotWarnCodeMappingDO> warnCodeMapping =
robotWarnCodeMappingDOS.stream().collect(Collectors.toMap(RobotWarnCodeMappingDO::getWarnCode, Function.identity()));
List<RobotWarnMsgDO> warnMsgDOS = new ArrayList<>();
//机器人异常等级
String errorLevelKey = RobotTaskChcheConstant.ROBOT_ERROR_LEVEL + data.getMac();
Object errorLevel = redisUtil.get(errorLevelKey);
String errorMsgKey = RobotTaskChcheConstant.ROBOT_ERROR_MSG + data.getMac();
Object errorMsg = redisUtil.get(errorMsgKey);
Integer level = ObjectUtil.isEmpty(errorLevel) ? 0 : Integer.valueOf(errorLevel.toString());
RobotTaskDetailActionLogDO lastTaskByRobotNo = taskDetailActionLogService.getLastTaskByRobotNo(robotNo);
int level = 0;
String msg = "";
int i = 0;
for (RobotStatusDataErrorDTO robotStatusData : errCode) {
List<RobotWarnCodeMappingDO> mappingDOS = warnCodeMapping.get(robotStatusData.getErrorCode());
RobotWarnCodeMappingDO mappingDOS = warnCodeMapping.get(robotStatusData.getErrorCode());
if (ObjectUtil.isEmpty(mappingDOS)) {
log.info("当前告警类型查不到对应的告警信息 :{}", robotStatusData.getErrorCode());
continue;
}
RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(Integer.valueOf(robotStatusData.getCodeLevel()))
RobotWarnMsgDO warnMsg = RobotWarnMsgDO.builder().warnLevel(mappingDOS.getWarnLevel())
.warnCode(robotStatusData.getErrorCode())
.robotNo(robotNo)
.warnType(RobotWarnType.ROBOT_WARN.getType())
.warnMsg(robotNo + "_" + mappingDOS.get(0).getWarnMsg())
.warnSolve(mappingDOS.get(0).getWarnSolve())
.warnMsg(robotNo + "_" + mappingDOS.getWarnMsg())
.warnSolve(mappingDOS.getWarnSolve())
.build();
if (ObjectUtil.isNotEmpty(lastTaskByRobotNo) && ActionStatusEnum.DOING.getType().equals(lastTaskByRobotNo.getActionStatus())) {
@ -159,20 +156,16 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
warnMsgDOS.add(warnMsg);
if (level.intValue() < Integer.valueOf(robotStatusData.getCodeLevel()).intValue()) {
level = Integer.valueOf(robotStatusData.getCodeLevel());
errorMsg = warnMsg.getWarnMsg();
}
if (i < Integer.valueOf(robotStatusData.getCodeLevel()).intValue()) {
i = Integer.valueOf(robotStatusData.getCodeLevel());
if (level < mappingDOS.getWarnLevel()) {
level = mappingDOS.getWarnLevel();
msg = warnMsg.getWarnMsg();
}
}
redisUtil.set(errorLevelKey, level);
redisUtil.set(errorMsgKey, errorMsg);
redisUtil.set(errorMsgKey, msg);
if (ObjectUtil.isNotEmpty(lastTaskByRobotNo) && ActionStatusEnum.DOING.getType().equals(lastTaskByRobotNo.getActionStatus())
&& 4 == i && ObjectUtil.isNotEmpty(lastTaskByRobotNo.getTaskDetailId())) {
&& 4 == level && ObjectUtil.isNotEmpty(lastTaskByRobotNo.getTaskDetailId())) {
taskDetailService.setTaskDetailError(lastTaskByRobotNo.getTaskDetailId());
}

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.api.robot;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
import cn.iocoder.yudao.module.system.api.robot.dto.*;
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
@ -39,12 +39,12 @@ public class RobotStatusApiImpl implements RobotStatusApi {
@Resource
private RequestProcessor processor;
@Resource
private PathPlanningApi pathPlanningApi;
@Autowired
private ThreadPoolTaskExecutor taskExecutor;
@Resource
private CommonApi commonApi;
/**
* 更新机器人点位/异常/能否做任务
*
@ -107,7 +107,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
private void sendToPP(RobotStatusDataPoseDTO robotStatusDataPoseDTO) {
taskExecutor.execute(()->{
pathPlanningApi.synchronousLineObject(robotStatusDataPoseDTO, PathPlanningTopicConstant.AGV_POSE);
commonApi.commonMethod(robotStatusDataPoseDTO, PathPlanningTopicConstant.AGV_POSE);
});
}
}

View File

@ -38,15 +38,9 @@ public class RobotTaskChcheConstant {
//机器人mac地址和机器人id以及机器人类型映射(通过mac地址获取机器人基本信息)
public static String ROBOT_GET_ROBOT_INFO = "robot:information:getRobotInfo";
//机器人正在做的任务整体信息(拼接common_id)
// public static String ROBOT_ACTION_LOG_ENTITY = "robot:action:log:entity";
//机器人取货完成(拼接robot_task_detail的id)
// public static String ROBOT_ACTION_TAKE_GOODS = "robot:take:";
//机器人放货完成(拼接robot_task_detail的id)
// public static String ROBOT_ACTION_RELEASE_GOODS = "robot:release:";
//机器人点位
public static String ROBOT_ADDRESS = "robot:information:address";
//机器人速度和货叉高度 (拼接的是车辆编号robotNo)
public static String ROBOT_SPEED_FORK_HEIGHT = "robot:speed:fork:height";
}

View File

@ -97,4 +97,10 @@ public class RobotTaskDetailSaveReqVO {
@Schema(description = "是否发生异常(0:正常、1异常)")
private Integer occurError;
@Schema(description = "是否人工干预(0:未干预、1RCS关闭、2RCS人工完成、3远遥取货完成、4远遥任务完成、5远遥取货完成和远遥任务完成)")
private Integer manualIntervention;
@Schema(description = "人工干预时间")
private LocalDateTime manualInterventionTime;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.system.controller.admin.statistics;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.controller.admin.statistics.vo.RobotStatusClassificationDTO;
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 统计")
@RestController
@RequestMapping("/system/statistics")
@Validated
public class StatisticsController {
@Resource
private RobotInformationService informationService;
@PostMapping("/robotStatusClassification")
@Operation(summary = "统计车辆状态分类")
@PreAuthorize("@ss.hasPermission('robot:information:robotStatusClassification')")
public CommonResult<RobotStatusClassificationDTO> robotStatusClassification() {
return success(informationService.robotStatusClassification());
}
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.system.controller.admin.statistics.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class RobotStatusClassificationDTO {
@Schema(description = "空闲车辆百分比")
private Integer idle ;
@Schema(description = "空闲车辆数量")
private Integer idleNum = 0;
@Schema(description = "执行任务车辆百分比")
private Integer doingTask;
@Schema(description = "执行任务车辆数量")
private Integer doingTaskNum = 0;
@Schema(description = "充电车辆百分比")
private Integer charge ;
@Schema(description = "充电车辆数量")
private Integer chargeNum = 0;
@Schema(description = "故障车辆百分比")
private Integer fault;
@Schema(description = "故障车辆数量")
private Integer faultNum = 0;
}

View File

@ -5,7 +5,6 @@ import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
import cn.iocoder.yudao.module.mqtt.api.path.dto.*;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskPathPlanningDTO;
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
@ -72,11 +71,6 @@ public class PathPlanningServiceImpl implements PathPlanningService {
@Resource
private PositionMapMapper positionMapMapper;
// public static ExecutorService executor = Executors.newFixedThreadPool(5);
@Resource
private PathPlanningApi pathPlanningApi;
@Resource
private PositionMapItemMapper positionMapItemMapper;
@ -150,7 +144,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
assembleDataToPP(relatedPathNode, positionMapLineDOS);
}
pathPlanningApi.synchronousLineObject(new PositionMapLineDTO(), PathPlanningTopicConstant.SYNCHRONOUS_ALL_MAP_LINE_END);
commonApi.commonMethod(new PositionMapLineDTO(), PathPlanningTopicConstant.SYNCHRONOUS_ALL_MAP_LINE_END);
}
/**
@ -181,7 +175,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
relatedPathNode.setControl_nodes(positionMapItemSynDTOS);
log.info("synchronousAllItem----doing");
pathPlanningApi.synchronousLineObject(relatedPathNode, PathPlanningTopicConstant.SYNCHRONOUS_ALL_MAP_NODE);
commonApi.commonMethod(relatedPathNode, PathPlanningTopicConstant.SYNCHRONOUS_ALL_MAP_NODE);
}
log.info("synchronousAllItem----end");
@ -230,7 +224,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
relatedPathNode.setArea(positionMapDO.getArea());
relatedPathNode.setControl_nodes(list);
pathPlanningApi.synchronousLineObject(relatedPathNode, PathPlanningTopicConstant.ADD_MAP_LINE);
commonApi.commonMethod(relatedPathNode, PathPlanningTopicConstant.ADD_MAP_LINE);
}
/**
@ -260,7 +254,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
ids.add(data.getId());
relatedPathNode.setIds(ids);
pathPlanningApi.synchronousLineObject(relatedPathNode, PathPlanningTopicConstant.DELETE_MAP_LINE);
commonApi.commonMethod(relatedPathNode, PathPlanningTopicConstant.DELETE_MAP_LINE);
}
@ -308,7 +302,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
relatedPathNode.setType(PathTypeEnum.UPDATE.getType());
relatedPathNode.setControl_nodes(list);
pathPlanningApi.synchronousLineObject(relatedPathNode, PathPlanningTopicConstant.UPDATE_MAP_LINE);
commonApi.commonMethod(relatedPathNode, PathPlanningTopicConstant.UPDATE_MAP_LINE);
}
/**
@ -350,7 +344,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
PositionMapItemPathDTO.setType(PathTypeEnum.ADD.getType());
PositionMapItemPathDTO.setControl_nodes(Arrays.asList(build));
pathPlanningApi.synchronousLineObject(PositionMapItemPathDTO, PathPlanningTopicConstant.ADD_MAP_NODE);
commonApi.commonMethod(PositionMapItemPathDTO, PathPlanningTopicConstant.ADD_MAP_NODE);
}
/**
@ -384,7 +378,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
PositionMapItemPathDTO.setType(PathTypeEnum.DELETE.getType());
PositionMapItemPathDTO.setIds(Arrays.asList(data.getId()));
pathPlanningApi.synchronousLineObject(PositionMapItemPathDTO, PathPlanningTopicConstant.DELETE_MAP_NODE);
commonApi.commonMethod(PositionMapItemPathDTO, PathPlanningTopicConstant.DELETE_MAP_NODE);
}
@Override
@ -421,13 +415,13 @@ public class PathPlanningServiceImpl implements PathPlanningService {
PositionMapItemPathDTO.setType(PathTypeEnum.UPDATE.getType());
PositionMapItemPathDTO.setControl_nodes(Arrays.asList(build));
pathPlanningApi.synchronousLineObject(PositionMapItemPathDTO, PathPlanningTopicConstant.UPDATE_MAP_NODE);
commonApi.commonMethod(PositionMapItemPathDTO, PathPlanningTopicConstant.UPDATE_MAP_NODE);
}
@Override
public void robotDimensions() {
List<RobotDimensionsDTO> list = informationMapper.selectRobotDimensions();
pathPlanningApi.synchronousLineObject(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
commonApi.commonMethod(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
}
/**
@ -437,12 +431,16 @@ public class PathPlanningServiceImpl implements PathPlanningService {
*/
@Override
public void sendPosedsToRobot(String message) {
PathPosedsDTO pathPosedsDTO = JSON.parseObject(message, PathPosedsDTO.class);
String mac = robotInformationService.getMacByRobotNo(pathPosedsDTO.getRobotNo());
PathToRobotDTO pathRobotDTO = JSON.parseObject(message, PathToRobotDTO.class);
String mac = robotInformationService.getMacByRobotNo(pathRobotDTO.getRobotNo());
String topic = RobotTopicConstant.ROBOT_TASK_MOVE_TOPIC + mac;
commonApi.commonMethodStr(message, topic);
if(RobotCommandTypeEnum.SWITCH_MAP.getType().equals(pathPosedsDTO.getCommandType())) {
controllerInformationService.robotChangeSpeed(pathPosedsDTO);
if(RobotCommandTypeEnum.SWITCH_MAP.getType().equals(pathRobotDTO.getCommandType())) {
String mapFileName = positionMapService.getMapFileNameByFloorAndAreaName(pathRobotDTO.getArg().getFloor(),pathRobotDTO.getArg().getAreaId());
pathRobotDTO.getArg().setMapName(mapFileName);
controllerInformationService.robotChangeSpeed(pathRobotDTO);
commonApi.commonMethodStr(JSON.toJSONString(pathRobotDTO), topic);
}else {
commonApi.commonMethodStr(message, topic);
}
}
@ -632,7 +630,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
relatedPathNode.setControl_nodes(list);
pathPlanningApi.synchronousPointToPP(relatedPathNode, PathPlanningTopicConstant.SYNCHRONOUS_ALL_MAP_LINE);
commonApi.commonMethod(relatedPathNode, PathPlanningTopicConstant.SYNCHRONOUS_ALL_MAP_LINE);
}

View File

@ -117,4 +117,12 @@ public interface PositionMapService extends IService<PositionMapDO> {
* @return
*/
List<RemoteRobotDTO> getRemoteAreaRobotByMapId(Long mapId);
/**
* 获取地图的文件名
* @param floor
* @param areaId
* @return
*/
String getMapFileNameByFloorAndAreaName(Long floor, String areaId);
}

View File

@ -478,6 +478,32 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
remoteMap);
}
/**
* 获取地图的文件名
* @param floor
* @param area
* @return
*/
@Override
public String getMapFileNameByFloorAndAreaName(Long floor, String area) {
PositionMapDO positionMapDO = positionMapMapper.selectOne(new LambdaQueryWrapperX<PositionMapDO>()
.eq(PositionMapDO::getFloor, floor)
.eq(PositionMapDO::getArea, area)
.last("limit 1"));
if (ObjectUtil.isEmpty(positionMapDO)) {
return null;
}
String pngUrl = positionMapDO.getPngUrl();
int startOne = pngUrl.lastIndexOf("\\");
int startTwo = pngUrl.lastIndexOf("/");
if (ObjectUtil.isNotEmpty(startTwo)) {
startTwo = startTwo + 1;
}
int start = Math.max(startOne, startTwo);
int end = pngUrl.lastIndexOf(".");
return pngUrl.substring(start, end);
}
private List<RemoteRobotDTO> getRemoteSingleMapInfomation(Map<String, RobotInformationDO> robotMap, List<String> robotNos,
Map<String, RobotDoingTaskDTO> robotDoingTaskMap,
Map<String, RemoteControllerInformationDO> remoteMap) {

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.service.remote;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mqtt.api.path.dto.PathPosedsDTO;
import cn.iocoder.yudao.module.mqtt.api.path.dto.PathToRobotDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotStatusDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotTransferDTO;
@ -14,7 +14,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.remote.RemoteControllerInfo
import cn.iocoder.yudao.module.system.mq.message.RemoteSendMessage;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 远遥设备信息 Service 接口
@ -116,7 +115,7 @@ public interface RemoteControllerInformationService extends IService<RemoteContr
* 车辆换图修改限速
* @param pathPosedsDTO
*/
void robotChangeSpeed(PathPosedsDTO pathPosedsDTO);
void robotChangeSpeed(PathToRobotDTO pathRobotDTO);
/**
* 断开连接

View File

@ -4,14 +4,18 @@ import cn.hutool.core.util.ObjectUtil;
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.path.dto.PathPosedsDTO;
import cn.iocoder.yudao.module.mqtt.api.path.dto.PathToRobotDTO;
import cn.iocoder.yudao.module.mqtt.api.path.dto.remote.RemotePathPlanningDTO;
import cn.iocoder.yudao.module.mqtt.api.path.dto.remote.RobotModeDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotStatusDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteRobotTransferDTO;
import cn.iocoder.yudao.module.system.api.remote.dto.RemoteTaskTransferDTO;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataSpeedDTO;
import cn.iocoder.yudao.module.system.api.robot.vo.RobotReactiveStatusDTO;
import cn.iocoder.yudao.module.system.constant.path.PathPlanningChcheConstant;
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.remote.vo.ControllerTaskTransferLogSaveReqVO;
@ -60,6 +64,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.*;
@ -359,12 +364,12 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
/**
* 车辆换图修改限速
*
* @param pathPosedsDTO
* @param pathRobotDTO
*/
@Override
public void robotChangeSpeed(PathPosedsDTO pathPosedsDTO) {
public void robotChangeSpeed(PathToRobotDTO pathRobotDTO) {
RemoteControllerInformationDO information = controllerInformationMapper.selectOne(new LambdaQueryWrapper<RemoteControllerInformationDO>()
.eq(RemoteControllerInformationDO::getRobotNo, pathPosedsDTO.getRobotNo())
.eq(RemoteControllerInformationDO::getRobotNo, pathRobotDTO.getRobotNo())
.last("limit 1"));
if (ObjectUtil.isEmpty(information)) {
return;
@ -590,6 +595,7 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
try {
Socket socket = new Socket();
socket.connect(new InetSocketAddress(remoteControllerIp, remoteControllerPort), 1000);
socket.close();
} catch (IOException e) {
throw exception(REMOTE_ROBOT_CONNECT_FAIL);
}
@ -733,6 +739,24 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
if (ObjectUtil.isEmpty(o) || !Boolean.parseBoolean(String.valueOf(o))) {
throw exception(REMOTE_NOT_HAVE_PATH_MATCH);
}
String speedKey = RobotTaskChcheConstant.ROBOT_SPEED_FORK_HEIGHT + robotNo;
Object speedObject = redisUtil.get(speedKey);
if (ObjectUtil.isEmpty(speedObject)) {
throw exception(REMOTE_NOT_HAVE_SPEED);
}
RobotReactiveStatusDTO data = JSON.parseObject(speedObject.toString(), RobotReactiveStatusDTO.class);
String linearSpeed = Optional.ofNullable(data).map(RobotReactiveStatusDTO::getAgvSpeed).map(RobotStatusDataSpeedDTO::getLinearSpeed).orElse(null);
String angleSpeed = Optional.ofNullable(data).map(RobotReactiveStatusDTO::getAgvSpeed).map(RobotStatusDataSpeedDTO::getAngleSpeed).orElse(null);
if (ObjectUtil.isEmpty(linearSpeed) || ObjectUtil.isEmpty(angleSpeed)) {
throw exception(REMOTE_NOT_HAVE_SPEED);
}
BigDecimal zeroSpeed = new BigDecimal("0");
BigDecimal linearSpeedBigDecimal = new BigDecimal(linearSpeed);
BigDecimal angleSpeedBigDecimal = new BigDecimal(angleSpeed);
if (zeroSpeed.compareTo(linearSpeedBigDecimal) < 0 || zeroSpeed.compareTo(angleSpeedBigDecimal) < 0 ){
throw exception(REMOTE_SPEED_MORE_THAN_ZERO);
}
}
/**
@ -744,7 +768,7 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
robotModeDTO.setOperationMode(operationMode);
if (RemoteOperationModeEnum.MAN.getType().equals(operationMode)) {
String maxSpeed = robotMaxSpeedService.getRobotMaxSpeedByRobotNo(robotNo);
double v = ObjectUtil.isNotEmpty(maxSpeed) ? Double.valueOf(maxSpeed) : 0.0;
double v = ObjectUtil.isNotEmpty(maxSpeed) ? Double.parseDouble(maxSpeed) : 0.0;
robotModeDTO.setMaxSpeed(v);
}
String mac = informationService.getMacByRobotNo(robotNo);

View File

@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDTO;
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.statistics.vo.RobotStatusClassificationDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
@ -241,4 +242,11 @@ public interface RobotInformationService extends IService<RobotInformationDO> {
* @param updateObj
*/
void checkIpAndPort(RobotInformationDO updateObj);
/**
* 统计车辆状态分类
* @return
*/
RobotStatusClassificationDTO robotStatusClassification();
}

View File

@ -11,7 +11,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
import cn.iocoder.yudao.module.mqtt.api.path.dto.RobotDimensionsDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskRobotNoLimittationAreaDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
@ -33,6 +32,7 @@ import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.robot.camera.RobotCameraAddVO;
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.statistics.vo.RobotStatusClassificationDTO;
import cn.iocoder.yudao.module.system.controller.admin.tool.dto.CleanAgvDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
@ -77,6 +77,7 @@ import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
@ -87,6 +88,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -153,9 +155,6 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
@Autowired
private WareHouseLocationMapper wareHouseLocationMapper;
@Resource
private PathPlanningApi pathPlanningApi;
@Resource
private RedissonUtils redissonUtils;
@ -240,7 +239,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
userOperationLogService.createUserOperationLog(operationLog);
List<RobotDimensionsDTO> list = informationMapper.selectRobotDimensions();
pathPlanningApi.synchronousLineObject(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
commonApi.commonMethod(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
redisUtil.del(key);
// 返回
@ -263,8 +262,65 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
}
}
/**
* 车辆状态分类统计
*
* @return
*/
@Override
public RobotStatusClassificationDTO robotStatusClassification() {
List<RobotInformationDO> robotInformationDOS = informationMapper.selectList();
if (ObjectUtil.isEmpty(robotInformationDOS)) {
return null;
}
int idleNum = 0;
int doingTaskNum = 0;
int chargeNum = 0;
int faultNum = 0;
int total = robotInformationDOS.size();
for (RobotInformationDO robotInformation : robotInformationDOS) {
String errorLevelKey = RobotTaskChcheConstant.ROBOT_ERROR_LEVEL + robotInformation.getMacAddress();
Object errorLevel = redisUtil.get(errorLevelKey);
if (ObjectUtil.isNotEmpty(errorLevel)) {
int level = Integer.parseInt(errorLevel.toString());
if (level > 3) {
faultNum = faultNum + 1;
continue;
}
}
if (RobotStatusEnum.STAND_BY.getType().equals(robotInformation.getRobotStatus())) {
idleNum = idleNum + 1;
} else if (RobotStatusEnum.DOING.getType().equals(robotInformation.getRobotStatus())) {
doingTaskNum = doingTaskNum + 1;
} else if (RobotStatusEnum.CHARGE.getType().equals(robotInformation.getRobotStatus())) {
chargeNum = chargeNum + 1;
}
}
int idle = idleNum * 100 / total;
int doingTask = doingTaskNum * 100 / total;
int charge = chargeNum * 100 / total;
int fault = faultNum * 100 / total;
return RobotStatusClassificationDTO.builder()
.idle(idle)
.idleNum(idleNum)
.doingTask(doingTask)
.doingTaskNum(doingTaskNum)
.charge(charge)
.chargeNum(chargeNum)
.fault(fault)
.faultNum(faultNum).build();
}
/**
* 校验IP地址是否合法
*
* @param ipAddress IP地址字符串
* @return 是否合法
*/
@ -393,7 +449,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
userOperationLogService.createUserOperationLog(operationLog);
List<RobotDimensionsDTO> RobotDimensions = informationMapper.selectRobotDimensions();
pathPlanningApi.synchronousLineObject(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
commonApi.commonMethod(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
}
@Override
@ -425,7 +481,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
releaseRobotStop(robotInformationDO);
List<RobotDimensionsDTO> RobotDimensions = informationMapper.selectRobotDimensions();
pathPlanningApi.synchronousLineObject(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
commonApi.commonMethod(RobotDimensions, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
redisUtil.del(key);
//地图相关
@ -494,7 +550,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
String soc = getSocByMac(robotInformationDO.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isNotEmpty(soc)) {
bean.setElectricity(soc);
bean.setElectricity(soc);
}
bean.setFloor(floorZoneDTO.getFloor());
bean.setArea(floorZoneDTO.getArea());
@ -701,9 +757,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
}
/**
*
* @param str
* type 1:是mac 0 :是车辆编号
* @param str type 1:是mac 0 :是车辆编号
* @param type
* @return
*/
@ -712,9 +766,9 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
if (ZeroOneEnum.ZERO.getType().equals(type)) {
str = getMacByRobotNo(str);
}
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +str;
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC + str;
Object o = redisUtil.get(socKey);
if (ObjectUtil.isEmpty(o)){
if (ObjectUtil.isEmpty(o)) {
return null;
}
return o.toString();
@ -1086,13 +1140,13 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
pathPlanning.setRobotNoLimitationAreaDTOS(robotNoLimitions);
if (!isSimulation || !restoreTaskRestart) {
resendToPPData(pathPlanning, actionLog, robotInformationDO,false);
resendToPPData(pathPlanning, actionLog, robotInformationDO, false);
}
List<TaskToPathPlanningDTO> pathPlanningList = new ArrayList<>();
pathPlanningList.add(pathPlanning);
log.info("任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
pathPlanningApi.synchronousLineObject(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
}
private void resendToPPData(TaskToPathPlanningDTO pathPlanning, RobotTaskDetailActionLogDO actionLog, RobotInformationDO robotInformationDO, Boolean isRemote) {
@ -1103,9 +1157,9 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|| PathTaskTypeEnum.AUTO_CHARGE.getType().equals(actionLog.getCommandType())) {
chargeTask(pathPlanning, robotInformationDO);
} else if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(actionLog.getCommandType())) {
takeReleaseTask(pathPlanning,isRemote);
takeReleaseTask(pathPlanning, isRemote);
} else if (PathTaskTypeEnum.TAKE.getType().equals(actionLog.getCommandType())) {
takeTask(pathPlanning,isRemote);
takeTask(pathPlanning, isRemote);
} else if (PathTaskTypeEnum.RELEASE.getType().equals(actionLog.getCommandType())) {
releaseTask(pathPlanning);
} else if (PathTaskTypeEnum.MOVE.getType().equals(actionLog.getCommandType())) {
@ -1130,7 +1184,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
*/
private void takeTask(TaskToPathPlanningDTO pathPlanning, Boolean isRemote) {
RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(),isRemote);
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(), isRemote);
}
public RobotTaskDetailDO checkTaskDone(String id) {
@ -1160,7 +1214,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
pathPlanning.setTakeOffsetHeight(null);
pathPlanning.setTaskType(PathTaskTypeToRobotEnum.DROP_OFF_GOODS.getType());
} else {
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(),isRemote);
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(), isRemote);
}
releaseCheck(robotTaskDetail.getToLocationId(), robotTaskDetail.getRobotTaskId());
}
@ -1410,7 +1464,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
}
}
return checkElectricity(chargeConfig, robotInformation,soc);
return checkElectricity(chargeConfig, robotInformation, soc);
}
@Override
@ -1489,16 +1543,17 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
List<TaskRobotNoLimittationAreaDTO> robotNoLimitions = Arrays.asList(taskRobotNoLimittationAreaDTO);
pathPlanning.setRobotNoLimitationAreaDTOS(robotNoLimitions);
resendToPPData(pathPlanning, actionLog, robotInformationDO,true);
resendToPPData(pathPlanning, actionLog, robotInformationDO, true);
List<TaskToPathPlanningDTO> pathPlanningList = new ArrayList<>();
pathPlanningList.add(pathPlanning);
log.info("远遥任务转移, 任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
pathPlanningApi.synchronousLineObject(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
}
/**
* 设置车辆空闲
*
* @param robotNo
*/
@Override

View File

@ -54,26 +54,12 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
@Resource
private RobotTaskAutoMoveMapper taskAutoMoveMapper;
@Autowired
private RobotInformationMapper robotInformationMapper;
@Autowired
private RobotTaskMapper robotTaskMapper;
@Autowired
private RobotTaskDetailMapper robotTaskDetailMapper;
@Resource
private RobotTaskApi robotTaskApi;
@Resource
private PositionMapItemMapper positionMapItemMapper;
@Resource
private WareHouseLocationMapper locationMapper;
@Autowired
private DistributeTasksService distributeTasksService;
@Value("${zn.lane_auto_move:true}")
private Boolean laneAutoMove;

View File

@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskLimitationAreaDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskRobotNoLimittationAreaDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
@ -81,9 +81,6 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
@Resource
private PositionMapMapper positionMapMapper;
@Resource
private PathPlanningApi pathPlanningApi;
@Value("${zn.robot_chearg.release_location_number_config:50}")
private Long releaseLocationNumberConfig;
@ -102,6 +99,9 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
@Autowired
private RobotTaskMapper robotTaskMapper;
@Resource
private CommonApi commonApi;
/**
* 下发任务给PP
*/
@ -309,7 +309,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
}
log.info("派车去停车点--任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
pathPlanningApi.synchronousLineObject(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
}
@Override
@ -369,7 +369,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
}
log.info("充电任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
pathPlanningApi.synchronousLineObject(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
}
@Transactional(rollbackFor = Exception.class)
@ -503,7 +503,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
if (ObjectUtil.isNotEmpty(pathPlanningList)) {
log.info("作业任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
pathPlanningApi.synchronousLineObject(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
}
}