| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R initLocs(LocMastInitParam param, Long loginUserId) { |
| | | //清空表 |
| | | // this.baseMapper.deleteAll(); |
| | | //清空当前库区库位 |
| | | List<Loc> locs = this.list(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, param.getWarehouseId()).eq(Loc::getAreaId, param.getAreaId())); |
| | | if (!locs.isEmpty()) { |
| | | if (!this.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, param.getWarehouseId()).eq(Loc::getAreaId, param.getAreaId()))) { |
| | | throw new CoolException("初始化失败:数据删除失败!!"); |
| | | } |
| | | } |
| | | |
| | | WarehouseAreas warehouseAreas = warehouseAreasService.getOne(new LambdaQueryWrapper<WarehouseAreas>() |
| | | .eq(WarehouseAreas::getWarehouseId, param.getWarehouseId()) |
| | | .eq(WarehouseAreas::getId, param.getAreaId())); |
| | | .eq(!Objects.isNull(param.getWarehouseId()), WarehouseAreas::getWarehouseId, param.getWarehouseId()) |
| | | .eq(!Objects.isNull(param.getAreaId()), WarehouseAreas::getId, param.getAreaId())); |
| | | if (Objects.isNull(warehouseAreas)) { |
| | | throw new CoolException("库区不存在!!"); |
| | | } |
| | | // 清空表 |
| | | // this.baseMapper.deleteAll(); |
| | | // 清空当前库区库位 |
| | | List<Loc> locs = this.list(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, warehouseAreas.getWarehouseId()) |
| | | .eq(Loc::getAreaId, warehouseAreas.getId())); |
| | | if (!locs.isEmpty()) { |
| | | if (!this.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, warehouseAreas.getWarehouseId()) |
| | | .eq(Loc::getAreaId, warehouseAreas.getId()))) { |
| | | throw new CoolException("初始化失败:数据删除失败!!"); |
| | | } |
| | | } |
| | | |
| | | String join = StringUtils.join(param.getTypeIds(), ","); |
| | | |
| | | String[] split = warehouseAreas.getCode().split("\\."); |
| | |
| | | Integer chanl = 0; //默认第一巷道 |
| | | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { |
| | | try{ |
| | | Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getChannel(), param.getStartRow()); |
| | | Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getChannel(), |
| | | param.getStartRow()); |
| | | for (List<Integer> node : shelves.nodes){ |
| | | if (node.contains(r)) { |
| | | if (!Cools.isEmpty(param.getStartChannel()) && param.getStartChannel() > 0){ |
| | |
| | | if (Objects.isNull(locs.getLocAreaId())) { |
| | | throw new CoolException("修改库位信息不能为空!!"); |
| | | } |
| | | List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getId, locs.getLocAreaId())); |
| | | List<LocArea> locAreas = locAreaService |
| | | .list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getId, locs.getLocAreaId())); |
| | | if (locAreas.isEmpty()) { |
| | | throw new CoolException("库位分区不存在!!"); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取库位使用情况 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |