/// <summary>
        /// 更新设备数据设备实时数据
        /// </summary>
        public static async void ProcessDevice(decimal value, string show, DateTime updateTime)
        {
            DeviceDto dto = new DeviceDto
            {
                ProcessedValue = value,
                ShowValue      = show,
                UpdateTime     = updateTime
            };
            //查询设备异常范围
            DeviceExceptionSetDto set = await _deviceExceptionSetService.GetDeviceExceptionSetByDeviceIdAsny(dto.Serialnum);

            var isException = false;

            if (set != null)
            {
                if (dto.ProcessedValue > set.Max || dto.ProcessedValue < set.Min)
                {
                    isException = true;
                }
            }
            var dType      = _redis.Smember <DeviceTypeDto>("deviceType", DataType.Protobuf).Find(dt => dt.Serialnum.EqualIgnoreCase(dto.DeviceTypeSerialnum));
            var deviceType = dType != null ? dType : await _deviceTypeService.GetDeviceTypeByIdAsny(dto.DeviceTypeSerialnum);//根据设备类型编码获取设备类型

            if (dType == null && deviceType != null)
            {
                _redis.Sadd("deviceType", deviceType, DataType.Protobuf);//加入到redis缓存中去
            }

            // device show value
            if (dto.ShowValue.IsNullOrWhiteSpace() && dto.Serialnum.Contains("control"))
            {
                if (deviceType.ValueCount == 1)
                {
                    dto.ShowValue = dto.ProcessedValue + "";
                }
                if (deviceType.ValueCount == 2)
                {
                    if (dto.ProcessedValue == 1)
                    {
                        dto.ShowValue = "开";
                    }
                    else if (dto.ProcessedValue == 0)
                    {
                        dto.ShowValue = "关";
                    }
                }
                else if (deviceType.ValueCount == 3)
                {
                    if (dto.ProcessedValue == 0xFF00)
                    {
                        dto.ShowValue = "开";
                    }
                    else if (dto.ProcessedValue == 0)
                    {
                        dto.ShowValue = "停";
                    }
                    else if (dto.ProcessedValue == 0x00FF)
                    {
                        dto.ShowValue = "关";
                    }
                }
            }
            dto.OnlineStatus = true;
            dto.IsException  = isException;
            DeviceDto dev = null;

            if (_redis.Exists("device") == 1)
            {
                dev = _redis.Smember <DeviceDto>("device", DataType.Protobuf).Find(d => d.Serialnum.EqualIgnoreCase(dto.DeviceTypeSerialnum));
            }
            if (dev != null)
            {
                _redis.Srem("device", dev, DataType.Protobuf);
            }
            _redis.Sadd("device", dto, DataType.Protobuf);//放入redis缓存
            //await _deviceService.UpdateDevice(dto);//更新设备
            LogHelper.Debug("更新设备数据 {0}:{1} {2} {3}", dto.Name, dto.ProcessedValue, dto.Unit, dto.UpdateTime);
        }