This commit is contained in:
aikai 2025-03-18 10:26:59 +08:00
commit 268deceb22
19 changed files with 228 additions and 53 deletions

View File

@ -35,7 +35,7 @@ mqtt:
host: tcp://127.0.0.1:1883
username: adminuser
password: adminuser
qos: 0
qos: 2
clientId: mqttx_b82345a52
maxInflight: 10
timeout: 10

View File

@ -13,5 +13,5 @@ public class RobotStatusCodeConstant {
public static Boolean CARGO_DETECTED = true;
//true表示可以做任务如果是到达了充电点正在充电中应该返回true
public static Boolean TASK_STATUS_RUNNING = true;
public static Boolean CAN_DO_TASK = true;
}

View File

@ -3,4 +3,8 @@ package cn.iocoder.yudao.module.system.constant.webSocket;
public class WebSocketConstant {
//webSocket推送给前端的告警信息key
public static String AGV_WARN = "agv_warn";
/**
* webSocket推送给站内信息key
*/
public static String STATION_WARN = "station_warn";
}

View File

@ -94,4 +94,19 @@ public class RobotWarnMsgController {
BeanUtils.toBean(list, RobotWarnMsgRespVO.class));
}
@GetMapping("/readPage")
@Operation(summary = "获得机器人告警信息分页")
@PreAuthorize("@ss.hasPermission('robot:warn-msg:readPage')")
public CommonResult<List<RobotWarnMsgRespVO>> getReadPage() {
List<RobotWarnMsgDO> readPage = warnMsgService.getReadPage();
return success(BeanUtils.toBean(readPage, RobotWarnMsgRespVO.class));
}
@PostMapping("/allRead")
@Operation(summary = "全部标记为已读")
@PreAuthorize("@ss.hasPermission('robot:warn-msg:allRead')")
public CommonResult<String> allRead() {
return success(warnMsgService.allRead());
}
}

View File

@ -41,4 +41,10 @@ public class RobotWarnMsgPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "是否已读(0:未读, 1:已读)")
private Integer readStatus;
@Schema(description = "阅读时间")
private LocalDateTime readTime;
}

View File

@ -48,4 +48,12 @@ public class RobotWarnMsgRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "是否已读(0:未读, 1:已读)")
@ExcelProperty("是否已读(0:未读, 1:已读)")
private Integer readStatus;
@Schema(description = "阅读时间")
@ExcelProperty("阅读时间")
private LocalDateTime readTime;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.controller.admin.robot.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -36,4 +37,10 @@ public class RobotWarnMsgSaveReqVO {
@NotNull(message = "结束时间不能为空")
private LocalDateTime solveTime;
@Schema(description = "是否已读(0:未读, 1:已读)")
private Integer readStatus;
@Schema(description = "阅读时间")
private LocalDateTime readTime;
}

View File

@ -56,5 +56,13 @@ public class RobotWarnMsgDO extends BaseDO {
* 结束时间
*/
private LocalDateTime solveTime;
/**
* 是否已读(0:未读, 1:已读)
*/
private Integer readStatus;
/**
* 阅读时间
*/
private LocalDateTime readTime;
}

View File

@ -41,12 +41,6 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
.orderByDesc(RobotTaskDetailDO::getId));
}
/**
* 添加
* @param taskDetailList
*/
void insertBatchList(@Param("taskDetailList") List<RobotTaskDetailAddVO> taskDetailList);
/**
* 查询未完成的库位任务
* @param stockLocationIds
@ -109,4 +103,10 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
* @return
*/
List<RobotTaskDetailDO> selectAutoCreateCycleTask();
/**
* 机器人最后做的任务
* @return
*/
List<RobotTaskDetailDO> getLastTaskGroupByRobotNo();
}

View File

