| | |
| | | if (null == task) { |
| | | return Boolean.FALSE; |
| | | } |
| | | this.maintainLocSts(task, Boolean.TRUE); |
| | | this.maintainLocAndStaHandler(task, Boolean.TRUE); |
| | | |
| | | task.setTaskSts(TaskStsType.COMPLETE.val()); |
| | | task.setUpdateTime(new Date()); |
| | |
| | | if (null == task) { |
| | | return Boolean.FALSE; |
| | | } |
| | | this.maintainLocSts(task, Boolean.FALSE); |
| | | this.maintainLocAndStaHandler(task, Boolean.FALSE); |
| | | |
| | | task.setTaskSts(TaskStsType.CANCEL.val()); |
| | | task.setUpdateTime(new Date()); |
| | |
| | | |
| | | |
| | | @Transactional |
| | | public void maintainLocSts(Task task, Boolean complete) { |
| | | public void maintainLocAndStaHandler(Task task, Boolean complete) { |
| | | Loc oriLoc = null; Loc destLoc = null; |
| | | Sta oriSta = null; Sta destSta = null; |
| | | Date now = new Date(); |
| | |
| | | } |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | destSta.setStaSts(complete?StaStsType.STOCK.val():StaStsType.IDLE.val()); |
| | | destSta.setUpdateTime(now); |
| | | if (!staService.updateById(destSta)) { |
| | | throw new BusinessException("Sta [" + destSta.getStaNo() + "] 站点修改状态失败 !!!"); |
| | | if (complete) { |
| | | staReserveService.confirmStaReserve(destSta, task, 1, StaReserveType.IN); |
| | | } else { |
| | | staReserveService.cancelStaReserve(destSta, task, 1, StaReserveType.IN); |
| | | } |
| | | break; |
| | | case STA_TO_LOC: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | oriSta.setStaSts(complete?StaStsType.IDLE.val():StaStsType.STOCK.val()); |
| | | oriSta.setUpdateTime(now); |
| | | if (!staService.updateById(oriSta)) { |
| | | throw new BusinessException("Sta [" + oriSta.getStaNo() + "] 站点修改状态失败 !!!"); |
| | | if (complete) { |
| | | staReserveService.confirmStaReserve(oriSta, task, 1, StaReserveType.OUT); |
| | | } else { |
| | | staReserveService.cancelStaReserve(oriSta, task, 1, StaReserveType.OUT); |
| | | } |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | |
| | | break; |
| | | case STA_TO_STA: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | oriSta.setStaSts(complete?StaStsType.IDLE.val():StaStsType.STOCK.val()); |
| | | oriSta.setUpdateTime(now); |
| | | if (!staService.updateById(oriSta)) { |
| | | throw new BusinessException("Sta [" + oriSta.getStaNo() + "] 站点修改状态失败 !!!"); |
| | | if (complete) { |
| | | staReserveService.confirmStaReserve(oriSta, task, 1, StaReserveType.OUT); |
| | | } else { |
| | | staReserveService.cancelStaReserve(oriSta, task, 1, StaReserveType.OUT); |
| | | } |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | destSta.setStaSts(complete?StaStsType.STOCK.val():StaStsType.IDLE.val()); |
| | | destSta.setUpdateTime(now); |
| | | if (!staService.updateById(destSta)) { |
| | | throw new BusinessException("Sta [" + destSta.getStaNo() + "] 站点修改状态失败 !!!"); |
| | | if (complete) { |
| | | staReserveService.confirmStaReserve(destSta, task, 1, StaReserveType.IN); |
| | | } else { |
| | | staReserveService.cancelStaReserve(destSta, task, 1, StaReserveType.IN); |
| | | } |
| | | break; |
| | | case TO_CHARGE: |