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