| | |
| | | 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; |
| | |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.support.TransactionTemplate; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import java.util.ArrayList; |
| | |
| | | private Thread actionPublicThread; |
| | | |
| | | @Autowired |
| | | private TransactionTemplate txTemplate; |
| | | @Autowired |
| | | private AgvService agvService; |
| | | @Autowired |
| | | private BusService busService; |
| | |
| | | private LocService locService; |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | @Autowired |
| | | private TransferStationHandler transferStationHandler; |
| | | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | private void startupBus() throws InterruptedException { |
| | |
| | | .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); |
| | | if (transferStationHandler.hasDelayAtSta(segment)) { |
| | | continue; |
| | | } |
| | | try { |
| | | txTemplate.executeWithoutResult(status -> { |
| | | trafficService.trigger(segment); |
| | | }); |
| | | } catch (Exception e) { |
| | | log.error("trigger fail segId={}", segment.getId(), e); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("KernelScheduler.trafficCalcThread fail", e); |
| | | } |