@ -21,6 +21,7 @@ public interface RobotWarnMsgMapper extends BaseMapperX<RobotWarnMsgDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<RobotWarnMsgDO>()
.eqIfPresent(RobotWarnMsgDO::getRobotNo, reqVO.getRobotNo())
.eqIfPresent(RobotWarnMsgDO::getWarnLevel, reqVO.getWarnLevel())
.eqIfPresent(RobotWarnMsgDO::getReadStatus, reqVO.getReadStatus())
.likeIfPresent(RobotWarnMsgDO::getWarnCode, reqVO.getWarnCode())
.eqIfPresent(RobotWarnMsgDO::getWarnMsg, reqVO.getWarnMsg())
.eqIfPresent(RobotWarnMsgDO::getWarnSolve, reqVO.getWarnSolve())
@ -29,4 +30,14 @@ public interface RobotWarnMsgMapper extends BaseMapperX<RobotWarnMsgDO> {
.orderByDesc(RobotWarnMsgDO::getId));
}
default PageResult<RobotWarnMsgDO> selectReadPage(RobotWarnMsgPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<RobotWarnMsgDO>()
.eqIfPresent(RobotWarnMsgDO::getReadStatus, reqVO.getReadStatus())
.orderByDesc(RobotWarnMsgDO::getCreateTime));
}
/**
* 全部标记为已读
*/
void updateAllRead();
}

View File

@ -9,13 +9,13 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum RobotStatusEnum {
NO_TASK_STOP(0),//暂停且无任务
STOP(1),//暂停且有处理中的任务
DOING(2), //任务中
STAND_BY(3), //待命
CHARGE(4); //充电中
LAST_TASK_IS_TAKE(1,"上一个任务是仅取货(这是一个过渡状态,数据库没有这种状态)"),
DOING(2,"任务中"),
STAND_BY(3,"待命"),
CHARGE(4,"充电中");
/**
* 类型
*/
private final Integer type;
private final String msg;
}

View File

@ -148,7 +148,7 @@ public class RobotJob {
/**
* 维护车机心跳
*/
@XxlJob("RcsHeartBeat")
// @XxlJob("RcsHeartBeat")
@TenantJob
public void rcsHeartBeat() {

View File

@ -61,4 +61,8 @@ public interface RobotWarnMsgService extends IService<RobotWarnMsgDO> {
* @param message
*/
void addWarnMsg(String message);
List<RobotWarnMsgDO> getReadPage();
String allRead();
}

View File

@ -5,15 +5,19 @@ import cn.hutool.json.JSONUtil;
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.infra.api.websocket.WebSocketSenderApi;
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;
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnMsgSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnMsgDO;
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapMapper;
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnMsgMapper;
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
import cn.iocoder.yudao.module.system.enums.robot.RobotWarnType;
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -46,6 +50,9 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
@Resource
public WebSocketSenderApi webSocketSenderApi;
@Resource
private UserOperationLogService userOperationLogService;
@Override
public Long createWarnMsg(RobotWarnMsgSaveReqVO createReqVO) {
// 插入
@ -62,6 +69,10 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
// 更新
RobotWarnMsgDO updateObj = BeanUtils.toBean(updateReqVO, RobotWarnMsgDO.class);
warnMsgMapper.updateById(updateObj);
UserOperationLogSaveReqVO operationLog = UserOperationLogSaveReqVO.builder().operateAction("查看告警信息: " + updateObj.getWarnMsg())
.nickName(SecurityFrameworkUtils.getLoginUserNickname()).build();
userOperationLogService.createUserOperationLog(operationLog);
}
@Override
@ -99,6 +110,7 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
webSocketSenderApi.sendObject(positionMapDO.getFloor() + "_" + positionMapDO.getArea(),
WebSocketConstant.AGV_WARN, JSONUtil.toJsonStr(errorMsg));
}
}
@Override
@ -113,4 +125,19 @@ public class RobotWarnMsgServiceImpl extends ServiceImpl<RobotWarnMsgMapper, Rob
warnMsgMapper.insert(warnMsg);
}
@Override
public List<RobotWarnMsgDO> getReadPage() {
RobotWarnMsgPageReqVO pageReqVO = new RobotWarnMsgPageReqVO();
pageReqVO.setPageSize(10);
pageReqVO.setPageNo(0);
pageReqVO.setReadStatus(ZeroOneEnum.ZERO.getType());
return warnMsgMapper.selectReadPage(pageReqVO).getList();
}
@Override
public String allRead() {
warnMsgMapper.updateAllRead();
return "更新成功";
}
}

View File

