Compare commits

..

No commits in common. "26c26007d05eaa4807eb309622f862e277562483" and "8e8643c23a82c78dd7932d96969cceef1494549c" have entirely different histories.

33 changed files with 87 additions and 341 deletions

View File

@ -147,8 +147,6 @@ public class MqttFactory {
return BeanUtils.getBean(RobotUpdatePalletHeightServiceImpl.class);
case ROBOT_OBSTACLES_STATUS:
return BeanUtils.getBean(RobotObstaclesStatusServiceImpl.class);
case ROBOT_WIRELESS_SIGNAL_STATUS:
return BeanUtils.getBean(RobotWirelessSignalStatusServiceImpl.class);
case PLANNING_INIT_DATA:
return BeanUtils.getBean(PathPlanningInitDataServiceImpl.class);
case PLANNING_DISTRIBUTION_TASK:

View File

@ -22,7 +22,6 @@ public enum DefineSubTopicEnum {
ROBOT_WORK_STATUS("ROBOT_WORK_STATUS", 2,"作业实时行为上报"),
ROBOT_UPDATE_PALLET_HEIGHT("UPDATE_PALLET_HEIGHT", 2,"放货后货物高度反馈和取货后货物高度反馈"),
ROBOT_OBSTACLES_STATUS("ROBOT_OBSTACLES_STATUS", 2,"障碍物状态上报"),
ROBOT_WIRELESS_SIGNAL_STATUS("ROBOT_WIRELESS_SIGNAL_STATUS", 2,"信号强度上报"),
PLANNING_INIT_DATA("SYNCHRONOUS_ALL_MAP_REQUEST", 2,"路径规划需要初始数据上报"),
PLANNING_DISTRIBUTION_TASK("TASK_ASSIGNMENT_FEEDBACK", 2,"路径规划任务分配上报"),
PLANNING_DISTRIBUTION_FAIL("TASK_ASSIGNMENT_FAIL", 2,"路径规划失败上报"),

View File

@ -1,22 +0,0 @@
package cn.iododer.yudao.module.mqtt.service;
import cn.iocoder.yudao.module.remote.api.path.RemotePathApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Slf4j
@Service
public class RobotWirelessSignalStatusServiceImpl implements MqttService{
@Resource
private RemotePathApi remotePathApi;
@Override
public void analysisMessage(String message) {
log.info("车辆信号上报 :{}",message);
remotePathApi.wirelessSignalStatus(message);
}
}

View File

@ -16,7 +16,4 @@ public interface RemotePathApi {
@Operation(summary = "远遥同步车辆导航行走路程信息")
void remoteDistanceInformation(@RequestParam("message") String message);
@PostMapping(PREFIX + "/wirelessSignalStatus")
@Operation(summary = "车辆信号信息")
void wirelessSignalStatus(@RequestParam("message") String message);
}

View File

@ -1,15 +0,0 @@
package cn.iocoder.yudao.module.remote.api.path.dto;
import lombok.Data;
@Data
public class RemoteRobotWirelessSignalDTO {
private String mac;
/**
* 整型单位dBm
*/
private String wirelessSignal;
}

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.remote.api.path;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotWirelessSignalDTO;
import cn.iocoder.yudao.module.remote.service.robot.RemoteRobotService;
import cn.iocoder.yudao.module.remote.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON;
@ -32,15 +31,5 @@ public class RemotePathApiImpl implements RemotePathApi{
remoteRobotService.remoteDistanceInformation(data);
}
/**
* 车辆信号信息
* @param message
*/
@Override
public void wirelessSignalStatus(String message) {
RemoteRobotWirelessSignalDTO data = JSON.parseObject(message, RemoteRobotWirelessSignalDTO.class);
remoteRobotService.sendRobotWirelessSignalStatus(data);
}
}

View File

@ -145,7 +145,7 @@ public class RemoteControllerProcessor {
cache.remove(remoteControllerIp);
Socket socket = remoteControllerSocketDTO.getSocket();
if (socket == null || socket.isClosed()) {
if (socket == null ||socket.isClosed()) {
try {
socket = new Socket();
socket.connect(new InetSocketAddress(remoteControllerIp, remoteControllerPort), 1000);
@ -186,7 +186,7 @@ public class RemoteControllerProcessor {
if (ObjectUtil.isEmpty(cache)) {
return;
}
// log.info("socket发送数据开始");
log.info("socket发送数据开始");
for (Map.Entry<String, RemoteControllerSocketDTO> v : cache.entrySet()) {
RemoteControllerSocketDTO remoteControllerSocketDTO = v.getValue();
if (ObjectUtil.isEmpty(remoteControllerSocketDTO)) {
@ -218,8 +218,8 @@ public class RemoteControllerProcessor {
try {
os = socket.getOutputStream();
String str = remoteControllerSocketDTO.getMsg();
os.write(remoteControllerSocketDTO.getMsg().getBytes());
log.info("socket推送的数据 :{}", str);
os.write(remoteControllerSocketDTO.getMsg().getBytes());
} catch (IOException e) {
log.error("socket发送异常 :{}", e);
} finally {
@ -230,6 +230,7 @@ public class RemoteControllerProcessor {
}
}
}
log.info("socket发送数据成功");
}
}

View File

@ -8,6 +8,4 @@ public class RobotTaskChcheConstant {
//机器人编号和mac地址映射(通过机器人编号查询mac地址) (拼接的是机器人编号)
public static String ROBOT_GET_MAC_BY_NO = "robot:information:getMac:ByNo";
//机器人mac地址和机器人编号映射(通过mac地址查询机器人编号) (拼接的是mac地址)
public static String ROBOT_GET_ROBOTNO_BY_MAC = "robot:information:getRobotNo:ByMac";
}

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.remote.service.robot;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotWirelessSignalDTO;
import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.PositionMapRespDTO;
import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.RemoteRobotChangeModeDTO;
import cn.iocoder.yudao.module.remote.controller.admin.robot.dto.RemoteRobotTaskDoneDTO;
@ -77,10 +76,4 @@ public interface RemoteRobotService {
* @param data
*/
void remoteDistanceInformation(RemoteRobotDistanceInformationDTO data);
/**
* 上报车辆信号信息
* @param data
*/
void sendRobotWirelessSignalStatus(RemoteRobotWirelessSignalDTO data);
}

View File

@ -5,7 +5,6 @@ import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotDistanceInformationDTO;
import cn.iocoder.yudao.module.remote.api.path.dto.RemoteRobotWirelessSignalDTO;
import cn.iocoder.yudao.module.remote.api.robot.RemoteControllerProcessor;
import cn.iocoder.yudao.module.remote.api.webSocket.RequestProcessor;
import cn.iocoder.yudao.module.remote.constant.robot.RobotTaskChcheConstant;
@ -208,21 +207,6 @@ public class RemoteRobotServiceImpl implements RemoteRobotService {
mac, JSONUtil.toJsonStr(build));
}
/**
* 上报车辆信息信息
* @param data
*/
@Override
public void sendRobotWirelessSignalStatus(RemoteRobotWirelessSignalDTO data) {
TenantContextHolder.setTenantId(1L);
String robotNo = (String) redisUtil.get(RobotTaskChcheConstant.ROBOT_GET_ROBOTNO_BY_MAC + data.getMac());
if (ObjectUtil.isEmpty(robotNo)) {
robotNo = remoteRobotApi.getRobotNoByMac(data.getMac());
}
log.info("车辆编号 :{}",robotNo);
}
/**
* 组装
*

View File

@ -62,8 +62,4 @@ public interface RemoteRobotApi {
@PostMapping(PREFIX + "/getMacByRobotNo")
@Operation(summary = "根据车辆编号获取MAC地址")
String getMacByRobotNo( @RequestParam(value = "robotNo") String robotNo);
@PostMapping(PREFIX + "/getRobotNoByMac")
@Operation(summary = "根据车辆MAC地址获取车辆编号")
String getRobotNoByMac( @RequestParam(value = "mac") String mac);
}

View File

@ -14,29 +14,4 @@ public class RobotObstaclesStatusDTO {
* true表示有障碍物false表示没有障碍物
*/
public Boolean obstacles;
/**
* 左前方障碍物距离 float单位是米
*/
private String frontLeft;
/**
* 右前方障碍物距离 float单位是米
*/
private String frontRight;
/**
* 左后方障碍物距离 float单位是米
*/
private String reaLeft;
/**
* 右后方障碍物距离 float单位是米
*/
private String reaRight;
/**
* 正后方障碍物距离 float单位是米
*/
private String rearCenter;
}

View File

@ -16,6 +16,6 @@ public class RobotStatusDataPoseDTO {
public String floor;
//区域
public String area;
//电池剩余容量 废弃 从ROBOT_INFORMATION_SOC 获取电量
// public String batSoc;
//电池剩余容量
public String batSoc;
}

View File

@ -142,10 +142,5 @@ public class RemoteRobotApiImpl implements RemoteRobotApi {
return robotInformationService.getMacByRobotNo(robotNo);
}
@Override
public String getRobotNoByMac(String mac) {
return robotInformationService.getRobotNoByMac(mac);
}
}

View File

@ -3,11 +3,15 @@ package cn.iocoder.yudao.module.system.api.robot;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotGenericsDataDTO;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@ -22,6 +26,8 @@ public class RobotGenericsStatusApiImpl implements RobotGenericsStatusApi {
@Resource
private RedisUtil redisUtil;
@Resource@Value("${zn.robot_position_cache_time:10}")
private Long robotPositionCacheTime;
@Override
@SystemRateLimiter(time = 1, count = 20, keyArg = "updateRobotCommonStatus",message = "机器人上报车辆其他信息")
@ -37,13 +43,17 @@ public class RobotGenericsStatusApiImpl implements RobotGenericsStatusApi {
}
String mac = robotStatusData.getMac();
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +mac;
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC +mac;
Object object = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO= JSONUtil.toBean((String)object, RobotStatusDataPoseDTO.class);
String batSoc = robotStatusData.getHwStates().getBatSoc();
if (ObjectUtil.isNotEmpty(batSoc)) {
String[] split = batSoc.split("\\.");
batSoc = split[1].substring(0,2);
redisUtil.set(socKey,batSoc);
robotStatusDataPoseDTO.setBatSoc(batSoc);
}
redisUtil.set(pose2dKey,JSON.toJSONString(robotStatusDataPoseDTO),robotPositionCacheTime);
}
}

View File

@ -51,6 +51,7 @@ public class RobotObstaclesStatusApiImpl implements RobotObstaclesStatusApi{
Object floorAreaObject = redisUtil.get(floorAreaKey);
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
String robotNo = robotInformationService.getRobotNoByMac(data.getMac());
RobotWarnMsgSaveReqVO warnMsg = new RobotWarnMsgSaveReqVO();

View File

@ -9,18 +9,29 @@ import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
import cn.iocoder.yudao.module.system.config.ratelimiter.SystemRateLimiter;
import cn.iocoder.yudao.module.system.constant.path.PathPlanningTopicConstant;
import cn.iocoder.yudao.module.system.constant.robot.RobotTaskChcheConstant;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnCodeMappingDO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotWarnMsgDO;
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnCodeMappingMapper;
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotWarnMsgMapper;
import cn.iocoder.yudao.module.system.enums.robot.RobotWarnType;
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
import cn.iocoder.yudao.module.system.service.robot.RobotWarnMsgService;
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@RestController // 提供 RESTful API 接口 Feign 调用
@ -71,7 +82,7 @@ public class RobotStatusApiImpl implements RobotStatusApi {
Object floorAreaObject = redisUtil.get(floorAreaKey);
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
String robotNo = robotInformationService.getRobotNoByMac(robotStatusDataDTO.getMac());
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robotStatusDataDTO.getMac();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotStatusDataDTO.getMac();
Object object = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);

View File

@ -9,10 +9,7 @@ public class RobotTaskChcheConstant {
public static String ROBOT_CARGO_DETECTED = "robot:information:cargo:detected";
//机器人点位和电量 (拼接的是mac地址)
public static String ROBOT_INFORMATION_POSE_BAT = "robot:information:pose:bat";
//机器人电量
public static String ROBOT_INFORMATION_SOC = "robot:information:soc";
public static String ROBOT_INFORMATION_POSE_BAT_SOC = "robot:information:pose:bat:soc";
//机器人楼层和区域 (拼接的是mac地址)
public static String ROBOT_FLOOR_AREA = "robot:floor:area";

View File

@ -6,7 +6,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
import io.swagger.v3.oas.annotations.Operation;
@ -120,12 +123,4 @@ public class WareHouseLocationController {
houseLocationService.updateHouseLocationList(list);
return success(true);
}
@GetMapping("/getLocationsXYByMapId")
@Operation(summary = "根据地图id查询此地图对应的所有库位,包括库位坐标")
@Parameter(name = "mapId", description = "地图id", required = true, example = "1024")
public CommonResult<List<WareHouseLocationItemRespVO>> getLocationsXYByMapId(@RequestParam("mapId") Long mapId) {
List<WareHouseLocationItemRespVO> list = houseLocationService.getLocationsXYByMapId(mapId);
return success(list);
}
}

View File

@ -1,63 +0,0 @@
package cn.iocoder.yudao.module.system.controller.admin.houselocation.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 库位和坐标 Response VO")
@Data
public class WareHouseLocationItemRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31866")
private Long id;
@Schema(description = "库位编号")
private String locationNo;
@Schema(description = "物料信息")
private String skuInfo;
@Schema(description = "物料数量")
private Long skuNumber;
@Schema(description = "启用/禁用0禁用、1启用")
private Integer locationEnable;
@Schema(description = "锁定/正常0锁定、1正常")
private Integer locationLock;
@Schema(description = "状态0空闲、1占用", example = "2")
private Integer locationUseStatus;
@Schema(description = "宽度")
private BigDecimal locationWide;
@Schema(description = "长度")
private BigDecimal locationDeep;
@Schema(description = "层数")
private Integer locationStorey;
@Schema(description = "实际坐标x轴")
private String actualLocationX;
@Schema(description = "实际坐标y轴")
private String actualLocationY;
}

View File

@ -121,13 +121,4 @@ public class RobotTaskController {
return success(pageResult);
}
@PostMapping("/checkHaveTask")
@Operation(summary = "判断是否存在任务")
@PreAuthorize("@ss.hasPermission('robot:task:checkHaveTask')")
public CommonResult<Boolean> checkHaveTask() {
//校验是否存在未完成的任务
taskService.checkHaveDoingTask();
return success(true);
}
}

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.dal.mysql.houselocation;
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.system.controller.admin.houselocation.vo.WareHouseLocationItemRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
@ -162,11 +161,4 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
*/
List<WareHouseLocationDO> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
@Param("locationStorey") Integer locationStorey);
/**
* 获取这个地图对应的库位和坐标信息
* @param mapId
* @return
*/
List<WareHouseLocationItemRespVO> getLocationsXYByMapId(@Param("mapId") Long mapId);
}

