| | |
| | | .in(Task::getTaskStatus, integers) |
| | | .orderByDesc(Task::getSort)); |
| | | for (Task task : tasks) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, task.getBarcode())); |
| | | if (Objects.isNull(loc)) { |
| | | continue; |
| | | } |
| | | //判断是否深库位 |
| | | if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | //获取深库位对应的浅库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | if (StringUtils.isBlank(shallowLoc)) { |
| | | continue; |
| | | } |
| | | Loc shalloc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | if (Objects.isNull(shalloc) || !shalloc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | //如果浅库位不在库跳出循环 |
| | | continue; |
| | | } |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(shallowLoc).setType(TaskType.TASK_TYPE_LOC_MOVE.type + ""); |
| | | //生成移库任务 |
| | | Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | moveTask.setSort(!Objects.isNull(task.getSort()) ? task.getSort() + 1 : Constants.TASK_SORT_DEFAULT_VALUE + 1); |
| | | if (!taskService.updateById(moveTask)) { |
| | | throw new Exception("任务优先级更新失败!!"); |
| | | } |
| | | } |
| | | // Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, task.getBarcode())); |
| | | // if (Objects.isNull(loc)) { |
| | | // continue; |
| | | // } |
| | | // //判断是否深库位 |
| | | // if (!LocUtils.isShallowLoc(loc.getCode())) { |
| | | // //获取深库位对应的浅库位 |
| | | // String shallowLoc = LocUtils.getShallowLoc(loc.getCode()); |
| | | // if (StringUtils.isBlank(shallowLoc)) { |
| | | // continue; |
| | | // } |
| | | // Loc shalloc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); |
| | | // if (Objects.isNull(shalloc) || !shalloc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | // //如果浅库位不在库跳出循环 |
| | | // continue; |
| | | // } |
| | | // LocToTaskParams params = new LocToTaskParams(); |
| | | // params.setOrgLoc(shallowLoc).setType(TaskType.TASK_TYPE_LOC_MOVE.type + ""); |
| | | // //生成移库任务 |
| | | // Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | // moveTask.setSort(!Objects.isNull(task.getSort()) ? task.getSort() + 1 : Constants.TASK_SORT_DEFAULT_VALUE + 1); |
| | | // if (!taskService.updateById(moveTask)) { |
| | | // throw new Exception("任务优先级更新失败!!"); |
| | | // } |
| | | // } |
| | | //TODO 调用下发任务接口 |
| | | pubTaskToWcs(task); |
| | | } |
| | |
| | | taskParams.setBatch(task.getBarcode()); |
| | | |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type ) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) { |
| | | |
| | | itemParam.setDestLoc(task.getTargLoc()) |
| | | .setOriSta(task.getOrgSite()); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)) { |
| | | itemParam.setDestLoc(task.getTargLoc()) |
| | | .setOriSta(task.getTargSite()); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) |
| | | |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) |
| | | ) { |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)) { |
| | | |
| | | itemParam.setOriLoc(task.getOrgLoc()) |
| | | .setDestSta(task.getTargSite()); |
| | |
| | | .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | | ) { |
| | | if (!taskService.update(new LambdaUpdateWrapper<Task>().eq(Task::getTaskCode, task.getTaskCode()) |
| | | .set(Task::getTaskStatus, TaskStsType.WCS_EXECUTE_OUT.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |