| | |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | /**获取组拖*/ |
| | | // List<Long> ids = pakins.stream().map(WaitPakin::getId).collect(Collectors.toList()); |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() |
| | | .in(WaitPakin::getId, pakins.getId()) |
| | | .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))); |
| | |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setTaskType(TaskType.TASK_TYPE_IN.type) |
| | | .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.id) |
| | | .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val) |
| | | .setTargLoc(targetLoc) |
| | | .setOrgSite(orgSta) |
| | | .setBarcode(pakin.getBarcode()) |
| | |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskStatus(TaskStsType.COMPLETE_IN.id) |
| | | .setTaskType(TaskType.TASK_TYPE_IN.type) |
| | | .setWarehType(WarehType.WAREHOUSE_TYPE_PLAT.id) |
| | | .setWarehType(WarehType.WAREHOUSE_TYPE_PLAT.val) |
| | | .setTargLoc(targetLoc) |
| | | .setBarcode(pakin.getBarcode()) |
| | | .setCreateBy(loginUserId) |
| | |
| | | } |
| | | |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | if (taskItems.isEmpty()) { |
| | | throw new CoolException("任务明细不存在!!"); |
| | | |
| | | if (!taskItems.isEmpty()) { |
| | | //移库有可能是空板 |
| | | try { |
| | | //更新库位明细 |
| | | saveLocItem(taskItems, task.getId()); |
| | | } catch (Exception e) { |
| | | throw new CoolException("库位明细更新失败!!"); |
| | | } |
| | | |
| | | if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { |
| | | throw new CoolException("源库位明细删除失败!"); |
| | | } |
| | | |
| | | } |
| | | try { |
| | | //更新库位明细 |
| | | saveLocItem(taskItems, task.getId()); |
| | | } catch (Exception e) { |
| | | throw new CoolException("库位明细更新失败!!"); |
| | | } |
| | | // /**对任务明细按组拖明细进行分组*/ |
| | | // try { |
| | | // //保存库存明细 |
| | | // saveStockItems(taskItems, null, null, pakinItem.getWkType(), pakinItem.getType()); |
| | | // } catch (Exception e) { |
| | | // log.error("<UNK>", e); |
| | | // throw new CoolException(e.getMessage()); |
| | | // } |
| | | |
| | | /**修改库位状态为F.在库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, task.getBarcode()) |
| | |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | |
| | | if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { |
| | | throw new CoolException("源库位明细删除失败!"); |
| | | } |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | |
| | | throw new CoolException("更新组托状态失败!!"); |
| | | } |
| | | } |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc())); |
| | | if (null != loc |
| | | && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) |
| | | || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) { |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc())); |
| | | if (null != loc && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) { |
| | | loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("更新库位状态失败!!"); |
| | | } |
| | | } |
| | | if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.id)) { |
| | | 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)) { |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | |
| | | ) { |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getTargLoc()) |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type) |
| | | ); |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)); |
| | | } |
| | | if (null == basStation) { |
| | | throw new CoolException("站点状态错误!!"); |
| | |
| | | if (!basStationService.updateById(basStation)) { |
| | | throw new CoolException("更新站点状态失败!!"); |
| | | } |
| | | } |
| | | |
| | | if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) { |
| | | throw new CoolException("任务明细删除失败!!"); |
| | | } |
| | | } |
| | | if (!this.removeByIds(Arrays.asList(ids))) { |
| | |
| | | public void complateOutStock(Task task) throws Exception { |
| | | if (Objects.isNull(task)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | if (StringUtils.isNotBlank(task.getParentId() + "")) { |
| | | Task task1 = taskService.getById(task.getParentId()); |
| | | if (!Objects.isNull(task1)) { |
| | | throw new CoolException("父任务:" + task1.getTaskCode() + "未执行完成!"); |
| | | } |
| | | } |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc())); |