联调修改
This commit is contained in:
parent
133cacbca6
commit
432eeba127
@ -23,9 +23,9 @@ public class CommonApiImpl implements CommonApi {
|
||||
String str = JSON.toJSONString(obj);
|
||||
mqttUtils.pub(topic, JSON.toJSONString(obj));
|
||||
if (str.length() > 510) {
|
||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
||||
// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
||||
}else {
|
||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
||||
// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
||||
}
|
||||
} catch (MqttException e) {
|
||||
log.info("MQTT消息发送异常 :{}",e);
|
||||
@ -37,9 +37,9 @@ public class CommonApiImpl implements CommonApi {
|
||||
try {
|
||||
mqttUtils.pub(topic, str);
|
||||
if (str.length() > 510) {
|
||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
||||
// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str.substring(0, 500));
|
||||
}else {
|
||||
log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
||||
// log.info("MQTT消息发送成功topic :{}, 内容 :{}",topic, str);
|
||||
}
|
||||
} catch (MqttException e) {
|
||||
log.info("MQTT消息发送异常 :{}",e);
|
||||
|
@ -4,6 +4,7 @@ package cn.iocoder.yudao.module.system.api.path;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
|
||||
import cn.iocoder.yudao.module.system.constant.CommonConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.path.dto.GraphMatchDataDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotWarnMsgSaveReqVO;
|
||||
@ -14,6 +15,7 @@ import cn.iocoder.yudao.module.system.service.robot.RobotWarnMsgService;
|
||||
import cn.iocoder.yudao.module.system.service.tool.ToolsService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
@ -21,6 +23,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@ -78,7 +81,13 @@ public class PathApiImpl implements PathApi {
|
||||
public void ppDistributionTask(String message) {
|
||||
taskExecutor.execute(() -> {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
taskService.assignTasks(message);
|
||||
String requestId = UUID.randomUUID().toString().replace("-", "");
|
||||
MDC.put(CommonConstant.REQUEST_ID, requestId);
|
||||
try {
|
||||
taskService.assignTasks(message);
|
||||
} finally {
|
||||
MDC.clear();
|
||||
}
|
||||
// taskService.ppDistributionTask(message); 废弃了
|
||||
});
|
||||
}
|
||||
|
@ -91,7 +91,13 @@ public class RobotStatusApiImpl implements RobotStatusApi {
|
||||
if (ObjectUtil.isNotEmpty(robotStatusDataDTO.getPose2d())) {
|
||||
robotStatusDataPoseDTO.setX(robotStatusDataDTO.getPose2d().getX());
|
||||
robotStatusDataPoseDTO.setY(robotStatusDataDTO.getPose2d().getY());
|
||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getPose2d().getYaw());
|
||||
if (robotStatusDataDTO.getPose2d().getYaw().length()>7) {
|
||||
String yaw = robotStatusDataDTO.getPose2d().getYaw().substring(0, 7);
|
||||
robotStatusDataPoseDTO.setYaw(yaw);
|
||||
}else {
|
||||
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getPose2d().getYaw());
|
||||
}
|
||||
|
||||
}
|
||||
robotStatusDataPoseDTO.setRobotNo(robotNo);
|
||||
robotStatusDataPoseDTO.setFloor(floorZoneDTO.getFloor());
|
||||
|
@ -237,6 +237,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
//todo 后面考虑下充电,车机目前对充电的逻辑未定义
|
||||
if (PathTaskTypeEnum.MOVE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.MOVE_TO_WAIT_STOP.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.MOVE_TO_POINT.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.MOVE_TO_WAIT.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.TAKE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
|| PathTaskTypeEnum.CHARGE.getType().equals(robotCompleteTaskDTO.getOrderType())
|
||||
@ -501,7 +502,7 @@ public class RobotTaskStatusApiImpl implements RobotTaskStatusApi {
|
||||
robotTaskMapper.updateRobot(robotTaskDO);
|
||||
taskCycleMapper.deletByRobotTaskId(taskDetails.get(0).getRobotTaskId());
|
||||
}
|
||||
return detailDO;
|
||||
return robotTaskDetailDO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ public class ScheduledTasks {
|
||||
private static final ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3);
|
||||
|
||||
// 这个方法将每200毫秒执行一次
|
||||
@Scheduled(fixedDelay = 300, timeUnit = TimeUnit.MILLISECONDS)
|
||||
// @Scheduled(fixedDelay = 300, timeUnit = TimeUnit.MILLISECONDS)
|
||||
public void executeTask() {
|
||||
fixedThreadPool.execute(new Runnable() {
|
||||
@Override
|
||||
|
@ -1431,7 +1431,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
List<String> robotNos = robots.stream().map(RobotInformationDO::getRobotNo).collect(Collectors.toList());
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
String floorArea = floor + "-" + area;
|
||||
String floorArea = floor + CommonConstant.SYMBOL + area;
|
||||
Map<Object, Object> hmget = redisUtil.hmget(floorArea);
|
||||
if (ObjectUtil.isEmpty(hmget)) {
|
||||
return new ArrayList<>();
|
||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import cn.iocoder.yudao.module.system.api.robot.websocket.RobotStatusDataPoseDTO;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotStatusCodeConstant;
|
||||
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.config.vo.CommonConfigVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVO;
|
||||
@ -115,6 +116,24 @@ public class AutoChargeServiceImpl implements AutoChargeService {
|
||||
|
||||
if (ObjectUtil.isEmpty(deviceInformationDOS)) {
|
||||
log.info("充电任务,没有空闲的充电桩");
|
||||
robots = getNeedChargeRobot(robots, chargeConfig);
|
||||
log.info("需要充电的车辆 :{}", JSON.toJSONString(robots));
|
||||
if (ObjectUtil.isEmpty(robots)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<RobotInformationDO> chargeIngRobots = robotInformationMapper.selectList(new LambdaQueryWrapperX<RobotInformationDO>()
|
||||
.eq(RobotInformationDO::getRobotStatus, RobotStatusEnum.CHARGE.getType())
|
||||
.eq(RobotInformationDO::getRobotTaskModel, RobotTaskModelEnum.NORMAL.getType()));
|
||||
if (ObjectUtil.isEmpty(chargeIngRobots)) {
|
||||
log.info("没有充电中的车辆");
|
||||
return;
|
||||
}
|
||||
chargeIngRobots = getCanLeaveChargingRobots(chargeIngRobots, chargeConfig, robots.size());
|
||||
if (ObjectUtil.isEmpty(chargeIngRobots)) {
|
||||
log.info("充电中的车辆未充满电");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -163,6 +182,150 @@ public class AutoChargeServiceImpl implements AutoChargeService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电达到阀值,能离开的车辆
|
||||
*
|
||||
* @param robots
|
||||
* @param chargeConfig sum 需要移动的车辆数量
|
||||
* @return
|
||||
*/
|
||||
private List<RobotInformationDO> getCanLeaveChargingRobots(List<RobotInformationDO> robots, CommonConfigVO chargeConfig, int sum) {
|
||||
List<RobotInformationDO> needChargeRobots = new ArrayList<>();
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
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.CAN_DO_TASK.equals(Boolean.parseBoolean(String.valueOf(taskStatus)))) {
|
||||
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
|
||||
log.info("车机上报不允许接任务 :{}", robot.getRobotNo());
|
||||
continue;
|
||||
}
|
||||
|
||||
Object cargoDetected = redisUtil.get(cargoDetectedKey);
|
||||
if (ObjectUtil.isEmpty(cargoDetected) || RobotStatusCodeConstant.CARGO_DETECTED.equals(Boolean.parseBoolean(String.valueOf(cargoDetected)))) {
|
||||
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
|
||||
log.info("车机上报传感器被按下--不允许接任务 :{}", robot.getRobotNo());
|
||||
continue;
|
||||
}
|
||||
|
||||
Boolean adequateBatteryCapacity = remainingElectricityBigger(chargeConfig, robot);
|
||||
if (adequateBatteryCapacity) {
|
||||
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC + robot.getMacAddress();
|
||||
Object o = redisUtil.get(socKey);
|
||||
Integer soc = ObjectUtil.isEmpty(o) ? 0 : Integer.parseInt(o.toString());
|
||||
map.put(robot.getRobotNo(), soc);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(map)) {
|
||||
return needChargeRobots;
|
||||
}
|
||||
|
||||
map = map.entrySet().stream()
|
||||
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (x1, x2) -> x2, LinkedHashMap::new));
|
||||
|
||||
|
||||
|
||||
|
||||
return needChargeRobots;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询需要充电的车辆
|
||||
*
|
||||
* @param robots
|
||||
* @return
|
||||
*/
|
||||
private List<RobotInformationDO> getNeedChargeRobot(List<RobotInformationDO> robots, CommonConfigVO chargeConfig) {
|
||||
List<RobotInformationDO> needChargeRobots = new ArrayList<>();
|
||||
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.CAN_DO_TASK.equals(Boolean.parseBoolean(String.valueOf(taskStatus)))) {
|
||||
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
|
||||
log.info("车机上报不允许接任务 :{}", robot.getRobotNo());
|
||||
continue;
|
||||
}
|
||||
|
||||
Object cargoDetected = redisUtil.get(cargoDetectedKey);
|
||||
if (ObjectUtil.isEmpty(cargoDetected) || RobotStatusCodeConstant.CARGO_DETECTED.equals(Boolean.parseBoolean(String.valueOf(cargoDetected)))) {
|
||||
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
|
||||
log.info("车机上报传感器被按下--不允许接任务 :{}", robot.getRobotNo());
|
||||
continue;
|
||||
}
|
||||
|
||||
Boolean adequateBatteryCapacity = remainingElectricityBigger(chargeConfig, robot);
|
||||
if (!adequateBatteryCapacity) {
|
||||
needChargeRobots.add(robot);
|
||||
|
||||
}
|
||||
}
|
||||
return needChargeRobots;
|
||||
}
|
||||
|
||||
/**
|
||||
* 剩余电量是否大于设置的充电阀值
|
||||
*
|
||||
* @param chargeConfig
|
||||
* @param robot
|
||||
*/
|
||||
private Boolean remainingElectricityBigger(CommonConfigVO chargeConfig, RobotInformationDO robot) {
|
||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robot.getMacAddress();
|
||||
String chargeModelKey = RobotTaskChcheConstant.ROBOT_CHARGE_MODEL + robot.getRobotNo();
|
||||
Object chargeModelCache = redisUtil.get(chargeModelKey);
|
||||
Object poseCache = redisUtil.get(pose2dKey);
|
||||
// RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class);
|
||||
// log.info("充电机器人编号:{} ,信息: {}", robot.getRobotNo(), JSON.toJSONString(dataPoseDTO));
|
||||
|
||||
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC + robot.getMacAddress();
|
||||
Object o = redisUtil.get(socKey);
|
||||
String soc = ObjectUtil.isEmpty(o) ? "0" : o.toString();
|
||||
|
||||
if (ObjectUtil.isEmpty(poseCache) || ObjectUtil.isEmpty(o)) {
|
||||
log.info("没有点位信息/或者没有电量信息 :{}", robot.getRobotNo());
|
||||
return false;
|
||||
}
|
||||
|
||||
//车子剩余电量
|
||||
BigDecimal robotRemainingElectricity = new BigDecimal(soc);
|
||||
//设置离开的电量
|
||||
BigDecimal robotEndElectricity = new BigDecimal("30");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(robot.getAutoCharge()) && ObjectUtil.isNotEmpty(chargeModelCache)
|
||||
&& !ChargeModelEnum.FULL.getType().equals((Integer) chargeModelCache)) {
|
||||
robotEndElectricity = new BigDecimal(String.valueOf(robot.getAutoCharge()));
|
||||
} else if (ObjectUtil.isNotEmpty(chargeModelCache) && ChargeModelEnum.FULL.getType().equals((Integer) chargeModelCache)) {
|
||||
robotEndElectricity = new BigDecimal(fullElectricity);
|
||||
} else if (ObjectUtil.isNotEmpty(chargeModelCache) && ChargeModelEnum.CHANCE.getType().equals((Integer) chargeModelCache)
|
||||
&& ObjectUtil.isNotEmpty(chargeConfig.getEndAutoCharge())) {
|
||||
robotEndElectricity = new BigDecimal(String.valueOf(chargeConfig.getChanceChargeEnd()));
|
||||
} else if (ObjectUtil.isNotEmpty(chargeConfig.getEndAutoCharge())) {
|
||||
robotEndElectricity = new BigDecimal(String.valueOf(chargeConfig.getEndAutoCharge()));
|
||||
}
|
||||
|
||||
if (robotRemainingElectricity.compareTo(robotEndElectricity) >= 0) {
|
||||
return true;
|
||||
} else {
|
||||
log.info("机器人正在充电,还没达到充电设置的电量,暂不能接任务:{} ", robot.getRobotNo());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Integer getSocByMac(RobotInformationDO robot) {
|
||||
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC + robot.getMacAddress();
|
||||
Object socObject = redisUtil.get(socKey);
|
||||
|
||||
if (ObjectUtil.isEmpty(socObject)) {
|
||||
log.info("当前机器人查不到电量信息,所以不执行充电 :{}", robot.getRobotNo());
|
||||
return null;
|
||||
}
|
||||
String[] split = socObject.toString().split("\\.");
|
||||
return Integer.valueOf(split[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装充电任务
|
||||
*
|
||||
@ -181,13 +344,13 @@ public class AutoChargeServiceImpl implements AutoChargeService {
|
||||
for (RobotInformationDO robot : robots) {
|
||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robot.getMacAddress();
|
||||
Object poseCache = redisUtil.get(pose2dKey);
|
||||
RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class);
|
||||
if (ObjectUtil.isEmpty(poseCache)) {
|
||||
log.info("查不到车辆的点位信息 :{}", robot.getRobotNo());
|
||||
continue;
|
||||
}
|
||||
|
||||
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC + robot.getMacAddress();
|
||||
Object socObject = redisUtil.get(socKey);
|
||||
|
||||
if (ObjectUtil.isEmpty(dataPoseDTO) || ObjectUtil.isEmpty(socObject)) {
|
||||
log.info("当前机器人查不到电量信息,所以不执行充电 :{}", robot.getRobotNo());
|
||||
Integer electricity = getSocByMac(robot);
|
||||
if (ObjectUtil.isEmpty(electricity)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -211,12 +374,12 @@ public class AutoChargeServiceImpl implements AutoChargeService {
|
||||
logDo.setDeviceNo(deviceInformationDO.getDeviceNo());
|
||||
logDo.setPositionMapItemId(deviceInformationDO.getPositionMapItemId());
|
||||
|
||||
String[] split = socObject.toString().split("\\.");
|
||||
logDo.setStartElectricity(Integer.valueOf(split[0]));
|
||||
|
||||
logDo.setStartElectricity(electricity);
|
||||
//配置的充满电电量
|
||||
BigDecimal robotFullElectricity = new BigDecimal(fullElectricity);
|
||||
//车子剩余电量
|
||||
BigDecimal robotRemainingElectricity = new BigDecimal(split[0]);
|
||||
BigDecimal robotRemainingElectricity = new BigDecimal(electricity + "");
|
||||
if (ObjectUtil.isNotEmpty(chargeConfig.getChanceCycle()) && !chargeFullNos.contains(robot.getRobotNo())
|
||||
&& robotRemainingElectricity.compareTo(robotFullElectricity) < 0) {
|
||||
//充满电
|
||||
|
@ -131,6 +131,7 @@ public class CycleServiceImpl implements CycleService {
|
||||
.takeType(v.getReleaseType())
|
||||
.releaseId(v.getTakeId())
|
||||
.takeId(v.getReleaseId())
|
||||
.robotNo(v.getRobotNo())
|
||||
.fromLocationNo(v.getToLocationNo())
|
||||
.fromLocationId(v.getToLocationId())
|
||||
.fromLaneId(v.getToLaneId())
|
||||
|
@ -156,7 +156,10 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
&& RobotStatusEnum.CHARGE.getType().equals(robot.getRobotStatus())) {
|
||||
setRobotStatus(commonConfigDO, robot);
|
||||
}*/
|
||||
setRobotStatus(commonConfigDO, robot);
|
||||
Boolean b = remainingElectricityBigger(chargeConfig, robot);
|
||||
if (b) {
|
||||
robot.setRobotStatus(RobotStatusEnum.STAND_BY.getType());
|
||||
}
|
||||
}
|
||||
|
||||
robots = robots.stream()
|
||||
@ -229,12 +232,12 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置机器人的状态
|
||||
* 剩余电量是否大于设置的充电阀值
|
||||
*
|
||||
* @param commonConfigDO
|
||||
* @param chargeConfig
|
||||
* @param robot
|
||||
*/
|
||||
private void setRobotStatus(CommonConfigDO commonConfigDO, RobotInformationDO robot) {
|
||||
private Boolean remainingElectricityBigger(CommonConfigVO chargeConfig, RobotInformationDO robot) {
|
||||
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robot.getMacAddress();
|
||||
String chargeModelKey = RobotTaskChcheConstant.ROBOT_CHARGE_MODEL + robot.getRobotNo();
|
||||
Object chargeModelCache = redisUtil.get(chargeModelKey);
|
||||
@ -246,16 +249,14 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
Object o = redisUtil.get(socKey);
|
||||
String soc = ObjectUtil.isEmpty(o) ? "0": o.toString();
|
||||
|
||||
if (ObjectUtil.isEmpty(commonConfigDO) || ObjectUtil.isEmpty(poseCache) || ObjectUtil.isEmpty(o)) {
|
||||
return;
|
||||
if ( ObjectUtil.isEmpty(poseCache) || ObjectUtil.isEmpty(o)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CommonConfigVO chargeConfig = JSONUtil.toBean(commonConfigDO.getConfigStr(), CommonConfigVO.class);
|
||||
|
||||
//车子剩余电量
|
||||
BigDecimal robotRemainingElectricity = new BigDecimal(soc);
|
||||
//设置离开的电量
|
||||
BigDecimal robotEndElectricity = new BigDecimal("10");
|
||||
BigDecimal robotEndElectricity = new BigDecimal("30");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(robot.getAutoCharge()) && ObjectUtil.isNotEmpty(chargeModelCache)
|
||||
&& !ChargeModelEnum.FULL.getType().equals((Integer) chargeModelCache)) {
|
||||
@ -270,10 +271,11 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
|
||||
}
|
||||
|
||||
if (robotRemainingElectricity.compareTo(robotEndElectricity) >= 0) {
|
||||
robot.setRobotStatus(RobotStatusEnum.STAND_BY.getType());
|
||||
return true;
|
||||
}else {
|
||||
log.info("机器人正在充电,还没达到充电设置的电量,暂不能接任务:{} ", robot.getRobotNo());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,6 +183,13 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
|
||||
*/
|
||||
private void moveRobotToWait(List<RobotInformationDO> robots) {
|
||||
|
||||
List<RobotTaskDetailDO> detailDOS = robotTaskDetailMapper.selectAutoCreateCycleTask();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailDOS)) {
|
||||
log.info("---存在需要自动创建循环的任务,不移动到等待点--");
|
||||
return;
|
||||
}
|
||||
|
||||
robots = robots.stream()
|
||||
.filter(v -> v.getRobotStatus().equals(RobotStatusEnum.STAND_BY.getType()))
|
||||
.collect(Collectors.toList());
|
||||
|
Loading…
Reference in New Issue
Block a user