| | |
| | | private OutStockService outStockService; |
| | | @Autowired |
| | | private WaveService waveService; |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | |
| | | |
| | | /** |
| | |
| | | if (Objects.isNull(map.getItems()) || map.getItems().isEmpty()) { |
| | | throw new CoolException("明细不能为空!"); |
| | | } |
| | | |
| | | String siteNo = map.getSiteNo(); |
| | | List<LocItem> items = map.getItems(); |
| | | Map<Long, List<LocItem>> listMap = items.stream().collect(Collectors.groupingBy(LocItem::getLocId)); |
| | |
| | | .setCreateTime(new Date()) |
| | | .setUpdateTime(new Date()) |
| | | .setTaskStatus(TaskStsType.GENERATE_OUT.id) |
| | | .setBarcode(loc.getBarcode()); |
| | | .setBarcode(loc.getBarcode()) |
| | | .setMemo(map.getMemo()); |
| | | |
| | | List<LocItem> locItems = this.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, key)); |
| | | if (locItems.isEmpty()) { |
| | |
| | | //拣料出库 -- 盘点出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(!Objects.isNull(loc.getChannel()),DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持拣料出库!!"); |
| | |
| | | } else { |
| | | //全板出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type)); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持全板出库!!"); |
| | |
| | | } else if (map.getType().equals(Constants.TASK_TYPE_OUT_CHECK)) { |
| | | //盘点出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type)); |
| | | if (Objects.isNull(deviceSite)) { |
| | |
| | | throw new CoolException("任务创建失败!!"); |
| | | } |
| | | |
| | | if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | //获取深库位对应浅库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(one)) { |
| | | throw new CoolException("对应库位不存在!!"); |
| | | } |
| | | Task workTask = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, one.getBarcode())); |
| | | if (Objects.isNull(workTask)) { |
| | | map.setOrgLoc(one.getCode()); |
| | | //优先生成移库任务 |
| | | if (one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | moveTask = genMoveTask(map, loginUserId); |
| | | } |
| | | } else { |
| | | workTask.setSort(task.getSort() + 1).setParentId(task.getId()); |
| | | if (!taskService.updateById(workTask)) { |
| | | throw new CoolException("优先级修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | // if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | // //获取深库位对应浅库位 |
| | | // String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | // Loc one = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | // if (Objects.isNull(one)) { |
| | | // throw new CoolException("对应库位不存在!!"); |
| | | // } |
| | | // Task workTask = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, one.getBarcode())); |
| | | // if (Objects.isNull(workTask)) { |
| | | // map.setOrgLoc(one.getCode()); |
| | | // //优先生成移库任务 |
| | | // if (one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | // moveTask = genMoveTask(map, loginUserId); |
| | | // } |
| | | // } else { |
| | | // workTask.setSort(task.getSort() + 1).setParentId(task.getId()); |
| | | // if (!taskService.updateById(workTask)) { |
| | | // throw new CoolException("优先级修改失败!!"); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if (!Objects.isNull(moveTask.getId())) { |
| | | moveTask.setParentId(task.getId()).setSort(moveTask.getSort() + 1); |
| | |
| | | //目标库位为空,自动获取新库位 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_LOC_MOVE.type) |
| | | .eq(DeviceSite::getChannel, orgLoc.getChannel()), false); |
| | | .eq(!Objects.isNull(orgLoc.getChannel()), DeviceSite::getChannel, orgLoc.getChannel()), false); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点信息不存在!!"); |
| | | } |
| | | TaskInParam param = new TaskInParam(); |
| | | param.setIoType(TaskType.TASK_TYPE_OUT.type) |
| | | .setOrgLoc(map.getOrgLoc()) |
| | | .setSourceStaNo(Integer.parseInt(deviceSite.getSite())) |
| | | .setSourceStaNo(deviceSite.getSite()) |
| | | .setLocType1(Integer.parseInt(orgLoc.getType()) |
| | | ); |
| | | InTaskMsgDto locNo; |
| | |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateTime(new Date()) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setBarcode(orgLoc.getBarcode()); |
| | | .setBarcode(orgLoc.getBarcode()) |
| | | .setMemo(map.getMemo()); |
| | | |
| | | if (!taskService.save(task)) { |
| | | throw new CoolException("新建移库任务失败!!"); |