| | |
| | | private LaneService laneService; |
| | | @Autowired |
| | | private ActionSorter actionSorter; |
| | | @Autowired |
| | | private StaReserveService staReserveService; |
| | | |
| | | @SuppressWarnings("all") |
| | | @Transactional |
| | |
| | | } |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status"); |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |
| | | destSta.setUpdateTime(now); |
| | | if (!staService.updateById(destSta)) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " failed to update"); |
| | | if (null == staReserveService.reserveStaIn(destSta, task, 1)) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " failed to reserve"); |
| | | } |
| | | break; |
| | | case STA_TO_LOC: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " is not in STOCK status"); |
| | | } |
| | | oriSta.setStaSts(StaStsType.READY_TAKE.val()); |
| | | oriSta.setUpdateTime(now); |
| | | if (!staService.updateById(oriSta)) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " failed to update"); |
| | | if (null == staReserveService.reserveStaOut(oriSta, task, 1)) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " failed to reserve"); |
| | | } |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | |
| | | break; |
| | | case STA_TO_STA: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " is not in STOCK status"); |
| | | } |
| | | oriSta.setStaSts(StaStsType.READY_TAKE.val()); |
| | | oriSta.setUpdateTime(now); |
| | | if (!staService.updateById(oriSta)) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " failed to update"); |
| | | if (null == staReserveService.reserveStaOut(oriSta, task, 1)) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " failed to reserve"); |
| | | } |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status"); |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |
| | | destSta.setUpdateTime(now); |
| | | if (!staService.updateById(destSta)) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " failed to update"); |
| | | if (null == staReserveService.reserveStaIn(destSta, task, 1)) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " failed to reserve"); |
| | | } |
| | | break; |
| | | default: |
| | |
| | | for (Segment item : segmentList) { |
| | | item.setGroupId(groupId); |
| | | item.setState(SegmentStateType.RUNNING.toString()); |
| | | item.setStartTime(now); |
| | | item.setUpdateTime(now); |
| | | if (null != algoStartTime) { |
| | | item.setAlgoTime((int) (now.getTime() - algoStartTime.getTime())); |
| | |
| | | } |
| | | |
| | | if (taskComplete) { |
| | | locService.taskCallBack(task); |
| | | // locService.taskCallBack(task); |
| | | |
| | | task.setTaskSts(TaskStsType.COMPLETE.val()); |
| | | task.setEndTime(now); |
| | |
| | | if (!taskService.updateById(task)) { |
| | | log.error("Task [{}] 更新失败 !!!", task.getSeqNum()); |
| | | } else { |
| | | taskService.maintainLocAndSta(task); |
| | | log.info("Task [{}] 作业完毕 ==========>> ", task.getSeqNum()); |
| | | } |
| | | |
| | |
| | | // segment |
| | | for (Segment segment : segmentList) { |
| | | segment.setState(SegmentStateType.FINISH.toString()); |
| | | segment.setEndTime(now); |
| | | segment.setUpdateTime(now); |
| | | if (!segmentService.updateById(segment)) { |
| | | log.error("Segment [{}] 更新失败 !!!", segment.getGroupId() + " - " + segment.getSerial()); |