Compare commits

..

No commits in common. "b92119dd75506afaaf6d0d565c8ca9043500bc7f" and "56f058981be5c451c80a65f2bb659976992936af" have entirely different histories.

22 changed files with 73 additions and 349 deletions

View File

@ -1,19 +0,0 @@
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;
}

View File

@ -1,41 +0,0 @@
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;
}

View File

@ -1,38 +0,0 @@
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;
}

View File

@ -1,25 +0,0 @@
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;
}

View File

@ -1,16 +0,0 @@
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;
}

View File

@ -21,6 +21,5 @@ public class PathToRobotDTO {
private Integer isCommandEnd;
private String robotNo;
private String commandType;
private String taskType;
private PathToRobotArgDTO arg;
}

View File

@ -50,7 +50,7 @@ public class PathApiImpl implements PathApi {
* 发送初始化信息给PP
*/
@Override
@SystemRateLimiter(time = 15, count = 1, keyArg = "pathInitData", message = "路径规划初始化数据频繁")
@SystemRateLimiter(time = 10, count = 1, keyArg = "pathInitData", message = "路径规划初始化数据频繁")
public void pathInitData() {
taskExecutor.execute(() -> {
TenantContextHolder.setTenantId(1L);

View File

@ -75,14 +75,6 @@ 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) {

View File

@ -98,6 +98,4 @@ public class RobotInformationPageRespVO {
@Schema(description = "车辆端口")
private Long robotPort;
@Schema(description = "车辆是否有货")
private String cargoDetected;
}

View File

@ -45,10 +45,4 @@ public class RobotModelPageReqVO extends PageParam {
@Schema(description = "转弯半径(单位米)")
private String robotTurningRadius;
@Schema(description = "X轴偏移量")
private String robotXOffset;
@Schema(description = "Y轴偏移量")
private String robotYOffset;
}

View File

@ -49,10 +49,4 @@ public class RobotModelRespVO {
@Schema(description = "转弯半径(单位米)")
private String robotTurningRadius;
@Schema(description = "X轴偏移量")
private String robotXOffset;
@Schema(description = "Y轴偏移量")
private String robotYOffset;
}

View File

@ -36,10 +36,4 @@ public class RobotModelSaveReqVO {
@Schema(description = "转弯半径(单位米)")
private String robotTurningRadius;
@Schema(description = "X轴偏移量")
private String robotXOffset;
@Schema(description = "Y轴偏移量")
private String robotYOffset;
}

View File

@ -67,14 +67,4 @@ public class RobotModelDO extends BaseDO {
*/
private String robotTurningRadius;
/**
* X轴偏移量
*/
private String robotXOffset;
/**
* Y轴偏移量
*/
private String robotYOffset;
}

View File

@ -151,7 +151,7 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
* @param locationStorey
* @return
*/
List<Long> queryUpperLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
List<WareHouseLocationDO> queryUpperLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
@Param("locationStorey") Integer locationStorey);
/**
@ -160,7 +160,7 @@ public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO
* @param locationStorey
* @return
*/
List<Long> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
List<WareHouseLocationDO> queryLowerLevelsByMapItemId(@Param("mapItemId") Long mapItemId,
@Param("locationStorey") Integer locationStorey);
/**

View File

@ -143,11 +143,4 @@ public interface DeviceInformationService extends IService<DeviceInformationDO>
* @param id
*/
void deleteDeviceByMapId(Long id);
/**
* 获取摄像头code
* @param id
* @return
*/
String getCameraCode(Long id) throws Exception;
}

View File

@ -117,7 +117,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
if (DeviceTypeEnum.CAMERA.getType().equals(createReqVO.getDeviceType())) {
try {
createReqVO.setCameraCode(AESEncryptionUtil.getEncrypt(createReqVO.getCameraCode(), cameraSecretKey));
createReqVO.setDeviceNo(AESEncryptionUtil.getEncrypt(createReqVO.getDeviceNo(), cameraSecretKey));
} catch (Exception ignored) {
}
}
@ -152,7 +152,7 @@ public class DeviceInformationServiceImpl extends ServiceImpl<DeviceInformationM
// 更新
if (DeviceTypeEnum.CAMERA.getType().equals(updateReqVO.getDeviceType())) {
try {
updateReqVO.setCameraCode(AESEncryptionUtil.getEncrypt(updateReqVO.getCameraCode(), cameraSecretKey));
updateReqVO.setDeviceNo(AESEncryptionUtil.getEncrypt(updateReqVO.getDeviceNo(), cameraSecretKey));
} catch (Exception ignored) {
}
}
@ -474,16 +474,6 @@ 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};

View File

@ -27,12 +27,10 @@ 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;
@ -47,7 +45,6 @@ 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;
@ -124,9 +121,6 @@ public class PathPlanningServiceImpl implements PathPlanningService {
@Resource
private RobotTaskDetailActionLogService taskDetailActionLogService;
@Resource
private RobotModelService modelService;
/**
* 同步ware_position_map_line的点位信息
*/
@ -453,38 +447,6 @@ 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);
@ -512,6 +474,9 @@ public class PathPlanningServiceImpl implements PathPlanningService {
actionLog.setDuration(duration.toMinutes());
taskDetailActionLogService.updateTaskDetailActionLogs(Collections.singletonList(actionLog));
}
}else {
commonApi.commonMethodStr(message, topic);
}
}
/**

View File

@ -31,6 +31,7 @@ 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;
@ -38,7 +39,6 @@ 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,9 +136,6 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
@Resource
private ParkingSpotService parkingSpotService;
@Resource
private RedisUtil redisUtil;
@Override
public Long createPositionMap(PositionMapSaveReqVO createReqVO) {
// 插入
@ -261,7 +258,6 @@ public class PositionMapServiceImpl extends ServiceImpl<PositionMapMapper, Posit
houseAreaService.deleteHouseAreaByMapId(positionMap.getId());
houseLaneService.deleteHouseLaneByMapId(positionMap.getId());
parkingSpotService.deleteParkingByMapId(positionMap.getId());
redisUtil.del("pngBase64");
}
// 处理 PNG 文件

View File

@ -662,15 +662,6 @@ 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);

View File

@ -531,7 +531,6 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
informationMapper.updateById(robotInformationDOS);
taskCycleMapper.deletByRobotTaskId(robotTaskDO.getId());
}
@Override
@ -979,29 +978,14 @@ 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(), chooseLocationIds);
doTakeRelease(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, task.getSkuInfo());
break;
case PARK:
doPark(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds);
@ -1013,10 +997,10 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
doMove(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds);
break;
case TAKE:
doTake(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, chooseLocationIds);
doTake(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds);
break;
case RELEASE:
doRelease(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, task.getSkuInfo(), chooseLocationIds);
doRelease(robotTaskVo, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, task.getSkuInfo());
break;
case SCAN:
//暂无此功能
@ -1078,10 +1062,8 @@ 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,
Set<Long> chooseLocationIds) {
setToLocation(robotTaskVo, getMapIdsByRobotNo(robotTaskVo.getRobotNo()), locationIds, takeMapItemIds,
releaseMapItemIds, laneIds, areaIds, skuInfo, chooseLocationIds);
List<Long> releaseMapItemIds, List<Long> laneIds, List<Long> areaIds, String skuInfo) {
setToLocation(robotTaskVo, getMapIdsByRobotNo(robotTaskVo.getRobotNo()), locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, skuInfo);
locationIds.add(robotTaskVo.getToLocationId());
}
@ -1092,12 +1074,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, Set<Long> chooseLocationIds) {
List<Long> releaseMapItemIds) {
Set<Long> mapIds = new HashSet<>();
if (ObjectUtil.isNotEmpty(robotTaskVo.getRobotNo())) {
mapIds = getMapIdsByRobotNo(robotTaskVo.getRobotNo());
}
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, chooseLocationIds);
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds);
locationIds.add(robotTaskVo.getFromLocationId());
}
@ -1110,7 +1092,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());
}
@ -1163,7 +1145,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, Set<Long> chooseLocationIds) {
List<Long> laneIds, List<Long> areaIds, String skuInfo) {
if (ReleaseTakeEnum.TO_LOCATION.getType().equals(robotTaskVo.getReleaseType())) {
WareHouseLocationDO query = WareHouseLocationDO.builder().id(robotTaskVo.getReleaseId()).build();
WareHouseLocationDO locationDO = locationMapper.queryAllByLimit(query);
@ -1185,7 +1167,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
log.error("此放货库位有库存 :{}", locationDO.getLocationNo());
throw exception0(TASK_CREATE_FAIL.getCode(), "此放货库位有库存 " + locationDO.getLocationNo());
}
checkToLocationNoneTask(locationDO, chooseLocationIds);
checkToLocationNoneTask(locationDO);
releaseMapItemIds.add(locationDO.getMapItemId());
} else {
if (ReleaseTakeEnum.TO_LANE.getType().equals(robotTaskVo.getReleaseType()) && ObjectUtil.isEmpty(laneIds)
@ -1220,19 +1202,13 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
*
* @param locationDO
*/
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;
}
private void checkToLocationNoneTask(WareHouseLocationDO locationDO) {
List<WareHouseLocationDO> locations = locationMapper.queryLowerLevelsByMapItemId(locationDO.getMapItemId(), locationDO.getLocationStorey());
if (ObjectUtil.isNotEmpty(locations)) {
log.error("此放货库位的下层库位无货,请先放下层库位 :{}", locationDO.getLocationNo());
throw exception0(TASK_CREATE_FAIL.getCode(), "此放货库位的下层库位无货,请先放下层库位 " + locationDO.getLocationNo());
}
}
/**
* 设置取货库位
@ -1243,7 +1219,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, Set<Long> chooseLocationIds) {
List<Long> takeMapItemIds, List<Long> releaseMapItemIds) {
if (ReleaseTakeEnum.TO_LOCATION.getType().equals(robotTaskVo.getTakeType())) {
WareHouseLocationDO query = WareHouseLocationDO.builder().id(robotTaskVo.getTakeId()).build();
WareHouseLocationDO locationDO = locationMapper.queryAllByLimit(query);
@ -1265,7 +1241,7 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
log.error("此取货库位没库存 :{}", locationDO.getLocationNo());
throw exception0(TASK_CREATE_FAIL.getCode(), "此取货库位没库存 " + locationDO.getLocationNo());
}
checkFromLocationNoneTask(locationDO, chooseLocationIds);
checkFromLocationNoneTask(locationDO);
takeMapItemIds.add(locationDO.getMapItemId());
} else {
WareHouseLocationDO wareHouseLocationDO =
@ -1290,20 +1266,14 @@ public class RobotTaskServiceImpl extends ServiceImpl<RobotTaskMapper, RobotTask
*
* @param 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;
}
private void checkFromLocationNoneTask(WareHouseLocationDO locationDO) {
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());
}
}
/**
* 取放
@ -1313,18 +1283,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, Set<Long> chooseLocationIds) {
List<Long> laneIds, List<Long> areaIds, String skuInfo) {
Set<Long> mapIds = new HashSet<>();
if (ObjectUtil.isNotEmpty(robotTaskVo.getRobotNo())) {
mapIds = getMapIdsByRobotNo(robotTaskVo.getRobotNo());
}
//校验放货库位
setToLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, skuInfo, chooseLocationIds);
setToLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, laneIds, areaIds, skuInfo);
locationIds.add(robotTaskVo.getToLocationId());
//校验取货库位
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds, chooseLocationIds);
setFromLocation(robotTaskVo, mapIds, locationIds, takeMapItemIds, releaseMapItemIds);
locationIds.add(robotTaskVo.getFromLocationId());
//验证取货库位是否存在未完成的任务

View File

@ -26,8 +26,6 @@ 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;
@ -80,8 +78,7 @@ 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)
.orderByAsc(RobotTaskDO::getCreateTime));
.in(RobotTaskDO::getId, taskIds));
Map<Long, List<RobotTaskDetailDO>> taskIdMap =
detailDOS.stream().collect(Collectors.groupingBy(RobotTaskDetailDO::getRobotTaskId));
@ -89,7 +86,7 @@ public class CycleServiceImpl implements CycleService {
String incrementByKey = redisUtil.getIncrementByKey(RobotCacheLockEnum.TASK_NO.getKey());
List<RobotTaskDO> taskDOList = new ArrayList<>();
List<RobotTaskDetailDO> taskDetailList = new LinkedList<>();
List<RobotTaskDetailDO> taskDetailList = new ArrayList<>();
for (RobotTaskDO v : taskList) {
RobotTaskDO taskData = getTaskData(incrementByKey, v);
List<RobotTaskDetailDO> taskDetailDOS = getTaskDetailData(taskData,taskIdMap,v.getId());
@ -100,7 +97,6 @@ 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());
@ -125,7 +121,7 @@ public class CycleServiceImpl implements CycleService {
private List<RobotTaskDetailDO> getTaskDetailData(RobotTaskDO taskData, Map<Long,
List<RobotTaskDetailDO>> taskIdMap, Long id) {
List<RobotTaskDetailDO> taskDetailDOList = new LinkedList<>();
List<RobotTaskDetailDO> taskDetailDOList = new ArrayList<>();
List<RobotTaskDetailDO> taskDetailDOS = taskIdMap.get(id);
for (RobotTaskDetailDO v : taskDetailDOS) {
RobotTaskDetailDO build = RobotTaskDetailDO.builder()

View File

@ -872,9 +872,10 @@
</select>
<select id="queryUpperLevelsByMapItemId" resultType="Long">
<select id="queryUpperLevelsByMapItemId"
resultType="cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO">
select
id
<include refid="base_sql"></include>
from
ware_house_location
<where>
@ -887,9 +888,9 @@
</select>
<select id="queryLowerLevelsByMapItemId"
resultType="Long">
resultType="cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO">
select
id
<include refid="base_sql"></include>
from
ware_house_location
<where>