分配任务给PP
This commit is contained in:
parent
e55ed52cee
commit
63909d1105
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 车辆尺寸
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RobotDimensionsDTO {
|
||||
@Schema(description = "AGV编号")
|
||||
private String robotNo;
|
||||
|
||||
@Schema(description = "车辆宽(单位米)")
|
||||
private String robotWide;
|
||||
|
||||
@Schema(description = "中心到车头距离(单位米)")
|
||||
private String robotCenterHeadstock;
|
||||
|
||||
@Schema(description = "中心到车尾距离(单位米)")
|
||||
private String robotCenterTail;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.task;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 任务执行顺序配置
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TaskOrderConfigDTO {
|
||||
|
||||
@Schema(description = "优先级权重")
|
||||
private Integer priority = 1;
|
||||
|
||||
@Schema(description = "创建时间权重")
|
||||
private Integer createTime = 1;
|
||||
|
||||
@Schema(description = "距离权重")
|
||||
private Integer distance = 1;
|
||||
}
|
@ -6,6 +6,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -51,4 +52,7 @@ public class TaskToPathPlanningDTO {
|
||||
@Schema(description = "能执行此任务的机器人编号, 和机器人不能行走的区域")
|
||||
private List<TaskRobotNoLimittationAreaDTO> robotNoLimitationAreaDTOS;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package cn.iododer.yudao.module.mqtt.config;
|
||||
|
||||
//import cn.iododer.yudao.module.mqtt.customer.MqttMessageListener;
|
||||
import cn.iododer.yudao.module.mqtt.enums.DefineSubTopicEnum;
|
||||
import cn.iododer.yudao.module.mqtt.service.MqttService;
|
||||
import cn.iododer.yudao.module.mqtt.service.RobotGenericsStatusServiceImpl;
|
||||
import cn.iododer.yudao.module.mqtt.service.RobotTaskStatusServiceImpl;
|
||||
import cn.iododer.yudao.module.mqtt.service.RobotStatusServiceImpl;
|
||||
import cn.iododer.yudao.module.mqtt.service.*;
|
||||
import cn.iododer.yudao.module.mqtt.util.BeanUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
@ -138,6 +135,8 @@ public class MqttFactory {
|
||||
return BeanUtils.getBean(RobotGenericsStatusServiceImpl.class);
|
||||
case ROBOT_STATUS:
|
||||
return BeanUtils.getBean(RobotStatusServiceImpl.class);
|
||||
case SYNCHRONOUS_ALL_MAP_REQUEST:
|
||||
return BeanUtils.getBean(PathPlanningInitDataServiceImpl.class);
|
||||
default :
|
||||
// case ROBOT_TASK_STATUS:
|
||||
return BeanUtils.getBean(RobotTaskStatusServiceImpl.class);
|
||||
|
@ -17,7 +17,8 @@ public enum DefineSubTopicEnum {
|
||||
//qos 0-至多1次、1-至少1次、2-正好一次
|
||||
ROBOT_STATUS("ROBOT_STATUS", 0,"点位"),
|
||||
ROBOT_TASK_STATUS("ROBOT_TASK_STATUS", 0,"机器人任务完成上报"),
|
||||
ROBOT_GENERICS_STATUS("ROBOT_GENERICS_STATUS", 0,"机器人异常");
|
||||
ROBOT_GENERICS_STATUS("ROBOT_GENERICS_STATUS", 0,"机器人异常"),
|
||||
SYNCHRONOUS_ALL_MAP_REQUEST("SYNCHRONOUS_ALL_MAP_REQUEST", 0,"路径规划需要初始数据上报");
|
||||
|
||||
|
||||
private final String topic;
|
||||
|
@ -0,0 +1,10 @@
|
||||
package cn.iododer.yudao.module.mqtt.framework.path;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.path.PathApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {PathApi.class})
|
||||
public class PathConfiguration {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iododer.yudao.module.mqtt.service;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.path.PathApi;
|
||||
import cn.iocoder.yudao.module.system.api.robot.RobotStatusApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PathPlanningInitDataServiceImpl implements MqttService{
|
||||
|
||||
@Resource
|
||||
private PathApi pathApi;
|
||||
|
||||
/**
|
||||
* 路径规划需要初始数据上报
|
||||
* @param message
|
||||
*/
|
||||
@Override
|
||||
public void analysisMessage(String message) {
|
||||
log.info("收到路径规划需要初始化数据的请求");
|
||||
pathApi.pathInitData();
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.api.path;
|
||||
|
||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 路径规划常规信息上报")
|
||||
public interface PathApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/path";
|
||||
|
||||
@PostMapping(PREFIX + "/initData")
|
||||
@Operation(summary = "路径规划需要初始化信息")
|
||||
void pathInitData();
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.system.api.path;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.path.PathPlanningService;
|
||||
import cn.iocoder.yudao.module.system.service.tool.ToolsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Slf4j
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class PathApiImpl implements PathApi {
|
||||
|
||||
@Resource
|
||||
private PathPlanningService pathPlanningService;
|
||||
|
||||
@Resource
|
||||
private ToolsService toolsService;
|
||||
|
||||
@Override
|
||||
public void pathInitData() {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
|
||||
//同步点位信息
|
||||
PositionMapSaveReqVO positionMapSaveReqVO = new PositionMapSaveReqVO();
|
||||
pathPlanningService.synchronousAllItem(positionMapSaveReqVO);
|
||||
//同步线的信息
|
||||
pathPlanningService.synchronousPoint(positionMapSaveReqVO);
|
||||
//车辆尺寸
|
||||
pathPlanningService.robotDimensions();
|
||||
//距离、优先级、时间权重
|
||||
toolsService.sendPPsortConfig();
|
||||
}
|
||||
}
|
@ -50,5 +50,15 @@ public class PathPlanningTopicConstant {
|
||||
*/
|
||||
public static String SEND_TASK_TO_PP = "SEND_TASK_TO_PP";
|
||||
|
||||
/**
|
||||
* 发送时间、优先级、距离的权重给PP
|
||||
*/
|
||||
public static String SEND_SORT_CONFIG_TO_PP = "SEND_SORT_CONFIG_TO_PP";
|
||||
|
||||
/**
|
||||
* 发送车辆编号对应的车宽、中心与车头距离、中心与车尾距离给PP
|
||||
*/
|
||||
public static String SEND_ROBOT_DIMENSIONS = "SEND_ROBOT_DIMENSIONS";
|
||||
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMa
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotInformationSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.path.PathPlanningService;
|
||||
import cn.iocoder.yudao.module.system.service.tool.ToolsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -18,7 +19,7 @@ import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 同步信息给路径规划")
|
||||
@Tag(name = "管理后台 - 路径规划")
|
||||
@RestController
|
||||
@RequestMapping("/system/path/planning")
|
||||
@Validated
|
||||
@ -27,6 +28,9 @@ public class PathPlanningController {
|
||||
@Resource
|
||||
private PathPlanningService pathPlanningService;
|
||||
|
||||
@Resource
|
||||
private ToolsService toolsService;
|
||||
|
||||
@PostMapping("/line/all")
|
||||
@Operation(summary = "同步ware_position_map_line的点位信息")
|
||||
@PreAuthorize("@ss.hasPermission('robot:information:synchronousPoint')")
|
||||
@ -91,4 +95,16 @@ public class PathPlanningController {
|
||||
return success("同步完成");
|
||||
}
|
||||
|
||||
@PostMapping("/sortConfig")
|
||||
@Operation(summary = "发送时间、优先级、距离的权重给PP")
|
||||
public CommonResult<String> sortConfig() {
|
||||
return success(toolsService.sendPPsortConfig());
|
||||
}
|
||||
|
||||
@PostMapping("/robot/dimensions")
|
||||
@Operation(summary = "发送车辆编号对应的车宽、中心与车头距离、中心与车尾距离给PP")
|
||||
public CommonResult<String> robotDimensions() {
|
||||
pathPlanningService.robotDimensions();
|
||||
return success("同步完成");
|
||||
}
|
||||
}
|
||||
|
@ -33,4 +33,13 @@ public class RobotModelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "是否自动充电(0:手动充电,1:自动充电)")
|
||||
private Integer chargeType;
|
||||
|
||||
@Schema(description = "车辆宽(单位米)")
|
||||
private String robotWide;
|
||||
|
||||
@Schema(description = "中心到车头距离(单位米)")
|
||||
private String robotCenterHeadstock;
|
||||
|
||||
@Schema(description = "中心到车尾距离(单位米)")
|
||||
private String robotCenterTail;
|
||||
}
|
@ -35,4 +35,13 @@ public class RobotModelRespVO {
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "车辆宽(单位米)")
|
||||
private String robotWide;
|
||||
|
||||
@Schema(description = "中心到车头距离(单位米)")
|
||||
private String robotCenterHeadstock;
|
||||
|
||||
@Schema(description = "中心到车尾距离(单位米)")
|
||||
private String robotCenterTail;
|
||||
|
||||
}
|
@ -25,4 +25,13 @@ public class RobotModelSaveReqVO {
|
||||
@Schema(description = "是否自动充电(0:手动充电,1:自动充电)")
|
||||
private Integer chargeType;
|
||||
|
||||
@Schema(description = "车辆宽(单位米)")
|
||||
private String robotWide;
|
||||
|
||||
@Schema(description = "中心到车头距离(单位米)")
|
||||
private String robotCenterHeadstock;
|
||||
|
||||
@Schema(description = "中心到车尾距离(单位米)")
|
||||
private String robotCenterTail;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.tool;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.service.tool.ToolsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 工具类(限技术人员使用)")
|
||||
@RestController
|
||||
@RequestMapping("/system/tools")
|
||||
@Validated
|
||||
public class ToolsController {
|
||||
|
||||
|
||||
|
||||
}
|
@ -47,4 +47,19 @@ public class RobotModelDO extends BaseDO {
|
||||
*/
|
||||
private Integer chargeType;
|
||||
|
||||
/**
|
||||
* 车辆宽(单位米)
|
||||
*/
|
||||
private String robotWide;
|
||||
|
||||
/**
|
||||
* 中心到车头距离(单位米)
|
||||
*/
|
||||
private String robotCenterHeadstock;
|
||||
|
||||
/**
|
||||
* 中心到车尾距离(单位米)
|
||||
*/
|
||||
private String robotCenterTail;
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.RobotDimensionsDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotInformationPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotInformationStatisticsVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
@ -68,4 +69,10 @@ public interface RobotInformationMapper extends BaseMapperX<RobotInformationDO>
|
||||
* @param robotStatus
|
||||
*/
|
||||
void updateRobotListStatus(@Param("robotNos") Set<String> robotNos, @Param("robotStatus") Integer robotStatus);
|
||||
|
||||
/**
|
||||
* 查询车辆尺寸
|
||||
* @return
|
||||
*/
|
||||
List<RobotDimensionsDTO> selectRobotDimensions();
|
||||
}
|
@ -10,7 +10,8 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CommandConfigTypeEnum {
|
||||
CHARG_CONFIG(1,"充电设置(页面)");
|
||||
CHARG_CONFIG(1,"充电设置(页面)"),
|
||||
PP_WEIGHT_CONFIG(2,"PP任务执行权重配置");
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.config.CommandConfigTypeEnum;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -47,7 +48,7 @@ public class CommonConfigServiceImpl implements CommonConfigService {
|
||||
// 插入
|
||||
CommonConfigDO config = BeanUtils.toBean(createReqVO, CommonConfigDO.class);
|
||||
|
||||
if (ZeroOneEnum.ONE.getType().equals(config.getConfigType())) {
|
||||
if (CommandConfigTypeEnum.CHARG_CONFIG.getType().equals(config.getConfigType())) {
|
||||
CommonConfigVO chargeConfig = JSONUtil.toBean(config.getConfigStr(), CommonConfigVO.class);
|
||||
//一次
|
||||
if (ZeroOneEnum.ZERO.getType().equals(chargeConfig.getEveryDay())
|
||||
@ -106,7 +107,7 @@ public class CommonConfigServiceImpl implements CommonConfigService {
|
||||
// 更新
|
||||
CommonConfigDO updateObj = BeanUtils.toBean(updateReqVO, CommonConfigDO.class);
|
||||
|
||||
if (ZeroOneEnum.ONE.getType().equals(updateReqVO.getConfigType())) {
|
||||
if (CommandConfigTypeEnum.CHARG_CONFIG.getType().equals(updateReqVO.getConfigType())) {
|
||||
CommonConfigVO chargeConfig = JSONUtil.toBean(updateReqVO.getConfigStr(), CommonConfigVO.class);
|
||||
//一次
|
||||
if (ZeroOneEnum.ZERO.getType().equals(chargeConfig.getEveryDay())
|
||||
|
@ -21,4 +21,6 @@ public interface PathPlanningService {
|
||||
void synchronousItemDelete(PositionMapItemSaveReqVO positionMapItemSaveReqVO);
|
||||
|
||||
void synchronousItemUpdate(PositionMapItemSaveReqVO positionMapItemSaveReqVO);
|
||||
|
||||
void robotDimensions();
|
||||
}
|
||||
|
@ -3,10 +3,7 @@ package cn.iocoder.yudao.module.system.service.path;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionMapItemPathDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionMapItemSynDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionMapLineDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionMapLinePathDTO;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.dto.*;
|
||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapLineSaveReqVO;
|
||||
@ -14,9 +11,11 @@ import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMa
|
||||
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.positionmap.PositionMapLineDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapItemMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapLineMapper;
|
||||
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.enums.line.DirectionEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.path.PathTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -57,6 +56,9 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
@Resource
|
||||
private PositionMapItemMapper positionMapItemMapper;
|
||||
|
||||
@Resource
|
||||
private RobotInformationMapper informationMapper;
|
||||
|
||||
/**
|
||||
* 同步ware_position_map_line的点位信息
|
||||
*/
|
||||
@ -350,6 +352,12 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
pathPlanningApi.synchronousLineObject(PositionMapItemPathDTO, PathPlanningTopicConstant.UPDATE_MAP_NODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void robotDimensions() {
|
||||
List<RobotDimensionsDTO> list = informationMapper.selectRobotDimensions();
|
||||
pathPlanningApi.synchronousLineObject(list, PathPlanningTopicConstant.SEND_ROBOT_DIMENSIONS);
|
||||
}
|
||||
|
||||
public PositionMapLineDTO setPositionMapLineDTOData(PositionMapLineDTO positionMapLineDO) {
|
||||
PositionMapLineDTO build = PositionMapLineDTO.builder()
|
||||
.id(positionMapLineDO.getId())
|
||||
|
@ -17,7 +17,6 @@ import cn.iocoder.yudao.module.system.constant.robot.RobotTopicConstant;
|
||||
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.robot.RobotInformationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
|
||||
@ -167,6 +166,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
.id(taskDetailDO.getId())
|
||||
.type(TaskTypeEnum.TASK.getType())
|
||||
.priority(taskDetailDO.getPriority())
|
||||
.createTime(taskDetailDO.getCreateTime())
|
||||
.build();
|
||||
|
||||
//能执行此任务的机器人 和 不能走的区域
|
||||
@ -214,6 +214,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(pathPlanningList)) {
|
||||
log.info("任务下发给PP :{}", JSON.toJSONString(pathPlanningList));
|
||||
pathPlanningApi.synchronousLineObject(pathPlanningList, PathPlanningTopicConstant.SEND_TASK_TO_PP);
|
||||
}
|
||||
}
|
||||
@ -312,40 +313,48 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
.collect(Collectors.groupingBy(RobotTaskDetailDO::getToLaneId,
|
||||
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)), Optional::get)));
|
||||
|
||||
//取货点位
|
||||
Map<Long, RobotTaskDetailDO> fromLocationMap = detailDOS.stream()
|
||||
.filter(v -> ObjectUtil.isEmpty(v.getFromLaneId()) && ObjectUtil.isNotEmpty(v.getFromMapId()))
|
||||
//取货点位--最小
|
||||
Map<Long, Long> fromLocationMap = detailDOS.stream()
|
||||
.filter(v -> ObjectUtil.isNotEmpty(v.getFromMapId()))
|
||||
.collect(Collectors.groupingBy(RobotTaskDetailDO::getFromMapId,
|
||||
Collectors.collectingAndThen(Collectors.minBy(Comparator.comparingLong(RobotTaskDetailDO::getFromLocationNumber)), Optional::get)));
|
||||
Collectors.collectingAndThen(Collectors.minBy(Comparator.comparingLong(RobotTaskDetailDO::getFromLocationNumber)),
|
||||
a -> a.isPresent() ? a.get().getFromLocationNumber() : null)));
|
||||
|
||||
//放货点位
|
||||
Map<Long, RobotTaskDetailDO> toLocationMap = detailDOS.stream()
|
||||
.filter(v -> ObjectUtil.isEmpty(v.getToLaneId()) && ObjectUtil.isNotEmpty(v.getToMapId()))
|
||||
//放货点位--最大
|
||||
Map<Long, Long> toLocationMap = detailDOS.stream()
|
||||
.filter(v -> ObjectUtil.isNotEmpty(v.getToMapId()))
|
||||
.collect(Collectors.groupingBy(RobotTaskDetailDO::getToMapId,
|
||||
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)), Optional::get)));
|
||||
Collectors.collectingAndThen(Collectors.maxBy(Comparator.comparingLong(RobotTaskDetailDO::getToLocationNumber)),
|
||||
a -> a.isPresent() ? a.get().getToLocationNumber() : null)));
|
||||
|
||||
//返回的数据
|
||||
List<RobotTaskDetailDO> list = new ArrayList<>();
|
||||
for (RobotTaskDetailDO v : detailDOS) {
|
||||
RobotTaskDetailDO fromLane = ObjectUtil.isNotEmpty(v.getFromLaneId()) ? fromLaneMap.get(v.getFromLaneId()) : null;
|
||||
RobotTaskDetailDO toLane = ObjectUtil.isNotEmpty(v.getToLaneId()) ? toLaneMap.get(v.getToLaneId()) : null;
|
||||
RobotTaskDetailDO fromLocation = ObjectUtil.isNotEmpty(v.getFromMapId()) ? fromLocationMap.get(v.getFromMapId()) : null;
|
||||
RobotTaskDetailDO toLocation = ObjectUtil.isNotEmpty(v.getToMapId()) ? toLocationMap.get(v.getToMapId()) : null;
|
||||
Long fromLocation = ObjectUtil.isNotEmpty(v.getFromMapId()) ? fromLocationMap.get(v.getFromMapId()) : null;
|
||||
Long toLocation = ObjectUtil.isNotEmpty(v.getToMapId()) ? toLocationMap.get(v.getToMapId()) : null;
|
||||
//校验放货线库,有取的任务
|
||||
RobotTaskDetailDO fromLaneDoRelease = ObjectUtil.isNotEmpty(v.getToLaneId()) ? fromLaneMap.get(v.getToLaneId()) : null;
|
||||
//校验放的普通库位,有取的任务
|
||||
Long toHaveFrom = ObjectUtil.isNotEmpty(v.getToMapId()) ? fromLocationMap.get(v.getToMapId()) : null;
|
||||
//校验取货库位,有放的任务
|
||||
Long fromHaveTo = ObjectUtil.isNotEmpty(v.getFromMapId()) ? toLocationMap.get(v.getFromMapId()) : null;
|
||||
|
||||
//取放模式
|
||||
if (RobotTaskTypeEnum.TAKE_RELEASE.getType().equals(v.getTaskType())) {
|
||||
takeReleaseSetTask(list, v, fromLane, toLane, fromLocation, toLocation);
|
||||
takeReleaseSetTask(list, v, fromLane, toLane, fromLocation, toLocation, fromLaneDoRelease, toHaveFrom, fromHaveTo);
|
||||
} else if (RobotTaskTypeEnum.MOVE.getType().equals(v.getTaskType())
|
||||
|| RobotTaskTypeEnum.RELEASE.getType().equals(v.getTaskType())) {
|
||||
//移动和仅放货
|
||||
moveSetTask(list, v, fromLane, toLane, fromLocation, toLocation);
|
||||
moveSetTask(list, v, fromLane, toLane, fromLocation, toLocation, toHaveFrom, fromHaveTo,fromLaneDoRelease);
|
||||
} else if (RobotTaskTypeEnum.TAKE.getType().equals(v.getTaskType())) {
|
||||
//仅取货
|
||||
takeSetTask(list, v, fromLane, toLane, fromLocation, toLocation);
|
||||
takeSetTask(list, v, fromLane, toLane, fromLocation, toLocation, toHaveFrom, fromHaveTo);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("---------处理:一个点位/线库 只派一台车 结束-------------");
|
||||
log.info("---------处理:一个点位/线库 只派一台车 结束------------- :{}", JSON.toJSONString(list));
|
||||
|
||||
return list;
|
||||
}
|
||||
@ -362,9 +371,15 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
* @param toLocation
|
||||
*/
|
||||
private void takeSetTask(List<RobotTaskDetailDO> list, RobotTaskDetailDO v, RobotTaskDetailDO fromLane,
|
||||
RobotTaskDetailDO toLane, RobotTaskDetailDO fromLocation, RobotTaskDetailDO toLocation) {
|
||||
RobotTaskDetailDO toLane, Long fromLocation, Long toLocation,
|
||||
Long toHaveFrom, Long fromHaveTo) {
|
||||
|
||||
if (!(ObjectUtil.isNotEmpty(fromLocation) && fromLocation.getFromLocationNumber().equals(v.getFromLocationNumber()))) {
|
||||
if (ObjectUtil.isNotEmpty(fromHaveTo) && fromHaveTo < v.getFromLocationNumber()) {
|
||||
log.info("下发任务给PP--仅取货任务--取货点有放货任务 :{}", v.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(ObjectUtil.isNotEmpty(fromLocation) && fromLocation.equals(v.getFromLocationNumber()))) {
|
||||
log.info("下发任务给PP--仅取货--排序不符合 :{}", v.getId());
|
||||
return;
|
||||
}
|
||||
@ -389,16 +404,23 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
*/
|
||||
private void moveSetTask(List<RobotTaskDetailDO> list, RobotTaskDetailDO v, RobotTaskDetailDO fromLane,
|
||||
RobotTaskDetailDO toLane,
|
||||
RobotTaskDetailDO fromLocation, RobotTaskDetailDO toLocation) {
|
||||
Long fromLocation, Long toLocation, Long toHaveFrom,
|
||||
Long fromHaveTo,RobotTaskDetailDO fromLaneDoRelease) {
|
||||
|
||||
if (!(ObjectUtil.isNotEmpty(toLocation) && toLocation.getToLocationNumber().equals(v.getToLocationNumber()))) {
|
||||
if (ObjectUtil.isNotEmpty(toHaveFrom) && toHaveFrom < v.getToLocationNumber()) {
|
||||
log.info("下发任务给PP--移动/仅放任务--放货点有取货任务 :{}", v.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(ObjectUtil.isNotEmpty(toLocation) && toLocation.equals(v.getToLocationNumber()))) {
|
||||
log.info("下发任务给PP--移动任务--排序不符合 :{}", v.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
//终点是线库
|
||||
if (ObjectUtil.isNotEmpty(v.getToLaneId()) && ObjectUtil.isNotEmpty(toLane)
|
||||
&& toLane.getToLocationNumber().equals(v.getToLocationNumber())) {
|
||||
&& toLane.getToLocationNumber().equals(v.getToLocationNumber())
|
||||
&& ObjectUtil.isEmpty(fromLaneDoRelease)) {
|
||||
list.add(v);
|
||||
|
||||
//终点是普通库位
|
||||
@ -410,16 +432,23 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
|
||||
/**
|
||||
* 取放,设置任务
|
||||
*
|
||||
* @param list
|
||||
* @param v
|
||||
*/
|
||||
private void takeReleaseSetTask(List<RobotTaskDetailDO> list, RobotTaskDetailDO v, RobotTaskDetailDO fromLane, RobotTaskDetailDO toLane,
|
||||
RobotTaskDetailDO fromLocation, RobotTaskDetailDO toLocation) {
|
||||
private void takeReleaseSetTask(List<RobotTaskDetailDO> list, RobotTaskDetailDO v, RobotTaskDetailDO fromLane,
|
||||
RobotTaskDetailDO toLane, Long fromLocation, Long toLocation,
|
||||
RobotTaskDetailDO fromLaneDoRelease, Long toHaveFrom,
|
||||
Long fromHaveTo) {
|
||||
|
||||
if (ObjectUtil.isNotEmpty(toHaveFrom) && toHaveFrom < v.getToLocationNumber()) {
|
||||
log.info("下发任务给PP--取放任务--放货点有取货任务 :{}", v.getId());
|
||||
return;
|
||||
|
||||
if (!(ObjectUtil.isNotEmpty(fromLocation) && fromLocation.getFromLocationNumber().equals(v.getFromLocationNumber())
|
||||
&& ObjectUtil.isNotEmpty(toLocation) && toLocation.getToLocationNumber().equals(v.getToLocationNumber()))) {
|
||||
} else if (ObjectUtil.isNotEmpty(fromHaveTo) && fromHaveTo < v.getFromLocationNumber()) {
|
||||
log.info("下发任务给PP--取放任务--取货点有放货任务 :{}", v.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(ObjectUtil.isNotEmpty(fromLocation) && fromLocation.equals(v.getFromLocationNumber())
|
||||
&& ObjectUtil.isNotEmpty(toLocation) && toLocation.equals(v.getToLocationNumber()))) {
|
||||
log.info("下发任务给PP--取放任务--取/放的排序不符合 :{}", v.getId());
|
||||
return;
|
||||
}
|
||||
@ -429,7 +458,13 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
&& fromLane.getFromLocationNumber().equals(v.getFromLocationNumber())
|
||||
&& ObjectUtil.isNotEmpty(toLane)
|
||||
&& toLane.getToLocationNumber().equals(v.getToLocationNumber())) {
|
||||
list.add(v);
|
||||
|
||||
if (v.getFromLaneId().equals(v.getToLaneId())) {
|
||||
list.add(v);
|
||||
} else if (ObjectUtil.isEmpty(fromLaneDoRelease)) {
|
||||
//放货的线库,有取的任务,先不进行放
|
||||
list.add(v);
|
||||
}
|
||||
|
||||
//取是线库,放是点位
|
||||
} else if (ObjectUtil.isNotEmpty(v.getFromLaneId()) && ObjectUtil.isEmpty(v.getToLaneId())
|
||||
@ -440,7 +475,8 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
//取是点位,放是线库
|
||||
} else if (ObjectUtil.isEmpty(v.getFromLaneId()) && ObjectUtil.isNotEmpty(v.getToLaneId())
|
||||
&& ObjectUtil.isNotEmpty(toLane)
|
||||
&& toLane.getToLocationNumber().equals(v.getToLocationNumber())) {
|
||||
&& toLane.getToLocationNumber().equals(v.getToLocationNumber())
|
||||
&& ObjectUtil.isEmpty(fromLaneDoRelease)) {
|
||||
list.add(v);
|
||||
|
||||
//取放都是点位
|
||||
|
@ -0,0 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.service.tool;
|
||||
|
||||
public interface ToolsService {
|
||||
String sendPPsortConfig();
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.system.service.tool;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
|
||||
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskOrderConfigDTO;
|
||||
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.config.CommonConfigDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.config.CommonConfigMapper;
|
||||
import cn.iocoder.yudao.module.system.enums.config.CommandConfigTypeEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Validated
|
||||
public class ToolsServiceImpl implements ToolsService {
|
||||
|
||||
@Resource
|
||||
private PathPlanningApi pathPlanningApi;
|
||||
|
||||
@Resource
|
||||
private CommonConfigMapper configMapper;
|
||||
|
||||
/**
|
||||
* 发送时间、优先级、距离的权重给PP
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String sendPPsortConfig() {
|
||||
|
||||
CommonConfigDO commonConfigDO = configMapper.selectOne(new LambdaQueryWrapper<CommonConfigDO>()
|
||||
.eq(CommonConfigDO::getConfigType, CommandConfigTypeEnum.PP_WEIGHT_CONFIG.getType()));
|
||||
TaskOrderConfigDTO taskOrderConfigDTO =null;
|
||||
if (ObjectUtil.isEmpty(commonConfigDO)) {
|
||||
taskOrderConfigDTO = new TaskOrderConfigDTO();
|
||||
} else {
|
||||
taskOrderConfigDTO = JSONUtil.toBean(commonConfigDO.getConfigStr(), TaskOrderConfigDTO.class);
|
||||
}
|
||||
|
||||
pathPlanningApi.synchronousLineObject(taskOrderConfigDTO, PathPlanningTopicConstant.SEND_SORT_CONFIG_TO_PP);
|
||||
|
||||
return "发送数据库权重配置成功";
|
||||
}
|
||||
}
|
@ -298,4 +298,16 @@
|
||||
#{robotNo}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectRobotDimensions"
|
||||
resultType="cn.iocoder.yudao.module.mqtt.api.path.dto.RobotDimensionsDTO">
|
||||
SELECT
|
||||
t1.robot_no AS robotNo,
|
||||
t2.robot_wide AS robotWide,
|
||||
t2.robot_center_headstock AS robotCenterHeadstock,
|
||||
t2.robot_center_tail AS robotCenterTail
|
||||
FROM
|
||||
robot_information t1
|
||||
LEFT JOIN robot_model t2 ON t1.robot_model_id = t2.id
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user