View File

@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.api.robot.dto.RobotStatusDataPoseDTO;
@ -20,7 +19,6 @@ import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformati
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.RobotWarnMsgDO;
import cn.iocoder.yudao.module.system.enums.common.ZeroOneEnum;
import cn.iocoder.yudao.module.system.enums.robot.RobotTaskDetailStatusEnum;
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import cn.iocoder.yudao.module.system.service.information.DeviceInformationService;
@ -118,7 +116,7 @@ public class BulletinBoardServiceImpl implements BulletinBoardService {
map = agvListStatusInfo.stream().collect(Collectors.toMap(RobotInfoStatusVO::getMacAddress, Function.identity()));
}
for (RobotInformationDO robotInformationDO : allRobot) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robotInformationDO.getMacAddress();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotInformationDO.getMacAddress();
Object object = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
if (robotStatusDataPoseDTO != null) {
@ -129,10 +127,7 @@ public class BulletinBoardServiceImpl implements BulletinBoardService {
BeanUtil.copyProperties(item, robotElectricityLevelVO);
}
robotElectricityLevelVO.setRobotNo(robotInformationDO.getRobotNo());
String socByMac = robotInformationService.getSocByMac(robotInformationDO.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isNotEmpty(socByMac)) {
robotElectricityLevelVO.setBatSoc(socByMac);
}
robotElectricityLevelVO.setBatSoc(robotStatusDataPoseDTO.getBatSoc());
robotElectricityLevelVOS.add(robotElectricityLevelVO);
}
}

View File

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.system.service.houselocation;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import com.baomidou.mybatisplus.extension.service.IService;
@ -116,11 +119,4 @@ public interface HouseLocationService extends IService<WareHouseLocationDO> {
* @param id
*/
void updateLocationAreaNameEmptyByAreaId(Long areaId);
/**
* 获取这个地图对应的库位和坐标信息
* @param mapId
* @return
*/
List<WareHouseLocationItemRespVO> getLocationsXYByMapId(Long mapId);
}

View File

@ -6,7 +6,10 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.api.robot.vo.RobotInformationVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.*;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationVO;
import cn.iocoder.yudao.module.system.controller.admin.log.vo.UserOperationLogSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
@ -183,16 +186,6 @@ public class HouseLocationServiceImpl extends ServiceImpl<WareHouseLocationMappe
houseLocationMapper.updateLocationAreaNameEmptyByAreaId(areaId);
}
/**
* 获取这个地图对应的库位和坐标信息
* @param mapId
* @return
*/
@Override
public List<WareHouseLocationItemRespVO> getLocationsXYByMapId(Long mapId) {
return houseLocationMapper.getLocationsXYByMapId(mapId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateHouseLocationList(List<WareHouseLocationSaveReqVO> list) {

View File

@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import static cn.hutool.core.collection.CollUtil.isNotEmpty;
@ -127,7 +128,7 @@ public class PositionMapItemServiceImpl extends ServiceImpl<PositionMapItemMappe
@Override
public Object getAGVPointInformation(String macAddress) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + macAddress;
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + macAddress;
try {
// 睡眠 0.5s 以确保获取到是最新的数据
Thread.sleep(500);

View File

@ -67,14 +67,6 @@ public interface RobotInformationService extends IService<RobotInformationDO> {
*/
RobotInformationStatisticsVO statisticsInformation();
/**
* 车机mac地址获取电量
* @param str
* type 1:是mac 0 :是车辆编号
* @return
*/
String getSocByMac(String str, Integer type);
/**
* 获取所有AGV状态
* @return

View File

@ -484,7 +484,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
RobotInformationDO robotInformationDO = informationMapper.selectById(id);
RobotInformationRespVO bean = BeanUtils.toBean(robotInformationDO, RobotInformationRespVO.class);
setPositionMapList(bean);
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + bean.getMacAddress();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + bean.getMacAddress();
Object object = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
@ -492,10 +492,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
Object floorAreaObject = redisUtil.get(floorAreaKey);
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
String soc = getSocByMac(robotInformationDO.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isNotEmpty(soc)) {
bean.setElectricity(soc);
}
bean.setElectricity(robotStatusDataPoseDTO.getBatSoc());
bean.setFloor(floorZoneDTO.getFloor());
bean.setArea(floorZoneDTO.getArea());
}
@ -579,7 +576,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
* @param v
*/
private void setMsgAndRobotStatus(RobotInformationPageRespVO v, String robotStatisticsType) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + v.getMacAddress();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + v.getMacAddress();
Object object = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
@ -591,10 +588,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
FloorZoneDTO floorZoneDTO = JSONUtil.toBean((String) floorAreaObject, FloorZoneDTO.class);
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
String soc = getSocByMac(v.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isNotEmpty(soc)) {
v.setElectricity(soc);
}
v.setElectricity(robotStatusDataPoseDTO.getBatSoc());
v.setFloor(floorZoneDTO.getFloor());
v.setArea(floorZoneDTO.getArea());
v.setOnlineStatus(1);
@ -659,7 +653,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
Integer fault = 0;
//0待命1任务中2锁定3离线4:充电中5:故障
for (RobotInformationDO v : existRobot) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + v.getMacAddress();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + v.getMacAddress();
Object object = redisUtil.get(pose2dKey);
if (ObjectUtil.isEmpty(object)) {
@ -700,26 +694,6 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
return info;
}
/**
*
* @param str
* type 1:是mac 0 :是车辆编号
* @param type
* @return
*/
@Override
public String getSocByMac(String str, Integer type) {
if (ZeroOneEnum.ZERO.getType().equals(type)) {
str = getMacByRobotNo(str);
}
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +str;
Object o = redisUtil.get(socKey);
if (ObjectUtil.isEmpty(o)){
return null;
}
return o.toString();
}
@Override
public List<RobotInfoStatusVO> getAGVListStatusInfo() {
List<RobotInfoStatusVO> list = new ArrayList<>();
@ -732,7 +706,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
RobotInfoStatusVO vo = new RobotInfoStatusVO();
vo.setMacAddress(informationDO.getMacAddress());
//0待命1任务中2锁定3离线4:充电中5:故障
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + informationDO.getMacAddress();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + informationDO.getMacAddress();
Object object = redisUtil.get(pose2dKey);
if (ObjectUtil.isEmpty(object)) {
//离线
@ -825,7 +799,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
robotStatusDataPoseDTO.setYaw(robotStatusDataDTO.getData().getPose2d().getYaw());
robotStatusDataPoseDTO.setFloor(robotStatusDataDTO.getData().getFloor_zone().getFloor());
robotStatusDataPoseDTO.setArea(robotStatusDataDTO.getData().getFloor_zone().getArea());
// robotStatusDataPoseDTO.setBatSoc(robotStatusDataDTO.getData().getPose2d().getBatSoc());
robotStatusDataPoseDTO.setBatSoc(robotStatusDataDTO.getData().getPose2d().getBatSoc());
robotInformationVO.setPose2d(robotStatusDataPoseDTO);
@ -1395,14 +1369,20 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
CommonConfigVO chargeConfig = JSONUtil.toBean(commonConfig.getConfigStr(), CommonConfigVO.class);
String soc = getSocByMac(robotInformation.getMacAddress(), ZeroOneEnum.ONE.getType());
if (ObjectUtil.isEmpty(soc)) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotInformation.getMacAddress();
Object poseCache = redisUtil.get(pose2dKey);
if (ObjectUtil.isEmpty(poseCache)) {
log.info("车机没有电量信息 :{}", robotInformation.getRobotNo());
return false;
}
RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class);
if (ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) {
log.info("车机没有电量信息 :{}", robotInformation.getRobotNo());
return false;
}
if (ObjectUtil.isNotEmpty(chargeConfig) && ObjectUtil.isNotEmpty(chargeConfig.getStartAutoCharge())) {
BigDecimal robotRemainingElectricity = new BigDecimal(soc);
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc());
BigDecimal robotEndElectricity = new BigDecimal(chargeConfig.getStartAutoCharge() + "");
if (robotRemainingElectricity.compareTo(robotEndElectricity) < 0) {
log.info("机器人的电量少于自动充电电量,不能接任务 :{}", robotInformation.getRobotNo());
@ -1410,7 +1390,7 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
}
}
return checkElectricity(chargeConfig, robotInformation,soc);
return checkElectricity(chargeConfig, robotInformation, dataPoseDTO);
}
@Override
@ -1510,13 +1490,13 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
informationMapper.updateById(robotInformationDO);
}
private Boolean checkElectricity(CommonConfigVO chargeConfig, RobotInformationDO robot, String soc) {
private Boolean checkElectricity(CommonConfigVO chargeConfig, RobotInformationDO robot, RobotStatusDataPoseDTO dataPoseDTO) {
String chargeModelKey = RobotTaskChcheConstant.ROBOT_CHARGE_MODEL + robot.getRobotNo();
Object chargeModelCache = redisUtil.get(chargeModelKey);
log.info("充电机器人编号:{} ,信息: {}", robot.getRobotNo());
log.info("充电机器人编号:{} ,信息: {}", robot.getRobotNo(), JSON.toJSONString(dataPoseDTO));
//车子剩余电量
BigDecimal robotRemainingElectricity = new BigDecimal(soc);
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc());
//设置离开的电量
BigDecimal robotEndElectricity = new BigDecimal("10");

View File

@ -991,8 +991,8 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
* @param robotTaskVo
*/
private void doMoveToPoint(RobotTaskDetailAddVO robotTaskVo) {
PositionMapItemDO positionMapItem = positionMapItemService.getPositionMapItem(robotTaskVo.getReleaseId());
robotTaskVo.setToLocationNo(String.valueOf(positionMapItem.getSortNum()));
}
/**
@ -1474,11 +1474,12 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
robotChargeLogDO.setEndTime(LocalDateTime.now());
deviceInformationService.chargeDeviceShrink(robotChargeLogDO.getDeviceNo());
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +robotInformationDO.getMacAddress();
Object socObject = redisUtil.get(socKey);
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robotInformationDO.getMacAddress();
Object object = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO robotStatusDataPoseDTO = JSONUtil.toBean((String) object, RobotStatusDataPoseDTO.class);
if (ObjectUtil.isNotEmpty(socObject)) {
robotChargeLogDO.setEndElectricity(Integer.valueOf(socObject.toString()));
if (ObjectUtil.isNotEmpty(object) && ObjectUtil.isNotEmpty(robotStatusDataPoseDTO)) {
robotChargeLogDO.setEndElectricity(Integer.valueOf(robotStatusDataPoseDTO.getBatSoc()));
}
robotChargeLogDO.setTaskStatus(ChargeTaskStatusEnum.DONE.getType());
chargeLogMapper.updateById(robotChargeLogDO);

View File

@ -160,14 +160,10 @@ public class AutoChargeServiceImpl implements AutoChargeService {
List<RobotChargeLogDO> logs, Map<String, List<RobotTaskDetailDO>> detailMap) {
//判断机器人身上的电量少于设定的电量
for (RobotInformationDO robot : robots) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT +robot.getMacAddress();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC +robot.getMacAddress();
Object poseCache = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO dataPoseDTO= JSON.parseObject((String)poseCache, RobotStatusDataPoseDTO.class);
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +robot.getMacAddress();
Object socObject = redisUtil.get(socKey);
if (ObjectUtil.isEmpty(dataPoseDTO) || ObjectUtil.isEmpty(socObject)) {
if (ObjectUtil.isEmpty(dataPoseDTO) || ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) {
log.info("当前机器人查不到电量信息,所以不执行充电 :{}",robot.getRobotNo());
continue;
}
@ -191,8 +187,7 @@ public class AutoChargeServiceImpl implements AutoChargeService {
logDo.setRobotNo(robot.getRobotNo());
logDo.setDeviceNo(deviceInformationDO.getDeviceNo());
logDo.setPositionMapItemId(deviceInformationDO.getPositionMapItemId());
String[] split = socObject.toString().split("\\.");
String[] split = dataPoseDTO.getBatSoc().split("\\.");
logDo.setStartElectricity(Integer.valueOf(split[0]));
//配置的充满电电量
BigDecimal robotFullElectricity = new BigDecimal(fullElectricity);

View File

@ -129,15 +129,15 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
}
if (ObjectUtil.isNotEmpty(chargeConfig) && ObjectUtil.isNotEmpty(chargeConfig.getStartAutoCharge())) {
String socKey = RobotTaskChcheConstant.ROBOT_INFORMATION_SOC +robot.getMacAddress();
Object socObject = redisUtil.get(socKey);
if (ObjectUtil.isEmpty(socObject)) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + robot.getMacAddress();
Object poseCache = redisUtil.get(pose2dKey);
RobotStatusDataPoseDTO dataPoseDTO = JSON.parseObject((String) poseCache, RobotStatusDataPoseDTO.class);
if (ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) {
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
log.info("车机没有电量信息 :{}",robot.getRobotNo());
continue;
}
BigDecimal robotRemainingElectricity = new BigDecimal(socObject.toString());
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc());
BigDecimal robotEndElectricity = new BigDecimal(chargeConfig.getStartAutoCharge()+"");
if (robotRemainingElectricity.compareTo(robotEndElectricity) < 0) {
robot.setRobotStatus(RobotStatusEnum.DOING.getType());
@ -235,25 +235,21 @@ public class DistributeTasksServiceImpl implements DistributeTasksService {
* @param robot
*/
private void setRobotStatus(CommonConfigDO commonConfigDO, RobotInformationDO robot) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robot.getMacAddress();
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT_SOC + 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(commonConfigDO) || ObjectUtil.isEmpty(poseCache) || ObjectUtil.isEmpty(o)) {
if (ObjectUtil.isEmpty(commonConfigDO) || ObjectUtil.isEmpty(poseCache) || ObjectUtil.isEmpty(dataPoseDTO.getBatSoc())) {
return;
}
CommonConfigVO chargeConfig = JSONUtil.toBean(commonConfigDO.getConfigStr(), CommonConfigVO.class);
//车子剩余电量
BigDecimal robotRemainingElectricity = new BigDecimal(soc);
BigDecimal robotRemainingElectricity = new BigDecimal(dataPoseDTO.getBatSoc());
//设置离开的电量
BigDecimal robotEndElectricity = new BigDecimal("10");

View File

@ -196,7 +196,7 @@ public class RobotPathPlanningServiceImpl implements RobotPathPlanningService {
List<RobotPositionMapDTO> list = new ArrayList<>();
for (RobotInformationDO robot : robots) {
String pose2dKey = RobotTaskChcheConstant.ROBOT_INFORMATION_POSE_BAT + robot.getMacAddress();
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)) {

View File

@ -894,29 +894,4 @@
</where>
</select>
<select id="getLocationsXYByMapId"
resultType="cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationItemRespVO">
SELECT
t1.id,
t1.location_no as locationNo,
t1.sku_info as skuInfo,
t1.sku_number as skuNumber,
t1.location_enable as locationEnable,
t1.location_lock as locationLock,
t1.location_use_status as locationUseStatus,
t1.location_wide as locationWide,
t1.location_deep as locationDeep,
t1.location_storey as locationStorey,
t2.actual_location_x as actualLocationX,
t2.actual_location_y as actualLocationY
FROM
ware_house_location t1
LEFT JOIN ware_position_map_item t2
on t1.map_item_id = t2.id
WHERE
t1.deleted = '0'
AND t2.deleted = '0'
AND t1.map_id = #{mapId}
</select>
</mapper>