| | |
| | | import com.zy.acs.manager.core.service.MainLockWrapService; |
| | | import com.zy.acs.manager.core.service.MainService; |
| | | import com.zy.acs.manager.core.service.TrafficService; |
| | | import com.zy.acs.manager.core.service.TransferStationHandler; |
| | | import com.zy.acs.manager.manager.entity.Bus; |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | |
| | | private LocService locService; |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | @Autowired |
| | | private TransferStationHandler transferStationHandler; |
| | | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | private void startupBus() throws InterruptedException { |
| | | // if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; } |
| | | if (!this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS)) { return; } |
| | | List<Bus> busList = busService.selectBySts(BusStsType.RECEIVE); |
| | | List<Bus> busList = busService.selectInSts(BusStsType.RECEIVE, BusStsType.PROGRESS); |
| | | for (Bus bus : busList) { |
| | | mainService.allocateTask(bus); |
| | | } |
| | |
| | | .eq(Segment::getState, SegmentStateType.WAITING.toString()) |
| | | ); |
| | | for (Segment segment : segments) { |
| | | long startTime = System.currentTimeMillis(); |
| | | trafficService.trigger(segment); |
| | | log.info("traffic calculation spend {} ms", System.currentTimeMillis() - startTime); |
| | | // long startTime = System.currentTimeMillis(); |
| | | if (!transferStationHandler.hasDelayAtSta(segment)) { |
| | | trafficService.trigger(segment); |
| | | } |
| | | // log.info("traffic calculation spend {} ms", System.currentTimeMillis() - startTime); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | // todo test TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.error("KernelScheduler.trafficCalcThread fail", e); |
| | | } |
| | | } |