Compare commits
No commits in common. "133cacbca69dcb677bb0a36d8d0b8317284ab592" and "febd0631522d78dfdea31a9d6d443448c2cb19d4" have entirely different histories.
133cacbca6
...
febd063152
@ -33,8 +33,8 @@ management:
|
|||||||
|
|
||||||
# MQTT
|
# MQTT
|
||||||
mqtt:
|
mqtt:
|
||||||
# host: tcp://123.57.12.40:1883
|
host: tcp://123.57.12.40:1883
|
||||||
host: tcp://127.0.0.1:1883
|
# host: tcp://127.0.0.1:1883
|
||||||
username: adminuser
|
username: adminuser
|
||||||
password: adminuser
|
password: adminuser
|
||||||
qos: 0
|
qos: 0
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot.dto;
|
package cn.iocoder.yudao.module.system.api.robot.dto;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotStatusDataPoseDTO;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot.dto;
|
package cn.iocoder.yudao.module.system.api.robot.dto;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotStatusDataPoseDTO;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot.websocket;
|
package cn.iocoder.yudao.module.system.api.robot.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -16,8 +16,6 @@ public class RobotStatusDataPoseDTO {
|
|||||||
public String floor;
|
public String floor;
|
||||||
//区域
|
//区域
|
||||||
public String area;
|
public String area;
|
||||||
//货叉高度
|
|
||||||
public Double forkHeight;
|
|
||||||
//电池剩余容量 废弃 从ROBOT_INFORMATION_SOC 获取电量
|
//电池剩余容量 废弃 从ROBOT_INFORMATION_SOC 获取电量
|
||||||
// public String batSoc;
|
// public String batSoc;
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot.websocket;
|
package cn.iocoder.yudao.module.system.api.robot.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
@ -1,23 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot.websocket;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class WsWareHouseLocationDTO {
|
|
||||||
|
|
||||||
@Schema(description = "实际坐标x轴")
|
|
||||||
private String actualLocationX;
|
|
||||||
|
|
||||||
@Schema(description = "实际坐标y轴")
|
|
||||||
private String actualLocationY;
|
|
||||||
|
|
||||||
@Schema(description = "类型: 1:添加, 0:减少")
|
|
||||||
private Integer type = 1;
|
|
||||||
|
|
||||||
@Schema(description = "所在楼")
|
|
||||||
public String floor;
|
|
||||||
|
|
||||||
@Schema(description = "所在区")
|
|
||||||
public String area;
|
|
||||||
}
|
|
@ -224,7 +224,6 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode TASK_CREATE_FAIL = new ErrorCode(1-002-035-110, "任务创建失败:");
|
ErrorCode TASK_CREATE_FAIL = new ErrorCode(1-002-035-110, "任务创建失败:");
|
||||||
ErrorCode ROBOT_DO_TASK_FAIL = new ErrorCode(1-002-035-112, "车机反馈不能接任务");
|
ErrorCode ROBOT_DO_TASK_FAIL = new ErrorCode(1-002-035-112, "车机反馈不能接任务");
|
||||||
ErrorCode TASK_COMMONG_FAIL = new ErrorCode(1-002-035-113, "下发失败");
|
ErrorCode TASK_COMMONG_FAIL = new ErrorCode(1-002-035-113, "下发失败");
|
||||||
ErrorCode TASK_ASSIGN_OTHER_ROBOT = new ErrorCode(1-002-035-114, "此任务已经转移给其他车辆");
|
|
||||||
|
|
||||||
// ========== 机器人任务明细 1-002-036-000 ==========
|
// ========== 机器人任务明细 1-002-036-000 ==========
|
||||||
ErrorCode TASK_DETAIL_NOT_EXISTS = new ErrorCode(1-002-036-001, "车辆任务明细不存在");
|
ErrorCode TASK_DETAIL_NOT_EXISTS = new ErrorCode(1-002-036-001, "车辆任务明细不存在");
|
||||||
|
@ -42,11 +42,7 @@ public class RobotGenericsStatusApiImpl implements RobotGenericsStatusApi {
|
|||||||
String batSoc = robotStatusData.getHwStates().getBatSoc();
|
String batSoc = robotStatusData.getHwStates().getBatSoc();
|
||||||
if (ObjectUtil.isNotEmpty(batSoc)) {
|
if (ObjectUtil.isNotEmpty(batSoc)) {
|
||||||
String[] split = batSoc.split("\\.");
|
String[] split = batSoc.split("\\.");
|
||||||
batSoc = split[1];
|
batSoc = split[1].substring(0,2);
|
||||||
if (batSoc.length() > 2) {
|
|
||||||
batSoc = batSoc.substring(0,2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (batSoc.startsWith("0")) {
|
if (batSoc.startsWith("0")) {
|
||||||
batSoc = batSoc.substring(1);
|
batSoc = batSoc.substring(1);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
|||||||
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotObstaclesStatusDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotObstaclesStatusDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.vo.RobotUpdatePalletHeightDTO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotUpdatePalletHeightDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.webSocket.WebSocketConstant;
|
import cn.iocoder.yudao.module.system.constant.webSocket.WebSocketConstant;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnMsgSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnMsgSaveReqVO;
|
||||||
@ -61,7 +60,7 @@ public class RobotObstaclesStatusApiImpl implements RobotObstaclesStatusApi{
|
|||||||
warnMsg.setWarnMsg(robotNo +" 机器人遇到障碍物");
|
warnMsg.setWarnMsg(robotNo +" 机器人遇到障碍物");
|
||||||
warnMsgService.createWarnMsg(warnMsg);
|
warnMsgService.createWarnMsg(warnMsg);
|
||||||
|
|
||||||
webSocketSenderApi.sendObject(floorZoneDTO.getFloor() + CommonConstant.SYMBOL + floorZoneDTO.getArea(),
|
webSocketSenderApi.sendObject(floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea(),
|
||||||
WebSocketConstant.AGV_WARN, warnMsg.getWarnMsg());
|
WebSocketConstant.AGV_WARN, warnMsg.getWarnMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot;
|
package cn.iocoder.yudao.module.system.api.robot;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
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.system.api.robot.dto.FloorZoneDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataErrorDTO;
|
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.RobotReactiveStatusDTO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotReactiveStatusDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
|
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
||||||
@ -25,6 +26,8 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -71,11 +74,11 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
|
|||||||
FloorZoneDTO floorZone = new FloorZoneDTO();
|
FloorZoneDTO floorZone = new FloorZoneDTO();
|
||||||
if (ObjectUtil.isNotEmpty(o)) {
|
if (ObjectUtil.isNotEmpty(o)) {
|
||||||
floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
||||||
String oldFloorArea = floorZone.getFloor() + CommonConstant.SYMBOL + floorZone.getArea();
|
String oldFloorArea = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||||
redisUtil.hdel(oldFloorArea, robotNo);
|
redisUtil.hdel(oldFloorArea, robotNo);
|
||||||
|
|
||||||
String newFloorArea = data.getFloorZone().getFloor() + CommonConstant.SYMBOL + data.getFloorZone().getArea();
|
String newFloorArea = data.getFloorZone().getFloor() + "-" + data.getFloorZone().getArea();
|
||||||
String key = FloorAreaConstant.FLOOR_AREA_ROBOT + floorZone.getFloor() + CommonConstant.SYMBOL + floorZone.getArea();
|
String key = FloorAreaConstant.FLOOR_AREA_ROBOT + floorZone.getFloor() + "-" + floorZone.getArea();
|
||||||
if (!oldFloorArea.equals(newFloorArea)) {
|
if (!oldFloorArea.equals(newFloorArea)) {
|
||||||
redisUtil.hdel(key, robotNo);
|
redisUtil.hdel(key, robotNo);
|
||||||
}
|
}
|
||||||
@ -87,7 +90,7 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
|
|||||||
|
|
||||||
redisUtil.set(floorAreaKey, JSON.toJSONString(floorZone));
|
redisUtil.set(floorAreaKey, JSON.toJSONString(floorZone));
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
String value = floorZone.getFloor() + CommonConstant.SYMBOL + floorZone.getArea();
|
String value = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||||
map.put(robotNo, value);
|
map.put(robotNo, value);
|
||||||
redisUtil.hmset(value, map);
|
redisUtil.hmset(value, map);
|
||||||
|
|
||||||
@ -150,7 +153,7 @@ public class RobotReactiveStatusApiImpl implements RobotReactiveStatusApi {
|
|||||||
.warnCode(robotStatusData.getErrorCode())
|
.warnCode(robotStatusData.getErrorCode())
|
||||||
.robotNo(robotNo)
|
.robotNo(robotNo)
|
||||||
.warnType(RobotWarnType.ROBOT_WARN.getType())
|
.warnType(RobotWarnType.ROBOT_WARN.getType())
|
||||||
.warnMsg(robotNo + CommonConstant.SYMBOL + mappingDOS.getWarnMsg())
|
.warnMsg(robotNo + "_" + mappingDOS.getWarnMsg())
|
||||||
.warnSolve(mappingDOS.getWarnSolve())
|
.warnSolve(mappingDOS.getWarnSolve())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -6,11 +6,8 @@ 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.system.api.robot.dto.*;
|
import cn.iocoder.yudao.module.system.api.robot.dto.*;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.processor.RequestProcessor;
|
import cn.iocoder.yudao.module.system.api.robot.processor.RequestProcessor;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotInformationVO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.vo.RobotReactiveStatusDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotStatusDataPoseDTO;
|
|
||||||
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.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
|
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
|
||||||
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;
|
||||||
@ -27,8 +24,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@ -47,11 +42,9 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
@Resource
|
@Resource
|
||||||
private RequestProcessor processor;
|
private RequestProcessor processor;
|
||||||
|
|
||||||
private static final ExecutorService executorService = Executors.newFixedThreadPool(5);
|
@Autowired
|
||||||
|
|
||||||
/*@Autowired
|
|
||||||
private ThreadPoolTaskExecutor taskExecutor;
|
private ThreadPoolTaskExecutor taskExecutor;
|
||||||
*/
|
|
||||||
@Resource
|
@Resource
|
||||||
private CommonApi commonApi;
|
private CommonApi commonApi;
|
||||||
|
|
||||||
@ -64,9 +57,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
@Override
|
@Override
|
||||||
@SystemRateLimiter(time = 1, count = 150, keyArg = "robotStatusUpdate", message = "机器人上报点位超过限流")
|
@SystemRateLimiter(time = 1, count = 150, keyArg = "robotStatusUpdate", message = "机器人上报点位超过限流")
|
||||||
public void robotStatusUpdate(RobotPoseStatusDTO robotStatusDataDTO) {
|
public void robotStatusUpdate(RobotPoseStatusDTO robotStatusDataDTO) {
|
||||||
executorService.execute(() -> {
|
updateRobotPosed(robotStatusDataDTO);
|
||||||
updateRobotPosed(robotStatusDataDTO);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,14 +87,6 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
||||||
robotStatusDataPoseDTO.setFloor(floorZoneDTO.getFloor());
|
robotStatusDataPoseDTO.setFloor(floorZoneDTO.getFloor());
|
||||||
robotStatusDataPoseDTO.setArea(floorZoneDTO.getArea());
|
robotStatusDataPoseDTO.setArea(floorZoneDTO.getArea());
|
||||||
|
|
||||||
String speedKey = RobotTaskChcheConstant.ROBOT_SPEED_FORK_HEIGHT + robotNo;
|
|
||||||
Object speedObject = redisUtil.get(speedKey);
|
|
||||||
if (ObjectUtil.isNotEmpty(speedObject)) {
|
|
||||||
RobotReactiveStatusDTO data = JSON.parseObject(speedObject.toString(), RobotReactiveStatusDTO.class);
|
|
||||||
robotStatusDataPoseDTO.setForkHeight(data.getForkHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
redisUtil.set(pose2dKey, JSON.toJSONString(robotStatusDataPoseDTO), robotPositionCacheTime);
|
||||||
|
|
||||||
//机器人身上是否有货
|
//机器人身上是否有货
|
||||||
@ -121,17 +104,19 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
|||||||
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
|
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
String value = FloorAreaConstant.FLOOR_AREA_ROBOT + floorZoneDTO.getFloor() + CommonConstant.SYMBOL + floorZoneDTO.getArea();
|
String value = FloorAreaConstant.FLOOR_AREA_ROBOT + floorZoneDTO.getFloor() + "-" + floorZoneDTO.getArea();
|
||||||
map.put(robotStatusDataDTO.getMac(), JSON.toJSONString(robotInformationVO));
|
map.put(robotStatusDataDTO.getMac(), JSON.toJSONString(robotInformationVO));
|
||||||
redisUtil.hmset(value, map, 20);
|
redisUtil.hmset(value, map, 20);
|
||||||
|
|
||||||
// 合并请求 - 这里接受到的数据都丢给 RequestProcessor - 再整合数据通过WebSocket丢给前端
|
// 合并请求 - 这里接受到的数据都丢给 RequestProcessor - 再整合数据通过WebSocket丢给前端
|
||||||
processor.handleRequest(floorZoneDTO.getFloor() + CommonConstant.SYMBOL + floorZoneDTO.getArea(),
|
processor.handleRequest(floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea(),
|
||||||
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotInformationVO));
|
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotInformationVO));
|
||||||
sendToPP(robotStatusDataPoseDTO);
|
sendToPP(robotStatusDataPoseDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendToPP(RobotStatusDataPoseDTO robotStatusDataPoseDTO) {
|
private void sendToPP(RobotStatusDataPoseDTO robotStatusDataPoseDTO) {
|
||||||
commonApi.commonMethod(robotStatusDataPoseDTO, PathPlanningTopicConstant.AGV_POSE);
|
taskExecutor.execute(() -> {
|
||||||
|
commonApi.commonMethod(robotStatusDataPoseDTO, PathPlanningTopicConstant.AGV_POSE);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,18 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot;
|
package cn.iocoder.yudao.module.system.api.robot;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
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.common.CommonApi;
|
||||||
import cn.iocoder.yudao.module.system.api.path.vo.RobotClosePathPlantingDTO;
|
import cn.iocoder.yudao.module.system.api.path.vo.RobotClosePathPlantingDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotCommandStateDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotCommandStateDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotCompleteTaskDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotCompleteTaskDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotSkuInfoDTO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotSkuInfoDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.WsWareHouseLocationDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
|
|
||||||
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.path.PathPlanningTopicConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotExecutionStateConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotExecutionStateConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.webSocket.WebSocketConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||||
@ -58,8 +51,6 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.module.system.service.robot.RobotInformationServiceImpl.key;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@Validated
|
@Validated
|
||||||
@ -102,9 +93,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;
|
||||||
|
|
||||||
@ -123,9 +111,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
@Value("${zn.robot_doing_action.doing_action_cache_time:2*24*60*60}")
|
@Value("${zn.robot_doing_action.doing_action_cache_time:2*24*60*60}")
|
||||||
private Long doingActionCacheTime;
|
private Long doingActionCacheTime;
|
||||||
|
|
||||||
@Value("${zn.is_simulation:false}")
|
|
||||||
private Boolean isSimulation;
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void doRobotDoneTask(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
public void doRobotDoneTask(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
||||||
log.info("机器人完成任务上报 :{}", JSON.toJSONString(robotCompleteTaskDTO));
|
log.info("机器人完成任务上报 :{}", JSON.toJSONString(robotCompleteTaskDTO));
|
||||||
@ -192,8 +177,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType()
|
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DOING.getType()
|
||||||
, null);
|
, null);
|
||||||
|
|
||||||
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||||
|| PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType()) ) {
|
|
||||||
chargeDoing(robotCompleteTaskDTO);
|
chargeDoing(robotCompleteTaskDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,7 +243,12 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
|
|
||||||
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||||
|| PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
|| PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||||
chargeLogMapper.updateChargStatusByTaskId(robotCompleteTaskDTO.getOrderId(),ChargeTaskStatusEnum.DONE.getType());
|
RobotChargeLogDO build = RobotChargeLogDO
|
||||||
|
.builder()
|
||||||
|
.id(robotCompleteTaskDTO.getOrderId())
|
||||||
|
.taskStatus(ChargeTaskStatusEnum.CHARGEING.getType())
|
||||||
|
.build();
|
||||||
|
chargeLogMapper.updateById(build);
|
||||||
}
|
}
|
||||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now());
|
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now());
|
||||||
|
|
||||||
@ -288,7 +277,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
toWareHouseLocation.setLocationLock(LocationLockEnum.YES.getType());
|
toWareHouseLocation.setLocationLock(LocationLockEnum.YES.getType());
|
||||||
toWareHouseLocation.setLocationUseStatus(LocationUseStatusEnum.YES.getType());
|
toWareHouseLocation.setLocationUseStatus(LocationUseStatusEnum.YES.getType());
|
||||||
locationMapper.updateById(toWareHouseLocation);
|
locationMapper.updateById(toWareHouseLocation);
|
||||||
pushWareLocation(toWareHouseLocation,robotCompleteTaskDTO.getMac(),ZeroOneEnum.ONE.getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -343,25 +331,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
wareHouseLocationDO.setLocationLock(LocationLockEnum.YES.getType());
|
wareHouseLocationDO.setLocationLock(LocationLockEnum.YES.getType());
|
||||||
wareHouseLocationDO.setLocationUseStatus(LocationUseStatusEnum.NO.getType());
|
wareHouseLocationDO.setLocationUseStatus(LocationUseStatusEnum.NO.getType());
|
||||||
locationMapper.updateById(wareHouseLocationDO);
|
locationMapper.updateById(wareHouseLocationDO);
|
||||||
pushWareLocation(wareHouseLocationDO,robotCompleteTaskDTO.getMac(),ZeroOneEnum.ZERO.getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void pushWareLocation(WareHouseLocationDO wareHouseLocationDO, String mac, Integer type) {
|
|
||||||
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + mac;
|
|
||||||
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
|
||||||
if (ObjectUtil.isEmpty(floorAreaObject)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
|
||||||
String floorAreaStr = floorZoneDTO.getFloor() + CommonConstant.SYMBOL + floorZoneDTO.getArea();
|
|
||||||
WsWareHouseLocationDTO wsWareHouseLocation = new WsWareHouseLocationDTO();
|
|
||||||
wsWareHouseLocation.setActualLocationX(wareHouseLocationDO.getActualLocationX());
|
|
||||||
wsWareHouseLocation.setActualLocationY(wareHouseLocationDO.getActualLocationY());
|
|
||||||
wsWareHouseLocation.setType(type);
|
|
||||||
wsWareHouseLocation.setFloor(floorZoneDTO.getFloor());
|
|
||||||
wsWareHouseLocation.setArea(floorZoneDTO.getArea());
|
|
||||||
log.info("让3D推送修改库存 :{}", JSON.toJSONString(wsWareHouseLocation));
|
|
||||||
webSocketSenderApi.sendObject(floorAreaStr, WebSocketConstant.THREE_D_CHANGE_STOCK, JSON.toJSONString(wsWareHouseLocation));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -468,18 +437,28 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
private void chargeDoing(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
private void chargeDoing(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
||||||
|
|
||||||
RobotCommandStateDTO commandStatus = robotCompleteTaskDTO.getCommandStatus();
|
RobotCommandStateDTO commandStatus = robotCompleteTaskDTO.getCommandStatus();
|
||||||
|
Integer taskStatus = ChargeTaskStatusEnum.CHARGEING.getType();
|
||||||
|
|
||||||
//自动充电任务,移动到充电点就改为完成
|
//编辑地图会判断这表的状态,所以自动充电任务,移动到充电点就改为完成
|
||||||
if (ObjectUtil.isNotEmpty(commandStatus) && CommandTypeEnum.MOVE_POSES.getType().equals(commandStatus.getCommandType())
|
if (ObjectUtil.isNotEmpty(commandStatus) && CommandTypeEnum.MOVE_POSES.getType().equals(commandStatus.getCommandType())
|
||||||
&& RobotExecutionStateConstant.DONE.equals(commandStatus.getExecutionState())) {
|
&& RobotExecutionStateConstant.DONE.equals(commandStatus.getExecutionState())) {
|
||||||
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now());
|
taskDetailActionLogMapper.updateActionStatus(robotCompleteTaskDTO.getOrderId(), ActionStatusEnum.DONE.getType(), LocalDateTime.now());
|
||||||
setTaskDone(robotCompleteTaskDTO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chargeLogMapper.updateChargStatusByTaskId(robotCompleteTaskDTO.getOrderId(),ChargeTaskStatusEnum.CHARGEING.getType());
|
RobotChargeLogDO build = RobotChargeLogDO
|
||||||
|
.builder()
|
||||||
|
.id(robotCompleteTaskDTO.getOrderId())
|
||||||
|
.taskStatus(taskStatus)
|
||||||
|
.build();
|
||||||
|
chargeLogMapper.updateById(build);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RobotTaskDetailDO setTaskDone(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
/**
|
||||||
|
* 任务完成
|
||||||
|
*
|
||||||
|
* @param robotCompleteTaskDTO
|
||||||
|
*/
|
||||||
|
private void taskDone(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
||||||
//更新任务状态
|
//更新任务状态
|
||||||
RobotTaskDetailDO detailDO = new RobotTaskDetailDO();
|
RobotTaskDetailDO detailDO = new RobotTaskDetailDO();
|
||||||
detailDO.setId(robotCompleteTaskDTO.getOrderId());
|
detailDO.setId(robotCompleteTaskDTO.getOrderId());
|
||||||
@ -491,8 +470,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
RobotTaskDetailDO robotTaskDetailDO = robotTaskDetailMapper.selectById(robotCompleteTaskDTO.getOrderId());
|
RobotTaskDetailDO robotTaskDetailDO = robotTaskDetailMapper.selectById(robotCompleteTaskDTO.getOrderId());
|
||||||
List<RobotTaskDetailDO> taskDetails = robotTaskDetailMapper.queryByTaskId(robotTaskDetailDO.getRobotTaskId());
|
List<RobotTaskDetailDO> taskDetails = robotTaskDetailMapper.queryByTaskId(robotTaskDetailDO.getRobotTaskId());
|
||||||
boolean done =
|
boolean done =
|
||||||
taskDetails.stream().noneMatch(v -> (v.getTaskStatus().equals(RobotTaskDetailStatusEnum.NEW.getType()) ||
|
taskDetails.stream().noneMatch(v -> (v.getTaskStatus().equals(RobotTaskDetailStatusEnum.NEW.getType())));
|
||||||
v.getTaskStatus().equals(RobotTaskDetailStatusEnum.DOING.getType())));
|
|
||||||
if (done) {
|
if (done) {
|
||||||
RobotTaskDO robotTaskDO = new RobotTaskDO();
|
RobotTaskDO robotTaskDO = new RobotTaskDO();
|
||||||
robotTaskDO.setId(taskDetails.get(0).getRobotTaskId());
|
robotTaskDO.setId(taskDetails.get(0).getRobotTaskId());
|
||||||
@ -501,17 +479,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
robotTaskMapper.updateRobot(robotTaskDO);
|
robotTaskMapper.updateRobot(robotTaskDO);
|
||||||
taskCycleMapper.deletByRobotTaskId(taskDetails.get(0).getRobotTaskId());
|
taskCycleMapper.deletByRobotTaskId(taskDetails.get(0).getRobotTaskId());
|
||||||
}
|
}
|
||||||
return detailDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 任务完成
|
|
||||||
*
|
|
||||||
* @param robotCompleteTaskDTO
|
|
||||||
*/
|
|
||||||
private void taskDone(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
|
||||||
|
|
||||||
RobotTaskDetailDO robotTaskDetailDO = setTaskDone(robotCompleteTaskDTO);
|
|
||||||
|
|
||||||
RobotInformationDO robotInformationDO = robotInformationMapper.selectOne(new LambdaQueryWrapperX<RobotInformationDO>()
|
RobotInformationDO robotInformationDO = robotInformationMapper.selectOne(new LambdaQueryWrapperX<RobotInformationDO>()
|
||||||
.eq(RobotInformationDO::getRobotNo, robotTaskDetailDO.getRobotNo()));
|
.eq(RobotInformationDO::getRobotNo, robotTaskDetailDO.getRobotNo()));
|
||||||
@ -525,11 +492,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
//同步任务完成给PP
|
//同步任务完成给PP
|
||||||
pathPlanningService.updateBehavior(String.valueOf(robotCompleteTaskDTO.getOrderId()), robotTaskDetailDO.getRobotNo()
|
pathPlanningService.updateBehavior(String.valueOf(robotCompleteTaskDTO.getOrderId()), robotTaskDetailDO.getRobotNo()
|
||||||
, "", PathIsReachEnum.END_WORK.getType());
|
, "", PathIsReachEnum.END_WORK.getType());
|
||||||
|
|
||||||
if (!isSimulation) {
|
|
||||||
String plantingKey = PathPlanningChcheConstant.PATH_PLANNING_TASK + robotCompleteTaskDTO.getOrderId();
|
|
||||||
redisUtil.del(plantingKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -617,7 +579,6 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
|||||||
|
|
||||||
String robotNo = robotInformationService.getRobotNoByMac(robotCompleteTaskDTO.getMac());
|
String robotNo = robotInformationService.getRobotNoByMac(robotCompleteTaskDTO.getMac());
|
||||||
logOne.setRobotNo(robotNo);
|
logOne.setRobotNo(robotNo);
|
||||||
logOne.setOriginalRobotNo(robotNo);
|
|
||||||
logOne.setTaskDetailId(robotCompleteTaskDTO.getOrderId());
|
logOne.setTaskDetailId(robotCompleteTaskDTO.getOrderId());
|
||||||
logOne.setTaskStage(robotTaskDetailDO.getTaskStage());
|
logOne.setTaskStage(robotTaskDetailDO.getTaskStage());
|
||||||
logOne.setCommandType(PathTaskTypeEnum.getTaskType(robotTaskDetailDO.getTaskType()));
|
logOne.setCommandType(PathTaskTypeEnum.getTaskType(robotTaskDetailDO.getTaskType()));
|
||||||
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.api.robot;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.vo.RobotUpdatePalletHeightDTO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotUpdatePalletHeightDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||||
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.robot.RobotTaskDetailDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||||
@ -102,7 +101,7 @@ public class RobotUpdatePalletHeightApiImpl implements RobotUpdatePalletHeightAp
|
|||||||
.warnCode(WARN_CODE)
|
.warnCode(WARN_CODE)
|
||||||
.robotNo(robotNo)
|
.robotNo(robotNo)
|
||||||
.warnType(RobotWarnType.ROBOT_WARN.getType())
|
.warnType(RobotWarnType.ROBOT_WARN.getType())
|
||||||
.warnMsg(data.getOrderId() + CommonConstant.SYMBOL + "不需要更新库位高度")
|
.warnMsg(data.getOrderId() + "_" + "不需要更新库位高度")
|
||||||
.build();
|
.build();
|
||||||
warnMsgMapper.insert(warnMsg);
|
warnMsgMapper.insert(warnMsg);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.system.schedul;
|
package cn.iocoder.yudao.module.system.api.robot.schedul;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotInformationVO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
|
import cn.iocoder.yudao.module.system.constant.area.FloorAreaConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.webSocket.WebSocketConstant;
|
import cn.iocoder.yudao.module.system.constant.webSocket.WebSocketConstant;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.robot.task.TaskAssignDTO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
@ -67,7 +67,7 @@ public class ScheduledTasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (PositionMapDO positionMap : allMap) {
|
for (PositionMapDO positionMap : allMap) {
|
||||||
String key = FloorAreaConstant.FLOOR_AREA_ROBOT + positionMap.getFloor() + CommonConstant.SYMBOL + positionMap.getArea();
|
String key = FloorAreaConstant.FLOOR_AREA_ROBOT + positionMap.getFloor() + "-" + positionMap.getArea();
|
||||||
Map<Object, Object> data = redisUtil.hmget(key);
|
Map<Object, Object> data = redisUtil.hmget(key);
|
||||||
if (ObjectUtil.isEmpty(data)) {
|
if (ObjectUtil.isEmpty(data)) {
|
||||||
continue;
|
continue;
|
||||||
@ -86,7 +86,7 @@ public class ScheduledTasks {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// log.info("3D发送数据:{}", JSON.toJSONString(map));
|
// log.info("3D发送数据:{}", JSON.toJSONString(map));
|
||||||
webSocketSenderApi.sendObject(positionMap.getFloor() + CommonConstant.SYMBOL + positionMap.getArea(), WebSocketConstant.THREE_D_MAP_PUSH, map);
|
webSocketSenderApi.sendObject(key, WebSocketConstant.THREE_D_MAP_PUSH, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.yudao.module.system.api.robot.websocket;
|
package cn.iocoder.yudao.module.system.api.robot.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -6,9 +6,4 @@ public class CommonConstant {
|
|||||||
* MDC请求常亮
|
* MDC请求常亮
|
||||||
*/
|
*/
|
||||||
public static final String REQUEST_ID = "requestId";
|
public static final String REQUEST_ID = "requestId";
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼接的符号 (不能改)
|
|
||||||
*/
|
|
||||||
public static final String SYMBOL = "_";
|
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,6 @@ public class WebSocketConstant {
|
|||||||
*/
|
*/
|
||||||
public static String THREE_D_MAP_PUSH = "3d_map_push";
|
public static String THREE_D_MAP_PUSH = "3d_map_push";
|
||||||
|
|
||||||
/**
|
|
||||||
* 3D地图修改库存
|
|
||||||
*/
|
|
||||||
public static String THREE_D_CHANGE_STOCK = "3d_change_stock";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送地图点位信息
|
* 推送地图点位信息
|
||||||
*/
|
*/
|
||||||
|
@ -57,6 +57,4 @@ public class RobotTaskDetailActionLogPageReqVO extends PageParam {
|
|||||||
@Schema(description = "是否已经统计(0:未统计、1:已经统计)")
|
@Schema(description = "是否已经统计(0:未统计、1:已经统计)")
|
||||||
private Integer alreadyCounted;
|
private Integer alreadyCounted;
|
||||||
|
|
||||||
@Schema(description = "这条任务第一次执行的AGV编号")
|
|
||||||
private String originalRobotNo;
|
|
||||||
}
|
}
|
@ -69,7 +69,4 @@ public class RobotTaskDetailActionLogRespVO {
|
|||||||
@ExcelProperty("是否已经统计(0:未统计、1:已经统计)")
|
@ExcelProperty("是否已经统计(0:未统计、1:已经统计)")
|
||||||
private Integer alreadyCounted;
|
private Integer alreadyCounted;
|
||||||
|
|
||||||
@Schema(description = "这条任务第一次执行的AGV编号")
|
|
||||||
@ExcelProperty("这条任务第一次执行的AGV编号")
|
|
||||||
private String originalRobotNo;
|
|
||||||
}
|
}
|
@ -52,7 +52,4 @@ public class RobotTaskDetailActionLogSaveReqVO {
|
|||||||
|
|
||||||
@Schema(description = "是否已经统计(0:未统计、1:已经统计)")
|
@Schema(description = "是否已经统计(0:未统计、1:已经统计)")
|
||||||
private Integer alreadyCounted;
|
private Integer alreadyCounted;
|
||||||
|
|
||||||
@Schema(description = "这条任务第一次执行的AGV编号")
|
|
||||||
private String originalRobotNo;
|
|
||||||
}
|
}
|
@ -87,9 +87,5 @@ public class RobotTaskDetailActionLogDO extends BaseDO {
|
|||||||
* 时长,单位分钟
|
* 时长,单位分钟
|
||||||
*/
|
*/
|
||||||
private Long duration;
|
private Long duration;
|
||||||
/**
|
|
||||||
* 这条任务第一次执行的AGV编号
|
|
||||||
*/
|
|
||||||
private String originalRobotNo;
|
|
||||||
|
|
||||||
}
|
}
|
@ -36,11 +36,4 @@ public interface RobotChargeLogMapper extends BaseMapperX<RobotChargeLogDO> {
|
|||||||
*/
|
*/
|
||||||
List<String> getChargeFullRobotNos(@Param("chanceCycle") Integer chanceCycle,
|
List<String> getChargeFullRobotNos(@Param("chanceCycle") Integer chanceCycle,
|
||||||
@Param("robotNos") List<String> robotNos);
|
@Param("robotNos") List<String> robotNos);
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param taskDetailId
|
|
||||||
* @param taskStatus
|
|
||||||
*/
|
|
||||||
void updateChargStatusByTaskId(@Param("taskDetailId") Long taskDetailId, @Param("taskStatus") Integer taskStatus);
|
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotStatusDataPoseDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.bulletinboard.vo.BulletinBoardVO;
|
import cn.iocoder.yudao.module.system.controller.admin.bulletinboard.vo.BulletinBoardVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.bulletinboard.vo.RobotElectricityLevelVO;
|
import cn.iocoder.yudao.module.system.controller.admin.bulletinboard.vo.RobotElectricityLevelVO;
|
||||||
|
@ -5,22 +5,25 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
|
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
||||||
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.mysql.houselocation.WareHouseLocationMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.LocationEnableEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.LocationEnableEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.LocationLockEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.LocationLockEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.LocationUseStatusEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.LocationUseStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -74,7 +77,7 @@ public class HouseLocationServiceImpl extends ServiceImpl<WareHouseLocationMappe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = "修改库位信息:" + updateReqVO.getLocationNo() + CommonConstant.SYMBOL + str;
|
str = "修改库位信息:" + updateReqVO.getLocationNo() + "_" + str;
|
||||||
|
|
||||||
UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder()
|
UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder()
|
||||||
.operateAction(str)
|
.operateAction(str)
|
||||||
|
@ -60,7 +60,7 @@ public interface RobotTaskDetailActionLogService {
|
|||||||
RobotTaskDetailActionLogDO setPreviousTaskDoneByOrderId(Long orderId);
|
RobotTaskDetailActionLogDO setPreviousTaskDoneByOrderId(Long orderId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取车辆的最后一条任务(限处理中的任务使用)
|
* 获取车辆的最后一条任务
|
||||||
* @param robotNo
|
* @param robotNo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -84,10 +84,4 @@ public interface RobotTaskDetailActionLogService {
|
|||||||
*/
|
*/
|
||||||
List<RobotTaskDetailActionLogDO> getUnStatisticsDurationLog();
|
List<RobotTaskDetailActionLogDO> getUnStatisticsDurationLog();
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取这台车最后一次执行的任务(查真实的分配记录)
|
|
||||||
* @param robotNo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
RobotTaskDetailActionLogDO getOriginalLastTaskByRobotNo(String robotNo);
|
|
||||||
}
|
}
|
@ -2,12 +2,19 @@ package cn.iocoder.yudao.module.system.service.log;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
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.controller.admin.log.vo.RobotTaskDetailActionLogSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.log.vo.RobotTaskDetailActionLogSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotTaskDetailActionLogDO;
|
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.RobotTaskDetailDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.log.RobotTaskDetailActionLogMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.log.RobotTaskDetailActionLogMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.actionlog.ActionStatusEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.actionlog.ActionStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.actionlog.CommandIdEnum;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -127,18 +134,4 @@ public class RobotTaskDetailActionLogServiceImpl implements RobotTaskDetailActio
|
|||||||
return taskDetailActionLogMapper.getUnStatisticsDurationLog();
|
return taskDetailActionLogMapper.getUnStatisticsDurationLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查这台车最后一次分配的任务
|
|
||||||
* @param robotNo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public RobotTaskDetailActionLogDO getOriginalLastTaskByRobotNo(String robotNo) {
|
|
||||||
return taskDetailActionLogMapper.selectOne(new LambdaQueryWrapperX<RobotTaskDetailActionLogDO>()
|
|
||||||
.eq(RobotTaskDetailActionLogDO::getOriginalRobotNo, robotNo)
|
|
||||||
.eq(RobotTaskDetailActionLogDO::getCommandId, CommandIdEnum.TASK.getType())
|
|
||||||
.orderByDesc(RobotTaskDetailActionLogDO::getCreateTime)
|
|
||||||
.last("limit 1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -9,7 +9,6 @@ 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.dto.FloorZoneDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.vo.PathPlanningMovePoseVO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.PathPlanningMovePoseVO;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningChcheConstant;
|
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.path.PathPlanningTopicConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
@ -504,7 +503,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
|||||||
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + mac;
|
String floorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + mac;
|
||||||
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
Object floorAreaObject = redisUtil.get(floorAreaKey);
|
||||||
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
|
||||||
webSocketSenderApi.sendObject(floorZoneDTO.getFloor() + CommonConstant.SYMBOL + floorZoneDTO.getArea(),
|
webSocketSenderApi.sendObject(floorZoneDTO.getFloor() + "_" + floorZoneDTO.getArea(),
|
||||||
WebSocketConstant.PLANNING_MOVE_POSE, message);
|
WebSocketConstant.PLANNING_MOVE_POSE, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +546,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<PositionMapItemDO> itemDOList = new ArrayList<>();
|
List<PositionMapItemDO> itemDOList = new ArrayList<>();
|
||||||
List<PositionMapItemDO> items = positionMapItemService.getPositionMapItemByMapAndType(positionMap.getId(), PositionMapItemEnum.STOP.getType());
|
List<PositionMapItemDO> items = positionMapItemService.getPositionMapItemByMapAndType(positionMap.getId(), PositionMapItemEnum.WAIT.getType());
|
||||||
if (ObjectUtil.isEmpty(items) || items.size() < robots.size()) {
|
if (ObjectUtil.isEmpty(items) || items.size() < robots.size()) {
|
||||||
List<PositionMapItemDO> itemPoses = positionMapItemService.getPositionMapItemByMapAndType(positionMap.getId(), PositionMapItemEnum.PATH.getType());
|
List<PositionMapItemDO> itemPoses = positionMapItemService.getPositionMapItemByMapAndType(positionMap.getId(), PositionMapItemEnum.PATH.getType());
|
||||||
itemDOList.addAll(itemPoses);
|
itemDOList.addAll(itemPoses);
|
||||||
|
@ -50,7 +50,6 @@ import cn.iocoder.yudao.module.system.service.log.RobotTaskDetailActionLogServic
|
|||||||
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.RobotInformationService;
|
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.RobotTaskDetailService;
|
import cn.iocoder.yudao.module.system.service.robot.RobotTaskDetailService;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.RobotTaskService;
|
|
||||||
import cn.iocoder.yudao.module.system.service.robot.mapstop.RobotMapStopService;
|
import cn.iocoder.yudao.module.system.service.robot.mapstop.RobotMapStopService;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
|
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
|
||||||
@ -58,7 +57,6 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -125,10 +123,6 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
|||||||
@Resource
|
@Resource
|
||||||
private RobotTaskDetailService taskDetailService;
|
private RobotTaskDetailService taskDetailService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
@Lazy
|
|
||||||
private RobotTaskService taskService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ControllerTaskTransferLogService controllerTaskTransferLogService;
|
private ControllerTaskTransferLogService controllerTaskTransferLogService;
|
||||||
|
|
||||||
@ -330,12 +324,7 @@ public class RemoteControllerInformationServiceImpl extends ServiceImpl<RemoteCo
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
RemoteRobotTransferDTO dto = doRobotChangeMode(remoteMode, remoteIp, robotNo, remoteControllerPort, remoteControllerIp);
|
return doRobotChangeMode(remoteMode, remoteIp, robotNo,remoteControllerPort,remoteControllerIp);
|
||||||
if (!RemoteModeEnum.AUTOMATIC.getType().equals(remoteMode)) {
|
|
||||||
taskService.chargeDone(robotNo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return dto;
|
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotSimulationPoseDTO;
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotSimulationPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
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.websocket.RobotInformationVO;
|
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.robot.vo.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.statistics.dto.RobotStatusClassificationDTO;
|
import cn.iocoder.yudao.module.system.controller.admin.statistics.dto.RobotStatusClassificationDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.statistics.dto.RobotTaskManualInterventionDTO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
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.RobotInformationDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||||
|
@ -21,9 +21,8 @@ import cn.iocoder.yudao.module.mqtt.enums.task.ExecutionTypeEnum;
|
|||||||
import cn.iocoder.yudao.module.system.api.robot.processor.RequestProcessor;
|
import cn.iocoder.yudao.module.system.api.robot.processor.RequestProcessor;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.dto.FloorZoneDTO;
|
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.websocket.RobotStatusDataPoseDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotInformationVO;
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningChcheConstant;
|
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.path.PathPlanningTopicConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotStatusCodeConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotStatusCodeConstant;
|
||||||
@ -58,8 +57,6 @@ import cn.iocoder.yudao.module.system.enums.item.UseStatusEnum;
|
|||||||
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.path.PathTaskTypeToRobotEnum;
|
import cn.iocoder.yudao.module.system.enums.path.PathTaskTypeToRobotEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.LocationLockEnum;
|
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.LocationUseStatusEnum;
|
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.RobotStatusEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.RobotStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskDetailStatusEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskDetailStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskModelEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskModelEnum;
|
||||||
@ -95,7 +92,6 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
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.*;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -166,9 +162,6 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
@Value("${zn.full_electricity:95}")
|
@Value("${zn.full_electricity:95}")
|
||||||
private String fullElectricity;
|
private String fullElectricity;
|
||||||
|
|
||||||
@Value("${zn.path_planning.task_chche_time:604800}")
|
|
||||||
private Long taskChcheTime;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RobotCameraService cameraService;
|
private RobotCameraService cameraService;
|
||||||
|
|
||||||
@ -320,7 +313,6 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆所在的地图id
|
* 查询车辆所在的地图id
|
||||||
*
|
|
||||||
* @param robotNo
|
* @param robotNo
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -452,14 +444,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
Object o = redisUtil.get(floorAreaKey);
|
Object o = redisUtil.get(floorAreaKey);
|
||||||
if (ObjectUtil.isNotEmpty(o)) {
|
if (ObjectUtil.isNotEmpty(o)) {
|
||||||
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
||||||
String oldFloorArea = floorZone.getFloor() + CommonConstant.SYMBOL + floorZone.getArea();
|
String oldFloorArea = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||||
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
||||||
redisUtil.del(floorAreaKey);
|
redisUtil.del(floorAreaKey);
|
||||||
if (ObjectUtil.isNotEmpty(o)) {
|
if (ObjectUtil.isNotEmpty(o)) {
|
||||||
String newFloorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + updateReqVO.getMacAddress();
|
String newFloorAreaKey = RobotTaskChcheConstant.ROBOT_FLOOR_AREA + updateReqVO.getMacAddress();
|
||||||
redisUtil.set(newFloorAreaKey, JSON.toJSONString(floorZone));
|
redisUtil.set(newFloorAreaKey, JSON.toJSONString(floorZone));
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
String value = floorZone.getFloor() + CommonConstant.SYMBOL + floorZone.getArea();
|
String value = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||||
map.put(updateReqVO.getRobotNo(), value);
|
map.put(updateReqVO.getRobotNo(), value);
|
||||||
redisUtil.hmset(value, map);
|
redisUtil.hmset(value, map);
|
||||||
}
|
}
|
||||||
@ -512,7 +504,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
Object o = redisUtil.get(floorAreaKey);
|
Object o = redisUtil.get(floorAreaKey);
|
||||||
if (ObjectUtil.isNotEmpty(o)) {
|
if (ObjectUtil.isNotEmpty(o)) {
|
||||||
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
FloorZoneDTO floorZone = JSON.parseObject((String) o, FloorZoneDTO.class);
|
||||||
String oldFloorArea = floorZone.getFloor() + CommonConstant.SYMBOL + floorZone.getArea();
|
String oldFloorArea = floorZone.getFloor() + "-" + floorZone.getArea();
|
||||||
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
redisUtil.hdel(oldFloorArea, robotInformationDO.getRobotNo());
|
||||||
redisUtil.del(floorAreaKey);
|
redisUtil.del(floorAreaKey);
|
||||||
}
|
}
|
||||||
@ -906,7 +898,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
|
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
|
||||||
|
|
||||||
// 模拟请求
|
// 模拟请求
|
||||||
processor.handleRequest(robotStatusDataDTO.getData().getFloor_zone().getFloor() + CommonConstant.SYMBOL + robotStatusDataDTO.getData().getFloor_zone().getArea(),
|
processor.handleRequest(robotStatusDataDTO.getData().getFloor_zone().getFloor() + "_" + robotStatusDataDTO.getData().getFloor_zone().getArea(),
|
||||||
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotInformationVO));
|
robotStatusDataDTO.getMac(), JSONUtil.toJsonStr(robotInformationVO));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1081,16 +1073,10 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void doTaskContinue(String robotNo) {
|
public void doTaskContinue(String robotNo) {
|
||||||
|
|
||||||
RobotTaskDetailActionLogDO actionLog = taskDetailActionLogService.getOriginalLastTaskByRobotNo(robotNo);
|
RobotTaskDetailActionLogDO actionLog = taskDetailActionLogService.getLastTaskByRobotNo(robotNo,CommandIdEnum.TASK.getType());
|
||||||
if (ObjectUtil.isEmpty(actionLog)) {
|
if (ObjectUtil.isEmpty(actionLog)) {
|
||||||
throw exception(ROBOT_LAST_TASK_NO_EXISTS);
|
throw exception(ROBOT_LAST_TASK_NO_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!actionLog.getRobotNo().equals(actionLog.getOriginalRobotNo())) {
|
|
||||||
throw exception0(TASK_ASSIGN_OTHER_ROBOT.getCode(), TASK_ASSIGN_OTHER_ROBOT.getMsg() + actionLog.getRobotNo(),
|
|
||||||
TASK_ASSIGN_OTHER_ROBOT.getMsg() + actionLog.getRobotNo());
|
|
||||||
}
|
|
||||||
|
|
||||||
String mac = getMacByRobotNo(robotNo);
|
String mac = getMacByRobotNo(robotNo);
|
||||||
robotCloseTaskDetail(actionLog.getTaskDetailId() + "", mac, actionLog.getCommandType());
|
robotCloseTaskDetail(actionLog.getTaskDetailId() + "", mac, actionLog.getCommandType());
|
||||||
|
|
||||||
@ -1172,10 +1158,6 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
|
|
||||||
List<TaskToPathPlanningDTO> pathPlanningList = new ArrayList<>();
|
List<TaskToPathPlanningDTO> pathPlanningList = new ArrayList<>();
|
||||||
pathPlanningList.add(pathPlanning);
|
pathPlanningList.add(pathPlanning);
|
||||||
|
|
||||||
String plantingKey = PathPlanningChcheConstant.PATH_PLANNING_TASK + pathPlanning.getOrderId();
|
|
||||||
redisUtil.set(plantingKey, JSON.toJSONString(pathPlanning), taskChcheTime);
|
|
||||||
|
|
||||||
log.info("任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
|
log.info("任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
|
||||||
commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
|
commonApi.commonMethod(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
|
||||||
}
|
}
|
||||||
@ -1193,8 +1175,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
takeTask(pathPlanning, isRemote);
|
takeTask(pathPlanning, isRemote);
|
||||||
} else if (PathTaskTypeEnum.RELEASE.getType().equals(actionLog.getCommandType())) {
|
} else if (PathTaskTypeEnum.RELEASE.getType().equals(actionLog.getCommandType())) {
|
||||||
releaseTask(pathPlanning);
|
releaseTask(pathPlanning);
|
||||||
} else if (PathTaskTypeEnum.MOVE.getType().equals(actionLog.getCommandType())
|
} else if (PathTaskTypeEnum.MOVE.getType().equals(actionLog.getCommandType())) {
|
||||||
|| PathTaskTypeEnum.MOVE_TO_POINT.getType().equals(actionLog.getCommandType())) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1233,14 +1214,11 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
* @param pathPlanning
|
* @param pathPlanning
|
||||||
*/
|
*/
|
||||||
private void takeReleaseTask(TaskToPathPlanningDTO pathPlanning, Boolean isRemote) {
|
private void takeReleaseTask(TaskToPathPlanningDTO pathPlanning, Boolean isRemote) {
|
||||||
|
|
||||||
RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
|
RobotTaskDetailDO robotTaskDetail = checkTaskDone(pathPlanning.getOrderId());
|
||||||
String robotNo = pathPlanning.getRobotNoLimitationAreaDTOS().get(0).getRobotNo();
|
if (!RobotTaskStageEnum.TAKEING.getType().equals(robotTaskDetail.getTaskStage())
|
||||||
String mac = getMacByRobotNo(robotNo);
|
&& !RobotTaskStageEnum.GO_TAKE.getType().equals(robotTaskDetail.getTaskStage())
|
||||||
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + mac;
|
&& !RobotTaskStageEnum.UN_START.getType().equals(robotTaskDetail.getTaskStage())) {
|
||||||
Object cargoDetected = redisUtil.get(cargoDetectedKey);
|
//只要放货
|
||||||
if (ObjectUtil.isNotEmpty(cargoDetected) && RobotStatusCodeConstant.CARGO_DETECTED.equals(Boolean.parseBoolean(String.valueOf(cargoDetected)))) {
|
|
||||||
//说明取货完成
|
|
||||||
pathPlanning.setTakeLevel(null);
|
pathPlanning.setTakeLevel(null);
|
||||||
pathPlanning.setTakeGroupId(null);
|
pathPlanning.setTakeGroupId(null);
|
||||||
pathPlanning.setTakeLocationNumber(null);
|
pathPlanning.setTakeLocationNumber(null);
|
||||||
@ -1248,15 +1226,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
pathPlanning.setTakeOffsetHeight(null);
|
pathPlanning.setTakeOffsetHeight(null);
|
||||||
pathPlanning.setTakeOffsetHeight(null);
|
pathPlanning.setTakeOffsetHeight(null);
|
||||||
pathPlanning.setTaskType(PathTaskTypeToRobotEnum.DROP_OFF_GOODS.getType());
|
pathPlanning.setTaskType(PathTaskTypeToRobotEnum.DROP_OFF_GOODS.getType());
|
||||||
WareHouseLocationDO wareHouseLocation = wareHouseLocationMapper.selectById(robotTaskDetail.getFromLocationId());
|
} else {
|
||||||
if (wareHouseLocation.getTaskId().equals(robotTaskDetail.getTakeId()) && LocationLockEnum.NO.getType().equals(wareHouseLocation.getLocationLock())) {
|
|
||||||
wareHouseLocation.setSkuInfo(null);
|
|
||||||
wareHouseLocation.setSkuNumber(0L);
|
|
||||||
wareHouseLocation.setLocationLock(LocationLockEnum.YES.getType());
|
|
||||||
wareHouseLocation.setLocationUseStatus(LocationUseStatusEnum.NO.getType());
|
|
||||||
wareHouseLocationMapper.updateById(wareHouseLocation);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(), isRemote);
|
takeCheck(robotTaskDetail.getFromLocationId(), robotTaskDetail.getRobotTaskId(), isRemote);
|
||||||
}
|
}
|
||||||
releaseCheck(robotTaskDetail.getToLocationId(), robotTaskDetail.getRobotTaskId());
|
releaseCheck(robotTaskDetail.getToLocationId(), robotTaskDetail.getRobotTaskId());
|
||||||
@ -1541,15 +1511,14 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void rmoteTransferTaskToNewFreeRobo(String oldRobotNo, Long id, String robotNo) {
|
public void rmoteTransferTaskToNewFreeRobo(String oldRobotNo, Long id, String robotNo) {
|
||||||
RobotTaskDetailActionLogDO actionLog = taskDetailActionLogService.getOriginalLastTaskByRobotNo(oldRobotNo);
|
RobotTaskDetailActionLogDO actionLog = taskDetailActionLogService.getLastTaskByRobotNo(robotNo,CommandIdEnum.TASK.getType());
|
||||||
if (ObjectUtil.isEmpty(actionLog)) {
|
if (ObjectUtil.isEmpty(actionLog)) {
|
||||||
log.info("车辆前一个任务不存在或已经完成");
|
log.info("车辆前一个任务不存在或已经完成");
|
||||||
throw exception(ROBOT_LAST_TASK_NO_EXISTS);
|
throw exception(ROBOT_LAST_TASK_NO_EXISTS);
|
||||||
}
|
}
|
||||||
if (!oldRobotNo.equals(actionLog.getRobotNo())) {
|
if (!actionLog.getTaskDetailId().equals(id)) {
|
||||||
log.info("此任务已经被转移到车辆 :{}", actionLog.getRobotNo());
|
log.info("车辆最新的任务id是 :{}, 车辆的前一个任务是 :{}", id, actionLog.getTaskDetailId());
|
||||||
throw exception0(TASK_ASSIGN_OTHER_ROBOT.getCode(), TASK_ASSIGN_OTHER_ROBOT.getMsg() + actionLog.getRobotNo(),
|
throw exception(ROBOT_LAST_TASK_NO_EXISTS);
|
||||||
TASK_ASSIGN_OTHER_ROBOT.getMsg() + actionLog.getRobotNo());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActionStatusEnum.DONE.getType().equals(actionLog.getActionStatus())) {
|
if (ActionStatusEnum.DONE.getType().equals(actionLog.getActionStatus())) {
|
||||||
@ -1593,9 +1562,6 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
|||||||
|
|
||||||
resendToPPData(pathPlanning, actionLog, robotInformationDO, true);
|
resendToPPData(pathPlanning, actionLog, robotInformationDO, true);
|
||||||
|
|
||||||
String plantingKey = PathPlanningChcheConstant.PATH_PLANNING_TASK + pathPlanning.getOrderId();
|
|
||||||
redisUtil.set(plantingKey, JSON.toJSONString(pathPlanning), taskChcheTime);
|
|
||||||
|
|
||||||
List<TaskToPathPlanningDTO> pathPlanningList = new ArrayList<>();
|
List<TaskToPathPlanningDTO> pathPlanningList = new ArrayList<>();
|
||||||
pathPlanningList.add(pathPlanning);
|
pathPlanningList.add(pathPlanning);
|
||||||
log.info("远遥任务转移, 任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
|
log.info("远遥任务转移, 任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
|
||||||
|
@ -109,10 +109,4 @@ public interface RobotTaskService extends IService<RobotTaskDO> {
|
|||||||
* 校验是否存在未完成的任务
|
* 校验是否存在未完成的任务
|
||||||
*/
|
*/
|
||||||
void checkHaveDoingTask();
|
void checkHaveDoingTask();
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置车辆充电完成
|
|
||||||
* @param robotNo
|
|
||||||
*/
|
|
||||||
void chargeDone(String robotNo);
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.robot;
|
package cn.iocoder.yudao.module.system.service.robot;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
@ -12,6 +14,7 @@ import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
|
|||||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.*;
|
import cn.iocoder.yudao.module.mqtt.api.task.dto.*;
|
||||||
import cn.iocoder.yudao.module.mqtt.enums.task.ExecutionTypeEnum;
|
import cn.iocoder.yudao.module.mqtt.enums.task.ExecutionTypeEnum;
|
||||||
import cn.iocoder.yudao.module.system.api.path.vo.RobotClosePathPlantingDTO;
|
import cn.iocoder.yudao.module.system.api.path.vo.RobotClosePathPlantingDTO;
|
||||||
|
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;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
|
||||||
@ -56,11 +59,13 @@ import cn.iocoder.yudao.module.system.enums.robot.task.RobotCommandTypeEnum;
|
|||||||
//import cn.iocoder.yudao.module.system.service.robot.job.RobotCommonTaskService;
|
//import cn.iocoder.yudao.module.system.service.robot.job.RobotCommonTaskService;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotTaskManualInterventionEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.task.RobotTaskManualInterventionEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotTaskStageEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.task.RobotTaskStageEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.wait.WaitStatusEnum;
|
||||||
import cn.iocoder.yudao.module.system.service.information.DeviceInformationService;
|
import cn.iocoder.yudao.module.system.service.information.DeviceInformationService;
|
||||||
import cn.iocoder.yudao.module.system.service.log.RobotTaskDetailActionLogService;
|
import cn.iocoder.yudao.module.system.service.log.RobotTaskDetailActionLogService;
|
||||||
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.positionmap.PositionMapItemService;
|
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||||
import cn.iocoder.yudao.module.system.service.statistics.RobotWorkingHoursStatisticsService;
|
import cn.iocoder.yudao.module.system.service.statistics.RobotWorkingHoursStatisticsService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.wait.MoveToWaitService;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
|
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@ -553,34 +558,33 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
|||||||
|
|
||||||
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(taskAssignDTO.getOrderType())
|
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(taskAssignDTO.getOrderType())
|
||||||
|| PathTaskTypeEnum.CHARGE.getType().equals(taskAssignDTO.getOrderType())) {
|
|| PathTaskTypeEnum.CHARGE.getType().equals(taskAssignDTO.getOrderType())) {
|
||||||
robotChargeLogs = chargeLogMapper.selectOne(new LambdaQueryWrapperX<RobotChargeLogDO>()
|
robotChargeLogs = chargeLogMapper.selectById(taskAssignDTO.getOrderId());
|
||||||
.eq(RobotChargeLogDO::getTaskDetailId, taskAssignDTO.getOrderId())
|
|
||||||
.orderByDesc(RobotChargeLogDO::getCreateTime)
|
robotChargeLogs.setTaskStatus(ChargeTaskStatusEnum.DOING.getType());
|
||||||
.last("limit 1"));
|
chargeLogMapper.updateById(robotChargeLogs);
|
||||||
|
|
||||||
chargeLogMapper.updateChargStatusByTaskId(taskAssignDTO.getOrderId(),ChargeTaskStatusEnum.CHARGEING.getType());
|
|
||||||
robotStatus = RobotStatusEnum.CHARGE.getType();
|
robotStatus = RobotStatusEnum.CHARGE.getType();
|
||||||
if (ObjectUtil.isNotEmpty(robotChargeLogs) && ObjectUtil.isNotEmpty(robotChargeLogs.getTaskDetailId())) {
|
|
||||||
deviceNoMap.put(robotChargeLogs.getTaskDetailId(), robotChargeLogs.getDeviceNo());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(robotChargeLogs) && ObjectUtil.isNotEmpty(robotChargeLogs.getDeviceNo())) {
|
if (ObjectUtil.isNotEmpty(robotChargeLogs.getTaskDetailId())) {
|
||||||
setDeviceUseing(robotChargeLogs.getDeviceNo(), taskAssignDTO.getRobotNo());
|
deviceNoMap.put(robotChargeLogs.getTaskDetailId(), robotChargeLogs.getDeviceNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// chargeDone(taskAssignDTO.getRobotNo());
|
chargeDone(taskAssignDTO.getRobotNo());
|
||||||
|
|
||||||
robotInformationMapper.updateRobotListStatus(taskAssignDTO.getRobotNo(), robotStatus, taskAssignDTO.getOrderId());
|
robotInformationMapper.updateRobotListStatus(taskAssignDTO.getRobotNo(), robotStatus, taskAssignDTO.getOrderId());
|
||||||
|
|
||||||
RobotTaskDO robotTaskDO = setTaskDoing(taskAssignDTO.getOrderId(), taskAssignDTO.getRobotNo(), deviceNoMap, taskAssignDTO.getWaitId());
|
RobotTaskDO robotTaskDO = setTaskDoing(taskAssignDTO.getOrderId(), taskAssignDTO.getRobotNo(), deviceNoMap, taskAssignDTO.getWaitId());
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(robotChargeLogs) && ObjectUtil.isNotEmpty(robotChargeLogs.getDeviceNo())) {
|
||||||
|
setDeviceUseing(robotChargeLogs.getDeviceNo(), taskAssignDTO.getRobotNo());
|
||||||
|
}
|
||||||
|
|
||||||
RobotTaskDetailActionLogSaveReqVO logOne = new RobotTaskDetailActionLogSaveReqVO();
|
RobotTaskDetailActionLogSaveReqVO logOne = new RobotTaskDetailActionLogSaveReqVO();
|
||||||
logOne.setCommandType(taskAssignDTO.getOrderType());
|
logOne.setCommandType(taskAssignDTO.getOrderType());
|
||||||
String actionMsg = taskAssignDTO.getRobotActionMsg() + robotTaskDO.getTaskNo();
|
String actionMsg = taskAssignDTO.getRobotActionMsg() + robotTaskDO.getTaskNo();
|
||||||
logOne.setActionMsg(actionMsg);
|
logOne.setActionMsg(actionMsg);
|
||||||
logOne.setRobotNo(taskAssignDTO.getRobotNo());
|
logOne.setRobotNo(taskAssignDTO.getRobotNo());
|
||||||
logOne.setOriginalRobotNo(taskAssignDTO.getRobotNo());
|
|
||||||
logOne.setStartTime(LocalDateTime.now());
|
logOne.setStartTime(LocalDateTime.now());
|
||||||
logOne.setTaskNo(robotTaskDO.getTaskNo());
|
logOne.setTaskNo(robotTaskDO.getTaskNo());
|
||||||
logOne.setCommandId(-1L);
|
logOne.setCommandId(-1L);
|
||||||
@ -1459,12 +1463,10 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
|||||||
*
|
*
|
||||||
* @param robotNo
|
* @param robotNo
|
||||||
*/
|
*/
|
||||||
@Override
|
private void chargeDone(String robotNo) {
|
||||||
public void chargeDone(String robotNo) {
|
|
||||||
RobotInformationDO robotInformationDO = robotInformationMapper.selectOne(new LambdaQueryWrapperX<RobotInformationDO>()
|
RobotInformationDO robotInformationDO = robotInformationMapper.selectOne(new LambdaQueryWrapperX<RobotInformationDO>()
|
||||||
.eq(RobotInformationDO::getRobotNo, robotNo));
|
.eq(RobotInformationDO::getRobotNo, robotNo));
|
||||||
if (!RobotStatusEnum.CHARGE.getType().equals(robotInformationDO.getRobotStatus())) {
|
if (!RobotStatusEnum.CHARGE.getType().equals(robotInformationDO.getRobotStatus())) {
|
||||||
log.info("车辆非充电状态:{}",robotNo);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.robot;
|
package cn.iocoder.yudao.module.system.service.robot;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||||
|
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnCodeMappingPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnCodeMappingPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnCodeMappingSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnCodeMappingSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.warn.RobotWarnCodeMappingVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.warn.RobotWarnCodeMappingVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnCodeMappingDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnCodeMappingDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnCodeMappingMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnCodeMappingMapper;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -14,11 +18,18 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -26,6 +37,7 @@ import java.util.function.Function;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
|
||||||
import cn.iocoder.yudao.module.system.constant.webSocket.WebSocketConstant;
|
import cn.iocoder.yudao.module.system.constant.webSocket.WebSocketConstant;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnMsgPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnMsgPageReqVO;
|
||||||
@ -119,7 +118,7 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (PositionMapDO positionMapDO : positionMapDOS) {
|
for (PositionMapDO positionMapDO : positionMapDOS) {
|
||||||
webSocketSenderApi.sendObject(positionMapDO.getFloor() + CommonConstant.SYMBOL + positionMapDO.getArea(),
|
webSocketSenderApi.sendObject(positionMapDO.getFloor() + "_" + positionMapDO.getArea(),
|
||||||
WebSocketConstant.AGV_WARN, JSONUtil.toJsonStr(errorMsg));
|
WebSocketConstant.AGV_WARN, JSONUtil.toJsonStr(errorMsg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,26 +177,13 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, List<RobotWarnMsgClassificationDTO>> robotWarnMsgClassification(String type) {
|
public Map<String, List<RobotWarnMsgClassificationDTO>> robotWarnMsgClassification(String type) {
|
||||||
|
|
||||||
|
|
||||||
if (TimeTypeEnum.WEEK.getType().equals(type)) {
|
if (TimeTypeEnum.WEEK.getType().equals(type)) {
|
||||||
List<RobotWarnMsgClassificationDTO> data = warnMsgMapper.getRobotWarnMsgClassification(type);
|
List<RobotWarnMsgClassificationDTO> data = warnMsgMapper.getRobotWarnMsgClassification(type);
|
||||||
if (ObjectUtil.isEmpty(data)) {
|
if (ObjectUtil.isEmpty(data)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return data.stream().collect(Collectors.groupingBy(RobotWarnMsgClassificationDTO::getWarnTime));
|
||||||
Map<String, List<RobotWarnMsgClassificationDTO>> map =
|
|
||||||
data.stream().collect(Collectors.groupingBy(RobotWarnMsgClassificationDTO::getWarnTime));
|
|
||||||
|
|
||||||
Calendar now = Calendar.getInstance();
|
|
||||||
now.setTime(new Date());
|
|
||||||
for (int i = 0; i < 7; i++) {
|
|
||||||
String timeStr = DateUtils.getYYYMMDD(now.getTime());
|
|
||||||
if (!map.containsKey(timeStr)) {
|
|
||||||
map.put(timeStr,new ArrayList<>());
|
|
||||||
}
|
|
||||||
now.set(Calendar.DATE, now.get(Calendar.DATE) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//季度是90天,分成10份,是9. getMonthData已经扣了1,所以是8
|
//季度是90天,分成10份,是9. getMonthData已经扣了1,所以是8
|
||||||
@ -212,7 +198,7 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
|
|||||||
/**
|
/**
|
||||||
* 按月查询
|
* 按月查询
|
||||||
*
|
*
|
||||||
* @param day
|
* @param data
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private LinkedHashMap<String, List<RobotWarnMsgClassificationDTO>> getMonthData(int day) {
|
private LinkedHashMap<String, List<RobotWarnMsgClassificationDTO>> getMonthData(int day) {
|
||||||
@ -234,7 +220,7 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
|
|||||||
String endTime = DateUtils.getYYYMMDD(endDate);
|
String endTime = DateUtils.getYYYMMDD(endDate);
|
||||||
List<RobotWarnMsgClassificationDTO> data = warnMsgMapper.getRobotWarnMsgByTime(startTime, endTime);
|
List<RobotWarnMsgClassificationDTO> data = warnMsgMapper.getRobotWarnMsgByTime(startTime, endTime);
|
||||||
|
|
||||||
String key = startKeyDateStr + CommonConstant.SYMBOL + endTime;
|
String key = startKeyDateStr + "_" + endTime;
|
||||||
map.put(key, data);
|
map.put(key, data);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
|
@ -15,9 +15,7 @@ import com.google.common.collect.Sets;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -92,7 +90,6 @@ public class RobotCameraServiceImpl extends ServiceImpl<RobotCameraMapper, Robot
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断IP是否存在
|
* 判断IP是否存在
|
||||||
*
|
|
||||||
* @param cameraAddVOList
|
* @param cameraAddVOList
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -110,7 +107,7 @@ public class RobotCameraServiceImpl extends ServiceImpl<RobotCameraMapper, Robot
|
|||||||
}
|
}
|
||||||
List<String> ips = robotCameraDOs.stream().map(RobotCameraDO::getCameraIp).collect(Collectors.toList());
|
List<String> ips = robotCameraDOs.stream().map(RobotCameraDO::getCameraIp).collect(Collectors.toList());
|
||||||
String join = StringUtils.join(ips, ",");
|
String join = StringUtils.join(ips, ",");
|
||||||
throw exception(CAMERA_IP_EXIST, "以下摄像头IP已经存在 " + join);
|
throw exception(CAMERA_IP_EXIST,"以下摄像头IP已经存在 "+join);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,47 +116,20 @@ public class RobotCameraServiceImpl extends ServiceImpl<RobotCameraMapper, Robot
|
|||||||
List<RobotCameraDO> cameraDOList = BeanUtils.toBean(cameraAddVOList, RobotCameraDO.class);
|
List<RobotCameraDO> cameraDOList = BeanUtils.toBean(cameraAddVOList, RobotCameraDO.class);
|
||||||
for (RobotCameraDO robotCameraDO : cameraDOList) {
|
for (RobotCameraDO robotCameraDO : cameraDOList) {
|
||||||
try {
|
try {
|
||||||
setCameraAccountAndPassword(robotCameraDO);
|
if (ObjectUtil.isEmpty(robotCameraDO.getId())) {
|
||||||
|
robotCameraDO.setCameraAccount(AESEncryptionUtil.encrypt(robotCameraDO.getCameraAccount(),cameraSecretKey));
|
||||||
|
robotCameraDO.setCameraPassword(AESEncryptionUtil.encrypt(robotCameraDO.getCameraPassword(),cameraSecretKey));
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw exception(CAMERA_DECRYPTION_FAILED);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
robotCameraDO.setRobotNo(robotNo);
|
robotCameraDO.setRobotNo(robotNo);
|
||||||
}
|
}
|
||||||
cameraMapper.insert(cameraDOList);
|
cameraMapper.insert(cameraDOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCameraAccountAndPassword(RobotCameraDO robotCameraDO) {
|
|
||||||
if (ObjectUtil.isEmpty(robotCameraDO.getId())) {
|
|
||||||
try {
|
|
||||||
robotCameraDO.setCameraAccount(AESEncryptionUtil.encrypt(robotCameraDO.getCameraAccount(), cameraSecretKey));
|
|
||||||
robotCameraDO.setCameraPassword(AESEncryptionUtil.encrypt(robotCameraDO.getCameraPassword(), cameraSecretKey));
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
robotCameraDO.setCameraAccount(getEncrypt(robotCameraDO.getCameraAccount()));
|
|
||||||
robotCameraDO.setCameraPassword(getEncrypt(robotCameraDO.getCameraPassword()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEncrypt(String str){
|
|
||||||
try {
|
|
||||||
AESEncryptionUtil.decrypt(str, cameraSecretKey);
|
|
||||||
return str;
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return AESEncryptionUtil.encrypt(str, cameraSecretKey);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据车辆编号删除
|
* 根据车辆编号删除
|
||||||
*
|
|
||||||
* @param robotNo
|
* @param robotNo
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
|||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotStatusDataPoseDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVO;
|
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVO;
|
||||||
@ -30,6 +30,7 @@ import cn.iocoder.yudao.module.system.enums.device.DeviceUseStatusEnum;
|
|||||||
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.charge.ChargeModelEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.charge.ChargeModelEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.pathplanning.RobotPathPlanningService;
|
import cn.iocoder.yudao.module.system.service.robot.pathplanning.RobotPathPlanningService;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotStatusDataPoseDTO;
|
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotStatusCodeConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotStatusCodeConstant;
|
||||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
||||||
|
@ -34,7 +34,6 @@ import cn.iocoder.yudao.module.system.enums.redis.RobotCacheLockEnum;
|
|||||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.charge.ChargeModelEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.charge.ChargeModelEnum;
|
||||||
import cn.iocoder.yudao.module.system.enums.robot.information.ChargeTypeEnum;
|
import cn.iocoder.yudao.module.system.enums.robot.information.ChargeTypeEnum;
|
||||||
import cn.iocoder.yudao.module.system.service.robot.RobotTaskService;
|
|
||||||
import cn.iocoder.yudao.module.system.service.robot.job.DistributeTasksService;
|
import cn.iocoder.yudao.module.system.service.robot.job.DistributeTasksService;
|
||||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@ -43,7 +42,6 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
|
|||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -107,10 +105,6 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CommonApi commonApi;
|
private CommonApi commonApi;
|
||||||
|
|
||||||
@Resource
|
|
||||||
@Lazy
|
|
||||||
private RobotTaskService taskService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下发任务给PP
|
* 下发任务给PP
|
||||||
*/
|
*/
|
||||||
@ -256,9 +250,6 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
List<RobotTaskDetailAddVO> taskDetails = new ArrayList<>();
|
List<RobotTaskDetailAddVO> taskDetails = new ArrayList<>();
|
||||||
List<RobotTaskDO> tasks = new ArrayList<>();
|
List<RobotTaskDO> tasks = new ArrayList<>();
|
||||||
for (PositionMapItemDO v : robotMapItems) {
|
for (PositionMapItemDO v : robotMapItems) {
|
||||||
|
|
||||||
taskService.chargeDone(v.getRobotNo());
|
|
||||||
|
|
||||||
RobotTaskDO task = new RobotTaskDO();
|
RobotTaskDO task = new RobotTaskDO();
|
||||||
String incrementByKey = redisUtil.getIncrementByKey(RobotCacheLockEnum.MOVE_TASK_NO.getKey());
|
String incrementByKey = redisUtil.getIncrementByKey(RobotCacheLockEnum.MOVE_TASK_NO.getKey());
|
||||||
task.setTaskNo(moveTaskNo + DateUtils.getYearMonthDay() + incrementByKey);
|
task.setTaskNo(moveTaskNo + DateUtils.getYearMonthDay() + incrementByKey);
|
||||||
@ -401,10 +392,6 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
//前一个任务是仅取货
|
//前一个任务是仅取货
|
||||||
List<String> robotDoTake = getRobotDoTake(robots);
|
List<String> robotDoTake = getRobotDoTake(robots);
|
||||||
|
|
||||||
for (RobotInformationDO robot : robots) {
|
|
||||||
taskService.chargeDone(robot.getRobotNo());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PositionMapItemDO> positionMapItems = positionMapItemMapper.selectList(new LambdaQueryWrapperX<PositionMapItemDO>()
|
List<PositionMapItemDO> positionMapItems = positionMapItemMapper.selectList(new LambdaQueryWrapperX<PositionMapItemDO>()
|
||||||
.eq(PositionMapItemDO::getType, PositionMapItemEnum.STOP.getType())
|
.eq(PositionMapItemDO::getType, PositionMapItemEnum.STOP.getType())
|
||||||
.eq(PositionMapItemDO::getUseStatus, UseStatusEnum.FREE.getType()));
|
.eq(PositionMapItemDO::getUseStatus, UseStatusEnum.FREE.getType()));
|
||||||
@ -482,7 +469,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
pathPlanning.setReleaseLocationNumber(taskDetailDO.getToLocationNumber());
|
pathPlanning.setReleaseLocationNumber(taskDetailDO.getToLocationNumber());
|
||||||
pathPlanning.setReleasePointId(toLocation.getMapItemId());
|
pathPlanning.setReleasePointId(toLocation.getMapItemId());
|
||||||
|
|
||||||
pathPlanningSetReleaseHeight(pathPlanning, toLocation);
|
pathPlanningSetReleaseHeight(pathPlanning,toLocation);
|
||||||
pathPlanning.setReleaseLevel(toLocation.getLocationStorey());
|
pathPlanning.setReleaseLevel(toLocation.getLocationStorey());
|
||||||
pathPlanning.setReleaseOffsetHeight(offsetHeight);
|
pathPlanning.setReleaseOffsetHeight(offsetHeight);
|
||||||
if (ObjectUtil.isNotEmpty(taskDetailDO.getToLaneId())) {
|
if (ObjectUtil.isNotEmpty(taskDetailDO.getToLaneId())) {
|
||||||
@ -506,19 +493,18 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置放货高度
|
* 设置放货高度
|
||||||
*
|
|
||||||
* @param pathPlanning
|
* @param pathPlanning
|
||||||
* @param toLocation
|
* @param toLocation
|
||||||
*/
|
*/
|
||||||
private void pathPlanningSetReleaseHeight(TaskToPathPlanningDTO pathPlanning, WareHouseLocationDO toLocation) {
|
private void pathPlanningSetReleaseHeight(TaskToPathPlanningDTO pathPlanning, WareHouseLocationDO toLocation) {
|
||||||
if (ZeroOneEnum.ONE.getType().equals(toLocation.getLocationStorey())) {
|
if ( ZeroOneEnum.ONE.getType().equals(toLocation.getLocationStorey())) {
|
||||||
pathPlanning.setReleaseHeight(0.0);
|
pathPlanning.setReleaseHeight(0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WareHouseLocationDO nextLocation = locationMapper.selectOne(new LambdaQueryWrapperX<WareHouseLocationDO>()
|
WareHouseLocationDO nextLocation = locationMapper.selectOne(new LambdaQueryWrapperX<WareHouseLocationDO>()
|
||||||
.eq(WareHouseLocationDO::getId, toLocation.getMapItemId())
|
.eq(WareHouseLocationDO::getId, toLocation.getMapItemId())
|
||||||
.eq(WareHouseLocationDO::getLocationStorey, toLocation.getLocationStorey() - 1)
|
.eq(WareHouseLocationDO::getLocationStorey, toLocation.getLocationStorey()-1)
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
if (ObjectUtil.isNotEmpty(nextLocation) && ObjectUtil.isNotEmpty(nextLocation.getLocationTotalHeight())) {
|
if (ObjectUtil.isNotEmpty(nextLocation) && ObjectUtil.isNotEmpty(nextLocation.getLocationTotalHeight())) {
|
||||||
pathPlanning.setReleaseHeight(Double.valueOf(nextLocation.getLocationTotalHeight() + ""));
|
pathPlanning.setReleaseHeight(Double.valueOf(nextLocation.getLocationTotalHeight() + ""));
|
||||||
@ -527,7 +513,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
|
|
||||||
Integer locationStorey = toLocation.getLocationStorey() - 1;
|
Integer locationStorey = toLocation.getLocationStorey() - 1;
|
||||||
double height = locationStorey * defaultTrayHeight;
|
double height = locationStorey * defaultTrayHeight;
|
||||||
log.info("放货设置默认高度 :{}", pathPlanning.getReleaseHeight());
|
log.info("放货设置默认高度 :{}",pathPlanning.getReleaseHeight());
|
||||||
pathPlanning.setReleaseHeight(height);
|
pathPlanning.setReleaseHeight(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +530,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
|||||||
}
|
}
|
||||||
Integer locationStorey = fromLocation.getLocationStorey();
|
Integer locationStorey = fromLocation.getLocationStorey();
|
||||||
double height = locationStorey * defaultTrayHeight;
|
double height = locationStorey * defaultTrayHeight;
|
||||||
log.info("取货设置默认取货高度 :{}", height);
|
log.info("取货设置默认取货高度 :{}",height);
|
||||||
pathPlanning.setTakeHeight(height);
|
pathPlanning.setTakeHeight(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,13 +8,6 @@ import java.util.Base64;
|
|||||||
public class AESEncryptionUtil {
|
public class AESEncryptionUtil {
|
||||||
private static final String AES_ALGORITHM = "AES";
|
private static final String AES_ALGORITHM = "AES";
|
||||||
|
|
||||||
/**
|
|
||||||
* 加密
|
|
||||||
* @param plaintext
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static String encrypt(String plaintext, String key) throws Exception {
|
public static String encrypt(String plaintext, String key) throws Exception {
|
||||||
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), AES_ALGORITHM);
|
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), AES_ALGORITHM);
|
||||||
Cipher cipher = Cipher.getInstance(AES_ALGORITHM);
|
Cipher cipher = Cipher.getInstance(AES_ALGORITHM);
|
||||||
@ -23,13 +16,6 @@ public class AESEncryptionUtil {
|
|||||||
return Base64.getEncoder().encodeToString(encryptedBytes);
|
return Base64.getEncoder().encodeToString(encryptedBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 解密
|
|
||||||
* @param ciphertext
|
|
||||||
* @param key
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static String decrypt(String ciphertext, String key) throws Exception {
|
public static String decrypt(String ciphertext, String key) throws Exception {
|
||||||
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), AES_ALGORITHM);
|
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), AES_ALGORITHM);
|
||||||
Cipher cipher = Cipher.getInstance(AES_ALGORITHM);
|
Cipher cipher = Cipher.getInstance(AES_ALGORITHM);
|
||||||
|
@ -2,17 +2,6 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.robot.RobotChargeLogMapper">
|
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.robot.RobotChargeLogMapper">
|
||||||
|
|
||||||
|
|
||||||
<update id="updateChargStatusByTaskId">
|
|
||||||
update
|
|
||||||
robot_charge_log
|
|
||||||
set
|
|
||||||
task_status = #{taskStatus}
|
|
||||||
where
|
|
||||||
task_detail_id = #{taskDetailId}
|
|
||||||
and deleted = '0'
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
@ -55,6 +55,12 @@
|
|||||||
<when test="type == 1">
|
<when test="type == 1">
|
||||||
AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_time)
|
AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(create_time)
|
||||||
</when>
|
</when>
|
||||||
|
<when test="type == 2">
|
||||||
|
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(create_time)
|
||||||
|
</when>
|
||||||
|
<when test="type == 3">
|
||||||
|
AND DATE_SUB(CURDATE(), INTERVAL 90 DAY) <= date(create_time)
|
||||||
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY warnTime ,warn_level
|
GROUP BY warnTime ,warn_level
|
||||||
|
Loading…
Reference in New Issue
Block a user