| | |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败!!"); |
| | | } |
| | | |
| | | Task moveTask = new Task(); |
| | | 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("对应库位不存在!!"); |
| | | } |
| | | map.setOrgLoc(one.getCode()); |
| | | //优先生成移库任务 |
| | | if (!one.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | moveTask = genMoveTask(map, loginUserId); |
| | | } |
| | | } |
| | | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | task.setOrgLoc(loc.getCode()) |
| | | .setTaskCode(ruleCode) |
| | | .setParentId(moveTask.getId()) |
| | | .setTargSite(siteNo) |
| | | .setSort(Short.valueOf("49")) |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId) |
| | | .setCreateTime(new Date()) |
| | |
| | | Double useQty = Math.round((outQty + workQty) * 10000) / 10000.0; |
| | | if (orgQty.compareTo(useQty) > 0) { |
| | | //拣料出库 |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(DeviceSite::getChannel, loc.getChannel()) |
| | |
| | | throw new CoolException("站点不支持拣料出库!!"); |
| | | } |
| | | task.setTaskType(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).setWarehType(deviceSite.getDevice()); |
| | | |
| | | } else { |
| | | //全板出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("当前站点不支持盘点出库!!"); |
| | | } |
| | | |
| | | task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type).setWarehType(deviceSite.getDevice()); |
| | | } |
| | | |
| | | if (!taskService.save(task)) { |
| | | 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); |
| | | if (!taskService.saveOrUpdate(moveTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | } |
| | | task.setParentId(moveTask.getId()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("主任务关联失败!!"); |
| | | } |
| | | } |
| | | |
| | | List<TaskItem> taskItems = new ArrayList<>(); |
| | | listMap.get(key).forEach(item -> { |
| | | TaskItem taskItem = new TaskItem(); |
| | |
| | | if (Objects.isNull(map.getOrgLoc()) || StringUtils.isBlank(map.getOrgLoc())) { |
| | | throw new CoolException("源库位不能为空!"); |
| | | } |
| | | |
| | | Loc orgLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, map.getOrgLoc())); |
| | | if (Objects.isNull(orgLoc)) { |
| | | throw new CoolException("源库位不存在!!"); |
| | | } |
| | | |
| | | if (orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type) |
| | | || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) |
| | | || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_X.type ) ) { |
| | | throw new CoolException("源库位有任务正在执行中..."); |
| | | } |
| | | |
| | | // if (orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type) |
| | | // || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) |
| | | // || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_X.type ) ) { |
| | | // throw new CoolException("源库位有任务正在执行中..."); |
| | | // } |
| | | orgLoc.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | |
| | | if (!locService.updateById(orgLoc)) { |
| | | throw new CoolException("出库预约失败!!"); |
| | | } |
| | | |
| | | Loc targetLoc = new Loc(); |
| | | Loc targetLoc; |
| | | if (Objects.isNull(map.getTarLoc()) || StringUtils.isBlank(map.getTarLoc())) { |
| | | //目标库位为空,自动获取新库位 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | |
| | | } |
| | | TaskInParam param = new TaskInParam(); |
| | | param.setIoType(TaskType.TASK_TYPE_OUT.type) |
| | | .setOrgLoc(map.getOrgLoc()) |
| | | .setSourceStaNo(Integer.parseInt(deviceSite.getSite())) |
| | | .setLocType1(Integer.parseInt(orgLoc.getType())); |
| | | InTaskMsgDto locNo = null; |
| | | .setLocType1(Integer.parseInt(orgLoc.getType()) |
| | | ); |
| | | InTaskMsgDto locNo; |
| | | try { |
| | | locNo = wcsService.getLocNo(param); |
| | | } catch (Exception e) { |
| | |
| | | .setTaskType(TaskType.TASK_TYPE_LOC_MOVE.type) |
| | | .setTargLoc(targetLoc.getCode()) |
| | | .setUpdateBy(loginUserId) |
| | | .setSort(Short.valueOf("49")) |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateTime(new Date()) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setBarcode(orgLoc.getBarcode()); |