Compare commits
2 Commits
56f058981b
...
b92119dd75
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b92119dd75 | ||
![]() |
e3223b5618 |
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYArgDTO {
|
||||
private List<PathToRobotChangeXYArgMovePoseDTO> pose2ds;
|
||||
private PathToRobotChangeXYArgPoseDTO backPose;
|
||||
private PathToRobotChangeXYArgPoseDTO cargoPose;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYArgMovePoseDTO {
|
||||
/**
|
||||
* 开始控制点x轴
|
||||
*/
|
||||
private Double actualBeginControlX;
|
||||
/**
|
||||
* 开始控制点y轴
|
||||
*/
|
||||
private Double actualBeginControlY;
|
||||
|
||||
/**
|
||||
* 结束控制点x轴
|
||||
*/
|
||||
private Double actualEndControlX;
|
||||
/**
|
||||
* 结束控制点y轴
|
||||
*/
|
||||
private Double actualEndControlY;
|
||||
|
||||
private String id;
|
||||
|
||||
private Integer isEndPose;
|
||||
private Integer isOldPose;
|
||||
private Boolean isStraightEdge;
|
||||
private String poseId;
|
||||
private Double speed;
|
||||
private Double x;
|
||||
private Double y;
|
||||
private Double yaw;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYArgPoseDTO {
|
||||
/**
|
||||
* 开始控制点x轴
|
||||
*/
|
||||
private Double actualBeginControlX;
|
||||
/**
|
||||
* 开始控制点y轴
|
||||
*/
|
||||
private Double actualBeginControlY;
|
||||
|
||||
/**
|
||||
* 结束控制点x轴
|
||||
*/
|
||||
private Double actualEndControlX;
|
||||
/**
|
||||
* 结束控制点y轴
|
||||
*/
|
||||
private Double actualEndControlY;
|
||||
|
||||
private String id;
|
||||
|
||||
private Boolean isStraightEdge;
|
||||
private Double speed;
|
||||
private Double x;
|
||||
private Double y;
|
||||
private Double yaw;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYDTO {
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
//这个实体类不要修改
|
||||
private String executionType;
|
||||
private String orderId;
|
||||
private String orderType;
|
||||
private String robotNo;
|
||||
private String taskType;
|
||||
|
||||
private PathToRobotChangeXYDataDTO data;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.mqtt.api.path.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PathToRobotChangeXYDataDTO {
|
||||
private PathToRobotChangeXYArgDTO arg;
|
||||
private String commandType;
|
||||
private Integer isCommandEnd;
|
||||
}
|
@ -21,5 +21,6 @@ public class PathToRobotDTO {
|
||||
private Integer isCommandEnd;
|
||||
private String robotNo;
|
||||
private String commandType;
|
||||
private String taskType;
|
||||
private PathToRobotArgDTO arg;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class PathApiImpl implements PathApi {
|
||||
* 发送初始化信息给PP
|
||||
*/
|
||||
@Override
|
||||
@SystemRateLimiter(time = 10, count = 1, keyArg = "pathInitData", message = "路径规划初始化数据频繁")
|
||||
@SystemRateLimiter(time = 15, count = 1, keyArg = "pathInitData", message = "路径规划初始化数据频繁")
|
||||
public void pathInitData() {
|
||||
taskExecutor.execute(() -> {
|
||||
TenantContextHolder.setTenantId(1L);
|
||||
|
@ -75,6 +75,14 @@ public class DeviceInformationController {
|
||||
return success(BeanUtils.toBean(information, DeviceInformationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getCameraCode")
|
||||
@Operation(summary = "获得设备信息的摄像头code")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('device:information:getCameraCode')")
|
||||
public CommonResult<String> getCameraCode(@RequestParam("id") Long id) throws Exception {
|
||||
return success(informationService.getCameraCode(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得设备信息列表")
|
||||
public CommonResult<List<DeviceInformationRespVO>> getList(@Valid DeviceInformationDTO dto) {
|
||||
|
@ -98,4 +98,6 @@ public class RobotInformationPageRespVO {
|
||||
@Schema(description = "车辆端口")
|
||||
private Long robotPort;
|
||||
|
||||
@Schema(description = "车辆是否有货")
|
||||
private String cargoDetected;
|
||||
}
|
||||
|
@ -45,4 +45,10 @@ public class RobotModelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "转弯半径(单位米)")
|
||||
private String robotTurningRadius;
|
||||
|
||||
@Schema(description = "X轴偏移量")
|
||||
private String robotXOffset;
|
||||
|
||||
@Schema(description = "Y轴偏移量")
|
||||
private String robotYOffset;
|
||||
}
|
@ -49,4 +49,10 @@ public class RobotModelRespVO {
|
||||
|
||||
@Schema(description = "转弯半径(单位米)")
|
||||
private String robotTurningRadius;
|
||||
|
||||
@Schema(description = "X轴偏移量")
|
||||
private String robotXOffset;
|
||||
|
||||
@Schema(description = "Y轴偏移量")
|
||||
private String robotYOffset;
|
||||
}
|
@ -36,4 +36,10 @@ public class RobotModelSaveReqVO {
|
||||
|
||||
@Schema(description = "转弯半径(单位米)")
|
||||
private String robotTurningRadius;
|
||||
|
||||
@Schema(description = "X轴偏移量")
|
||||
private String robotXOffset;
|
||||
|
||||
@Schema(description = "Y轴偏移量")
|
||||
private String robotYOffset;
|
||||
}
|
@ -67,4 +67,14 @@ public class RobotModelDO extends BaseDO {
|
||||
*/
|
||||
private String robotTurningRadius;
|
||||
|
||||
/**
|
||||
* X轴偏移量
|
||||
*/
|
||||
private String robotXOffset;
|
||||
|
||||
/**
|
||||
* Y轴偏移量
|
||||
*/
|
||||
private String robotYOffset;
|
||||
|
||||
}
|
@ -151,7 +151,7 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
||||
* @param locationStorey
|
||||
* @return
|
||||
*/
|
||||
List<WareHouseLocationDO> queryUpperLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
|
||||
List<Long> queryUpperLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
|
||||
@Param("locationStorey") Integer locationStorey);
|
||||
|
||||
/**
|
||||
@ -160,7 +160,7 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
|
||||
* @param locationStorey
|
||||
* @return
|
||||
*/
|
||||
List<WareHouseLocationDO> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
|
||||
List<Long> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
|
||||
@Param("locationStorey") Integer locationStorey);
|
||||
|
||||
/**
|
||||
|
@ -143,4 +143,11 @@ public interface DeviceInformationService extends IService<DeviceInformationDO>
|
||||
* @param id
|
||||
*/
|
||||
void deleteDeviceByMapId(Long id);
|
||||
|
||||
/**
|
||||
* 获取摄像头code
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getCameraCode(Long id) throws Exception;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
|
||||
if (DeviceTypeEnum.CAMERA.getType().equals(createReqVO.getDeviceType())) {
|
||||
try {
|
||||
createReqVO.setDeviceNo(AESEncryptionUtil.getEncrypt(createReqVO.getDeviceNo(), cameraSecretKey));
|
||||
createReqVO.setCameraCode(AESEncryptionUtil.getEncrypt(createReqVO.getCameraCode(), cameraSecretKey));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
// 更新
|
||||
if (DeviceTypeEnum.CAMERA.getType().equals(updateReqVO.getDeviceType())) {
|
||||
try {
|
||||
updateReqVO.setDeviceNo(AESEncryptionUtil.getEncrypt(updateReqVO.getDeviceNo(), cameraSecretKey));
|
||||
updateReqVO.setCameraCode(AESEncryptionUtil.getEncrypt(updateReqVO.getCameraCode(), cameraSecretKey));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
@ -474,6 +474,16 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
|
||||
informationMapper.deleteDeviceByMapId(mapId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCameraCode(Long id) throws Exception {
|
||||
DeviceInformationDO deviceInformationDO = informationMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(deviceInformationDO.getCameraCode()) || !DeviceTypeEnum.CAMERA.getType().equals(deviceInformationDO.getDeviceType())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return AESEncryptionUtil.decrypt(deviceInformationDO.getCameraCode(), cameraSecretKey);
|
||||
}
|
||||
|
||||
public void shrink(String ip, int port, String deviceNo) {
|
||||
boolean success = true;
|
||||
short[] shrinkArr = {0};
|
||||
|
@ -27,10 +27,12 @@ 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.dataobject.robot.RobotModelDO;
|
||||
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.common.ZeroOneEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.config.CommandConfigTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.item.PositionMapItemEnum;
|
||||
import cn.iocoder.yudao.module.system.enums.line.DirectionEnum;
|
||||
@ -45,6 +47,7 @@ import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
||||
import cn.iocoder.yudao.module.system.service.remote.RemoteControllerInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotModelService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -121,6 +124,9 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
@Resource
|
||||
private RobotTaskDetailActionLogService taskDetailActionLogService;
|
||||
|
||||
@Resource
|
||||
private RobotModelService modelService;
|
||||
|
||||
/**
|
||||
* 同步ware_position_map_line的点位信息
|
||||
*/
|
||||
@ -447,6 +453,38 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
String mac = robotInformationService.getMacByRobotNo(pathRobotDTO.getRobotNo());
|
||||
String topic = RobotTopicConstant.ROBOT_TASK_MOVE_TOPIC + mac;
|
||||
if(RobotCommandTypeEnum.SWITCH_MAP.getType().equals(pathRobotDTO.getCommandType())) {
|
||||
switchMap(pathRobotDTO,topic);
|
||||
} else if (RobotCommandTypeEnum.WORD_DROP_OFF_GOODS.getType().equals(pathRobotDTO.getCommandType())) {
|
||||
wordDropOffGoods(message,topic,pathRobotDTO.getRobotNo());
|
||||
} else {
|
||||
commonApi.commonMethodStr(message, topic);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配不同车型的放货点
|
||||
* @param message
|
||||
* @param topic
|
||||
*/
|
||||
private void wordDropOffGoods(String message, String topic, String robotNo) {
|
||||
RobotInformationDO robotInformation = robotInformationService.getInformationByRobotNo(robotNo);
|
||||
RobotModelDO model = modelService.getModel(robotInformation.getRobotModelId());
|
||||
if (String.valueOf(ZeroOneEnum.ZERO.getType()).equals(model.getRobotXOffset())
|
||||
&& String.valueOf(ZeroOneEnum.ZERO.getType()).equals(model.getRobotYOffset())) {
|
||||
commonApi.commonMethodStr(message, topic);
|
||||
return;
|
||||
}
|
||||
PathToRobotChangeXYDTO pathToRobotChangeXY = JSON.parseObject(message, PathToRobotChangeXYDTO.class);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计时间使用
|
||||
* @param pathRobotDTO
|
||||
* @param topic
|
||||
*/
|
||||
public void switchMap(PathToRobotDTO pathRobotDTO,String topic ) {
|
||||
String mapFileName = positionMapService.getMapFileNameByFloorAndAreaName(pathRobotDTO.getArg().getFloor(),pathRobotDTO.getArg().getAreaId());
|
||||
pathRobotDTO.getArg().setMapName(mapFileName);
|
||||
controllerInformationService.robotChangeSpeed(pathRobotDTO);
|
||||
@ -474,9 +512,6 @@ public class PathPlanningServiceImpl implements PathPlanningService {
|
||||
actionLog.setDuration(duration.toMinutes());
|
||||
taskDetailActionLogService.updateTaskDetailActionLogs(Collections.singletonList(actionLog));
|
||||
}
|
||||
}else {
|
||||
commonApi.commonMethodStr(message, topic);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,6 @@ import cn.iocoder.yudao.module.system.enums.robot.task.RobotCommandTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.service.housearea.HouseAreaService;
|
||||
import cn.iocoder.yudao.module.system.service.houselane.WareHouseLaneService;
|
||||
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
|
||||
import cn.iocoder.yudao.module.system.service.information.DeviceInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.log.UserOperationLogService;
|
||||
import cn.iocoder.yudao.module.system.service.parkingspot.ParkingSpotService;
|
||||
import cn.iocoder.yudao.module.system.service.remote.RemoteControllerInformationService;
|
||||
@ -39,6 +38,7 @@ import cn.iocoder.yudao.module.system.service.robot.RobotInformationService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotTaskDetailService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.RobotWarnMsgService;
|
||||
import cn.iocoder.yudao.module.system.service.robot.mapstop.RobotMapStopService;
|
||||
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -136,6 +136,9 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
|
||||
@Resource
|
||||
private ParkingSpotService parkingSpotService;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public Long createPositionMap(PositionMapSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -258,6 +261,7 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
|
||||
houseAreaService.deleteHouseAreaByMapId(positionMap.getId());
|
||||
houseLaneService.deleteHouseLaneByMapId(positionMap.getId());
|
||||
parkingSpotService.deleteParkingByMapId(positionMap.getId());
|
||||
redisUtil.del("pngBase64");
|
||||
}
|
||||
|
||||
// 处理 PNG 文件
|
||||
|
@ -662,6 +662,15 @@ public class RobotInformationServiceImpl extends ServiceImpl<RobotInformationMap
|
||||
if (ObjectUtil.isNotEmpty(pageReqVO.getRobotStatisticsType())) {
|
||||
List<RobotInformationPageRespVO> resultList = new ArrayList<>();
|
||||
for (RobotInformationPageRespVO v : targetList) {
|
||||
|
||||
String cargoDetectedKey = RobotTaskChcheConstant.ROBOT_CARGO_DETECTED + v.getMacAddress();
|
||||
Object cargoDetected = redisUtil.get(cargoDetectedKey);
|
||||
if (ObjectUtil.isNotEmpty(cargoDetected) && RobotStatusCodeConstant.CARGO_DETECTED.equals(Boolean.parseBoolean(String.valueOf(cargoDetected)))) {
|
||||
//说明取货完成
|
||||
v.setCargoDetected("有货");
|
||||
}else {
|
||||
v.setCargoDetected("空车");
|
||||
}
|
||||
if (RobotStatisticsTypeEnum.STANDBY.getType().equals(pageReqVO.getRobotStatisticsType())
|
||||
&& v.getRobotTaskStatus().equals(0)) {
|
||||
resultList.add(v);
|
||||
|
@ -531,6 +531,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
|
||||
informationMapper.updateById(robotInformationDOS);
|
||||
|
||||
taskCycleMapper.deletByRobotTaskId(robotTaskDO.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -978,14 +979,29 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
releaseMapItemIds.addAll(mapItemList);
|
||||
}
|
||||
List<Long> locationIds = new ArrayList<>();
|
||||
Set<Long> chooseLocationIds = new HashSet<>();
|
||||
|
||||
for (RobotTaskDetailAddVO item : taskDetailList) {
|
||||
if (RobotTaskTypeEnum.TAKE_RELEASE.getType().equals(item.getTaskType())) {
|
||||
chooseLocationIds.add(item.getTakeId());
|
||||
chooseLocationIds.add(item.getReleaseId());
|
||||
} else if (RobotTaskTypeEnum.TAKE.getType().equals(item.getTaskType())) {
|
||||
chooseLocationIds.add(item.getTakeId());
|
||||
} else if (RobotTaskTypeEnum.RELEASE.getType().equals(item.getTaskType())) {
|
||||
chooseLocationIds.add(item.getReleaseId());
|
||||
}
|
||||
}
|
||||
|
||||
for (RobotTaskDetailAddVO robotTaskVo : taskDetailList) {
|
||||
robotTaskVo.setRobotTaskId(task.getId());
|
||||
robotTaskVo.setPriority(task.getPriority());
|
||||
RobotTaskTypeEnum robotTaskType = RobotTaskTypeEnum.getRobotTaskType(robotTaskVo.getTaskType());
|
||||
if (ObjectUtil.isEmpty(robotTaskType)) {
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "任务类型不存在");
|
||||
}
|
||||
switch (robotTaskType) {
|
||||
case TAKE_RELEASE:
|
||||
doTakeRelease(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, task.getSkuInfo());
|
||||
doTakeRelease(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, task.getSkuInfo(), chooseLocationIds);
|
||||
break;
|
||||
case PARK:
|
||||
doPark(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds);
|
||||
@ -997,10 +1013,10 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
doMove(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds);
|
||||
break;
|
||||
case TAKE:
|
||||
doTake(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds);
|
||||
doTake(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, chooseLocationIds);
|
||||
break;
|
||||
case RELEASE:
|
||||
doRelease(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, task.getSkuInfo());
|
||||
doRelease(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, task.getSkuInfo(), chooseLocationIds);
|
||||
break;
|
||||
case SCAN:
|
||||
//暂无此功能
|
||||
@ -1062,8 +1078,10 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void doRelease(RobotTaskDetailAddVO robotTaskVo, List<Long> locationIds, List<Long> takeMapItemIds,
|
||||
List<Long> releaseMapItemIds, List<Long> laneIds, List<Long> areaIds, String skuInfo) {
|
||||
setToLocation(robotTaskVo, getMapIdsByRobotNo(robotTaskVo.getRobotNo()), locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, skuInfo);
|
||||
List<Long> releaseMapItemIds, List<Long> laneIds, List<Long> areaIds, String skuInfo,
|
||||
Set<Long> chooseLocationIds) {
|
||||
setToLocation(robotTaskVo, getMapIdsByRobotNo(robotTaskVo.getRobotNo()), locationIds, takeMapItemIds,
|
||||
releaseMapItemIds, laneIds, areaIds, skuInfo, chooseLocationIds);
|
||||
locationIds.add(robotTaskVo.getToLocationId());
|
||||
}
|
||||
|
||||
@ -1074,12 +1092,12 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void doTake(RobotTaskDetailAddVO robotTaskVo, List<Long> locationIds, List<Long> takeMapItemIds,
|
||||
List<Long> releaseMapItemIds) {
|
||||
List<Long> releaseMapItemIds, Set<Long> chooseLocationIds) {
|
||||
Set<Long> mapIds = new HashSet<>();
|
||||
if (ObjectUtil.isNotEmpty(robotTaskVo.getRobotNo())) {
|
||||
mapIds = getMapIdsByRobotNo(robotTaskVo.getRobotNo());
|
||||
}
|
||||
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds);
|
||||
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, chooseLocationIds);
|
||||
locationIds.add(robotTaskVo.getFromLocationId());
|
||||
}
|
||||
|
||||
@ -1092,7 +1110,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
public void doMove(RobotTaskDetailAddVO robotTaskVo, List<Long> locationIds, List<Long> takeMapItemIds,
|
||||
List<Long> releaseMapItemIds) {
|
||||
setToLocation(robotTaskVo, getMapIdsByRobotNo(robotTaskVo.getRobotNo()), locationIds, takeMapItemIds, releaseMapItemIds,
|
||||
null, null, null);
|
||||
null, null, null, null);
|
||||
locationIds.add(robotTaskVo.getToLocationId());
|
||||
}
|
||||
|
||||
@ -1145,7 +1163,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void setToLocation(RobotTaskDetailAddVO robotTaskVo, Set<Long> mapIds, List<Long> locationIds,
|
||||
List<Long> takeMapItemIds, List<Long> releaseMapItemIds,
|
||||
List<Long> laneIds, List<Long> areaIds, String skuInfo) {
|
||||
List<Long> laneIds, List<Long> areaIds, String skuInfo, Set<Long> chooseLocationIds) {
|
||||
if (ReleaseTakeEnum.TO_LOCATION.getType().equals(robotTaskVo.getReleaseType())) {
|
||||
WareHouseLocationDO query = WareHouseLocationDO.builder().id(robotTaskVo.getReleaseId()).build();
|
||||
WareHouseLocationDO locationDO = locationMapper.queryAllByLimit(query);
|
||||
@ -1167,7 +1185,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
log.error("此放货库位有库存 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此放货库位有库存 " + locationDO.getLocationNo());
|
||||
}
|
||||
checkToLocationNoneTask(locationDO);
|
||||
checkToLocationNoneTask(locationDO, chooseLocationIds);
|
||||
releaseMapItemIds.add(locationDO.getMapItemId());
|
||||
} else {
|
||||
if (ReleaseTakeEnum.TO_LANE.getType().equals(robotTaskVo.getReleaseType()) && ObjectUtil.isEmpty(laneIds)
|
||||
@ -1202,13 +1220,19 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
*
|
||||
* @param locationDO
|
||||
*/
|
||||
private void checkToLocationNoneTask(WareHouseLocationDO locationDO) {
|
||||
List<WareHouseLocationDO> locations = locationMapper.queryLowerLevelsByMapItemId(locationDO.getMapItemId(), locationDO.getLocationStorey());
|
||||
if (ObjectUtil.isNotEmpty(locations)) {
|
||||
private void checkToLocationNoneTask(WareHouseLocationDO locationDO, Set<Long> chooseLocationIds) {
|
||||
if (ObjectUtil.isEmpty(chooseLocationIds)) {
|
||||
return;
|
||||
}
|
||||
List<Long> locations = locationMapper.queryLowerLevelsByMapItemId(locationDO.getMapItemId(), locationDO.getLocationStorey());
|
||||
|
||||
if (ObjectUtil.isEmpty(locations) || chooseLocationIds.containsAll(locations)) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.error("此放货库位的下层库位无货,请先放下层库位 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此放货库位的下层库位无货,请先放下层库位 " + locationDO.getLocationNo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置取货库位
|
||||
@ -1219,7 +1243,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void setFromLocation(RobotTaskDetailAddVO robotTaskVo, Set<Long> mapIds, List<Long> locationIds,
|
||||
List<Long> takeMapItemIds, List<Long> releaseMapItemIds) {
|
||||
List<Long> takeMapItemIds, List<Long> releaseMapItemIds, Set<Long> chooseLocationIds) {
|
||||
if (ReleaseTakeEnum.TO_LOCATION.getType().equals(robotTaskVo.getTakeType())) {
|
||||
WareHouseLocationDO query = WareHouseLocationDO.builder().id(robotTaskVo.getTakeId()).build();
|
||||
WareHouseLocationDO locationDO = locationMapper.queryAllByLimit(query);
|
||||
@ -1241,7 +1265,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
log.error("此取货库位没库存 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此取货库位没库存 " + locationDO.getLocationNo());
|
||||
}
|
||||
checkFromLocationNoneTask(locationDO);
|
||||
checkFromLocationNoneTask(locationDO, chooseLocationIds);
|
||||
takeMapItemIds.add(locationDO.getMapItemId());
|
||||
} else {
|
||||
WareHouseLocationDO wareHouseLocationDO =
|
||||
@ -1266,14 +1290,20 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
*
|
||||
* @param locationDO
|
||||
*/
|
||||
private void checkFromLocationNoneTask(WareHouseLocationDO locationDO) {
|
||||
private void checkFromLocationNoneTask(WareHouseLocationDO locationDO, Set<Long> chooseLocationIds) {
|
||||
|
||||
if (ObjectUtil.isEmpty(chooseLocationIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Long> locations = locationMapper.queryUpperLevelsByMapItemId(locationDO.getMapItemId(), locationDO.getLocationStorey());
|
||||
if (ObjectUtil.isEmpty(locations) || chooseLocationIds.containsAll(locations)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<WareHouseLocationDO> locations = locationMapper.queryUpperLevelsByMapItemId(locationDO.getMapItemId(), locationDO.getLocationStorey());
|
||||
if (ObjectUtil.isNotEmpty(locations)) {
|
||||
log.error("此取货库位的上层库位有货,请先取上层库位的货物 :{}", locationDO.getLocationNo());
|
||||
throw exception0(TASK_CREATE_FAIL.getCode(), "此取货库位的上层库位有货,请先取上层库位的货物 " + locationDO.getLocationNo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取放
|
||||
@ -1283,18 +1313,18 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void doTakeRelease(RobotTaskDetailAddVO robotTaskVo, List<Long> locationIds,
|
||||
List<Long> takeMapItemIds, List<Long> releaseMapItemIds,
|
||||
List<Long> laneIds, List<Long> areaIds, String skuInfo) {
|
||||
List<Long> laneIds, List<Long> areaIds, String skuInfo, Set<Long> chooseLocationIds) {
|
||||
Set<Long> mapIds = new HashSet<>();
|
||||
if (ObjectUtil.isNotEmpty(robotTaskVo.getRobotNo())) {
|
||||
mapIds = getMapIdsByRobotNo(robotTaskVo.getRobotNo());
|
||||
}
|
||||
|
||||
//校验放货库位
|
||||
setToLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, skuInfo);
|
||||
setToLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, skuInfo, chooseLocationIds);
|
||||
locationIds.add(robotTaskVo.getToLocationId());
|
||||
|
||||
//校验取货库位
|
||||
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds);
|
||||
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, chooseLocationIds);
|
||||
locationIds.add(robotTaskVo.getFromLocationId());
|
||||
|
||||
//验证取货库位是否存在未完成的任务
|
||||
|
@ -26,6 +26,8 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -78,7 +80,8 @@ public class CycleServiceImpl implements CycleService {
|
||||
Set<Long> taskIds = detailDOS.stream().map(RobotTaskDetailDO::getRobotTaskId).collect(Collectors.toSet());
|
||||
|
||||
List<RobotTaskDO> taskList = taskMapper.selectList(new LambdaQueryWrapper<RobotTaskDO>()
|
||||
.in(RobotTaskDO::getId, taskIds));
|
||||
.in(RobotTaskDO::getId, taskIds)
|
||||
.orderByAsc(RobotTaskDO::getCreateTime));
|
||||
|
||||
Map<Long, List<RobotTaskDetailDO>> taskIdMap =
|
||||
detailDOS.stream().collect(Collectors.groupingBy(RobotTaskDetailDO::getRobotTaskId));
|
||||
@ -86,7 +89,7 @@ public class CycleServiceImpl implements CycleService {
|
||||
String incrementByKey = redisUtil.getIncrementByKey(RobotCacheLockEnum.TASK_NO.getKey());
|
||||
|
||||
List<RobotTaskDO> taskDOList = new ArrayList<>();
|
||||
List<RobotTaskDetailDO> taskDetailList = new ArrayList<>();
|
||||
List<RobotTaskDetailDO> taskDetailList = new LinkedList<>();
|
||||
for (RobotTaskDO v : taskList) {
|
||||
RobotTaskDO taskData = getTaskData(incrementByKey, v);
|
||||
List<RobotTaskDetailDO> taskDetailDOS = getTaskDetailData(taskData,taskIdMap,v.getId());
|
||||
@ -97,6 +100,7 @@ public class CycleServiceImpl implements CycleService {
|
||||
|
||||
taskMapper.insertBatch(taskDOList);
|
||||
taskMapper.updateById(taskList);
|
||||
Collections.reverse(taskDetailList);
|
||||
taskDetailMapper.insertBatch(taskDetailList);
|
||||
|
||||
List<Long> fromLocationIds = taskDetailList.stream().map(RobotTaskDetailDO::getFromLocationId).collect(Collectors.toList());
|
||||
@ -121,7 +125,7 @@ public class CycleServiceImpl implements CycleService {
|
||||
private List<RobotTaskDetailDO> getTaskDetailData(RobotTaskDO taskData, Map<Long,
|
||||
List<RobotTaskDetailDO>> taskIdMap, Long id) {
|
||||
|
||||
List<RobotTaskDetailDO> taskDetailDOList = new ArrayList<>();
|
||||
List<RobotTaskDetailDO> taskDetailDOList = new LinkedList<>();
|
||||
List<RobotTaskDetailDO> taskDetailDOS = taskIdMap.get(id);
|
||||
for (RobotTaskDetailDO v : taskDetailDOS) {
|
||||
RobotTaskDetailDO build = RobotTaskDetailDO.builder()
|
||||
|
@ -872,10 +872,9 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryUpperLevelsByMapItemId"
|
||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO">
|
||||
<select id="queryUpperLevelsByMapItemId" resultType="Long">
|
||||
select
|
||||
<include refid="base_sql"></include>
|
||||
id
|
||||
from
|
||||
ware_house_location
|
||||
<where>
|
||||
@ -888,9 +887,9 @@
|
||||
</select>
|
||||
|
||||
<select id="queryLowerLevelsByMapItemId"
|
||||
resultType="cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO">
|
||||
resultType="Long">
|
||||
select
|
||||
<include refid="base_sql"></include>
|
||||
id
|
||||
from
|
||||
ware_house_location
|
||||
<where>
|
||||
|
Loading…
Reference in New Issue
Block a user