任务联调
This commit is contained in:
parent
fde40418c2
commit
7e37f213b5
@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PathPosedsDataArgPosedDTO {
|
public class PathPosedsDataArgPosedDTO {
|
||||||
@Schema(description = "唯一key,导航下发给RCS应用", example = "20863")
|
@Schema(description = "唯一key,导航下发给RCS应用", example = "20863")
|
||||||
private Integer poseId;
|
private String poseId;
|
||||||
|
|
||||||
private Double x;
|
private Double x;
|
||||||
|
|
||||||
|
@ -71,9 +71,6 @@ public class PathApiImpl implements PathApi {
|
|||||||
taskExecutor.execute(() -> {
|
taskExecutor.execute(() -> {
|
||||||
TenantContextHolder.setTenantId(1L);
|
TenantContextHolder.setTenantId(1L);
|
||||||
taskService.assignTasks(message);
|
taskService.assignTasks(message);
|
||||||
if (ObjectUtil.isEmpty(message)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// taskService.ppDistributionTask(message); 废弃了
|
// taskService.ppDistributionTask(message); 废弃了
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,6 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
|
|||||||
@Resource
|
@Resource
|
||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@Value("${zn.robot_position_cache_time:600}")
|
|
||||||
private Long robotPositionCacheTime;
|
|
||||||
|
|
||||||
@Value("${zn.robot_error_level_time:30}")
|
@Value("${zn.robot_error_level_time:30}")
|
||||||
private Long robotErrorLevelTime;
|
private Long robotErrorLevelTime;
|
||||||
|
|
||||||
@ -59,15 +56,8 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
|
|||||||
public void robotReactiveStatus(String message) {
|
public void robotReactiveStatus(String message) {
|
||||||
TenantContextHolder.setTenantId(1L);
|
TenantContextHolder.setTenantId(1L);
|
||||||
RobotReactiveStatusDTO data = JSON.parseObject(message, RobotReactiveStatusDTO.class);
|
RobotReactiveStatusDTO data = JSON.parseObject(message, RobotReactiveStatusDTO.class);
|
||||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + data.getMac();
|
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + data.getMac();
|
||||||
Object object = redisUtil.get(pose2dKey);
|
redisUtil.set(floorAreaKey, JSON.toJSONString(data.getFloorZone()));
|
||||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(data.getFloorZone())) {
|
|
||||||
robotStatusDataPoseDTO.setFloor(data.getFloorZone().getFloor());
|
|
||||||
robotStatusDataPoseDTO.setArea(data.getFloorZone().getArea());
|
|
||||||
}
|
|
||||||
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
|
||||||
|
|
||||||
//机器人异常等级
|
//机器人异常等级
|
||||||
if (ObjectUtil.isEmpty(data.getErrCode())) {
|
if (ObjectUtil.isEmpty(data.getErrCode())) {
|
||||||
|
@ -4,10 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
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.path.PathPlanningApi;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotPoseStatusDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.*;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataErrorDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
||||||
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
|
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
|
||||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
||||||
@ -80,6 +77,9 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
log.info("机器人上报的信息不全 :{}", JSON.toJSONString(robotStatusDataDTO));
|
log.info("机器人上报的信息不全 :{}", JSON.toJSONString(robotStatusDataDTO));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + robotStatusDataDTO.getMac();
|
||||||
|
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
||||||
|
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
||||||
String robotNo = robotInformationService.getRobotNoByMac(robotStatusDataDTO.getMac());
|
String robotNo = robotInformationService.getRobotNoByMac(robotStatusDataDTO.getMac());
|
||||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac();
|
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac();
|
||||||
Object object = redisUtil.get(pose2dKey);
|
Object object = redisUtil.get(pose2dKey);
|
||||||
@ -91,6 +91,8 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getPose2d().getYaw());
|
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getPose2d().getYaw());
|
||||||
}
|
}
|
||||||
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
||||||
|
robotStatusDataPoseDTO.setFloor(floorZoneDTO.getFloor());
|
||||||
|
robotStatusDataPoseDTO.setArea(floorZoneDTO.getArea());
|
||||||
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
||||||
|
|
||||||
//机器人身上是否有货
|
//机器人身上是否有货
|
||||||
@ -106,8 +108,9 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
robotInformationVO = robotInformationService.getRobotByRedis(robotStatusDataDTO.getMac());
|
robotInformationVO = robotInformationService.getRobotByRedis(robotStatusDataDTO.getMac());
|
||||||
}
|
}
|
||||||
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
|
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
|
||||||
|
|
||||||
// 合并请求 - 这里接受到的数据都丢给 RequestProcessor - 再整合数据通过WebSocket丢给前端
|
// 合并请求 - 这里接受到的数据都丢给 RequestProcessor - 再整合数据通过WebSocket丢给前端
|
||||||
processor.handleRequest(robotStatusDataPoseDTO.getFloor() + "_" + robotStatusDataPoseDTO.getArea(),
|
processor.handleRequest(floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea(),
|
||||||
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotInformationVO));
|
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotInformationVO));
|
||||||
sendToPP(robotStatusDataPoseDTO);
|
sendToPP(robotStatusDataPoseDTO);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
|||||||
import cn.iocoder.yudao.module.system.enums.path.PathIsReachEnum;
|
import cn.iocoder.yudao.module.system.enums.path.PathIsReachEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.path.PathTaskTypeEnum;
|
import cn.iocoder.yudao.module.system.enums.path.PathTaskTypeEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.robot.actionlog.ActionStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.charge.ChargeTaskStatusEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.charge.ChargeTaskStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotStatusCodeEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.task.RobotStatusCodeEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotTaskStageEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.task.RobotTaskStageEnum;
|
||||||
@ -48,8 +49,6 @@ import javax.annotation.Resource;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@Validated
|
@Validated
|
||||||
@ -89,9 +88,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
@Resource
|
@Resource
|
||||||
private CommonApi commonApi;
|
private CommonApi commonApi;
|
||||||
|
|
||||||
@Resource
|
|
||||||
public WebSocketSenderApi webSocketSenderApi;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RobotTaskDetailService taskDetailService;
|
private RobotTaskDetailService taskDetailService;
|
||||||
|
|
||||||
@ -101,18 +97,12 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
@Resource
|
@Resource
|
||||||
private RobotWarnMsgService warnMsgService;
|
private RobotWarnMsgService warnMsgService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DeviceInformationMapper deviceInformationMapper;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MoveToWaitService moveToWaitService;
|
private MoveToWaitService moveToWaitService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PathPlanningService pathPlanningService;
|
private PathPlanningService pathPlanningService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RobotTaskService taskService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DeviceInformationService deviceInformationService;
|
private DeviceInformationService deviceInformationService;
|
||||||
|
|
||||||
@ -175,6 +165,8 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
|
|
||||||
sendStartDoActionToPP(robotCompleteTaskDTO.getCommandStatus(), robotCompleteTaskDTO.getMac(),
|
sendStartDoActionToPP(robotCompleteTaskDTO.getCommandStatus(), robotCompleteTaskDTO.getMac(),
|
||||||
String.valueOf(robotCompleteTaskDTO.getOrderId()));
|
String.valueOf(robotCompleteTaskDTO.getOrderId()));
|
||||||
|
|
||||||
|
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,6 +217,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
.build();
|
.build();
|
||||||
chargeLogMapper.updateById(build);
|
chargeLogMapper.updateById(build);
|
||||||
}
|
}
|
||||||
|
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -344,6 +337,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
RobotTaskDetailDO detailDO = new RobotTaskDetailDO();
|
RobotTaskDetailDO detailDO = new RobotTaskDetailDO();
|
||||||
detailDO.setId(robotCompleteTaskDTO.getOrderId());
|
detailDO.setId(robotCompleteTaskDTO.getOrderId());
|
||||||
detailDO.setEndTime(LocalDateTime.now());
|
detailDO.setEndTime(LocalDateTime.now());
|
||||||
|
detailDO.setTaskStage(RobotTaskStageEnum.DONE.getType());
|
||||||
detailDO.setTaskStatus(RobotTaskDetailStatusEnum.DONE.getType());
|
detailDO.setTaskStatus(RobotTaskDetailStatusEnum.DONE.getType());
|
||||||
robotTaskDetailMapper.updateRobotDetailById(detailDO);
|
robotTaskDetailMapper.updateRobotDetailById(detailDO);
|
||||||
//更新任务状态
|
//更新任务状态
|
||||||
|
@ -11,6 +11,9 @@ public class RobotTaskChcheConstant {
|
|||||||
//机器人点位和电量 (拼接的是mac地址)
|
//机器人点位和电量 (拼接的是mac地址)
|
||||||
public static String ROBOT_INFORMATION_POSE_BAT_SOC = "robot:information:pose:bat:soc";
|
public static String ROBOT_INFORMATION_POSE_BAT_SOC = "robot:information:pose:bat:soc";
|
||||||
|
|
||||||
|
//机器人楼层和区域 (拼接的是mac地址)
|
||||||
|
public static String ROBOT_FLOOR_AREA = "robot:floor:area";
|
||||||
|
|
||||||
//机器人mac地址和机器人编号映射(通过mac地址。查询机器人编号) (拼接的是mac地址)
|
//机器人mac地址和机器人编号映射(通过mac地址。查询机器人编号) (拼接的是mac地址)
|
||||||
public static String ROBOT_GET_ROBOTNO_BY_MAC = "robot:information:getRobotNo:ByMac";
|
public static String ROBOT_GET_ROBOTNO_BY_MAC = "robot:information:getRobotNo:ByMac";
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ public class RobotTopicConstant {
|
|||||||
/**
|
/**
|
||||||
* 下发让车子移动
|
* 下发让车子移动
|
||||||
*/
|
*/
|
||||||
public static String ROBOT_TASK_MOVE_TOPIC = "ROBOT_TASK_MOVE";
|
public static String ROBOT_TASK_MOVE_TOPIC = "ROBOT_TASK_MOVE_";
|
||||||
/**
|
/**
|
||||||
*RCS发送心跳给车机
|
*RCS发送心跳给车机
|
||||||
*/
|
*/
|
||||||
@ -19,5 +19,5 @@ public class RobotTopicConstant {
|
|||||||
/**
|
/**
|
||||||
* 让机器人同步告警码值映射的topic (拼接mac地址)
|
* 让机器人同步告警码值映射的topic (拼接mac地址)
|
||||||
*/
|
*/
|
||||||
public static String UPDATE_ERROR_TOPIC = "UPDATE_ERROR";
|
public static String UPDATE_ERROR_TOPIC = "UPDATE_ERROR_";
|
||||||
}
|
}
|
||||||
|
@ -86,4 +86,7 @@ public class DeviceInformationPageReqVO extends PageParam {
|
|||||||
@Schema(description = "端口")
|
@Schema(description = "端口")
|
||||||
private String devicePort;
|
private String devicePort;
|
||||||
|
|
||||||
|
@Schema(description = "最后使用者")
|
||||||
|
private String lastUser;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -116,4 +116,8 @@ public class DeviceInformationRespVO {
|
|||||||
@ExcelProperty("端口")
|
@ExcelProperty("端口")
|
||||||
private String devicePort;
|
private String devicePort;
|
||||||
|
|
||||||
|
@Schema(description = "最后使用者")
|
||||||
|
@ExcelProperty("最后使用者")
|
||||||
|
private String lastUser;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,4 +82,7 @@ public class DeviceInformationSaveReqVO {
|
|||||||
@Schema(description = "端口")
|
@Schema(description = "端口")
|
||||||
private String devicePort;
|
private String devicePort;
|
||||||
|
|
||||||
|
@Schema(description = "最后使用者")
|
||||||
|
private String lastUser;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.robot.task;
|
package cn.iocoder.yudao.module.system.controller.admin.robot.task;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.enums.path.PathTaskTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@ -22,4 +23,29 @@ public class TaskAssignDTO {
|
|||||||
|
|
||||||
@Schema(description = "AGV编号")
|
@Schema(description = "AGV编号")
|
||||||
private String robotNo;
|
private String robotNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取机器人要做的任务描述
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRobotActionMsg() {
|
||||||
|
if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(orderType)) {
|
||||||
|
return "机器人分配到取放货任务";
|
||||||
|
}if (PathTaskTypeEnum.CHARGE.getType().equals(orderType)) {
|
||||||
|
return "机器人分配到充电任务";
|
||||||
|
}if (PathTaskTypeEnum.MOVE.getType().equals(orderType)) {
|
||||||
|
return "机器人分配到移动任务";
|
||||||
|
}if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(orderType)) {
|
||||||
|
return "机器人分配移动到等待点的任务";
|
||||||
|
}if (PathTaskTypeEnum.MOVE_TO_WAIT_STOP.getType().equals(orderType)) {
|
||||||
|
return "机器人分配停车任务";
|
||||||
|
}if (PathTaskTypeEnum.TAKE.getType().equals(orderType)) {
|
||||||
|
return "机器人分配到仅取货任务";
|
||||||
|
}if (PathTaskTypeEnum.RELEASE.getType().equals(orderType)) {
|
||||||
|
return "机器人分配到仅放货任务";
|
||||||
|
}if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(orderType)) {
|
||||||
|
return "机器人分配到自动充电任务";
|
||||||
|
}
|
||||||
|
return "未知任务";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,4 +130,9 @@ public class DeviceInformationDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String devicePort;
|
private String devicePort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最后使用者
|
||||||
|
*/
|
||||||
|
private String lastUser;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|||||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆动作记录 Mapper
|
* 车辆动作记录 Mapper
|
||||||
@ -27,4 +28,11 @@ public interface RobotTaskDetailActionLogMapper extends BaseMapperX<RobotTaskDet
|
|||||||
.orderByDesc(RobotTaskDetailActionLogDO::getId));
|
.orderByDesc(RobotTaskDetailActionLogDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新任务状态
|
||||||
|
* @param taskDetailId
|
||||||
|
* @param actionStatus
|
||||||
|
*/
|
||||||
|
void updateActionStatus(@Param("taskDetailId") Long taskDetailId,
|
||||||
|
@Param("actionStatus") int actionStatus);
|
||||||
}
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.enums.robot.actionlog;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum ActionStatusEnum {
|
||||||
|
|
||||||
|
UN_DO(0,"未开始"),
|
||||||
|
DOING(1,"正在进行"),
|
||||||
|
DONE(2,"完成");
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final Integer type;
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
private final String msg;
|
||||||
|
}
|
@ -24,6 +24,7 @@ import cn.iocoder.yudao.module.system.enums.device.DeviceTypeEnum;
|
|||||||
import cn.iocoder.yudao.module.system.enums.device.PictureConfigEnum;
|
import cn.iocoder.yudao.module.system.enums.device.PictureConfigEnum;
|
||||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.robot.RobotWarnMsgService;
|
||||||
import cn.iocoder.yudao.module.system.util.modbus3.ModbusUtils;
|
import cn.iocoder.yudao.module.system.util.modbus3.ModbusUtils;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@ -74,6 +75,9 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
|||||||
@Resource
|
@Resource
|
||||||
private UserOperationLogService userOperationLogService;
|
private UserOperationLogService userOperationLogService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotWarnMsgService warnMsgService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createInformation(DeviceInformationSaveReqVO createReqVO) {
|
public Long createInformation(DeviceInformationSaveReqVO createReqVO) {
|
||||||
// -- 先判断库里是否有相通的mac地址数据
|
// -- 先判断库里是否有相通的mac地址数据
|
||||||
@ -348,10 +352,11 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
|||||||
}
|
}
|
||||||
if (ObjectUtil.isEmpty(deviceInformationDO.getDeviceIp()) || ObjectUtil.isEmpty(deviceInformationDO.getDevicePort())) {
|
if (ObjectUtil.isEmpty(deviceInformationDO.getDeviceIp()) || ObjectUtil.isEmpty(deviceInformationDO.getDevicePort())) {
|
||||||
log.info("没有设备IP、端口不能伸出 :{}", deviceNo);
|
log.info("没有设备IP、端口不能伸出 :{}", deviceNo);
|
||||||
|
warnMsgService.addWarnMsg(deviceNo + " 没有设备IP和端口");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("设备伸出 :{}",deviceNo);
|
log.info("设备伸出 :{}",deviceNo);
|
||||||
extend(deviceInformationDO.getDeviceIp(), Integer.parseInt(deviceInformationDO.getDevicePort()));
|
extend(deviceInformationDO.getDeviceIp(), Integer.parseInt(deviceInformationDO.getDevicePort()), deviceNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -376,10 +381,10 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("设备缩回 :{}",deviceNo);
|
log.info("设备缩回 :{}",deviceNo);
|
||||||
shrink(deviceInformationDO.getDeviceIp(), Integer.parseInt(deviceInformationDO.getDevicePort()));
|
shrink(deviceInformationDO.getDeviceIp(), Integer.parseInt(deviceInformationDO.getDevicePort()), deviceNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shrink(String ip, int port) {
|
public void shrink(String ip, int port, String deviceNo) {
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
short[] shrinkArr = {0};
|
short[] shrinkArr = {0};
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
@ -388,6 +393,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
|||||||
ModbusUtils.writeHoldingRegisters(asciiMaster, 1, 0, shrinkArr);
|
ModbusUtils.writeHoldingRegisters(asciiMaster, 1, 0, shrinkArr);
|
||||||
} catch (ModbusInitException | ModbusTransportException e) {
|
} catch (ModbusInitException | ModbusTransportException e) {
|
||||||
log.info("充电设备缩回时,出现异常 :{}", ip);
|
log.info("充电设备缩回时,出现异常 :{}", ip);
|
||||||
|
warnMsgService.addWarnMsg(deviceNo + " 充电设备缩回失败");
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +408,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
|||||||
* @param ip
|
* @param ip
|
||||||
* @param port
|
* @param port
|
||||||
*/
|
*/
|
||||||
public void extend(String ip, int port) {
|
public void extend(String ip, int port, String deviceNo) {
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
short[] extendArr = {1};
|
short[] extendArr = {1};
|
||||||
short[] shrinkArr = {0};
|
short[] shrinkArr = {0};
|
||||||
@ -414,6 +420,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
|||||||
ModbusUtils.writeHoldingRegisters(asciiMaster, 1, 0, extendArr);
|
ModbusUtils.writeHoldingRegisters(asciiMaster, 1, 0, extendArr);
|
||||||
} catch (ModbusInitException | ModbusTransportException | InterruptedException e) {
|
} catch (ModbusInitException | ModbusTransportException | InterruptedException e) {
|
||||||
log.info("充电设备伸出时,出现异常 :{}", ip);
|
log.info("充电设备伸出时,出现异常 :{}", ip);
|
||||||
|
warnMsgService.addWarnMsg(deviceNo + " 充电设备伸出失败");
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ 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.dto.*;
|
||||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskPathPlanningDTO;
|
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskPathPlanningDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.RequestProcessor;
|
import cn.iocoder.yudao.module.system.api.robot.RequestProcessor;
|
||||||
|
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotPoseStatusDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotPoseStatusDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.vo.PathPlanningMovePoseVO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.PathPlanningMovePoseVO;
|
||||||
@ -436,10 +437,10 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
|||||||
public void pathPlanningMovePose(String message) {
|
public void pathPlanningMovePose(String message) {
|
||||||
PathPlanningMovePoseVO robotStatusData = JSON.parseObject(message, PathPlanningMovePoseVO.class);
|
PathPlanningMovePoseVO robotStatusData = JSON.parseObject(message, PathPlanningMovePoseVO.class);
|
||||||
String mac = robotInformationService.getMacByRobotNo(robotStatusData.getRobotNo());
|
String mac = robotInformationService.getMacByRobotNo(robotStatusData.getRobotNo());
|
||||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + mac;
|
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + mac;
|
||||||
Object object = redisUtil.get(pose2dKey);
|
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
||||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
||||||
webSocketSenderApi.sendObject(robotStatusDataPoseDTO.getFloor() + "_" + robotStatusDataPoseDTO.getArea(),
|
webSocketSenderApi.sendObject(floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea(),
|
||||||
WebSocketConstant.PLANNING_MOVE_POSE, message);
|
WebSocketConstant.PLANNING_MOVE_POSE, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ 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.common.CommonApi;
|
||||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotRcsHeartBeatDTO;
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotRcsHeartBeatDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.RequestProcessor;
|
import cn.iocoder.yudao.module.system.api.robot.RequestProcessor;
|
||||||
|
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.dto.RobotStatusDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
||||||
@ -205,10 +206,13 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
Object object = redisUtil.get(pose2dKey);
|
Object object = redisUtil.get(pose2dKey);
|
||||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
||||||
|
|
||||||
|
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + robotInformationDO.getMacAddress();
|
||||||
|
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
||||||
|
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
||||||
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
|
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
|
||||||
bean.setElectricity(robotStatusDataPoseDTO.getBatSoc());
|
bean.setElectricity(robotStatusDataPoseDTO.getBatSoc());
|
||||||
bean.setFloor(robotStatusDataPoseDTO.getFloor());
|
bean.setFloor(floorZoneDTO.getFloor());
|
||||||
bean.setArea(robotStatusDataPoseDTO.getArea());
|
bean.setArea(floorZoneDTO.getArea());
|
||||||
}
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
@ -294,10 +298,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION + v.getMacAddress();
|
String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION + v.getMacAddress();
|
||||||
Object action = redisUtil.get(robotDoingActionKey);
|
Object action = redisUtil.get(robotDoingActionKey);
|
||||||
|
|
||||||
|
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + v.getMacAddress();
|
||||||
|
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
||||||
|
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
|
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
|
||||||
v.setElectricity(robotStatusDataPoseDTO.getBatSoc());
|
v.setElectricity(robotStatusDataPoseDTO.getBatSoc());
|
||||||
v.setFloor(robotStatusDataPoseDTO.getFloor());
|
v.setFloor(floorZoneDTO.getFloor());
|
||||||
v.setArea(robotStatusDataPoseDTO.getArea());
|
v.setArea(floorZoneDTO.getArea());
|
||||||
v.setOnlineStatus(1);
|
v.setOnlineStatus(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.housearea.HouseAreaDO;
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselane.WareHouseLaneDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.houselane.WareHouseLaneDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotChargeLogDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotChargeLogDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||||
@ -36,6 +37,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.housearea.HouseAreaMapper;
|
|||||||
import cn.iocoder.yudao.module.system.dal.mysql.houselane.WareHouseLaneMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.houselane.WareHouseLaneMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.information.DeviceInformationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.information.DeviceInformationMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.log.RobotTaskDetailActionLogMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotChargeLogMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotChargeLogMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||||
@ -158,6 +160,9 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
|||||||
@Resource
|
@Resource
|
||||||
private DeviceInformationService deviceInformationService;
|
private DeviceInformationService deviceInformationService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RobotTaskDetailActionLogMapper taskDetailActionLogMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createTask(RobotTaskSaveReqVO createReqVO) throws InterruptedException {
|
public Long createTask(RobotTaskSaveReqVO createReqVO) throws InterruptedException {
|
||||||
@ -507,6 +512,15 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
|||||||
setTaskDoing(detailId, taskAssignDTO.getRobotNo(), deviceNoMap);
|
setTaskDoing(detailId, taskAssignDTO.getRobotNo(), deviceNoMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
|
||||||
|
logOne.setCommandType(taskAssignDTO.getOrderType());
|
||||||
|
logOne.setActionMsg(taskAssignDTO.getRobotActionMsg());
|
||||||
|
logOne.setRobotNo(taskAssignDTO.getRobotNo());
|
||||||
|
logOne.setCommandId(-1L);
|
||||||
|
logOne.setTaskDetailId(taskAssignDTO.getOrderId());
|
||||||
|
taskDetailActionLogMapper.insert(logOne);
|
||||||
|
|
||||||
// sendTaskToRobot(robotTaskDetailDO, taskAssignDTO);
|
// sendTaskToRobot(robotTaskDetailDO, taskAssignDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
|
|||||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskLimitationAreaDTO;
|
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.TaskRobotNoLimittationAreaDTO;
|
||||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
|
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
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.RobotTaskChcheConstant;
|
||||||
@ -198,7 +199,11 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String mapKey = robotStatusDataPoseDTO.getFloor() + "_" + robotStatusDataPoseDTO.getArea();
|
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + robot.getMacAddress();
|
||||||
|
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
||||||
|
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
||||||
|
|
||||||
|
String mapKey = floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea();
|
||||||
PositionMapDO positionMapDO = positionMap.get(mapKey);
|
PositionMapDO positionMapDO = positionMap.get(mapKey);
|
||||||
if (ObjectUtil.isEmpty(positionMapDO)) {
|
if (ObjectUtil.isEmpty(positionMapDO)) {
|
||||||
log.info("------此机器人没有匹配到楼层和区域------ :{}", robot.getRobotNo());
|
log.info("------此机器人没有匹配到楼层和区域------ :{}", robot.getRobotNo());
|
||||||
|
@ -9,4 +9,13 @@
|
|||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<update id="updateActionStatus">
|
||||||
|
update
|
||||||
|
robot_task_detail_action_log
|
||||||
|
set
|
||||||
|
action_status = #{actionStatus}
|
||||||
|
where
|
||||||
|
task_detail_id = #{taskDetailId}
|
||||||
|
and command_id = '-1'
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
@ -13,8 +13,10 @@
|
|||||||
update
|
update
|
||||||
robot_warn_msg
|
robot_warn_msg
|
||||||
set
|
set
|
||||||
read_status = '1'
|
read_status = '1',
|
||||||
|
read_time = now()
|
||||||
where
|
where
|
||||||
read_status = '0'
|
read_status = '0'
|
||||||
|
LIMIT 1000
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user