| | |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private LaneService laneService; |
| | | @Autowired |
| | | private StaReserveService staReserveService; |
| | | |
| | | @Override |
| | | public PageResult<Task> pageRel(PageParam<Task, BaseParam> pageParam) { |
| | |
| | | return this.list(wrapper).stream().findFirst().orElse(null); |
| | | } |
| | | |
| | | @Override |
| | | public void maintainLocAndSta(Task task) { |
| | | if (null == task) { |
| | | return; |
| | | } |
| | | if (!task.getTaskSts().equals(TaskStsType.COMPLETE.val())) { |
| | | return; |
| | | } |
| | | Date now = new Date(); |
| | | // loc status |
| | | Loc oriLoc = null; |
| | | Loc destLoc = null; |
| | | Sta oriSta = null; |
| | | Sta destSta = null; |
| | | switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) { |
| | | case LOC_TO_LOC: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) { |
| | | oriLoc.setLocSts(LocStsType.IDLE.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | log.error("Loc [{}] 库位修改状态失败", task.getOriLoc$()); |
| | | } |
| | | } |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) { |
| | | destLoc.setLocSts(LocStsType.STOCK.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | log.error("Loc [{}] 库位修改状态失败", task.getDestLoc$()); |
| | | } |
| | | } |
| | | break; |
| | | case LOC_TO_STA: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) { |
| | | oriLoc.setLocSts(LocStsType.IDLE.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | log.error("Loc [{}] 库位修改状态失败", task.getOriLoc$()); |
| | | } |
| | | } |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | staReserveService.confirmStaReserve(destSta, task, 1, StaReserveType.IN); |
| | | break; |
| | | case STA_TO_LOC: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | staReserveService.confirmStaReserve(oriSta, task, 1, StaReserveType.OUT); |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) { |
| | | destLoc.setLocSts(LocStsType.STOCK.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | log.error("Loc [{}] 库位修改状态失败", task.getDestLoc$()); |
| | | } |
| | | } |
| | | break; |
| | | case STA_TO_STA: |
| | | oriSta = staService.getById(task.getOriSta()); |
| | | staReserveService.confirmStaReserve(oriSta, task, 1, StaReserveType.OUT); |
| | | |
| | | destSta = staService.getById(task.getDestSta()); |
| | | staReserveService.confirmStaReserve(destSta, task, 1, StaReserveType.IN); |
| | | break; |
| | | case TO_CHARGE: |
| | | case TO_STANDBY: |
| | | case MOVE: |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public void maintainLocSts(Task task, Boolean complete) { |
| | | Loc oriLoc = null; Loc destLoc = null; |