机器人移动到等待点
This commit is contained in:
parent
5a870cf145
commit
928491f16c
@ -21,4 +21,8 @@ public interface CommonApi {
|
||||
@PostMapping(PREFIX + "/commonMethod")
|
||||
@Operation(summary = "公共方法")
|
||||
void commonMethod(@RequestBody Object obj, @RequestParam("topic") String topic);
|
||||
|
||||
@PostMapping(PREFIX + "/commonMethodStr")
|
||||
@Operation(summary = "公共方法")
|
||||
void commonMethodStr(@RequestParam("str") String str, @RequestParam("topic") String topic);
|
||||
}
|
||||
|
@ -76,4 +76,8 @@ public class TaskToPathPlanningDTO {
|
||||
@Schema(description = "取货-叉起货需要在原来高度基础上偏移的高度")
|
||||
private Double releaseOffsetHeight;
|
||||
|
||||
//PICK_UP_GOODS取货、DROP_OFF_GOODS放货、MOVE移动、AUTO_CHARGE自动充电、MANUAL_CHARGE手动充电
|
||||
//如果是取放货 传PICK_UP_GOODS
|
||||
private String taskType;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.task.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RobotRcsHeartBeatDTO {
|
||||
}
|
@ -31,4 +31,18 @@ public class CommonApiImpl implements CommonApi {
|
||||
log.info("MQTT消息发送异常 :{}",e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commonMethodStr(String str, String topic) {
|
||||
try {
|
||||
mqttUtils.pub(topic, str);
|
||||
if (str.length() > 510) {
|
||||
log.info("MQTT消息发送成功 :{}", str.substring(0, 500));
|
||||
}else {
|
||||
log.info("MQTT消息发送成功 :{}", str);
|
||||
}
|
||||
} catch (MqttException e) {
|
||||
log.info("MQTT消息发送异常 :{}",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,17 @@ import java.util.List;
|
||||
public enum DefineSubTopicEnum {
|
||||
|
||||
//qos 0-至多1次、1-至少1次、2-正好一次
|
||||
ROBOT_STATUS("ROBOT_STATUS", 0,"点位"),
|
||||
ROBOT_TASK_STATUS("ROBOT_TASK_STATUS", 0,"机器人任务完成上报"),
|
||||
ROBOT_REACTIVE_STATUS("ROBOT_REACTIVE_STATUS", 0,"机器人响应式状态上报"),
|
||||
ROBOT_GENERICS_STATUS("ROBOT_GENERICS_STATUS", 0,"机器人异常"),
|
||||
ROBOT_PATH_STATUS("ROBOT_PATH_STATUS", 0,"导航实时行为上报"),
|
||||
ROBOT_WORK_STATUS("ROBOT_WORK_STATUS", 0,"作业实时行为上报"),
|
||||
ROBOT_UPDATE_PALLET_HEIGHT("UPDATE_PALLET_HEIGHT", 0,"放货后货物高度反馈和取货后货物高度反馈"),
|
||||
SYNCHRONOUS_ALL_MAP_REQUEST("SYNCHRONOUS_ALL_MAP_REQUEST", 0,"路径规划需要初始数据上报"),
|
||||
TASK_ASSIGNMENT_FEEDBACK("TASK_ASSIGNMENT_FEEDBACK", 0,"路径规划任务分配上报"),
|
||||
TASK_ASSIGNMENT_FAIL("TASK_ASSIGNMENT_FAIL", 0,"路径规划失败上报"),
|
||||
ROBOT_TASK_MOVE ("ROBOT_TASK_MOVE ", 0,"路径规划上报实时路径");
|
||||
ROBOT_STATUS("ROBOT_STATUS", 2,"点位"),
|
||||
ROBOT_TASK_STATUS("ROBOT_TASK_STATUS", 2,"机器人任务完成上报"),
|
||||
ROBOT_REACTIVE_STATUS("ROBOT_REACTIVE_STATUS", 2,"机器人响应式状态上报"),
|
||||
ROBOT_GENERICS_STATUS("ROBOT_GENERICS_STATUS", 2,"机器人异常"),
|
||||
ROBOT_PATH_STATUS("ROBOT_PATH_STATUS", 2,"导航实时行为上报"),
|
||||
ROBOT_WORK_STATUS("ROBOT_WORK_STATUS", 2,"作业实时行为上报"),
|
||||
ROBOT_UPDATE_PALLET_HEIGHT("UPDATE_PALLET_HEIGHT", 2,"放货后货物高度反馈和取货后货物高度反馈"),
|
||||
SYNCHRONOUS_ALL_MAP_REQUEST("SYNCHRONOUS_ALL_MAP_REQUEST", 2,"路径规划需要初始数据上报"),
|
||||
TASK_ASSIGNMENT_FEEDBACK("TASK_ASSIGNMENT_FEEDBACK", 2,"路径规划任务分配上报"),
|
||||
TASK_ASSIGNMENT_FAIL("TASK_ASSIGNMENT_FAIL", 2,"路径规划失败上报"),
|
||||
ROBOT_TASK_MOVE ("ROBOT_TASK_MOVE", 2,"路径规划上报实时路径");
|
||||
|
||||
|
||||
private final String topic;
|
||||
|
@ -197,6 +197,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode TASK_CHECK_TASK_STATUS = new ErrorCode(1-002-035-100, "订单已完成");
|
||||
ErrorCode TASK_CHECK_UPDATE_STATUS = new ErrorCode(1-002-035-101, "订单更新失败");
|
||||
ErrorCode TASK_CHECK_EXIST_NO = new ErrorCode(1-002-035-102, "订单号已存在");
|
||||
ErrorCode TASK_TYPE_UN_EXIST = new ErrorCode(1-002-035-103, "找不到对应的任务类型");
|
||||
|
||||
// ========== 机器人任务明细 1-002-036-000 ==========
|
||||
ErrorCode TASK_DETAIL_NOT_EXISTS = new ErrorCode(1-002-036-001, "机器人任务明细不存在");
|
||||
|
@ -21,7 +21,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.information.DeviceInformationMap
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.*;
|
||||
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathIsReachEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathTaskType;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathTaskTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.*;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.charge.ChargeTaskStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.robot.task.RobotStatusCodeEnum;
|
||||
@ -140,9 +140,9 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
* @param robotCompleteTaskDTO
|
||||
*/
|
||||
private void robotTaskDoing(RobotCompleteTaskDTO robotCompleteTaskDTO, String robotDoingActionKey) {
|
||||
if (PathTaskType.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
chargeDoing(robotCompleteTaskDTO, robotDoingActionKey);
|
||||
} else if (PathTaskType.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
|
||||
logOne.setActionMsg("车辆正在前往等待点");
|
||||
String robotNo = robotInformationService.getRobotNoByMac(robotCompleteTaskDTO.getMac());
|
||||
@ -182,14 +182,14 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
*/
|
||||
private void robotTaskDone(RobotCompleteTaskDTO robotCompleteTaskDTO) {
|
||||
//todo 后面考虑下充电,车机目前对充电的逻辑未定义
|
||||
if (PathTaskType.MOVE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskType.MOVE_TO_WAIT_STOP.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskType.TAKE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskType.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskType.RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (PathTaskTypeEnum.MOVE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.MOVE_TO_WAIT_STOP.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.TAKE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
taskDone(robotCompleteTaskDTO);
|
||||
|
||||
} else if (PathTaskType.TAKE_RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
RobotTaskDetailDO robotTaskDetailDO = robotTaskDetailMapper.selectById(robotCompleteTaskDTO.getOrderId());
|
||||
if (RobotTaskStageEnum.TAKEING.getType().equals(robotTaskDetailDO.getTaskStage())) {
|
||||
pathPlanningService.updateBehavior(String.valueOf(robotCompleteTaskDTO.getOrderId()), robotTaskDetailDO.getRobotNo()
|
||||
@ -197,9 +197,9 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
} else if (RobotTaskStageEnum.RELEASEING.getType().equals(robotTaskDetailDO.getTaskStage())) {
|
||||
taskDone(robotCompleteTaskDTO);
|
||||
}
|
||||
} else if (PathTaskType.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
moveToWaitService.updateWaitStatus(robotCompleteTaskDTO.getOrderId(), WaitStatusEnum.REACH_WAIT.getType());
|
||||
} else if (PathTaskType.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
RobotChargeLogDO build = RobotChargeLogDO
|
||||
.builder()
|
||||
.id(robotCompleteTaskDTO.getOrderId())
|
||||
@ -371,7 +371,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
String commandType = commandStatus.getCommandType();
|
||||
|
||||
RobotTaskDetailActionLogDO logOne = new RobotTaskDetailActionLogDO();
|
||||
if (PathTaskType.TAKE_RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (CommandTypeEnum.MOVE_POSES.getType().equals(commandType) && RobotTaskStageEnum.UN_START.getType().equals(taskStage)) {
|
||||
logOne.setActionMsg("车辆正在前往" + robotTaskDetailDO.getFromLocationNo() + "取货");
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.GO_TAKE.getType());
|
||||
@ -386,7 +386,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.GO_RELEASE.getType());
|
||||
}
|
||||
|
||||
} else if (PathTaskType.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
RobotChargeLogDO robotChargeLogDO = chargeLogMapper.selectById(robotCompleteTaskDTO.getOrderId());
|
||||
if (CommandTypeEnum.MOVE_POSES.getType().equals(commandType)) {
|
||||
logOne.setActionMsg("车辆正在前往" + robotChargeLogDO.getDeviceNo() + "充电");
|
||||
@ -396,17 +396,17 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.CHARGEING.getType());
|
||||
}
|
||||
|
||||
} else if (PathTaskType.MOVE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.MOVE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (CommandTypeEnum.MOVE_POSES.getType().equals(commandType)) {
|
||||
logOne.setActionMsg("车辆正在前往" + robotTaskDetailDO.getToLocationNo());
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.MOVE.getType());
|
||||
}
|
||||
} else if (PathTaskType.MOVE_TO_WAIT_STOP.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.MOVE_TO_WAIT_STOP.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (CommandTypeEnum.MOVE_POSES.getType().equals(commandType)) {
|
||||
logOne.setActionMsg("车辆正在前往" + robotTaskDetailDO.getToLocationNo());
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.MOVE.getType());
|
||||
}
|
||||
} else if (PathTaskType.TAKE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.TAKE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (CommandTypeEnum.MOVE_POSES.getType().equals(commandType) && RobotTaskStageEnum.UN_START.getType().equals(taskStage)) {
|
||||
logOne.setActionMsg("车辆正在前往" + robotTaskDetailDO.getFromLocationNo() + "取货");
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.GO_TAKE.getType());
|
||||
@ -415,7 +415,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.TAKEING.getType());
|
||||
}
|
||||
|
||||
} else if (PathTaskType.RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
} else if (PathTaskTypeEnum.RELEASE.getType().equals(robotCompleteTaskDTO.getOrderType())) {
|
||||
if (CommandTypeEnum.MOVE_POSES.getType().equals(commandType) && RobotTaskStageEnum.UN_START.getType().equals(taskStage)) {
|
||||
logOne.setActionMsg("车辆正在前往" + robotTaskDetailDO.getToLocationNo() + "放货");
|
||||
robotTaskDetailDO.setTaskStage(RobotTaskStageEnum.GO_RELEASE.getType());
|
||||
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class RobotPositionMapDTO {
|
||||
/**
|
||||
* 实际坐标x轴
|
||||
*/
|
||||
private String actualLocationX;
|
||||
/**
|
||||
* 实际坐标y轴
|
||||
*/
|
||||
private String actualLocationY;
|
||||
|
||||
/**
|
||||
* 类型 1.路径点位 2.库位点 3.充电桩 4.停车点 5.区域变更点 6.等待点 --- 后续补充
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* AGV编号
|
||||
*/
|
||||
private String robotNo;
|
||||
|
||||
/**
|
||||
* 仓库点位地图表id
|
||||
*/
|
||||
private Long positionMapId;
|
||||
}
|
@ -15,7 +15,7 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
public class TaskAssignDTO {
|
||||
@Schema(description = "robot_task_detail/robot_charge_log 的 id")
|
||||
private Long id;
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "任务类型(TAKE_RELEASE、CHARGE、MOVE、TAKE、RELEASE、AUTO_CHARGE)")
|
||||
private String type;
|
||||
|
@ -25,7 +25,7 @@ public class MoveToWaitDO extends BaseDO {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* AGV编号
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionMapItemSynDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.Pose2ds;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.RobotPositionMapDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -60,4 +61,11 @@ public interface PositionMapItemMapper extends BaseMapperX<PositionMapItemDO> {
|
||||
* @param laneId
|
||||
*/
|
||||
void emptyLaneId(@Param("mapId") Long mapId, @Param("laneId") Long laneId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
List<PositionMapItemDO> selectInWaitList(@Param("list") List<RobotPositionMapDTO> list);
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.enums.item;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PositionMapItemEnum {
|
||||
PATH(1,"路径点位"),
|
||||
LOCATION(2,"库位点"),
|
||||
CHARGE(3,"充电桩"),
|
||||
STOP(4,"停车点"),
|
||||
CHANGE(5,"区域变更点"),
|
||||
WAIT(6,"等待点");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
private final String msg;
|
||||
}
|
@ -9,7 +9,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PathTaskType {
|
||||
public enum PathTaskTypeEnum {
|
||||
TAKE_RELEASE("TAKE_RELEASE","取放货"),
|
||||
CHARGE("CHARGE","充电任务"),
|
||||
MOVE("MOVE","移动任务"),
|
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.system.enums.path;
|
||||
|
||||
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ROBOT_MAC_ADDRESS_EXISTS;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.TASK_TYPE_UN_EXIST;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PathTaskTypeToRobotEnum {
|
||||
PICK_UP_GOODS("PICK_UP_GOODS","取货"),
|
||||
DROP_OFF_GOODS("DROP_OFF_GOODS","放货"),
|
||||
MOVE("MOVE","移动"),
|
||||
AUTO_CHARGE("AUTO_CHARGE","自动充电"),
|
||||
MANUAL_CHARGE("MANUAL_CHARGE","手动充电");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String type;
|
||||
|
||||
private final String msg;
|
||||
|
||||
/**
|
||||
* 任务对应的类型
|
||||
* @param taskType
|
||||
* @return
|
||||
*/
|
||||
public static String taskDetailGetType(Integer taskType) {
|
||||
if (RobotTaskTypeEnum.TAKE_RELEASE.getType().equals(taskType)) {
|
||||
return PICK_UP_GOODS.getType();
|
||||
}else if (RobotTaskTypeEnum.MOVE.getType().equals(taskType)) {
|
||||
return MOVE.getType();
|
||||
}else if (RobotTaskTypeEnum.TAKE.getType().equals(taskType)) {
|
||||
return PICK_UP_GOODS.getType();
|
||||
}else if (RobotTaskTypeEnum.RELEASE.getType().equals(taskType)) {
|
||||
return DROP_OFF_GOODS.getType();
|
||||
}else if (RobotTaskTypeEnum.PARK.getType().equals(taskType)) {
|
||||
return MOVE.getType();
|
||||
}
|
||||
throw exception(TASK_TYPE_UN_EXIST);
|
||||
}
|
||||
}
|
@ -164,7 +164,6 @@ public class RobotJob {
|
||||
lock.unlock();
|
||||
}
|
||||
}else {
|
||||
log.info("维护车机心跳未获取到锁");
|
||||
throw exception(REDISSON_NOT_OBTAIN_LOCK);
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
PathPosedsDTO pathPosedsDTO = JSON.parseObject(message, PathPosedsDTO.class);
|
||||
String mac = robotInformationService.getMacByRobotNo(pathPosedsDTO.getRobotNo());
|
||||
String topic = RobotTopicConstant.ROBOT_TASK_MOVE_TOPIC + mac;
|
||||
commonApi.commonMethod(message, topic);
|
||||
commonApi.commonMethodStr(message, topic);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.mqtt.api.common.CommonApi;
|
||||
import cn.iocoder.yudao.module.mqtt.api.task.dto.RobotRcsHeartBeatDTO;
|
||||
import cn.iocoder.yudao.module.system.api.robot.RequestProcessor;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDTO;
|
||||
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
|
||||
@ -574,10 +575,10 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
@Override
|
||||
public void rcsHeartBeat() {
|
||||
RobotInformationDO query = new RobotInformationDO();
|
||||
List<RobotInformationDO> robotInformationDOS = informationMapper.queryAllByLimit(query);
|
||||
for (RobotInformationDO robotInformationDO : robotInformationDOS) {
|
||||
List<RobotInformationDO> robotInformations = informationMapper.queryAllByLimit(query);
|
||||
for (RobotInformationDO robotInformationDO : robotInformations) {
|
||||
String topic = RobotTopicConstant.RCS_HEART_BEAT + robotInformationDO.getMacAddress();
|
||||
commonApi.commonMethod("同步的消息", topic);
|
||||
commonApi.commonMethod(new RobotRcsHeartBeatDTO(), topic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ 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.RobotStatusCodeConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.detail.RobotTaskDetailLogResoVO;
|
||||
@ -41,7 +40,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.device.DeviceUseStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathTaskType;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathTaskTypeEnum;
|
||||
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.ChargeTaskStatusEnum;
|
||||
@ -457,8 +456,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
|
||||
Integer robotStatus = RobotStatusEnum.DOING.getType();
|
||||
|
||||
if (PathTaskType.AUTO_CHARGE.getType().equals(taskAssignDTO.getType())) {
|
||||
robotChargeLogs = chargeLogMapper.selectById(taskAssignDTO.getId());
|
||||
if (PathTaskTypeEnum.AUTO_CHARGE.getType().equals(taskAssignDTO.getType())) {
|
||||
robotChargeLogs = chargeLogMapper.selectById(taskAssignDTO.getOrderId());
|
||||
|
||||
robotChargeLogs.setTaskStatus(ChargeTaskStatusEnum.DOING.getType());
|
||||
chargeLogMapper.updateBatch(robotChargeLogs);
|
||||
@ -469,18 +468,18 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
detailId = robotChargeLogs.getTaskDetailId();
|
||||
}
|
||||
|
||||
} else if (PathTaskType.MOVE_TO_WAIT.getType().equals(taskAssignDTO.getType())) {
|
||||
} else if (PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(taskAssignDTO.getType())) {
|
||||
chargeDone(taskAssignDTO.getRobotNo());
|
||||
moveToWaitService.updateWaitStatus(taskAssignDTO.getId(), WaitStatusEnum.GO_TO_WAIT.getType());
|
||||
} else if (PathTaskType.CHARGE.getType().equals(taskAssignDTO.getType())) {
|
||||
moveToWaitService.updateWaitStatus(taskAssignDTO.getOrderId(), WaitStatusEnum.GO_TO_WAIT.getType());
|
||||
} else if (PathTaskTypeEnum.CHARGE.getType().equals(taskAssignDTO.getType())) {
|
||||
robotStatus = RobotStatusEnum.CHARGE.getType();
|
||||
detailId = taskAssignDTO.getId();
|
||||
detailId = taskAssignDTO.getOrderId();
|
||||
} else {
|
||||
chargeDone(taskAssignDTO.getRobotNo());
|
||||
detailId = taskAssignDTO.getId();
|
||||
detailId = taskAssignDTO.getOrderId();
|
||||
}
|
||||
|
||||
robotInformationMapper.updateRobotListStatus(taskAssignDTO.getRobotNo(), robotStatus, taskAssignDTO.getId());
|
||||
robotInformationMapper.updateRobotListStatus(taskAssignDTO.getRobotNo(), robotStatus, taskAssignDTO.getOrderId());
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailId)) {
|
||||
setTaskDoing(detailId, taskAssignDTO.getRobotNo(), deviceNoMap);
|
||||
@ -502,17 +501,17 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
.topic(RobotTopicConstant.ROBOT_TASK_TOPIC + mac)
|
||||
.orderType(taskAssignDTO.getType())
|
||||
.executionType(ExecutionTypeEnum.DEFAULT.getType())
|
||||
.orderId(taskAssignDTO.getId().toString())
|
||||
.orderId(taskAssignDTO.getOrderId().toString())
|
||||
.data(Lists.newArrayList(robotAssignTask))
|
||||
.build();
|
||||
if (PathTaskType.TAKE_RELEASE.getType().equals(taskAssignDTO.getType())
|
||||
|| PathTaskType.TAKE.getType().equals(taskAssignDTO.getType())
|
||||
|| PathTaskType.RELEASE.getType().equals(taskAssignDTO.getType())) {
|
||||
if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(taskAssignDTO.getType())
|
||||
|| PathTaskTypeEnum.TAKE.getType().equals(taskAssignDTO.getType())
|
||||
|| PathTaskTypeEnum.RELEASE.getType().equals(taskAssignDTO.getType())) {
|
||||
RobotAssignTaskDataDTO robotAssignTaskData = getRobotAssignTaskData(v, taskAssignDTO);
|
||||
List<RobotAssignTaskDataDTO> data = build.getData();
|
||||
data.add(robotAssignTaskData);
|
||||
} else if (PathTaskType.CHARGE.getType().equals(taskAssignDTO.getType())
|
||||
|| PathTaskType.AUTO_CHARGE.getType().equals(taskAssignDTO.getType())) {
|
||||
} else if (PathTaskTypeEnum.CHARGE.getType().equals(taskAssignDTO.getType())
|
||||
|| PathTaskTypeEnum.AUTO_CHARGE.getType().equals(taskAssignDTO.getType())) {
|
||||
RobotAssignTaskDataDTO robotAssignTaskData = new RobotAssignTaskDataDTO();
|
||||
robotAssignTaskData.setCommandType(RobotCommandTypeEnum.WORK_START_CHARGE.getType());
|
||||
List<RobotAssignTaskDataDTO> data = build.getData();
|
||||
@ -536,8 +535,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
RobotAssignTaskDataDTO take = new RobotAssignTaskDataDTO();
|
||||
RobotAssignTaskArgDTO build = null;
|
||||
WareHouseLocationDO location = null;
|
||||
if (PathTaskType.TAKE_RELEASE.getType().equals(taskAssignDTO.getType()) ||
|
||||
PathTaskType.TAKE.getType().equals(taskAssignDTO.getType())) {
|
||||
if (PathTaskTypeEnum.TAKE_RELEASE.getType().equals(taskAssignDTO.getType()) ||
|
||||
PathTaskTypeEnum.TAKE.getType().equals(taskAssignDTO.getType())) {
|
||||
take.setCommandType(RobotCommandTypeEnum.WORD_PICK_UP_GOODS.getType());
|
||||
location = locationMapper.selectById(v.getFromLocationId());
|
||||
build = RobotAssignTaskArgDTO.builder()
|
||||
@ -545,7 +544,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
.offsetHeight(offsetHeight)
|
||||
.build();
|
||||
take.setArg(Arrays.asList(build));
|
||||
} else if (PathTaskType.RELEASE.getType().equals(taskAssignDTO.getType())) {
|
||||
} else if (PathTaskTypeEnum.RELEASE.getType().equals(taskAssignDTO.getType())) {
|
||||
take.setCommandType(RobotCommandTypeEnum.WORD_DROP_OFF_GOODS.getType());
|
||||
location = locationMapper.selectById(v.getToLocationId());
|
||||
build = RobotAssignTaskArgDTO.builder()
|
||||
|
@ -121,7 +121,7 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
String taskStatusKey = RobotTaskChcheConstant.ROBOT_TASK_STATUS + robot.getMacAddress();
|
||||
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + robot.getMacAddress();
|
||||
Object taskStatus = redisUtil.get(taskStatusKey);
|
||||
if (ObjectUtil.isEmpty(taskStatus) || RobotStatusCodeConstant.TASK_STATUS_RUNNING.equals(Boolean.parseBoolean(String.valueOf(taskStatus)))) {
|
||||
if (ObjectUtil.isEmpty(taskStatus) || !RobotStatusCodeConstant.TASK_STATUS_RUNNING.equals(Boolean.parseBoolean(String.valueOf(taskStatus)))) {
|
||||
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
|
||||
continue;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.service.robot.pathplanning;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
|
||||
@ -8,12 +9,17 @@ import cn.iocoder.yudao.module.mqtt.api.path.task.TaskLimitationAreaDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskRobotNoLimittationAreaDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.task.RobotTaskApi;
|
||||
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.controller.admin.positionmap.dto.RobotPositionMapDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotChargeLogDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.wait.MoveToWaitDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapItemMapper;
|
||||
@ -21,14 +27,18 @@ import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotInformationMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathTaskType;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.wait.MoveToWaitMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.item.PositionMapItemEnum;
|
||||
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.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.job.DistributeTasksService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
@ -37,7 +47,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@ -111,6 +120,9 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
@Value("${zn.robot_config.offset_height}")
|
||||
private Double offsetHeight;
|
||||
|
||||
@Resource
|
||||
private MoveToWaitMapper moveToWaitMapper;
|
||||
|
||||
/**
|
||||
* 下发任务给PP
|
||||
*/
|
||||
@ -130,7 +142,8 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
|
||||
List<RobotTaskDetailDO> taskDetailDOS = robotAndTaskDetails.getRight();
|
||||
if (ObjectUtil.isEmpty(taskDetailDOS)) {
|
||||
log.info("--不存在需要执行的任务--");
|
||||
log.info("--不存在需要执行的任务--派车辆去等待点");
|
||||
moveRobotToWait(robots);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -139,6 +152,136 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 派车辆去等待点
|
||||
*
|
||||
* @param robots
|
||||
*/
|
||||
private void moveRobotToWait(List<RobotInformationDO> robots) {
|
||||
|
||||
List<PositionMapItemDO> positionMapItems = positionMapItemMapper.selectList(new LambdaQueryWrapperX<PositionMapItemDO>()
|
||||
.eq(PositionMapItemDO::getType, PositionMapItemEnum.STOP.getType())
|
||||
.eq(PositionMapItemDO::getUseStatus, ZeroOneEnum.ZERO.getType()));
|
||||
if (ObjectUtil.isEmpty(positionMapItems)) {
|
||||
log.info("------没有空闲的停车点-----");
|
||||
return;
|
||||
}
|
||||
|
||||
List<PositionMapDO> positionMaps = positionMapMapper.selectList(new LambdaQueryWrapperX<PositionMapDO>());
|
||||
Map<String, PositionMapDO> positionMap =
|
||||
positionMaps.stream().collect(Collectors.toMap(v -> v.getFloor() + "_" + v.getArea(), Function.identity()));
|
||||
|
||||
List<RobotPositionMapDTO> list = new ArrayList<>();
|
||||
for (RobotInformationDO robot : robots) {
|
||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robot.getMacAddress();
|
||||
Object object = redisUtil.get(pose2dKey);
|
||||
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
|
||||
if (ObjectUtil.isEmpty(object) || ObjectUtil.isEmpty(robotStatusDataPoseDTO)) {
|
||||
log.info("------此机器人没有点位信息------ :{}", robot.getRobotNo());
|
||||
continue;
|
||||
}
|
||||
|
||||
String mapKey = robotStatusDataPoseDTO.getFloor() + "_" + robotStatusDataPoseDTO.getArea();
|
||||
PositionMapDO positionMapDO = positionMap.get(mapKey);
|
||||
if (ObjectUtil.isEmpty(positionMapDO)) {
|
||||
log.info("------此机器人没有匹配到楼层和区域------ :{}", robot.getRobotNo());
|
||||
}
|
||||
RobotPositionMapDTO build = RobotPositionMapDTO.builder()
|
||||
.actualLocationX(robotStatusDataPoseDTO.getX())
|
||||
.actualLocationY(robotStatusDataPoseDTO.getY())
|
||||
.robotNo(robot.getRobotNo())
|
||||
.positionMapId(positionMapDO.getId())
|
||||
.type(PositionMapItemEnum.STOP.getType())
|
||||
.build();
|
||||
list.add(build);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
log.info("------没有需要移动到等待点的机器人------");
|
||||
return;
|
||||
}
|
||||
|
||||
//在等待点的车
|
||||
List<PositionMapItemDO> existItems = positionMapItemMapper.selectInWaitList(list);
|
||||
if (ObjectUtil.isEmpty(existItems)) {
|
||||
robotToWait(list, positionMapItems);
|
||||
} else {
|
||||
robotToWaitFilterWait(list, positionMapItems, existItems);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 派部分车去停车点
|
||||
*
|
||||
* @param list 车辆
|
||||
* @param freePositionMapItems 空闲点位
|
||||
* @param existItems 已经有车的点位
|
||||
*/
|
||||
private void robotToWaitFilterWait(List<RobotPositionMapDTO> list, List<PositionMapItemDO> freePositionMapItems,
|
||||
List<PositionMapItemDO> existItems) {
|
||||
Map<String, RobotPositionMapDTO> robotNoPositionMap =
|
||||
list.stream().collect(Collectors.toMap(v -> v.getActualLocationX() + "_"
|
||||
+ v.getActualLocationY() + "_" + v.getPositionMapId(), Function.identity()));
|
||||
|
||||
Map<String, PositionMapItemDO> existItemsMap =
|
||||
existItems.stream().collect(Collectors.toMap(v -> v.getActualLocationX() + "_"
|
||||
+ v.getActualLocationY() + "_" + v.getPositionMapId(), Function.identity()));
|
||||
|
||||
List<RobotPositionMapDTO> needMoveToWaitList = new ArrayList<>();
|
||||
robotNoPositionMap.forEach((key, value) -> {
|
||||
PositionMapItemDO positionMapItemDO = existItemsMap.get(key);
|
||||
if (ObjectUtil.isEmpty(positionMapItemDO)) {
|
||||
needMoveToWaitList.add(value);
|
||||
}
|
||||
});
|
||||
|
||||
if (ObjectUtil.isEmpty(needMoveToWaitList)) {
|
||||
log.info("没有需要移动到等待点的车辆");
|
||||
return;
|
||||
}
|
||||
robotToWait(needMoveToWaitList, freePositionMapItems);
|
||||
}
|
||||
|
||||
/**
|
||||
* 派车去停车点
|
||||
*
|
||||
* @param list
|
||||
* @param positionMapItems
|
||||
*/
|
||||
private void robotToWait(List<RobotPositionMapDTO> list, List<PositionMapItemDO> positionMapItems) {
|
||||
if (positionMapItems.size() < list.size()) {
|
||||
log.info("空闲停车点少于车辆数量");
|
||||
list = list.subList(0, positionMapItems.size());
|
||||
}
|
||||
|
||||
List<String> waitIds = positionMapItems
|
||||
.stream()
|
||||
.map(u -> u.getId() + "")
|
||||
.collect(Collectors.toList());
|
||||
List<MoveToWaitDO> waits = list.stream()
|
||||
.map(v -> {
|
||||
MoveToWaitDO build = MoveToWaitDO.builder().robotNo(v.getRobotNo()).build();
|
||||
return build;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
moveToWaitMapper.insertBatch(waits);
|
||||
|
||||
List<TaskToPathPlanningDTO> pathPlanningList = new ArrayList<>();
|
||||
for (MoveToWaitDO wait : waits) {
|
||||
TaskToPathPlanningDTO pathPlanning = TaskToPathPlanningDTO.builder()
|
||||
.orderId(String.valueOf(wait.getId()))
|
||||
.orderType(PathTaskTypeEnum.MOVE_TO_WAIT.getType())
|
||||
.priority(1l)
|
||||
.createTime(LocalDateTime.now())
|
||||
.taskType(PathTaskTypeToRobotEnum.MOVE.getType())
|
||||
.build();
|
||||
pathPlanningList.add(pathPlanning);
|
||||
}
|
||||
|
||||
log.info("派车去停车点--任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
|
||||
pathPlanningApi.synchronousLineObject(pathPlanningList, PathPlanningTopicConstant.TASK_ASSIGNMENT_REQUEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendChargeTaskToPP(List<RobotChargeLogDO> logs, List<RobotTaskDetailDO> taskDetailDOS,
|
||||
List<RobotInformationDO> robots) {
|
||||
@ -149,6 +292,9 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
Map<String, TaskRobotNoLimittationAreaDTO> robotNoLimittationAreaDTOMap =
|
||||
robotNoLimitationArea.stream().collect(Collectors.toMap(v -> v.getRobotNo(), Function.identity()));
|
||||
|
||||
Map<String, RobotInformationDO> robotMap =
|
||||
robots.stream().collect(Collectors.toMap(v -> v.getRobotNo(), Function.identity()));
|
||||
|
||||
Map<Long, RobotTaskDetailDO> taskDetailMap =
|
||||
taskDetailDOS.stream().collect(Collectors.toMap(v -> v.getId(), Function.identity()));
|
||||
|
||||
@ -165,7 +311,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
priority = taskDetailMap.get(v.getTaskDetailId()).getPriority();
|
||||
}
|
||||
|
||||
String orderType = ObjectUtil.isEmpty(v.getTaskDetailId()) ? PathTaskType.AUTO_CHARGE.getType():PathTaskType.CHARGE.getType();
|
||||
String orderType = ObjectUtil.isEmpty(v.getTaskDetailId()) ? PathTaskTypeEnum.AUTO_CHARGE.getType() : PathTaskTypeEnum.CHARGE.getType();
|
||||
TaskToPathPlanningDTO pathPlanning = TaskToPathPlanningDTO.builder()
|
||||
.orderId(String.valueOf(v.getId()))
|
||||
.orderType(orderType)
|
||||
@ -177,6 +323,11 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
List<TaskRobotNoLimittationAreaDTO> robotNoLimitions = Arrays.asList(taskRobotNoLimittationAreaDTO);
|
||||
pathPlanning.setRobotNoLimitationAreaDTOS(robotNoLimitions);
|
||||
|
||||
RobotInformationDO robotInformationDO = robotMap.get(taskRobotNoLimittationAreaDTO.getRobotNo());
|
||||
String taskType = ChargeTypeEnum.AUTOMATIC.getType().equals(robotInformationDO.getChargeType()) ?
|
||||
PathTaskTypeToRobotEnum.AUTO_CHARGE.getType() : PathTaskTypeToRobotEnum.MANUAL_CHARGE.getType();
|
||||
pathPlanning.setTaskType(taskType);
|
||||
|
||||
pathPlanning.setReleaseGroupId("POINT_" + v.getPositionMapItemId());
|
||||
pathPlanning.setReleaseLocationNumber(releaseLocationNumberConfig);
|
||||
pathPlanning.setReleasePointId(v.getPositionMapItemId());
|
||||
@ -221,10 +372,12 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
log.info("开始组装需要下发给PP的任务");
|
||||
for (RobotTaskDetailDO taskDetailDO : taskDetailDOS) {
|
||||
|
||||
String taskType = PathTaskTypeToRobotEnum.taskDetailGetType(taskDetailDO.getTaskType());
|
||||
TaskToPathPlanningDTO pathPlanning = TaskToPathPlanningDTO.builder()
|
||||
.orderId(String.valueOf(taskDetailDO.getId()))
|
||||
.orderType(PathTaskType.getTaskType(taskDetailDO.getTaskType()))
|
||||
.orderType(PathTaskTypeEnum.getTaskType(taskDetailDO.getTaskType()))
|
||||
.priority(taskDetailDO.getPriority())
|
||||
.taskType(taskType)
|
||||
.createTime(taskDetailDO.getCreateTime())
|
||||
.build();
|
||||
|
||||
@ -251,7 +404,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
pathPlanning.setTakeGroupId("LINE_" + taskDetailDO.getFromLaneId());
|
||||
pathPlanning.setTakeLocationNumber(Math.abs(locationNumberReduce - taskDetailDO.getFromLocationNumber()));
|
||||
pathPlanning.setTakePointId(fromLocation.getMapItemId());
|
||||
pathPlanning.setTakeHeight(Double.valueOf(fromLocation.getLocationTrayHeight()+""));
|
||||
pathPlanning.setTakeHeight(Double.valueOf(fromLocation.getLocationTrayHeight() + ""));
|
||||
pathPlanning.setTakeLevel(fromLocation.getLocationStorey());
|
||||
pathPlanning.setTakeOffsetHeight(offsetHeight);
|
||||
|
||||
@ -261,7 +414,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
pathPlanning.setTakeGroupId("POINT_" + taskDetailDO.getFromMapItemId());
|
||||
pathPlanning.setTakeLocationNumber(Math.abs(locationNumberReduce - taskDetailDO.getFromLocationNumber()));
|
||||
pathPlanning.setTakePointId(fromLocation.getMapItemId());
|
||||
pathPlanning.setTakeHeight(Double.valueOf(fromLocation.getLocationTrayHeight()+""));
|
||||
pathPlanning.setTakeHeight(Double.valueOf(fromLocation.getLocationTrayHeight() + ""));
|
||||
pathPlanning.setTakeLevel(fromLocation.getLocationStorey());
|
||||
pathPlanning.setTakeOffsetHeight(offsetHeight);
|
||||
}
|
||||
@ -273,7 +426,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
pathPlanning.setReleaseGroupId("LINE_" + taskDetailDO.getToLaneId());
|
||||
pathPlanning.setReleaseLocationNumber(taskDetailDO.getToLocationNumber());
|
||||
pathPlanning.setReleasePointId(toLocation.getMapItemId());
|
||||
pathPlanning.setReleaseHeight(Double.valueOf(toLocation.getLocationTrayHeight()+""));
|
||||
pathPlanning.setReleaseHeight(Double.valueOf(toLocation.getLocationTrayHeight() + ""));
|
||||
pathPlanning.setReleaseLevel(toLocation.getLocationStorey());
|
||||
pathPlanning.setReleaseOffsetHeight(offsetHeight);
|
||||
|
||||
@ -283,7 +436,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
pathPlanning.setReleaseGroupId("POINT_" + taskDetailDO.getToMapItemId());
|
||||
pathPlanning.setReleaseLocationNumber(taskDetailDO.getToLocationNumber());
|
||||
pathPlanning.setReleasePointId(toLocation.getMapItemId());
|
||||
pathPlanning.setReleaseHeight(Double.valueOf(toLocation.getLocationTrayHeight()+""));
|
||||
pathPlanning.setReleaseHeight(Double.valueOf(toLocation.getLocationTrayHeight() + ""));
|
||||
pathPlanning.setReleaseLevel(toLocation.getLocationStorey());
|
||||
pathPlanning.setReleaseOffsetHeight(offsetHeight);
|
||||
|
||||
@ -560,12 +713,4 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,8 @@
|
||||
<result property="laneId" column="lane_id" jdbcType="INTEGER"/>
|
||||
<result property="locationX" column="location_x" jdbcType="VARCHAR"/>
|
||||
<result property="locationY" column="location_y" jdbcType="VARCHAR"/>
|
||||
<result property="actualLocationX" column="actual_location_x" jdbcType="VARCHAR"/>
|
||||
<result property="actualLocationY" column="actual_location_y" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="dataJson" column="data_json" jdbcType="VARCHAR"/>
|
||||
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
||||
@ -33,6 +35,8 @@
|
||||
lane_id,
|
||||
location_x,
|
||||
location_y,
|
||||
actual_location_x,
|
||||
actual_location_y,
|
||||
type,
|
||||
data_json,
|
||||
creator,
|
||||
@ -43,117 +47,6 @@
|
||||
tenant_id
|
||||
</sql>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="BaseResultMap">
|
||||
select
|
||||
id, position_map_id, area_id, lane_id, location_x, location_y, type, data_json, creator, create_time, updater,
|
||||
update_time, deleted, tenant_id
|
||||
from ware_position_map_item
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="positionMapId != null">
|
||||
and position_map_id = #{positionMapId}
|
||||
</if>
|
||||
<if test="areaId != null">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
<if test="laneId != null">
|
||||
and lane_id = #{laneId}
|
||||
</if>
|
||||
<if test="locationX != null and locationX != ''">
|
||||
and location_x = #{locationX}
|
||||
</if>
|
||||
<if test="locationY != null and locationY != ''">
|
||||
and location_y = #{locationY}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="dataJson != null and dataJson != ''">
|
||||
and data_json = #{dataJson}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
and creator = #{creator}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
and updater = #{updater}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
and deleted = #{deleted}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--通过实体作为筛选条件查询-->
|
||||
<select id="queryAll" resultMap="BaseResultMap">
|
||||
select
|
||||
id, position_map_id, area_id, lane_id, location_x, location_y, type, data_json, creator, create_time, updater,
|
||||
update_time, deleted, tenant_id
|
||||
from zn_wcs.ware_position_map_item
|
||||
</select>
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from ware_position_map_item
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="positionMapId != null">
|
||||
and position_map_id = #{positionMapId}
|
||||
</if>
|
||||
<if test="areaId != null">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
<if test="laneId != null">
|
||||
and lane_id = #{laneId}
|
||||
</if>
|
||||
<if test="locationX != null and locationX != ''">
|
||||
and location_x = #{locationX}
|
||||
</if>
|
||||
<if test="locationY != null and locationY != ''">
|
||||
and location_y = #{locationY}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and type = #{type}
|
||||
</if>
|
||||
<if test="dataJson != null and dataJson != ''">
|
||||
and data_json = #{dataJson}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
and creator = #{creator}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
and updater = #{updater}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
and deleted = #{deleted}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByLocationId" resultType="cn.iocoder.yudao.module.mqtt.api.task.dto.Pose2ds">
|
||||
select
|
||||
t1.location_x as x,
|
||||
@ -180,49 +73,30 @@
|
||||
and type in ('1','2')
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insertEntity" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into ware_position_map_item(position_map_id, area_id, lane_id, location_x, location_y, type, data_json,
|
||||
creator, create_time, updater, update_time, deleted, tenant_id)
|
||||
values (#{positionMapId}, #{areaId}, #{laneId}, #{locationX}, #{locationY}, #{type}, #{dataJson}, #{creator},
|
||||
#{createTime}, #{updater}, #{updateTime}, #{deleted}, #{tenantId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into ware_position_map_item(position_map_id, area_id, lane_id, location_x, location_y, type, data_json,
|
||||
creator, create_time, updater, update_time, deleted, tenant_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.positionMapId}, #{entity.areaId}, #{entity.laneId}, #{entity.locationX}, #{entity.locationY},
|
||||
#{entity.type}, #{entity.dataJson}, #{entity.creator}, #{entity.createTime}, #{entity.updater},
|
||||
#{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
|
||||
<select id="selectInWaitList"
|
||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO">
|
||||
select
|
||||
<include refid="base_sql"></include>
|
||||
from
|
||||
ware_position_map_item
|
||||
where deleted = '0'
|
||||
<foreach collection="list" item="item" index="index" open="(" close=")"
|
||||
separator=",">
|
||||
<if test="positionMapId != null">
|
||||
and position_map_id = #{positionMapId}
|
||||
</if>
|
||||
<if test="actualLocationX != null and actualLocationX != ''">
|
||||
and actual_location_x = #{actualLocationX}
|
||||
</if>
|
||||
<if test="actualLocationY != null and actualLocationY != ''">
|
||||
and actual_location_y = #{actualLocationY},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and type = #{type},
|
||||
</if>
|
||||
</foreach>
|
||||
</insert>
|
||||
</select>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into ware_position_map_item(position_map_id, area_id, lane_id, location_x, location_y, type, data_json,
|
||||
creator, create_time, updater, update_time, deleted, tenant_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.positionMapId}, #{entity.areaId}, #{entity.laneId}, #{entity.locationX}, #{entity.locationY},
|
||||
#{entity.type}, #{entity.dataJson}, #{entity.creator}, #{entity.createTime}, #{entity.updater},
|
||||
#{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
position_map_id = values(position_map_id),
|
||||
area_id = values(area_id),
|
||||
lane_id = values(lane_id),
|
||||
location_x = values(location_x),
|
||||
location_y = values(location_y),
|
||||
type = values(type),
|
||||
data_json = values(data_json),
|
||||
creator = values(creator),
|
||||
create_time = values(create_time),
|
||||
updater = values(updater),
|
||||
update_time = values(update_time),
|
||||
deleted = values(deleted),
|
||||
tenant_id = values(tenant_id)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!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.actionlog.RobotTaskDetailActionLogMapper">
|
||||
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.log.RobotTaskDetailActionLogMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
|
Loading…
Reference in New Issue
Block a user