| | |
| | | import com.zy.asrs.entity.DeviceDataLog; |
| | | import com.zy.asrs.service.BasRgvService; |
| | | import com.zy.asrs.service.BasRgvOptService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | private RedisUtil redisUtil; |
| | | private ZyRgvConnectDriver zyRgvConnectDriver; |
| | | private RgvProtocol rgvProtocol; |
| | | private int deviceLogCollectTime = 200; |
| | | |
| | | public ZyRgvThread(DeviceConfig deviceConfig, RedisUtil redisUtil) { |
| | | this.deviceConfig = deviceConfig; |
| | |
| | | initRgv(); |
| | | while (true) { |
| | | try { |
| | | deviceLogCollectTime = Utils.getDeviceLogCollectTime(); |
| | | int step = 1; |
| | | Task task = MessageQueue.poll(SlaveType.Rgv, deviceConfig.getDeviceNo()); |
| | | if (task != null) { |
| | |
| | | rgvProtocol.setLastCommandTime(System.currentTimeMillis()); |
| | | } |
| | | |
| | | if (System.currentTimeMillis() - rgvProtocol.getDeviceDataLog() > 200) { |
| | | if (System.currentTimeMillis() - rgvProtocol.getDeviceDataLog() > deviceLogCollectTime) { |
| | | DeviceDataLog deviceDataLog = new DeviceDataLog(); |
| | | deviceDataLog.setOriginData(JSON.toJSONString(s)); |
| | | deviceDataLog.setWcsData(JSON.toJSONString(rgvProtocol)); |
| | |
| | | rgvProtocol.setDeviceDataLog(System.currentTimeMillis()); |
| | | } |
| | | |
| | | BasRgvService basRgvService = SpringUtils.getBean(BasRgvService.class); |
| | | BasRgvService basRgvService = null; |
| | | try { |
| | | basRgvService = SpringUtils.getBean(BasRgvService.class); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (basRgvService != null) { |
| | | BasRgv basRgv = basRgvService.selectOne(new EntityWrapper<BasRgv>().eq("rgv_no", deviceConfig.getDeviceNo())); |
| | | if(basRgv == null) { |