Junjie
14 小时以前 1654b0a8c149f86d38f3202cb88c655ad0a25384
src/main/java/com/zy/core/thread/impl/ZyStationV3Thread.java
@@ -30,6 +30,8 @@
import com.zy.core.network.DeviceConnectPool;
import com.zy.core.network.ZyStationConnectDriver;
import com.zy.core.network.entity.ZyStationStatusEntity;
import com.zy.core.thread.support.RecentStationArrivalTracker;
import com.zy.core.thread.support.StationErrLogSupport;
import com.zy.core.utils.DeviceLogRedisKeyBuilder;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -54,10 +56,12 @@
    private int deviceLogCollectTime = 200;
    private long deviceDataLogTime = System.currentTimeMillis();
    private ExecutorService executor = Executors.newFixedThreadPool(9999);
    private final RecentStationArrivalTracker recentArrivalTracker;
    public ZyStationV3Thread(DeviceConfig deviceConfig, RedisUtil redisUtil) {
        this.deviceConfig = deviceConfig;
        this.redisUtil = redisUtil;
        this.recentArrivalTracker = new RecentStationArrivalTracker(redisUtil);
    }
    @Override
@@ -148,6 +152,7 @@
                    stationProtocol.setRunBlock(statusEntity.isRunBlock());
                    stationProtocol.setEnableIn(statusEntity.isEnableIn());
                    stationProtocol.setWeight(statusEntity.getWeight());
                    recentArrivalTracker.observe(statusEntity.getStationId(), statusEntity.getTaskNo(), statusEntity.isLoading());
                }
                if (!Cools.isEmpty(stationProtocol.getSystemWarning())) {
@@ -161,6 +166,7 @@
        }
        OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), deviceConfig.getDeviceNo()));
        StationErrLogSupport.sync(deviceConfig, redisUtil, statusList);
        if (System.currentTimeMillis() - deviceDataLogTime > deviceLogCollectTime) {
            DeviceDataLog deviceDataLog = new DeviceDataLog();
@@ -208,6 +214,11 @@
    }
    @Override
    public boolean hasRecentArrival(Integer stationId, Integer taskNo) {
        return recentArrivalTracker.hasRecentArrival(stationId, taskNo);
    }
    @Override
    public StationCommand getCommand(StationCommandType commandType, Integer taskNo, Integer stationId, Integer targetStationId, Integer palletSize) {
        return getCommand(commandType, taskNo, stationId, targetStationId, palletSize, null);
    }