@ -4,7 +4,6 @@ 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.task.RobotTaskApi;
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;
@ -14,8 +13,6 @@ 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;
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapItemMapper;
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;
@ -40,6 +37,8 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
@ -92,19 +91,32 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
return pair;
}
//机器人最后做的任务
List<RobotTaskDetailDO> lastTaskDetails = robotTaskDetailMapper.getLastTaskGroupByRobotNo();
Map<String, RobotTaskDetailDO> lastTaskDetailMap = null;
if (ObjectUtil.isNotEmpty(lastTaskDetails)) {
lastTaskDetailMap = lastTaskDetails.stream().collect(Collectors.toMap(v -> v.getRobotNo(), Function.identity()));
}
for (RobotInformationDO robot : robots) {
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.CAN_DO_TASK.equals(Boolean.parseBoolean(String.valueOf(taskStatus)))) {
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
log.info("车机上报不允许接任务 :{}",robot.getRobotNo());
continue;
}
Object cargoDetected = redisUtil.get(cargoDetectedKey);
// todo 后续需要判断(新建个任务明细表)如果上一条任务是仅取货且正常完成 则能进行仅放货的任务
if (ObjectUtil.isNotEmpty(lastTaskDetailMap) && ObjectUtil.isNotEmpty(lastTaskDetailMap.get(robot.getRobotNo()))) {
robot.setRobotStatus(RobotStatusEnum.LAST_TASK_IS_TAKE.getType());
continue;
}
if (ObjectUtil.isEmpty(cargoDetected) || RobotStatusCodeConstant.CARGO_DETECTED.equals(Boolean.parseBoolean(String.valueOf(cargoDetected)))) {
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
log.info("车机上报传感器被按下--不允许接任务 :{}",robot.getRobotNo());
continue;
}
//自动充电的车子电量到达设定的阀值也能执行任务
@ -115,11 +127,12 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
}
robots = robots.stream()
.filter(v -> RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus()))
.filter(v -> (RobotStatusEnum.STAND_BY.getType().equals(v.getRobotStatus())
|| RobotStatusEnum.LAST_TASK_IS_TAKE.getType().equals(v.getRobotStatus())))
.collect(Collectors.toList());
if (robots.isEmpty()) {
log.info("暂无可用的机器人,可能正在充电,可能机器人有任务");
log.info("暂无可用的机器人,可能正在充电,可能车机上报不允许接任务");
return pair;
}
@ -147,13 +160,13 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
return pair;
}
List<RobotTaskDetailDO> taskDetailDOS = getTaskDetail(montageTaskIds, singleTaskIds);
List<RobotTaskDetailDO> taskDetails = getTaskDetail(montageTaskIds, singleTaskIds);
if (taskDetailDOS.isEmpty()) {
if (taskDetails.isEmpty()) {
log.info("暂无需要处理的明细任务");
return pair;
}
return ImmutablePair.of(robots, taskDetailDOS);
return ImmutablePair.of(robots, taskDetails);
}
/**
@ -220,6 +233,8 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
if (robotRemainingElectricity.compareTo(robotEndElectricity) >= 0) {
robot.setRobotStatus(RobotStatusEnum.STAND_BY.getType());
}else {
log.info("机器人正在充电,还没达到充电设置的电量,暂不能接任务:{} ", robot.getRobotNo());
}
}

View File

@ -129,7 +129,7 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
@Override
@Transactional(rollbackFor = Exception.class)
public void distributeAutoMoveJob() {
TenantContextHolder.setTenantId(1L);
/*TenantContextHolder.setTenantId(1L);
//todo 有循环的任务是否要关闭自动移库的功能.做成配置
if (!cycleDoAutoMove) {
@ -193,7 +193,7 @@ public class RobotTaskAutoMoveServiceImpl implements RobotTaskAutoMoveService {
List<List<Long>> fromPartition = Lists.partition(locationIds, 100);
fromPartition.forEach(list-> {
// locationMapper.updateLocationLockList(list,0l,LocationLockEnum.NO.getType());
});
});*/
// todo 搬运任务下发给机器人

View File

