| | |
| | | import com.zy.acs.manager.manager.enums.*; |
| | | import com.zy.acs.manager.manager.service.*; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | | import com.zy.acs.manager.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | |
| | | private StaReserveService staReserveService; |
| | | @Autowired |
| | | private AgvAreaDispatcher agvAreaDispatcher; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agv:update')") |
| | | @OperationLog("Locate All Agv") |
| | |
| | | return R.error(); |
| | | } |
| | | |
| | | Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class); |
| | | Date now = new Date(); |
| | | Agv agv = agvService.selectByUuid(param.getAgvNo()); |
| | | AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId()); |
| | |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始库位【" + oriLoc.getLocNo() + "】"); |
| | | } |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); |
| | | if (maintainLocSts) { |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); |
| | | } |
| | | } |
| | | |
| | | // destLoc |
| | |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标库位【" + destLoc.getLocNo() + "】"); |
| | | } |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); |
| | | if (maintainLocSts) { |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); |
| | | } |
| | | } |
| | | |
| | | // task |
| | |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始库位【" + oriLoc.getLocNo() + "】"); |
| | | } |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); |
| | | if (maintainLocSts) { |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 修改库位状态失败"); |
| | | } |
| | | } |
| | | |
| | | // destSta |
| | |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标库位【" + destLoc.getLocNo() + "】"); |
| | | } |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); |
| | | if (maintainLocSts) { |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 修改库位状态失败"); |
| | | } |
| | | } |
| | | |
| | | // task |