任务联调
This commit is contained in:
parent
fde40418c2
commit
7e37f213b5
@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
public class PathPosedsDataArgPosedDTO {
|
||||
@Schema(description = "唯一key,导航下发给RCS应用", example = "20863")
|
||||
private Integer poseId;
|
||||
private String poseId;
|
||||
|
||||
private Double x;
|
||||
|
||||
|
@ -71,9 +71,6 @@ public class PathApiImpl implements PathApi {
|
||||
taskExecutor.execute(() -> {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
taskService.assignTasks(message);
|
||||
if (ObjectUtil.isEmpty(message)) {
|
||||
return;
|
||||
}
|
||||
// taskService.ppDistributionTask(message); 废弃了
|
||||
});
|
||||
}
|
||||
|
@ -37,9 +37,6 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Value("${zn.robot_position_cache_time:600}")
|
||||
private Long robotPositionCacheTime;
|
||||
|
||||
@Value("${zn.robot_error_level_time:30}")
|
||||
private Long robotErrorLevelTime;
|
||||
|
||||
@ -59,15 +56,8 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
|
||||
public void robotReactiveStatus(String message) {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
RobotReactiveStatusDTO data = JSON.parseObject(message, RobotReactiveStatusDTO.class);
|
||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + data.getMac();
|
||||
Object object = redisUtil.get(pose2dKey);
|
||||
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);
|
||||
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + data.getMac();
|
||||
redisUtil.set(floorAreaKey, JSON.toJSONString(data.getFloorZone()));
|
||||
|
||||
//机器人异常等级
|
||||
if (ObjectUtil.isEmpty(data.getErrCode())) {
|
||||
|
@ -4,10 +4,7 @@ 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.system.api.robot.dto.RobotPoseStatusDTO;
|
||||
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.dto.*;
|
||||
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.constant.path.PathPlanningTopicConstant;
|
||||
@ -80,6 +77,9 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
log.info("机器人上报的信息不全 :{}", JSON.toJSONString(robotStatusDataDTO));
|
||||
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 pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac();
|
||||
Object object = redisUtil.get(pose2dKey);
|
||||
@ -91,6 +91,8 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getPose2d().getYaw());
|
||||
}
|
||||
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
||||
robotStatusDataPoseDTO.setFloor(floorZoneDTO.getFloor());
|
||||
robotStatusDataPoseDTO.setArea(floorZoneDTO.getArea());
|
||||
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
||||
|
||||
//机器人身上是否有货
|
||||
@ -106,8 +108,9 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
robotInformationVO = robotInformationService.getRobotByRedis(robotStatusDataDTO.getMac());
|
||||
}
|
||||
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
|
||||
|
||||
// 合并请求 - 这里接受到的数据都丢给 RequestProcessor - 再整合数据通过WebSocket丢给前端
|
||||
processor.handleRequest(robotStatusDataPoseDTO.getFloor() + "_" + robotStatusDataPoseDTO.getArea(),
|
||||
processor.handleRequest(floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea(),
|
||||
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotInformationVO));
|
||||
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.PathTaskTypeEnum;
|
||||
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.task.RobotStatusCodeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotTaskStageEnum;
|
||||
@ -48,8 +49,6 @@ import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
|
||||
|
||||
@Slf4j
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
@ -89,9 +88,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
@Resource
|
||||
private CommonApi commonApi;
|
||||
|
||||
@Resource
|
||||
public WebSocketSenderApi webSocketSenderApi;
|
||||
|
||||
@Resource
|
||||
private RobotTaskDetailService taskDetailService;
|
||||
|
||||
@ -101,18 +97,12 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
@Resource
|
||||
private RobotWarnMsgService warnMsgService;
|
||||
|
||||
@Resource
|
||||
private DeviceInformationMapper deviceInformationMapper;
|
||||
|
||||
@Resource
|
||||
private MoveToWaitService moveToWaitService;
|
||||
|
||||
@Resource
|
||||
private PathPlanningService pathPlanningService;
|
||||
|
||||
@Resource
|
||||
private RobotTaskService taskService;
|
||||
|
||||
@Resource
|
||||
private DeviceInformationService deviceInformationService;
|
||||
|
||||
@ -175,6 +165,8 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
|
||||
sendStartDoActionToPP(robotCompleteTaskDTO.getCommandStatus(), robotCompleteTaskDTO.getMac(),
|
||||
String.valueOf(robotCompleteTaskDTO.getOrderId()));
|
||||
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -225,6 +217,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
.build();
|
||||
chargeLogMapper.updateById(build);
|
||||
}
|
||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType());
|
||||
}
|
||||
|
||||
|
||||
@ -344,6 +337,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
RobotTaskDetailDO detailDO = new RobotTaskDetailDO();
|
||||
detailDO.setId(robotCompleteTaskDTO.getOrderId());
|
||||
detailDO.setEndTime(LocalDateTime.now());
|
||||
detailDO.setTaskStage(RobotTaskStageEnum.DONE.getType());
|
||||
detailDO.setTaskStatus(RobotTaskDetailStatusEnum.DONE.getType());
|
||||
robotTaskDetailMapper.updateRobotDetailById(detailDO);
|
||||
//更新任务状态
|
||||
|
@ -11,6 +11,9 @@ public class RobotTaskChcheConstant {
|
||||
//机器人点位和电量 (拼接的是mac地址)
|
||||
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地址)
|
||||
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发送心跳给车机
|
||||
*/
|
||||
@ -19,5 +19,5 @@ public class RobotTopicConstant {
|
||||
/**
|
||||
* 让机器人同步告警码值映射的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 = "端口")
|
||||
private String devicePort;
|
||||
|
||||
@Schema(description = "最后使用者")
|
||||
private String lastUser;
|
||||
|
||||
}
|
||||
|
@ -116,4 +116,8 @@ public class DeviceInformationRespVO {
|
||||
@ExcelProperty("端口")
|
||||
private String devicePort;
|
||||
|
||||
@Schema(description = "最后使用者")
|
||||
@ExcelProperty("最后使用者")
|
||||
private String lastUser;
|
||||
|
||||
}
|
||||
|
@ -82,4 +82,7 @@ public class DeviceInformationSaveReqVO {
|
||||
@Schema(description = "端口")
|
||||
private String devicePort;
|
||||
|
||||
@Schema(description = "最后使用者")
|
||||
private String lastUser;
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -22,4 +23,29 @@ public class TaskAssignDTO {
|
||||
|
||||
@Schema(description = "AGV编号")
|
||||
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 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.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 车辆动作记录 Mapper
|
||||
@ -27,4 +28,11 @@ public interface RobotTaskDetailActionLogMapper extends BaseMapperX<RobotTaskDet
|
||||
.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.service.dict.DictDataService;
|
||||
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.redis.RedisUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -74,6 +75,9 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
@Resource
|
||||
private UserOperationLogService userOperationLogService;
|
||||
|
||||
@Resource
|
||||
private RobotWarnMsgService warnMsgService;
|
||||
|
||||
@Override
|
||||
public Long createInformation(DeviceInformationSaveReqVO createReqVO) {
|
||||
// -- 先判断库里是否有相通的mac地址数据
|
||||
@ -348,10 +352,11 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
}
|
||||
if (ObjectUtil.isEmpty(deviceInformationDO.getDeviceIp()) || ObjectUtil.isEmpty(deviceInformationDO.getDevicePort())) {
|
||||
log.info("没有设备IP、端口不能伸出 :{}", deviceNo);
|
||||
warnMsgService.addWarnMsg(deviceNo + " 没有设备IP和端口");
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
short[] shrinkArr = {0};
|
||||
for (int i = 0; i < 3; i++) {
|
||||
@ -388,6 +393,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
ModbusUtils.writeHoldingRegisters(asciiMaster, 1, 0, shrinkArr);
|
||||
} catch (ModbusInitException | ModbusTransportException e) {
|
||||
log.info("充电设备缩回时,出现异常 :{}", ip);
|
||||
warnMsgService.addWarnMsg(deviceNo + " 充电设备缩回失败");
|
||||
success = false;
|
||||
}
|
||||
|
||||
@ -402,7 +408,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
* @param ip
|
||||
* @param port
|
||||
*/
|
||||
public void extend(String ip, int port) {
|
||||
public void extend(String ip, int port, String deviceNo) {
|
||||
boolean success = true;
|
||||
short[] extendArr = {1};
|
||||
short[] shrinkArr = {0};
|
||||
@ -414,6 +420,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
ModbusUtils.writeHoldingRegisters(asciiMaster, 1, 0, extendArr);
|
||||
} catch (ModbusInitException | ModbusTransportException | InterruptedException e) {
|
||||
log.info("充电设备伸出时,出现异常 :{}", ip);
|
||||
warnMsgService.addWarnMsg(deviceNo + " 充电设备伸出失败");
|
||||
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.task.TaskPathPlanningDTO;
|
||||
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.RobotStatusDataPoseDTO;
|
||||
import cn.iocoder.yudao.module.system.api.robot.vo.PathPlanningMovePoseVO;
|
||||
@ -436,10 +437,10 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
public void pathPlanningMovePose(String message) {
|
||||
PathPlanningMovePoseVO robotStatusData = JSON.parseObject(message, PathPlanningMovePoseVO.class);
|
||||
String mac = robotInformationService.getMacByRobotNo(robotStatusData.getRobotNo());
|
||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + mac;
|
||||
Object object = redisUtil.get(pose2dKey);
|
||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
||||
webSocketSenderApi.sendObject(robotStatusDataPoseDTO.getFloor() + "_" + robotStatusDataPoseDTO.getArea(),
|
||||
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + mac;
|
||||
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
||||
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
||||
webSocketSenderApi.sendObject(floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea(),
|
||||
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.task.dto.RobotRcsHeartBeatDTO;
|
||||
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.RobotStatusDataPoseDTO;
|
||||
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);
|
||||
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)) {
|
||||
bean.setElectricity(robotStatusDataPoseDTO.getBatSoc());
|
||||
bean.setFloor(robotStatusDataPoseDTO.getFloor());
|
||||
bean.setArea(robotStatusDataPoseDTO.getArea());
|
||||
bean.setFloor(floorZoneDTO.getFloor());
|
||||
bean.setArea(floorZoneDTO.getArea());
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
@ -294,10 +298,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
String robotDoingActionKey = RobotTaskChcheConstant.ROBOT_QUERY_DOING_ACTION + v.getMacAddress();
|
||||
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)) {
|
||||
v.setElectricity(robotStatusDataPoseDTO.getBatSoc());
|
||||
v.setFloor(robotStatusDataPoseDTO.getFloor());
|
||||
v.setArea(robotStatusDataPoseDTO.getArea());
|
||||
v.setFloor(floorZoneDTO.getFloor());
|
||||
v.setArea(floorZoneDTO.getArea());
|
||||
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.houselocation.WareHouseLocationDO;
|
||||
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.RobotInformationDO;
|
||||
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.houselocation.WareHouseLocationMapper;
|
||||
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.RobotInformationMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||
@ -158,6 +160,9 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
@Resource
|
||||
private DeviceInformationService deviceInformationService;
|
||||
|
||||
@Resource
|
||||
private RobotTaskDetailActionLogMapper taskDetailActionLogMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createTask(RobotTaskSaveReqVO createReqVO) throws InterruptedException {
|
||||
@ -507,6 +512,15 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
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);
|
||||
|
||||
}
|
||||
|
@ -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.TaskRobotNoLimittationAreaDTO;
|
||||
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.constant.path.PathPlanningTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
@ -198,7 +199,11 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
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);
|
||||
if (ObjectUtil.isEmpty(positionMapDO)) {
|
||||
log.info("------此机器人没有匹配到楼层和区域------ :{}", robot.getRobotNo());
|
||||
|
@ -9,4 +9,13 @@
|
||||
文档可见: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>
|
@ -13,8 +13,10 @@
|
||||
update
|
||||
robot_warn_msg
|
||||
set
|
||||
read_status = '1'
|
||||
read_status = '1',
|
||||
read_time = now()
|
||||
where
|
||||
read_status = '0'
|
||||
LIMIT 1000
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user