| | |
| | | import com.zy.core.network.entity.ZyStationStatusEntity; |
| | | import com.zy.core.service.StationTaskLoopService; |
| | | import com.zy.core.thread.impl.v5.StationV5SegmentExecutor; |
| | | import com.zy.core.thread.support.RecentStationArrivalTracker; |
| | | import com.zy.core.trace.StationTaskTraceRegistry; |
| | | import com.zy.core.utils.DeviceLogRedisKeyBuilder; |
| | | import lombok.Data; |
| | |
| | | private long deviceDataLogTime = System.currentTimeMillis(); |
| | | private ExecutorService executor = Executors.newFixedThreadPool(9999); |
| | | private StationV5SegmentExecutor segmentExecutor; |
| | | private final RecentStationArrivalTracker recentArrivalTracker; |
| | | |
| | | public ZyStationV5Thread(DeviceConfig deviceConfig, RedisUtil redisUtil) { |
| | | this.deviceConfig = deviceConfig; |
| | | this.redisUtil = redisUtil; |
| | | this.recentArrivalTracker = new RecentStationArrivalTracker(redisUtil); |
| | | this.segmentExecutor = new StationV5SegmentExecutor(deviceConfig, redisUtil, this::sendCommand); |
| | | } |
| | | |
| | |
| | | stationProtocol.setWeight(statusEntity.getWeight()); |
| | | stationProtocol.setTaskWriteIdx(statusEntity.getTaskWriteIdx()); |
| | | stationProtocol.setTaskBufferItems(statusEntity.getTaskBufferItems()); |
| | | recentArrivalTracker.observe(statusEntity.getStationId(), statusEntity.getTaskNo(), statusEntity.isLoading()); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(stationProtocol.getSystemWarning())) { |
| | |
| | | map.put(stationProtocol.getStationId(), stationProtocol); |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasRecentArrival(Integer stationId, Integer taskNo) { |
| | | return recentArrivalTracker.hasRecentArrival(stationId, taskNo); |
| | | } |
| | | |
| | | @Override |
| | |
| | | log.warn("输送站缓存区残留路径清理失败。stationId={}, slotIdx={}, taskNo={}", |
| | | stationId, item.getSlotIdx(), item.getTaskNo()); |
| | | continue; |
| | | }else { |
| | | success = true; |
| | | log.warn("输送站缓存区残留路径清理成功。stationId={}, slotIdx={}, taskNo={}", |
| | | stationId, item.getSlotIdx(), item.getTaskNo()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (success) { |
| | | log.info("输送站缓存区残留路径清理成功。taskNo={}", taskNo); |
| | | } |
| | | return found && success; |
| | | } |