| | |
| | | if (!busService.save(bus)) { |
| | | throw new BusinessException("Internal Server Error!"); |
| | | } |
| | | Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, false); |
| | | |
| | | |
| | | // 保存任务 |
| | | for (Task task : taskList) { |
| | |
| | | switch (TaskTypeType.get(task.getTaskTypeEl())) { |
| | | case LOC_TO_LOC: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | if (locStaStatusCheck && !oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | |
| | | } |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | if (locStaStatusCheck && !destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | |
| | | break; |
| | | case LOC_TO_STA: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | if (locStaStatusCheck && !oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | |
| | | } |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status"); |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |
| | |
| | | break; |
| | | case STA_TO_LOC: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " is not in STOCK status"); |
| | | } |
| | | oriSta.setStaSts(StaStsType.READY_TAKE.val()); |
| | |
| | | } |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | if (locStaStatusCheck && !destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | |
| | | break; |
| | | case STA_TO_STA: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) { |
| | | throw new BusinessException("oriSta:" + task.getOriSta$() + " is not in STOCK status"); |
| | | } |
| | | oriSta.setStaSts(StaStsType.READY_TAKE.val()); |
| | |
| | | } |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | if (locStaStatusCheck && !destSta.getStaSts().equals(StaStsType.IDLE.val())) { |
| | | throw new BusinessException("destSta:" + task.getDestSta$() + " is not in IDLE status"); |
| | | } |
| | | destSta.setStaSts(StaStsType.READY_RELEASE.val()); |