| | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getTargLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .set(Loc::getBarcode, pakin.getBarcode()))) { |
| | | throw new CoolException("库位预约失败!!"); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 任务置顶 |
| | | * |
| | | * @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("任务已处执行状态不可一键置顶!!"); |
| | | } |
| | | //判断子任务,修改任务优先级 |
| | | modiftyTaskSort(tasks); |
| | | |
| | | if (!taskService.updateById(tasks)) { |
| | | throw new CoolException("置顶失败!!"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 手动完成任务 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Task operateComplete(Long id) { |
| | | List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | Task task = taskService.getOne(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getId, id) |
| | | .in(Task::getTaskStatus, longs)); |
| | | |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("当前任务正在执行中,不可取消!!"); |
| | | } |
| | | |
| | | modiftyTaskSort(task); |
| | | |
| | | task.setTaskStatus(task.getTaskType() < 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id); |
| | | if (!this.updateById(task)) { |
| | | throw new CoolException("完成任务失败"); |
| | | } |
| | | return task; |
| | | } |
| | | |
| | | /** |
| | | * 修改任务优先级 |
| | | * @param task |
| | | */ |
| | | private Task modiftyTaskSort(Task task) { |
| | | String curLoc; |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) { |
| | | curLoc = task.getTargLoc(); |
| | | } else { |
| | | curLoc = task.getOrgLoc(); |
| | | } |
| | | if (!LocUtils.isShallowLoc(curLoc)) { |
| | | String shallowLoc = LocUtils.getShallowLoc(curLoc); |
| | | if (StringUtils.isNotBlank(shallowLoc)) { |
| | | throw new CoolException("数据异常,请联系管理员!"); |
| | | } |
| | | 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)) { |
| | | task.setSort(999); |
| | | } else { |
| | | int i = serviceOne.getSort() - 1; |
| | | task.setSort(i); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return task; |
| | | } |
| | | |
| | | @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.在库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, task.getBarcode()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getCode, task.getTargLoc()))) { |
| | | .set(Loc::getBarcode, task.getBarcode()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getCode, task.getTargLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .eq(Loc::getCode, task.getOrgLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getUpdateBy, loginUserId) |
| | | .set(Task::getUpdateTime, new Date()) |
| | | .set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .set(Loc::getUpdateBy, loginUserId) |
| | | .set(Loc::getUpdateTime, new Date()) |
| | | .eq(Loc::getId, loc.getId()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | | .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val) |
| | | .set(WaitPakin::getUpdateBy, loginUserId) |
| | | .set(WaitPakin::getUpdateBy, loginUserId) |
| | | .eq(WaitPakin::getId, pakinItem.getPakinId()))) { |
| | | throw new CoolException("组拖状态修改失败!!"); |
| | | } |