| | |
| | | } |
| | | //深库位先出情况 |
| | | if (!LocUtils.isShallowLoc(curLoc)) { |
| | | //深库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(curLoc); |
| | | if (StringUtils.isBlank(shallowLoc)) { |
| | | throw new CoolException("数据异常,请联系管理员!"); |
| | |
| | | task.setSort(i); |
| | | } |
| | | } |
| | | // else if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | // //如果为在库状态,生成移库任务 |
| | | // LocToTaskParams params = new LocToTaskParams(); |
| | | // params.setOrgLoc(curLoc); |
| | | // //生成移深库位任务 |
| | | // Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | // moveTask.setTaskType(task.getSort() + 1); |
| | | // |
| | | // return moveTask; |
| | | // } |
| | | } else { |
| | | //浅库位,判断深对应深库位是否为空,如果为空生成一个移库任务,将托盘送入深库位 |
| | | String deepLoc = LocUtils.getDeepLoc(curLoc); |
| | |
| | | //判断深库位是否为空 |
| | | if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(loc.getCode()).setTarLoc(deepLoc); |
| | | |
| | | Task task1 = locItemService.genMoveTask(params, loginUserId); |
| | | params.setOrgLoc(curLoc).setTarLoc(deepLoc); |
| | | //生成移深库位任务 |
| | | locItemService.genMoveTask(params, loginUserId); |
| | | } |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R removeTask(Long[] ids, Long loginUserId) { |
| | | List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type,TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, |
| | | TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type, |
| | | TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); |
| | | List<Task> tasks = this.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, list) |
| | | .in(Task::getId, ids).in(Task::getTaskStatus, longs)); |
| | |
| | | throw new CoolException("任务已处执行状态不可取消!!"); |
| | | } |
| | | for (Task task : tasks) { |
| | | //取消移库任务 |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) && task.getTaskStatus().equals(TaskStsType.GENERATE_OUT.id)) { |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | | throw new CoolException("源库位状态修改失败!!"); |
| | | } |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()).set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { |
| | | throw new CoolException("移库目标库位状态修改失败!!"); |
| | | } |
| | | |
| | | Task outTask = taskService.getById(task.getParentId()); |
| | | if (!Objects.isNull(outTask)) { |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(task.getOrgLoc()).setSiteNo(task.getOrgSite()); |
| | | //生成移深库位任务 |
| | | Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | moveTask.setSort(task.getSort() + 1).setParentId(outTask.getId()); |
| | | if (!this.updateById(moveTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | } |
| | | outTask.setParentId(moveTask.getId()); |
| | | if (!this.updateById(outTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | |
| | | } |
| | | |
| | | } else { |
| | | throw new CoolException("无法生成新的移库任务,取消失败!!"); |
| | | } |
| | | } |
| | | |
| | | if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) { |
| | | BasStation basStation = null; |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) { |
| | |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) |
| | | ) { |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) { |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getTargLoc()) |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)); |