| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 任务置顶 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Task taskToTop(Long id) throws Exception { |
| | | List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | Task tasks = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs)); |
| | | if (Objects.isNull(tasks)) { |
| | | throw new CoolException("任务已处执行状态不可一键置顶!!"); |
| | | } |
| | | |
| | | if (!LocUtils.isShallowLoc(tasks.getOrgLoc())) { |
| | | String shallowLoc = LocUtils.getShallowLoc(tasks.getOrgLoc()); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("数据错误,库位不存在!!"); |
| | | } |
| | | if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { |
| | | Task serviceOne = taskService.getOne(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getOrgLoc, loc.getCode()) |
| | | .or() |
| | | .eq(Task::getTargLoc, loc.getCode())); |
| | | if (Objects.isNull(serviceOne)) { |
| | | tasks.setSort(999); |
| | | } else { |
| | | int i = serviceOne.getSort() - 1; |
| | | tasks.setSort(i); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!taskService.updateById(tasks)) { |
| | | throw new CoolException("置顶失败!!"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void moveInStock(Task task, Long loginUserId) { |
| | | if (Objects.isNull(task)) { |
| | |
| | | if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { |
| | | throw new CoolException("源库位明细删除失败!"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /**修改库位状态为F.在库*/ |