| | |
| | | import com.zy.core.network.entity.ZyCrnStatusEntity; |
| | | import com.zy.core.service.WrkCommandRollbackService; |
| | | import com.zy.core.thread.CrnThread; |
| | | import com.zy.core.utils.DeviceLogRedisKeyBuilder; |
| | | import com.zy.core.task.DeviceAsyncLogPublisher; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | private ZyCrnConnectDriver zyCrnConnectDriver; |
| | | private CrnProtocol crnProtocol; |
| | | private int deviceLogCollectTime = 200; |
| | | private final DeviceAsyncLogPublisher deviceAsyncLogPublisher; |
| | | |
| | | public ZySiemensCrnThread(DeviceConfig deviceConfig, RedisUtil redisUtil) { |
| | | this.deviceConfig = deviceConfig; |
| | | this.redisUtil = redisUtil; |
| | | this.deviceAsyncLogPublisher = SpringUtils.getBean(DeviceAsyncLogPublisher.class); |
| | | } |
| | | |
| | | @Override |
| | |
| | | crnProtocol.setWalkPos(crnStatus.getWalkPos()); |
| | | crnProtocol.setLoaded(crnStatus.getLoaded()); |
| | | crnProtocol.setAlarm(crnStatus.getAlarm()); |
| | | crnProtocol.setLaserValue(crnStatus.getLaserValue()); |
| | | crnProtocol.setTemp1(crnStatus.getTemp1()); |
| | | crnProtocol.setTemp2(crnStatus.getTemp2()); |
| | | crnProtocol.setTemp3(crnStatus.getTemp3()); |
| | |
| | | deviceDataLog.setDeviceNo(crnProtocol.getCrnNo()); |
| | | deviceDataLog.setCreateTime(new Date()); |
| | | |
| | | redisUtil.set(DeviceLogRedisKeyBuilder.build(deviceDataLog), deviceDataLog, 60 * 60 * 24); |
| | | deviceAsyncLogPublisher.publishLatest(deviceDataLog); |
| | | //更新采集时间 |
| | | crnProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |