| | |
| | | String batch = busSubmitParam.getBatch(); |
| | | List<TaskDto> taskDtoList = busSubmitParam.getTaskList(); |
| | | if (Cools.isEmpty(taskDtoList)) { |
| | | throw new BusinessException("taskDtoList 不能为空"); |
| | | throw new BusinessException("taskList can't be empty!"); |
| | | } |
| | | |
| | | // 优先级排序 |
| | |
| | | bus.setMemo(memo); |
| | | |
| | | if (!busService.save(bus)) { |
| | | throw new BusinessException("任务保存失败"); |
| | | throw new BusinessException("Internal Server Error!"); |
| | | } |
| | | |
| | | // 保存任务 |
| | |
| | | task.setBusId(bus.getId()); |
| | | task.setTaskSts(TaskStsType.INIT.val()); |
| | | if (!taskService.save(task)) { |
| | | throw new BusinessException(task.getSeqNum() + "任务保存失败"); |
| | | throw new BusinessException("seqNum:" + task.getSeqNum() + " failed to save!"); |
| | | } |
| | | |
| | | // 修改库位状态 |
| | |
| | | case LOC_TO_LOC: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 不是在库状态"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); |
| | | } |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 不是空闲状态"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); |
| | | } |
| | | break; |
| | | case LOC_TO_STA: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 不是在库状态"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); |
| | | } |
| | | break; |
| | | case STA_TO_LOC: |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 不是空闲状态"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); |
| | | } |
| | | break; |
| | | case STA_TO_STA: |