@ -8,7 +8,6 @@ import cn.iocoder.yudao.module.mqtt.api.path.PathPlanningApi;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskLimitationAreaDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskRobotNoLimittationAreaDTO;
import cn.iocoder.yudao.module.mqtt.api.path.task.TaskToPathPlanningDTO;
import cn.iocoder.yudao.module.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;
@ -20,13 +19,10 @@ 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;
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.dal.mysql.wait.MoveToWaitMapper;
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
import cn.iocoder.yudao.module.system.enums.item.PositionMapItemEnum;
@ -39,6 +35,7 @@ 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;
@ -132,6 +129,14 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
*/
private void moveRobotToWait(List<RobotInformationDO> robots) {
robots = robots.stream()
.filter(v -> !v.getRobotStatus().equals(RobotStatusEnum.STAND_BY.getType()))
.collect(Collectors.toList());
if (ObjectUtil.isEmpty(robots)) {
log.info("------没有空闲的机器人可以去等待点-----");
return;
}
List<PositionMapItemDO> positionMapItems = positionMapItemMapper.selectList(new LambdaQueryWrapperX<PositionMapItemDO>()
.eq(PositionMapItemDO::getType, PositionMapItemEnum.STOP.getType())
.eq(PositionMapItemDO::getUseStatus, ZeroOneEnum.ZERO.getType()));
@ -332,15 +337,16 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
List<WareHouseLocationDO> locations = locationMapper.selectList(new LambdaQueryWrapperX<WareHouseLocationDO>()
.in(WareHouseLocationDO::getId, locationIds));
Map<Long, WareHouseLocationDO> locationDOMap =
locations.stream().collect(Collectors.toMap(v -> v.getId(), Function.identity()));
//能执行此任务的机器人 不能走的区域
List<TaskRobotNoLimittationAreaDTO> robotNoLimitationArea = getRobotNoLimitationArea(robots);
Pair<List<TaskRobotNoLimittationAreaDTO>, Map<String, TaskRobotNoLimittationAreaDTO>> pair = getRobotLimitationArea(robots);
Map<String, TaskRobotNoLimittationAreaDTO> robotDoReleaseMap = pair.getRight();
List<TaskRobotNoLimittationAreaDTO> robotNoLimitationArea = pair.getLeft();
Map<String, TaskRobotNoLimittationAreaDTO> robotNoLimittationAreaDTOMap =
robotNoLimitationArea.stream().collect(Collectors.toMap(v -> v.getRobotNo(), Function.identity()));
//前一个任务是仅取货
List<String> robotDoTake = getRobotDoTake(robots);
log.info("开始组装需要下发给PP的任务");
for (RobotTaskDetailDO taskDetailDO : taskDetailDOS) {
@ -354,12 +360,19 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
.createTime(taskDetailDO.getCreateTime())
.build();
if (ObjectUtil.isNotEmpty(robotDoTake) && ObjectUtil.isNotEmpty(taskDetailDO.getRobotNo())
&& robotDoTake.contains(taskDetailDO.getRobotNo())
&& !RobotTaskTypeEnum.RELEASE.getType().equals(taskDetailDO.getTaskType())) {
log.info("机器人前一个任务是仅取货,当前任务非仅放货,所以当前任务不执行 :{}", taskDetailDO.getId());
continue;
}
List<TaskRobotNoLimittationAreaDTO> robotNoLimitions = null;
if (ObjectUtil.isNotEmpty(taskDetailDO.getRobotNo()) && ObjectUtil.isNotEmpty(robotNoLimittationAreaDTOMap)) {
TaskRobotNoLimittationAreaDTO taskRobotNoLimittationAreaDTO = robotNoLimittationAreaDTOMap.get(taskDetailDO.getRobotNo());
robotNoLimitions = Arrays.asList(taskRobotNoLimittationAreaDTO);
} else if (ObjectUtil.isEmpty(taskDetailDO.getRobotNo())) {
if (ObjectUtil.isEmpty(taskDetailDO.getRobotNo())) {
robotNoLimitions = robotNoLimitationArea;
} else {
TaskRobotNoLimittationAreaDTO taskRobotNoLimittationAreaDTO = robotDoReleaseMap.get(taskDetailDO.getRobotNo());
robotNoLimitions = Arrays.asList(taskRobotNoLimittationAreaDTO);
}
if (ObjectUtil.isEmpty(robotNoLimitions)) {
@ -424,6 +437,57 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
}
}
/**
* 获取能执行此任务的机器人 不能走的区域
*
* @param robots
* @return
*/
private Pair<List<TaskRobotNoLimittationAreaDTO>, Map<String, TaskRobotNoLimittationAreaDTO>> getRobotLimitationArea(List<RobotInformationDO> robots) {
List<PositionMapDO> positionMapDOS = positionMapMapper.selectList(new LambdaQueryWrapperX<PositionMapDO>());
List<TaskRobotNoLimittationAreaDTO> robotNoLimitationAreaDTOS = new ArrayList<>();
Map<String, TaskRobotNoLimittationAreaDTO> map = new HashMap<>();
for (RobotInformationDO robot : robots) {
TaskRobotNoLimittationAreaDTO robotNoLimitationAreaDTO = new TaskRobotNoLimittationAreaDTO();
List<TaskLimitationAreaDTO> limitationAreaList = new ArrayList<>();
robotNoLimitationAreaDTO.setRobotNo(robot.getRobotNo());
for (PositionMapDO v : positionMapDOS) {
if (!robot.getFloorAreaJson().contains(v.getId())) {
TaskLimitationAreaDTO taskLimitationAreaDTO = new TaskLimitationAreaDTO(v.getFloor(), v.getArea());
limitationAreaList.add(taskLimitationAreaDTO);
}
}
robotNoLimitationAreaDTO.setLimitationAreaList(limitationAreaList);
if (RobotStatusEnum.LAST_TASK_IS_TAKE.getType().equals(robot.getRobotStatus())) {
map.put(robot.getRobotNo(), robotNoLimitationAreaDTO);
} else {
robotNoLimitationAreaDTOS.add(robotNoLimitationAreaDTO);
map.put(robot.getRobotNo(), robotNoLimitationAreaDTO);
}
}
return ImmutablePair.of(robotNoLimitationAreaDTOS, map);
}
/**
* 前一个任务是仅取货
*
* @param robots
*/
private List<String> getRobotDoTake(List<RobotInformationDO> robots) {
return robots.stream()
.map(v -> {
if (v.getRobotStatus().equals(RobotStatusEnum.LAST_TASK_IS_TAKE.getType())) {
return v.getRobotNo();
}
return null;
})
.collect(Collectors.toList());
}
/**
* 设置机器人编号及不能行走的区域
*

View File

@ -231,23 +231,21 @@
and t1.deleted = '0'
and t2.deleted = '0'
</select>
<select id="getLastTaskGroupByRobotNo"
resultType="cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO">
SELECT
t1.*
FROM
robot_task_detail t1
INNER JOIN ( SELECT MAX( update_time ) AS update_time, robot_no FROM robot_task_detail WHERE task_status = '2' GROUP BY robot_no ) t2
ON t1.update_time = t2.update_time
AND t1.robot_no = t2.robot_no
WHERE
t1.task_type = '5'
and t1.task_status = '2'
</select>
<!--keyProperty="id" useGeneratedKeys="true"-->
<insert id="insertBatchList" >
insert into robot_task_detail(robot_task_id, task_type, release_type, take_type, release_id, take_id,
from_location_no, from_location_id, to_location_no, to_location_id, robot_no,from_location_storey,
to_location_storey,priority,from_lane_id,to_lane_id,from_location_number,to_location_number,
from_map_item_id,to_map_item_id)
values
<foreach collection="taskDetailList" item="entity" separator=",">
(#{entity.robotTaskId}, #{entity.taskType}, #{entity.releaseType}, #{entity.takeType}, #{entity.releaseId},
#{entity.takeId}, #{entity.fromLocationNo}, #{entity.fromLocationId}, #{entity.toLocationNo},
#{entity.toLocationId}, #{entity.robotNo}, #{entity.fromLocationStorey}, #{entity.toLocationStorey}
, #{entity.priority}, #{entity.fromLaneId}, #{entity.toLaneId}, #{entity.fromLocationNumber},
#{entity.toLocationNumber}, #{entity.fromMapItemId}, #{entity.toMapItemId})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="updateRobotDetailById">

View File

@ -9,4 +9,12 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<update id="updateAllRead">
update
robot_warn_msg
set
read_status = '1'
where
read_status = '0'
</update>
</mapper>