From f6130e1d0b32d5f3ae36de73079244a8e17c6118 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Fri, 9 May 2025 17:54:52 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BC=98=E5=8C=96IoTDB=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E5=AE=9E=E7=8E=B030=E4=B8=AA=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=9A=84270W=E4=BB=BB=E5=8A=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=B9=B3=E5=9D=87=E8=80=97=E6=97=B6=E5=9C=A870=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComplexTypeSourceAnalyzers.cs | 4 +- .../JiShe.CollectBus.IoTDB/Model/IoTEntity.cs | 23 + .../Provider/DeviceMetadata.cs | 50 +- .../Provider/IoTDBProvider.cs | 593 ++++++++---------- .../DataChannels/DataChannelManageService.cs | 14 +- .../Samples/SampleAppService.cs | 4 +- .../BasicScheduledMeterReadingService.cs | 67 +- 7 files changed, 378 insertions(+), 377 deletions(-) diff --git a/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs b/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs index bad9528..ecb9c78 100644 --- a/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs +++ b/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs @@ -226,7 +226,7 @@ namespace JiShe.CollectBus.IncrementalGenerator code.AppendLine($" public string EntityName {{get;}} = \"{classSymbol.Name}\";"); // 添加 EntityType 属性 code.AppendLine($" public EntityTypeEnum? EntityType {{ get; }} = {entityTypeValue};"); - + foreach (var prop in propList) { // 安全类型转换 @@ -573,7 +573,7 @@ namespace JiShe.CollectBus.IncrementalGenerator $"new EntityMemberInfo(" + $"\"{prop.Name}.{elementName}\", " + $"typeof({elementType}), " + - $"\"{elementDeclaredName}\", " + + $"typeof({elementType}).Name, " +//$"\"{elementDeclaredName}\", " + $"(e) => Get{prop.Name}_{elementName}(({entityType})e), " + $"(e, v) => Set{prop.Name}_{elementName}(({entityType})e, ({elementType})v))"); } diff --git a/modules/JiShe.CollectBus.IoTDB/Model/IoTEntity.cs b/modules/JiShe.CollectBus.IoTDB/Model/IoTEntity.cs index f2d55a5..9df2488 100644 --- a/modules/JiShe.CollectBus.IoTDB/Model/IoTEntity.cs +++ b/modules/JiShe.CollectBus.IoTDB/Model/IoTEntity.cs @@ -1,6 +1,7 @@ using JiShe.CollectBus.Common.Attributes; using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.IoTDB.Attributes; +using Volo.Abp.Domain.Entities; namespace JiShe.CollectBus.IoTDB.Model { @@ -43,5 +44,27 @@ namespace JiShe.CollectBus.IoTDB.Model /// 时标,也就是业务时间戳,单位毫秒,必须通过DateTimeOffset获取 /// public long Timestamps { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + + /// + /// 设备路径 + /// + public virtual string DevicePath + { + get + { + return $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`"; + } + set + { + if (string.IsNullOrWhiteSpace(value)) + { + DevicePath = $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`"; + } + else + { + DevicePath = value; + } + } + } } } diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs b/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs index f48d218..92c33ee 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs @@ -6,8 +6,18 @@ namespace JiShe.CollectBus.IoTDB.Provider /// /// 设备元数据 /// - public class DeviceMetadata + public sealed class DeviceMetadata { + /// + /// 实体类名称 + /// + public string EntityName { get; set; } + + /// + /// 设备表名或树路径,如果实体没有添加TableNameOrTreePath,此处为空 + /// + public string TableNameOrTreePath { get; set; } + /// /// 实体类型枚举 /// @@ -31,6 +41,42 @@ namespace JiShe.CollectBus.IoTDB.Provider /// /// 值类型集合,用于构建Table的值类型,也就是dataTypes参数 /// - public List DataTypes { get; } = new(); + public List DataTypes { get; set; } = new(); + + /// + /// 列处理信息集合 + /// + public List Processors { get; } = new List(); + } + + /// + /// 列处理信息结构 + /// + public struct ColumnProcessor + { + /// + /// 列名 + /// + public string ColumnName; + + /// + /// 值获取委托 + /// + public Func ValueGetter; + + /// + /// 类型转换委托 + /// + public Func Converter; + + /// + /// 是否单测点 + /// + public bool IsSingleMeasuring; + + /// + /// 单测点名称委托 + /// + public Func SingleMeasuringNameGetter; } } diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs index db86791..34b4f4b 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs @@ -22,6 +22,10 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities; using JiShe.CollectBus.Analyzers.Shared; using JiShe.CollectBus.IoTDB.Exceptions; +using System.Diagnostics.Metrics; +using Newtonsoft.Json.Linq; +using static System.Runtime.InteropServices.JavaScript.JSType; +using System.Text.RegularExpressions; namespace JiShe.CollectBus.IoTDB.Provider { @@ -68,8 +72,13 @@ namespace JiShe.CollectBus.IoTDB.Provider var metadata = await GetMetadata(); var tablet = BuildTablet(new[] { entity }, metadata); + if (tablet == null || tablet.Count <= 0) + { + _logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null"); + return; + } - await CurrentSession.InsertAsync(tablet); + await CurrentSession.InsertAsync(tablet.First()); } catch (Exception ex) { @@ -95,7 +104,15 @@ namespace JiShe.CollectBus.IoTDB.Provider foreach (var batch in batches) { var tablet = BuildTablet(batch, metadata); - await CurrentSession.InsertAsync(tablet); + if (tablet == null || tablet.Count <= 0) + { + _logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null"); + return; + } + foreach (var item in tablet) + { + await CurrentSession.InsertAsync(item); + } } } catch (Exception ex) @@ -123,7 +140,15 @@ namespace JiShe.CollectBus.IoTDB.Provider foreach (var batch in batches) { var tablet = BuildTablet(batch, deviceMetadata); - await CurrentSession.InsertAsync(tablet); + if (tablet == null || tablet.Count <= 0) + { + _logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null"); + return; + } + foreach (var item in tablet) + { + await CurrentSession.InsertAsync(item); + } } } catch (Exception ex) @@ -181,22 +206,54 @@ namespace JiShe.CollectBus.IoTDB.Provider var accessor = SourceEntityAccessorFactory.GetAccessor(); var columns = CollectColumnMetadata(accessor); - var metadata = BuildDeviceMetadata(columns); + var tmpMetadata = BuildDeviceMetadata(columns, accessor); + + string tableNameOrTreePath = string.Empty; + var tableNameOrTreePathAttribute = typeof(T).GetCustomAttribute(); + if (tableNameOrTreePathAttribute != null) + { + tableNameOrTreePath = tableNameOrTreePathAttribute.TableNameOrTreePath; + } + tmpMetadata.EntityName = accessor.EntityName; + tmpMetadata.EntityType = accessor.EntityType; + tmpMetadata.TableNameOrTreePath = tableNameOrTreePath; + var metaData = MetadataCache.AddOrUpdate( typeof(T), - addValueFactory: t => metadata, // 如果键不存在,用此值添加 + addValueFactory: t => tmpMetadata, // 如果键不存在,用此值添加 updateValueFactory: (t, existingValue) => { var columns = CollectColumnMetadata(accessor); - var metadata = BuildDeviceMetadata(columns); + var metadata = BuildDeviceMetadata(columns, accessor); //对现有值 existingValue 进行修改,返回新值 + string tableNameOrTreePath = string.Empty; + var tableNameOrTreePathAttribute = typeof(T).GetCustomAttribute(); + if (tableNameOrTreePathAttribute != null) + { + tableNameOrTreePath = tableNameOrTreePathAttribute.TableNameOrTreePath; + } existingValue.ColumnNames = metadata.ColumnNames; + existingValue.DataTypes = metadata.DataTypes; return existingValue; } ); - metadata.EntityType = accessor.EntityType; + //var metaData = MetadataCache.GetOrAdd(typeof(T), type => + //{ + // var columns = CollectColumnMetadata(accessor); + // var metadata = BuildDeviceMetadata(columns, accessor); + // string tableNameOrTreePath = string.Empty; + // var tableNameOrTreePathAttribute = typeof(T).GetCustomAttribute(); + // if (tableNameOrTreePathAttribute != null) + // { + // tableNameOrTreePath = tableNameOrTreePathAttribute.TableNameOrTreePath; + // } + // metadata.EntityName = accessor.EntityName; + // metadata.EntityType = accessor.EntityType; + // metadata.TableNameOrTreePath = tableNameOrTreePath; + // return metadata; + //}); return await Task.FromResult(metaData); } @@ -251,338 +308,110 @@ namespace JiShe.CollectBus.IoTDB.Provider } } - ///// - ///// 构建Tablet - ///// - ///// - ///// 表实体 - ///// 设备元数据 - ///// - //private Tablet BuildTablet(IEnumerable entities, DeviceMetadata metadata) where T : IoTEntity - //{ - // var timestamps = new List(); - // var values = new List>(); - // var devicePaths = new HashSet(); - // List tempColumnNames = new List(); - // tempColumnNames.AddRange(metadata.ColumnNames); - - // var accessor = SourceEntityAccessorFactory.GetAccessor(); - - // var memberCache = new Dictionary(); // 缓存优化查询 - // // 预构建成员缓存(Key: NameOrPath) - // foreach (var member in accessor.MemberList) - // { - // memberCache[member.NameOrPath] = member; - // } - - // if (accessor.EntityType == null || metadata.EntityType == null) - // { - // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 没有指定,属于异常情况,-101"); - // } - - // if (metadata.EntityType != accessor.EntityType) - // { - // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 和{nameof(DeviceMetadata)}的 EntityType 不一致,属于异常情况,-102"); - // } - - // if (metadata.EntityType == EntityTypeEnum.TreeModel && _runtimeContext.UseTableSessionPool == true) - // { - // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 tree模型不能使用table模型Session连接,属于异常情况,-103"); - // } - // else if (metadata.EntityType == EntityTypeEnum.TableModel && _runtimeContext.UseTableSessionPool == false) - // { - // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 table模型不能使用tree模型Session连接,属于异常情况,-104"); - // } - - // string tableNameOrTreePath = string.Empty; - // var tableNameOrTreePathAttribute = typeof(T).GetCustomAttribute(); - // if (tableNameOrTreePathAttribute != null) - // { - // tableNameOrTreePath = tableNameOrTreePathAttribute.TableNameOrTreePath; - // } - - // foreach (var entity in entities) - // { - // timestamps.Add(entity.Timestamps); - // var rowValues = new List(); - - // foreach (var measurement in metadata.ColumnNames) - // { - // if (!memberCache.TryGetValue(measurement, out var member)) - // { - // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构时{accessor.EntityName}没有找到{measurement}对应的member信息,-105"); - // } - - // var value = member.GetValue(entity); - - // // 特性查询优化 - // var attributes = member.CustomAttributes ?? Enumerable.Empty(); - // var singleMeasuringAttr = attributes.OfType().FirstOrDefault(); - // if (singleMeasuringAttr != null)//如果是单侧点 - // { - - // var tupleItem1Key = $"{member.NameOrPath}.Item1"; - // if (!memberCache.TryGetValue(tupleItem1Key, out var tuple1Member)) - // { - // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构时{accessor.EntityName} 没有找到{measurement}对应的member Item1 信息,-106"); - // } - // int indexOf = metadata.ColumnNames.IndexOf(measurement); - // tempColumnNames[indexOf] = (string)tuple1Member.GetValue(entity); - - // var tupleItem2Key = $"{member.NameOrPath}.Item2"; - // if (!memberCache.TryGetValue(tupleItem2Key, out var tuple2Member)) - // { - // throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构时{accessor.EntityName} 没有找到{measurement}对应的member Item2 信息,-107"); - // } - - // value = tuple2Member.GetValue(entity); - // } - - // if (value != null) - // { - // var tempValue = member.DeclaredTypeName.ToUpper() switch - // { - // "DATETIME" => Convert.ToDateTime(value).GetDateTimeOffset().ToUnixTimeNanoseconds(), - // _ => value - // }; - - // rowValues.Add(tempValue); - // } - // else - // { - // rowValues.Add(value); - // } - // } - - // values.Add(rowValues); - - // //如果指定了路径 - // if (!string.IsNullOrWhiteSpace(tableNameOrTreePath)) - // { - // devicePaths.Add(tableNameOrTreePath); - // } - // else - // { - // if (!_runtimeContext.UseTableSessionPool)//树模型 - // { - // devicePaths.Add(DevicePathBuilder.GetDevicePath(entity)); - // } - // else - // { - // devicePaths.Add(DevicePathBuilder.GetTableName()); - // } - // } - // } - - // if (devicePaths.Count > 1) - // { - // throw new Exception($"{nameof(BuildTablet)} 构建Tablet《{typeof(T).Name}》时,批量插入的设备路径不一致。"); - // } - - // return _runtimeContext.UseTableSessionPool - // ? BuildTableSessionTablet(metadata, devicePaths.First(), tempColumnNames, values, timestamps) - // : BuildSessionTablet(metadata, devicePaths.First(), tempColumnNames,values, timestamps); - //} - /// /// 构建Tablet /// /// - /// 表实体集合 + /// 表实体 /// 设备元数据 /// - private Tablet BuildTablet(IEnumerable entities, DeviceMetadata metadata) where T : IoTEntity + private List BuildTablet(IEnumerable entities, DeviceMetadata metadata) where T : IoTEntity { - // 前置校验 - ValidateMetadataAndAccessor(metadata, out var accessor); - - // 初始化数据结构 - var (timestamps, values, devicePaths) = (new List(), new List>(), new HashSet()); - var tempColumnNames = new List(metadata.ColumnNames); - var memberCache = BuildMemberCache(accessor); - var tableNameOrTreePath = GetTableNameOrTreePath(); - - // 处理每个实体 - foreach (var entity in entities) + var entitiyList = entities.ToList(); + if (entitiyList == null || entitiyList.Count <= 0) { - ProcessEntity(entity, accessor, metadata, memberCache, tempColumnNames, timestamps, values); - UpdateDevicePaths(entity, tableNameOrTreePath, devicePaths); + return null; + } + + //var accessor = SourceEntityAccessorFactory.GetAccessor(); + + //var memberCache = BuildMemberCache(accessor); + + if (metadata.EntityType == null) + { + throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 没有指定,属于异常情况,-101"); + } + + if (metadata.EntityType == EntityTypeEnum.Other) + { + throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 不属于IoTDB数据模型实体,属于异常情况,-102"); + } + + if (metadata.EntityType == EntityTypeEnum.TreeModel && _runtimeContext.UseTableSessionPool == true) + { + throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 tree模型不能使用table模型Session连接,属于异常情况,-103"); + } + else if (metadata.EntityType == EntityTypeEnum.TableModel && _runtimeContext.UseTableSessionPool == false) + { + throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 table模型不能使用tree模型Session连接,属于异常情况,-104"); + } + string tableNameOrTreePath = string.Empty; + if (_runtimeContext.UseTableSessionPool)//表模型 + { + //如果指定了路径 + if (!string.IsNullOrWhiteSpace(metadata.TableNameOrTreePath)) + { + tableNameOrTreePath = metadata.TableNameOrTreePath; + } + else + { + tableNameOrTreePath = DevicePathBuilder.GetTableName(); + } + + return new List() { BuildTablet(entitiyList, metadata, tableNameOrTreePath) }; + } + else + { + //树模型的时候,实体的设备Id可能会不同,因此需要根据不同路径进行存储。 + var tabletList = new List(); + var groupEntities = entitiyList.GroupBy(d => d.DevicePath).ToList(); + foreach (var group in groupEntities) + { + tabletList.Add(BuildTablet(group.ToList(), metadata, group.Key)); + } + + return tabletList; + } + } + + private Tablet BuildTablet(List entities, DeviceMetadata metadata, string tableNameOrTreePath) where T : IoTEntity + { + // 预分配内存结构 + var rowCount = entities.Count; + var timestamps = new long[rowCount]; + var values = new object[rowCount][]; + for (var i = 0; i < values.Length; i++) + { + values[i] = new object[metadata.ColumnNames.Count]; + } + + List tempColumnNames = new List(); + tempColumnNames.AddRange(metadata.ColumnNames); + + // 顺序处理数据(保证线程安全) + for (var row = 0; row < rowCount; row++) + { + var entity = entities[row]; + timestamps[row] = entity.Timestamps; + + for (int i = 0; i < metadata.ColumnNames.Count; i++) + { + var processor = metadata.Processors[i]; + if (processor.IsSingleMeasuring) + { + tempColumnNames[i] = (string)processor.SingleMeasuringNameGetter(entity); + } + + // 获取并转换值 + values[row][i] = processor.ValueGetter(entity); + } } - // 后置校验与返回 - ValidateDevicePaths(devicePaths); - // return CreateFinalTablet(metadata, devicePaths.First(), tempColumnNames, values, timestamps); return _runtimeContext.UseTableSessionPool - ? BuildTableSessionTablet(metadata, devicePaths.First(), tempColumnNames, values, timestamps) - : BuildSessionTablet(metadata, devicePaths.First(), tempColumnNames, values, timestamps); + ? BuildTableSessionTablet(metadata, tableNameOrTreePath, tempColumnNames, values.Select(d => d.ToList()).ToList(), timestamps.ToList()) + : BuildSessionTablet(metadata, tableNameOrTreePath, tempColumnNames, values.Select(d => d.ToList()).ToList(), timestamps.ToList()); } - private void ValidateMetadataAndAccessor(DeviceMetadata metadata, out ISourceEntityAccessor accessor) where T : IoTEntity - { - accessor = SourceEntityAccessorFactory.GetAccessor(); - - if (accessor.EntityType == null || metadata.EntityType == null) - { - throw new IoTException($"{nameof(BuildTablet)} 构建IoTDB数据结构时,EntityType未指定", -101); - } - - if (metadata.EntityType != accessor.EntityType) - { - throw new IoTException($"{nameof(BuildTablet)} 构建IoTDB数据结构时,EntityType不一致", -102); - } - - bool isTableModel = accessor.EntityType == EntityTypeEnum.TableModel; - if (_runtimeContext.UseTableSessionPool != isTableModel) - { - throw new IoTException($"{nameof(BuildTablet)} 构建IoTDB数据结构时,Session类型不匹配: 预期{(isTableModel ? "Table" : "Tree")}模型", isTableModel ? -104 : -103); - } - } - - /// - /// 处理实体并获取值 - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - private void ProcessEntity( - T entity, - ISourceEntityAccessor accessor, - DeviceMetadata metadata, - Dictionary memberCache, - List tempColumnNames, - List timestamps, - List> values) where T : IoTEntity - { - timestamps.Add(entity.Timestamps); - var rowValues = new object[metadata.ColumnNames.Count]; - - Parallel.ForEach(metadata.ColumnNames, (measurement, state, index) => - { - if (!memberCache.TryGetValue(measurement, out var member)) - { - throw new IoTException($"{nameof(BuildTablet)} 构建IoTDB数据结构时,找不到成员: {measurement}", -105); - } - - object value = ResolveMemberValue(entity, member, memberCache, tempColumnNames, (int)index); - rowValues[index] = ConvertValueByType(member, value); - }); - - values.Add(rowValues.ToList()); - } - - private object ResolveMemberValue( - T entity, - EntityMemberInfo member, - Dictionary memberCache, - List tempColumnNames, - int columnIndex) where T : IoTEntity - { - // 单测点逻辑 - if (member.CustomAttributes?.OfType().FirstOrDefault() is { } attr) - { - var tuple1Key = $"{member.NameOrPath}.Item1"; - var tuple2Key = $"{member.NameOrPath}.Item2"; - - if (!memberCache.TryGetValue(tuple1Key, out var tuple1) || !memberCache.TryGetValue(tuple2Key, out var tuple2)) - { - throw new IoTException($"{nameof(BuildTablet)} 构建IoTDB数据结构时,单侧点元组成员缺失", -106); - } - - tempColumnNames[columnIndex] = (string)tuple1.GetValue(entity); - return tuple2.GetValue(entity); - } - return member.GetValue(entity); - } - - /// - /// 设置实体的成员值 - /// - /// - /// - /// - private object ConvertValueByType(EntityMemberInfo member, object value) - { - return member.DeclaredTypeName switch - { - "DATETIME" => Convert.ToDateTime(value).GetDateTimeOffset().ToUnixTimeNanoseconds(), - _ => value - }; - } - - /// - /// 处理设备路径 - /// - /// - /// - /// - /// - private void UpdateDevicePaths( - T entity, - string tableNameOrTreePath, - HashSet devicePaths) where T : IoTEntity - { - if (!string.IsNullOrEmpty(tableNameOrTreePath)) - { - devicePaths.Add(tableNameOrTreePath); - return; - } - - var path = _runtimeContext.UseTableSessionPool - ? DevicePathBuilder.GetTableName() - : DevicePathBuilder.GetDevicePath(entity); - devicePaths.Add(path); - } - - /// - /// 验证设备路径 - /// - /// - private void ValidateDevicePaths(HashSet devicePaths) - { - if (devicePaths.Count == 0) - { - throw new IoTException($"{nameof(BuildTablet)} 构建IoTDB数据结构时,设备路径集合为空", -108); - } - - if (devicePaths.Count > 1) - { - var paths = string.Join(", ", devicePaths.Take(3)); - { - throw new IoTException($"{nameof(BuildTablet)} 构建IoTDB数据结构时,设备路径不一致。检测到路径: {paths}...", -109); - } - } - } - - /// - /// 缓存优化:避免重复反射 - /// - /// - /// - private string GetTableNameOrTreePath() - { - return AttributeCache.TableNameOrTreePath; - } - - /// - /// 特性缓存辅助类 - /// - /// - private static class AttributeCache - { - public static readonly string TableNameOrTreePath; - - static AttributeCache() - { - var attr = typeof(T).GetCustomAttribute(); - TableNameOrTreePath = attr?.TableNameOrTreePath ?? string.Empty; - } - } /// /// 构建tree模型的Tablet @@ -615,7 +444,7 @@ namespace JiShe.CollectBus.IoTDB.Provider /// 数据集合 /// 时间戳集合 /// - private Tablet BuildTableSessionTablet(DeviceMetadata metadata, string tableName, List columns,List> values, List timestamps) + private Tablet BuildTableSessionTablet(DeviceMetadata metadata, string tableName, List columns, List> values, List timestamps) { var tablet = new Tablet( tableName, @@ -802,7 +631,7 @@ namespace JiShe.CollectBus.IoTDB.Provider private List CollectColumnMetadata(ISourceEntityAccessor accessor) { var columns = new List(); - var memberCache = BuildMemberCache(accessor); + var memberCache = BuildMemberCache(accessor); foreach (var member in accessor.MemberList) { @@ -825,15 +654,15 @@ namespace JiShe.CollectBus.IoTDB.Provider ColumnInfo? column = null; if (tagAttr != null) { - column = new ColumnInfo(member.NameOrPath, ColumnCategory.TAG, GetDataTypeFromTypeName(declaredTypeName), false); + column = new ColumnInfo(member.NameOrPath, ColumnCategory.TAG, GetDataTypeFromTypeName(declaredTypeName), false, member.DeclaredTypeName); } else if (attrColumn != null) { - column = new ColumnInfo(member.NameOrPath, ColumnCategory.ATTRIBUTE, GetDataTypeFromTypeName(declaredTypeName), false); + column = new ColumnInfo(member.NameOrPath, ColumnCategory.ATTRIBUTE, GetDataTypeFromTypeName(declaredTypeName), false, member.DeclaredTypeName); } else if (fieldColumn != null) { - column = new ColumnInfo(member.NameOrPath, ColumnCategory.FIELD, GetDataTypeFromTypeName(declaredTypeName), false); + column = new ColumnInfo(member.NameOrPath, ColumnCategory.FIELD, GetDataTypeFromTypeName(declaredTypeName), false, member.DeclaredTypeName); } // 单测模式处理 @@ -844,7 +673,7 @@ namespace JiShe.CollectBus.IoTDB.Provider { throw new Exception($"{nameof(CollectColumnMetadata)} {accessor.EntityName} {member.NameOrPath} 单侧点属性解析异常"); } - column = new ColumnInfo(member.NameOrPath, ColumnCategory.FIELD, GetDataTypeFromTypeName(tupleMember.DeclaredTypeName), true); + column = new ColumnInfo(member.NameOrPath, ColumnCategory.FIELD, GetDataTypeFromTypeName(tupleMember.DeclaredTypeName), true, tupleMember.DeclaredTypeName); } if (column.HasValue) columns.Add(column.Value); @@ -858,7 +687,7 @@ namespace JiShe.CollectBus.IoTDB.Provider /// 待解析的类 /// 已处理好的数据列 /// - private DeviceMetadata BuildDeviceMetadata(List columns) where T : IoTEntity + private DeviceMetadata BuildDeviceMetadata(List columns, ISourceEntityAccessor accessor) where T : IoTEntity { var metadata = new DeviceMetadata(); @@ -877,9 +706,97 @@ namespace JiShe.CollectBus.IoTDB.Provider ProcessCategory(groupedColumns, ColumnCategory.ATTRIBUTE, metadata); ProcessCategory(groupedColumns, ColumnCategory.FIELD, metadata); + // 新增处理器初始化 + foreach (var item in metadata.ColumnNames) + { + ColumnInfo column = columns.FirstOrDefault(d => d.Name == item); + + var processor = new ColumnProcessor + { + ColumnName = column.Name, + IsSingleMeasuring = column.IsSingleMeasuring, + Converter = CreateConverter(column.DeclaredTypeName.ToUpper()) + }; + + // 处理单测点 + if (column.IsSingleMeasuring) + { + var item1Member = accessor.MemberList + .First(m => m.NameOrPath == $"{column.Name}.Item1"); + + processor.SingleMeasuringNameGetter = (obj) => + { + // 获取原始值并转为字符串 + object rawValue = item1Member.Getter(obj); + string value = rawValue?.ToString(); + + if (!string.IsNullOrEmpty(value)) + { + // 规则1: 严格检查ASCII字母和数字(0-9, A-Z, a-z) + bool hasInvalidChars = value.Any(c => + !((c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + (c >= '0' && c <= '9'))); + + // 规则2: 首字符不能是数字 + bool startsWithDigit = value[0] >= '0' && value[0] <= '9'; + + // 规则3: 全字符串不能都是数字 + bool allDigits = value.All(c => c >= '0' && c <= '9'); + + // 按优先级抛出具体异常 + if (hasInvalidChars) + { + throw new InvalidOperationException( + $"SingleMeasuring name '{value}' 包含非法字符,只允许字母和数字"); + } + else if (startsWithDigit) + { + throw new InvalidOperationException( + $"SingleMeasuring name '{value}' 不能以数字开头"); + } + else if (allDigits) + { + throw new InvalidOperationException( + $"SingleMeasuring name '{value}' 不能全为数字"); + } + } + + return value; + }; + + var item2Member = accessor.MemberList + .First(m => m.NameOrPath == $"{column.Name}.Item2"); + processor.ValueGetter = (obj) => { + object rawValue = item2Member.Getter(obj); + return processor.Converter(rawValue); + }; + } + else + { + // 获取对应的成员访问器 + var member = accessor.MemberList.First(m => m.NameOrPath == column.Name); + processor.ValueGetter = (obj) => { + object rawValue = member.Getter(obj); + return processor.Converter(rawValue); + }; + } + + metadata.Processors.Add(processor); + } + return metadata; } + private Func CreateConverter(string declaredTypeName) + { + return declaredTypeName switch + { + "DATETIME" => value => ((DateTime)value).GetDateTimeOffset().ToUnixTimeNanoseconds(), + _ => value => value + }; + } + /// /// 处理不同列类型的逻辑 /// @@ -906,6 +823,11 @@ namespace JiShe.CollectBus.IoTDB.Provider /// public string Name { get; } + /// + /// 声明的类型的名称 + /// + public string DeclaredTypeName { get; } + /// /// 是否是单测点 /// @@ -921,12 +843,13 @@ namespace JiShe.CollectBus.IoTDB.Provider /// public TSDataType DataType { get; } - public ColumnInfo(string name, ColumnCategory category, TSDataType dataType, bool isSingleMeasuring) + public ColumnInfo(string name, ColumnCategory category, TSDataType dataType, bool isSingleMeasuring, string declaredTypeName) { Name = name; Category = category; DataType = dataType; IsSingleMeasuring = isSingleMeasuring; + DeclaredTypeName = declaredTypeName; } } @@ -1023,5 +946,7 @@ namespace JiShe.CollectBus.IoTDB.Provider } return cache; } + + private static readonly Regex _asciiAlphanumericRegex = new Regex(@"^[a-zA-Z0-9]*$", RegexOptions.Compiled); } } diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs index d6f9e04..c24ad18 100644 --- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs +++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs @@ -140,13 +140,13 @@ namespace JiShe.CollectBus.DataChannels // 批量写入数据库 await _dbProvider.BatchInsertAsync(metadata, records); - //// 限流推送Kafka - //await DeviceGroupBalanceControl.ProcessWithThrottleAsync( - // items: records, - // deviceIdSelector: data => data.DeviceId, - // processor: async (data, groupIndex) => - // await KafkaProducerIssuedMessageAction(topicName, data, groupIndex) - //); + // 限流推送Kafka + await DeviceGroupBalanceControl.ProcessWithThrottleAsync( + items: records, + deviceIdSelector: data => data.DeviceId, + processor: async (data, groupIndex) => + await KafkaProducerIssuedMessageAction(topicName, data, groupIndex) + ); } catch (Exception ex) { diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs index 843c6f7..0009e20 100644 --- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs +++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs @@ -184,14 +184,14 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS time = DateTime.Now; //System.Reflection.PropertyInfo; //System.Reflection.FieldInfo - var meter = new TreeModelSingleMeasuringEntity() + var meter = new TreeModelSingleMeasuringEntity() { SystemName = "energy", DeviceId = "402440506", DeviceType = "1", ProjectId = "10059", Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(), - SingleMeasuring = (measuring, value) + SingleMeasuring = (measuring, time) }; await _iotDBProvider.InsertAsync(meter); } diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index bab879d..9d45f08 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -322,7 +322,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading /// public virtual async Task InitAmmeterCacheData(string gatherCode = "") { - //return; + //return; // 创建取消令牌源 //var cts = new CancellationTokenSource(); @@ -1635,36 +1635,43 @@ namespace JiShe.CollectBus.ScheduledMeterReading /// protected MeterReadingTelemetryPacketInfo CreateAmmeterPacketInfo(AmmeterInfo ammeterInfo, long timestamps, ProtocolBuildResponse builderResponse, string itemCode, string subItemCode, DateTime pendingCopyReadTime, DateTime creationTime, TelemetryPacketTypeEnum packetType) { - string taskMark = CommonHelper.GetTaskMark(builderResponse.AFn, builderResponse.Fn, ammeterInfo.MeteringCode, builderResponse.MSA, builderResponse.Seq); - return new MeterReadingTelemetryPacketInfo() + try { - SystemName = SystemType, - ProjectId = $"{ammeterInfo.ProjectID}", - DeviceType = $"{MeterTypeEnum.Ammeter}", - DeviceId = $"{ammeterInfo.MeterId}", - Timestamps = timestamps, - DatabaseBusiID = ammeterInfo.DatabaseBusiID, - PendingCopyReadTime = pendingCopyReadTime, - CreationTime = creationTime, - MeterAddress = ammeterInfo.AmmerterAddress, - PacketType = (int)packetType, - AFN = builderResponse.AFn, - Fn = builderResponse.Fn, - Seq = builderResponse.Seq, - MSA = builderResponse.MSA, - FocusId = ammeterInfo.FocusId, - FocusAddress = ammeterInfo.FocusAddress, - ItemCode = itemCode, - SubItemCode = subItemCode, - TaskMark = taskMark, - IsSend = false, - ManualOrNot = false, - Pn = ammeterInfo.MeteringCode, - IssuedMessageId = GuidGenerator.Create().ToString(), - IssuedMessageHexString = Convert.ToHexString(builderResponse.Data), - IsReceived = false, - ScoreValue = $"{ammeterInfo.FocusAddress}.{taskMark}".Md5Fun(), - }; + string taskMark = CommonHelper.GetTaskMark(builderResponse.AFn, builderResponse.Fn, ammeterInfo.MeteringCode, builderResponse.MSA, builderResponse.Seq); + return new MeterReadingTelemetryPacketInfo() + { + SystemName = SystemType, + ProjectId = $"{ammeterInfo.ProjectID}", + DeviceType = $"{MeterTypeEnum.Ammeter}", + DeviceId = $"{ammeterInfo.MeterId}", + Timestamps = timestamps, + DatabaseBusiID = ammeterInfo.DatabaseBusiID, + PendingCopyReadTime = pendingCopyReadTime, + CreationTime = creationTime, + MeterAddress = ammeterInfo.AmmerterAddress, + PacketType = (int)packetType, + AFN = builderResponse.AFn, + Fn = builderResponse.Fn, + Seq = builderResponse.Seq, + MSA = builderResponse.MSA, + FocusId = ammeterInfo.FocusId, + FocusAddress = ammeterInfo.FocusAddress, + ItemCode = itemCode, + SubItemCode = subItemCode, + TaskMark = taskMark, + IsSend = false, + ManualOrNot = false, + Pn = ammeterInfo.MeteringCode, + IssuedMessageId = Guid.NewGuid().ToString(), + IssuedMessageHexString = Convert.ToHexString(builderResponse.Data), + IsReceived = false, + ScoreValue = $"{ammeterInfo.FocusAddress}.{taskMark}".Md5Fun(), + }; + } + catch (Exception ex) + { + throw ex; + } } #endregion From 57148f3189c61565332d7d4add942c57816c5240 Mon Sep 17 00:00:00 2001 From: zenghongyao <873884283@qq.com> Date: Sun, 11 May 2025 10:42:55 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs b/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs index a0438db..96237bb 100644 --- a/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs +++ b/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs @@ -137,9 +137,13 @@ namespace JiShe.CollectBus.Kafka foreach (var sub in subscribedMethods) { - int partitionCount = sub.Attribute!.TaskCount==-1?3: sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; + //int partitionCount = sub.Attribute!.TaskCount==-1?3: sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; var adminClientService = provider.GetRequiredService(); + int topicCount = adminClientService.GetTopicPartitionsNum(sub.Attribute!.Topic); + + int partitionCount = sub.Attribute!.TaskCount == -1 ? topicCount : sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; + partitionCount = partitionCount > topicCount ? topicCount : partitionCount; //partitionCount = sub.Attribute!.TaskCount == -1 ? adminClientService.GetTopicPartitionsNum(sub.Attribute!.Topic) : sub.Attribute!.TaskCount; if (partitionCount <= 0) From cf9bf6c210687638d0872fb0c3b40ca43d75f3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=9B=8A?= Date: Sun, 11 May 2025 21:53:55 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E5=AE=8C=E5=96=84Redis=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Provider/IoTDBProvider.cs | 2 +- .../RedisDataCache/IRedisDataCacheService.cs | 2 +- .../RedisDataCache/RedisDataCacheService.cs | 175 ++++++++++-------- .../BasicScheduledMeterReadingService.cs | 2 +- .../IotSystems/Ammeters/AmmeterInfo.cs | 2 +- .../Helpers/CommonHelper.cs | 61 ++++-- 6 files changed, 149 insertions(+), 95 deletions(-) diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs index 34b4f4b..dfe442d 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs @@ -730,7 +730,7 @@ namespace JiShe.CollectBus.IoTDB.Provider object rawValue = item1Member.Getter(obj); string value = rawValue?.ToString(); - if (!string.IsNullOrEmpty(value)) + if (!string.IsNullOrWhiteSpace(value)) { // 规则1: 严格检查ASCII字母和数字(0-9, A-Z, a-z) bool hasInvalidChars = value.Any(c => diff --git a/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs b/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs index dc7c14e..b5f492c 100644 --- a/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs +++ b/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs @@ -123,7 +123,7 @@ namespace JiShe.CollectBus.Application.Contracts /// 最后一个唯一标识 /// 排序方式 /// - Task> GetPagedData( + Task> GetSingleData( string redisHashCacheKey, string redisZSetScoresIndexCacheKey, string scoreValueRawData, diff --git a/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs b/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs index e413527..ebf1d2b 100644 --- a/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs +++ b/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs @@ -42,8 +42,6 @@ namespace JiShe.CollectBus.RedisDataCache Instance = _freeRedisProvider.Instance; } - //todo 单个数据查询 - /// /// 单个添加数据 /// @@ -370,7 +368,7 @@ namespace JiShe.CollectBus.RedisDataCache /// - /// 通过集中器与表计信息排序索引获取数据 + /// 通过集中器与表计信息排序索引获取单个数据 /// /// /// 主数据存储Hash缓存Key @@ -381,24 +379,105 @@ namespace JiShe.CollectBus.RedisDataCache /// 最后一个唯一标识 /// 排序方式 /// - public async Task> GetPagedData( - string redisHashCacheKey, - string redisZSetScoresIndexCacheKey, - string scoreValueRawData, - int pageSize = 10, - decimal? lastScore = null, - string lastMember = null, - bool descending = true) - where T : DeviceCacheBasicModel + public async Task> GetSingleData( + string redisHashCacheKey, + string redisZSetScoresIndexCacheKey, + string scoreValueRawData, + int pageSize = 10, + decimal? lastScore = null, + string lastMember = null, + bool descending = true) + where T : DeviceCacheBasicModel { - var rawDataArray = scoreValueRawData.Split(":"); - string focusAddress = rawDataArray[0]; - string point = rawDataArray[1]; + // 参数校验 + if (string.IsNullOrWhiteSpace(redisHashCacheKey) || + string.IsNullOrWhiteSpace(redisZSetScoresIndexCacheKey) || + string.IsNullOrWhiteSpace(scoreValueRawData)) + { + _logger.LogError($"{nameof(GetSingleData)} 参数异常,-101"); + return new BusCacheGlobalPagedResult { Items = new List() }; + } - long scoreValue = 0; + // 解析原始数据 + var rawDataArray = scoreValueRawData.Split(':'); + if (rawDataArray.Length != 2) + { + _logger.LogError($"{nameof(GetSingleData)} scoreValueRawData格式错误,应为[focusAddress:point]"); + return new BusCacheGlobalPagedResult { Items = new List() }; + } + // 计算Score值 + long scoreValue; + try + { + var focusAddress = rawDataArray[0]; + var point = Convert.ToInt32(rawDataArray[1]); + scoreValue = CommonHelper.GetFocusScores(focusAddress, point); + } + catch (Exception ex) + { + _logger.LogError(ex, $"{nameof(GetSingleData)} 计算Score值失败"); + return new BusCacheGlobalPagedResult { Items = new List() }; + } - throw new Exception(); + // Lua脚本:原子化查询操作 + const string luaScript = @" + local zsetKey = KEYS[1] + local hashKey = KEYS[2] + local targetScore = ARGV[1] + + -- 精确匹配Score并获取第一个成员 + local members = redis.call('ZRANGEBYSCORE', zsetKey, targetScore, targetScore, 'LIMIT', 0, 1) + if #members == 0 then + return nil + end + + -- 获取哈希表数据 + local member = members[1] + local data = redis.call('HGET', hashKey, member) + return {member, data}"; + + try + { + // 执行脚本 + var result = await Instance.EvalAsync( + luaScript, + new[] { redisZSetScoresIndexCacheKey, redisHashCacheKey }, + new object[] { scoreValue }); + + // 处理空结果 + if (result == null) + return new BusCacheGlobalPagedResult { Items = new List() }; + + // 解析Redis返回数据 + var resultArray = (object[])result; + var memberId = (string)resultArray[0]; + var dataStr = (string)resultArray[1]; + + // 反序列化数据 + var data = BusJsonSerializer.Deserialize(dataStr); + if (data == null) + { + _logger.LogError($"{nameof(GetSingleData)} 反序列化失败,MemberId: {memberId}"); + return new BusCacheGlobalPagedResult { Items = new List() }; + } + + // 构造返回结果 + return new BusCacheGlobalPagedResult + { + Items = new List { data }, + TotalCount = 1, + PageSize = 1, + HasNext = false, + NextScore = null, + NextMember = null + }; + } + catch (Exception ex) + { + _logger.LogError(ex, $"{nameof(GetSingleData)} Redis操作异常"); + return new BusCacheGlobalPagedResult { Items = new List() }; + } } /// @@ -559,67 +638,7 @@ namespace JiShe.CollectBus.RedisDataCache PageSize = pageSize, }; } - - ///// - ///// 通过集中器与表计信息排序索引获取数据 - ///// - ///// - ///// 主数据存储Hash缓存Key - ///// ZSET索引缓存Key - ///// 分页尺寸 - ///// 最后一个索引 - ///// 最后一个唯一标识 - ///// 排序方式 - ///// - //public async Task> GetAllPagedData( - //string redisHashCacheKey, - //string redisZSetScoresIndexCacheKey, - //int pageSize = 1000, - //decimal? lastScore = null, - //string lastMember = null, - //bool descending = true) - //where T : DeviceCacheBasicModel - //{ - // // 参数校验增强 - // if (string.IsNullOrWhiteSpace(redisHashCacheKey) || string.IsNullOrWhiteSpace(redisZSetScoresIndexCacheKey)) - // { - // _logger.LogError($"{nameof(GetAllPagedData)} 参数异常,-101"); - // return null; - // } - - // if (pageSize < 1 || pageSize > 10000) - // { - // _logger.LogError($"{nameof(GetAllPagedData)} 分页大小应在1-10000之间,-102"); - // return null; - // } - - // //// 分页参数解析 - // //var (startScore, excludeMember) = descending - // // ? (lastScore ?? decimal.MaxValue, lastMember) - // // : (lastScore ?? 0, lastMember); - - // //执行分页查询(整合游标处理) - // var pageResult = await GetPagedMembers( - // redisZSetScoresIndexCacheKey, - // pageSize, - // lastScore, - // lastMember, - // descending); - - // // 批量获取数据(优化内存分配) - // var dataDict = await BatchGetData(redisHashCacheKey, pageResult.Members); - - // return new BusCacheGlobalPagedResult - // { - // Items = pageResult.Members.Select(m => dataDict.TryGetValue(m, out var v) ? v : default) - // .Where(x => x != null).ToList(), - // HasNext = pageResult.HasNext, - // NextScore = pageResult.NextScore, - // NextMember = pageResult.NextMember, - // TotalCount = await GetTotalCount(redisZSetScoresIndexCacheKey), - // PageSize = pageSize, - // }; - //} + /// /// 游标分页查询 diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index 9d45f08..270bb67 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -737,7 +737,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading ItemCode = tempItem, DataTimeMark = new Protocol.DataTimeMark() { - Density = ammeterInfo.TimeDensity.GetDensity(),//转换成协议的值 + Density = ammeterInfo.TimeDensity.GetFocusDensity(),//转换成协议的值 Point = 1, DataTime = timestamps, } diff --git a/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs b/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs index 60d6c91..4cd69ba 100644 --- a/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs +++ b/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs @@ -20,7 +20,7 @@ namespace JiShe.CollectBus.IotSystems.Ammeters /// ZSet排序索引分数值,具体值可以根据不同业务场景进行定义,例如时间戳 /// [Column(IsIgnore = true)] - public override long ScoreValue => ((long)FocusId << 32) | (uint)DateTime.Now.Ticks; + public override long ScoreValue => Common.Helpers.CommonHelper.GetFocusScores(FocusAddress,MeteringCode); /// /// 电表名称 diff --git a/shared/JiShe.CollectBus.Common/Helpers/CommonHelper.cs b/shared/JiShe.CollectBus.Common/Helpers/CommonHelper.cs index e3177a1..7d3fc4a 100644 --- a/shared/JiShe.CollectBus.Common/Helpers/CommonHelper.cs +++ b/shared/JiShe.CollectBus.Common/Helpers/CommonHelper.cs @@ -10,6 +10,8 @@ using System.Text; using System.Threading.Tasks; using JiShe.CollectBus.Common.Attributes; using System.Collections.Specialized; +using JiShe.CollectBus.Common.Enums; +using Newtonsoft.Json.Linq; namespace JiShe.CollectBus.Common.Helpers { @@ -796,7 +798,7 @@ namespace JiShe.CollectBus.Common.Helpers /// /// /// - public static string GetTaskMark(int afn, int fn, int pn, int msa,int seq) + public static string GetTaskMark(int afn, int fn, int pn, int msa, int seq) { var makstr = $"{afn.ToString().PadLeft(2, '0')}{fn.ToString().PadLeft(2, '0')}{pn.ToString().PadLeft(2, '0')}{msa.ToString().PadLeft(2, '0')}{seq.ToString().PadLeft(2, '0')}"; @@ -860,20 +862,53 @@ namespace JiShe.CollectBus.Common.Helpers } /// - /// 采集频率转换为集中器采集密度 + /// 系统采集频率转换为集中器采集密度 /// /// /// - public static int GetDensity(this int timeDensity) => - timeDensity switch - { - 0 => 0,//无 - 1 => 255,//1分钟 - 5 => 245,//5分钟 - 15 => 1,//15分钟 - 30 => 2,//30分钟 - 60 => 3,//60分钟 - _ => -1//采集项本身无密度位 - }; + public static int GetFocusDensity(this int timeDensity) => timeDensity switch + { + 0 => 0,//无 + 1 => 255,//1分钟 + 5 => 245,//5分钟 + 15 => 1,//15分钟 + 30 => 2,//30分钟 + 60 => 3,//60分钟 + _ => -1//采集项本身无密度位 + }; + + /// + /// 集中器采集密度转换为系统采集频率 + /// + /// + /// + public static int GetSystemDensity(this int density) => density switch + { + 0 => 0,//无 + 255 => 1,//1分钟 + 245 => 5,//5分钟 + 1 => 15,//15分钟 + 2 => 30,//30分钟 + 3 => 60,//60分钟 + _ => -1//采集项本身无密度位 + }; + + /// + /// 获取集中器ZSet Scores + /// + /// + /// + /// + public static long GetFocusScores(string focusScores, int point) + { + bool hasInvalidChars = focusScores.Any(c => !(c >= '0' && c <= '9')); + if (hasInvalidChars) + { + throw new Exception($"{nameof(GetFocusScores)} 集中器地址格式错误"); + } + var scoresStr = $"{focusScores}{point.ToString().PadLeft(2, '0')}"; + + return Convert.ToInt64(scoresStr); + } } } From e35172d69f4c5f620ced3f13f664be44abee0654 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Mon, 12 May 2025 10:14:08 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs | 2 +- .../JiShe.CollectBus.Protocol.csproj | 2 +- .../DataChannels/DataChannelManageService.cs | 4 ++-- .../JiShe.CollectBus.Application.csproj | 4 ++-- .../JiShe.CollectBus.Application/Samples/SampleAppService.cs | 4 ++-- .../BasicScheduledMeterReadingService.cs | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs index dfe442d..6d77ce3 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs @@ -134,7 +134,7 @@ namespace JiShe.CollectBus.IoTDB.Provider try { - var batchSize = 1000; + var batchSize = 2000; var batches = entities.Chunk(batchSize); foreach (var batch in batches) diff --git a/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj b/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj index 6495b24..7fead27 100644 --- a/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj +++ b/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj @@ -19,7 +19,7 @@ - + diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs index c24ad18..21cec8a 100644 --- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs +++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs @@ -63,8 +63,8 @@ namespace JiShe.CollectBus.DataChannels public async Task ScheduledMeterTaskReadingAsync( ChannelReader>> telemetryPacketInfoReader) { - const int BatchSize = 20000; - const int EmptyWaitMilliseconds = 1000; + const int BatchSize = 100000; + const int EmptyWaitMilliseconds = 200; var timeout = TimeSpan.FromSeconds(5); var timer = Stopwatch.StartNew(); long timeoutMilliseconds = 0; diff --git a/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj b/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj index b9d899c..01878c2 100644 --- a/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj +++ b/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs index 0009e20..ffbfadb 100644 --- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs +++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs @@ -250,14 +250,14 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS { time = DateTime.Now; - var meter = new TableModelSingleMeasuringEntity() + var meter = new TableModelSingleMeasuringEntity() { SystemName = "energy", DeviceId = "402440506", DeviceType = "Ammeter", ProjectId = "10059", Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(), - SingleColumn = (measuring, value) + SingleColumn = (measuring, true) }; _dbContext.UseTableSessionPool = true; await _iotDBProvider.InsertAsync(meter); diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index 270bb67..7b407b4 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -231,7 +231,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading //检查任务时间节点,由于定时任务10秒钟运行一次,需要判定当前时间是否在任务时间节点内,不在则跳过 var currentTaskTime = tasksToBeIssueModel.LastTaskTime.CalculateNextCollectionTime(timeDensity);//程序启动缓存电表的时候,NextTaskTime需要格式化到下一个采集点时间。 - if (!IsTaskTime(currentTaskTime, timeDensity)) + if (!IsTaskTime(currentTaskTime, timeDensity))//todo 如果时间超过两个采集频率周期,就一直处理,直到追加到下一个采集频率周期。 { _logger.LogInformation($"{nameof(CreateToBeIssueTasks)} 构建待处理的下发指令任务处理时Key=>{item}时间节点不在当前时间范围内,103"); continue; @@ -498,7 +498,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading timer.Stop(); - _logger.LogInformation($"{nameof(InitAmmeterCacheData)} 初始化电表缓存数据完成,耗时{timer.ElapsedMilliseconds}毫秒"); + _logger.LogWarning($"{nameof(InitAmmeterCacheData)} 初始化电表缓存数据完成,耗时{timer.ElapsedMilliseconds}毫秒"); } /// From 80b8942d9d28ab066c6bc1e8b2686cb2abe79414 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Mon, 12 May 2025 11:20:50 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataChannels/DataChannelManageService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs index 21cec8a..3cf4dad 100644 --- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs +++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.DataChannels ChannelReader>> telemetryPacketInfoReader) { const int BatchSize = 100000; - const int EmptyWaitMilliseconds = 200; + const int EmptyWaitMilliseconds = 50; var timeout = TimeSpan.FromSeconds(5); var timer = Stopwatch.StartNew(); long timeoutMilliseconds = 0; @@ -83,7 +83,7 @@ namespace JiShe.CollectBus.DataChannels _logger.LogError($"{nameof(ScheduledMeterTaskReadingAsync)} 通道处理数据耗时{timeoutMilliseconds}毫秒"); } timeoutMilliseconds = 0; - //无消息时短等待1秒 + //无消息时短等待50毫秒 await Task.Delay(EmptyWaitMilliseconds); continue; } From 529623a2324bf399d5256c7e35030f27724aefcc Mon Sep 17 00:00:00 2001 From: zenghongyao <873884283@qq.com> Date: Mon, 12 May 2025 14:02:22 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BF=9D=E5=AD=98=E5=88=B0iotdb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdminClient/AdminClientService.cs | 2 +- .../KafkaSubscribeExtensions.cs | 82 +++++++-- .../MongoDB/CollectBusMongoDbContext.cs | 2 +- .../MongoDB/CollectBusMongoDbModule.cs | 10 +- .../LogRecord/ILogRecordRepository.cs | 57 ++++++ .../LogRecord/LogRecordRepository.cs | 166 ++++++++++++++++++ .../ShardingStrategy/DayShardingStrategy.cs | 9 +- .../ShardingStrategy/HourShardingStrategy.cs | 58 ++++++ .../ShardingStrategy/IHourShardingStrategy.cs | 12 ++ .../AnalysisData/AFN_00H/AFN0_F1_Analysis.cs | 34 +++- .../AnalysisData/AFN_00H/AFN0_F2_Analysis.cs | 35 +++- .../AnalysisData/AFN_02H/AFN2_F1_Analysis.cs | 10 +- .../AnalysisData/AFN_02H/AFN2_F2_Analysis.cs | 7 +- .../AnalysisData/AFN_02H/AFN2_F3_Analysis.cs | 7 +- .../AnalysisData/AFN_09H/AFN9_F1_Analysis.cs | 39 +++- .../AnalysisData/AFN_09H/AFN9_F9_Analysis.cs | 36 +++- .../AFN_0AH/AFN10_F10_Analysis.cs | 42 +++-- .../AFN_0AH/AFN10_F66_Analysis.cs | 33 +++- .../AFN_0AH/AFN10_F68_Analysis.cs | 36 +++- .../AFN_0CH/AFN12_F129_Analysis.cs | 27 ++- .../AFN_0CH/AFN12_F130_Analysis.cs | 24 ++- .../AFN_0CH/AFN12_F131_Analysis.cs | 24 ++- .../AFN_0CH/AFN12_F132_Analysis.cs | 24 ++- .../AFN_0CH/AFN12_F145_Analysis.cs | 21 ++- .../AFN_0CH/AFN12_F149_Analysis.cs | 2 +- .../AFN_0CH/AFN12_F188_Analysis.cs | 20 ++- .../AFN_0CH/AFN12_F25_Analysis.cs | 26 ++- .../AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs | 20 ++- .../AFN_0CH/AFN12_F33_Analysis.cs | 30 +++- .../AFN_0CH/AFN12_F49_Analysis.cs | 25 ++- .../AFN_0DH/AFN13_F100_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F101_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F102_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F103_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F104_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F105_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F106_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F107_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F108_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F11_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F145_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F146_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F147_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F148_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F161_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F162_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F163_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F164_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F165_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F166_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F167_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F168_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F177_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F178_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F179_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F180_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F181_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F182_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F183_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F184_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F189_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F190_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F193_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F195_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F19_Analysis.cs | 2 +- .../AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs | 2 +- .../AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F81_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F82_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F83_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F84_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F85_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F86_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F87_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F88_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F89_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F90_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F91_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F92_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F93_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F94_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F95_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F97_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F98_Analysis.cs | 2 +- .../AFN_0DH/AFN13_F99_Analysis.cs | 2 +- .../AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs | 2 +- .../AFN_10H/AFN16_F101_Analysis.cs | 26 ++- .../AFN_10H/AFN16_F97_Analysis.cs | 5 +- .../AFN_10H/AFN16_F98_Analysis.cs | 34 ++-- .../AnalysisData/DataStorage.cs | 138 ++++++++++++--- .../CollectBusProtocolT37612012Module.cs | 2 + .../CollectBusApplicationModule.cs | 27 ++- .../DataChannels/DataChannelManage.cs | 12 ++ .../DataChannels/DataChannelManageService.cs | 141 ++++++++++++++- .../Workers/CreateToBeIssueTaskWorker.cs | 78 ++++---- .../DataDetectionFifteenMinuteWorker.cs | 68 +++---- .../Workers/EpiCollectWorker.cs | 68 +++---- .../Workers/SubscriberFifteenMinuteWorker.cs | 86 ++++----- .../Workers/SubscriberFiveMinuteWorker.cs | 76 ++++---- .../Workers/SubscriberOneMinuteWorker.cs | 76 ++++---- .../IotSystems/LogRecord/LogRecords.cs | 99 +++++++++++ .../JiShe.CollectBus.Domain.csproj | 4 +- .../Protocol3761/Dto/AFN10_F66_AnalysisDto.cs | 4 - .../Protocol3761/Dto/UnitDataAnalysis.cs | 4 +- .../Consts/T37612012PacketItemCodeConst.cs | 4 - .../Enums/TableTimeStrategyEnum.cs | 36 ++++ .../Extensions/DateTimeExtensions.cs | 26 ++- .../CollectBusHostModule.Configure.cs | 2 +- .../Pages/Monitor.cshtml | 1 + web/JiShe.CollectBus.Host/appsettings.json | 6 +- 110 files changed, 1545 insertions(+), 510 deletions(-) create mode 100644 modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/ILogRecordRepository.cs create mode 100644 modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/LogRecordRepository.cs create mode 100644 modules/JiShe.CollectBus.MongoDB/ShardingStrategy/HourShardingStrategy.cs create mode 100644 modules/JiShe.CollectBus.MongoDB/ShardingStrategy/IHourShardingStrategy.cs create mode 100644 services/JiShe.CollectBus.Domain/IotSystems/LogRecord/LogRecords.cs create mode 100644 shared/JiShe.CollectBus.Common/Enums/TableTimeStrategyEnum.cs diff --git a/modules/JiShe.CollectBus.Kafka/AdminClient/AdminClientService.cs b/modules/JiShe.CollectBus.Kafka/AdminClient/AdminClientService.cs index 0287f40..bef89ad 100644 --- a/modules/JiShe.CollectBus.Kafka/AdminClient/AdminClientService.cs +++ b/modules/JiShe.CollectBus.Kafka/AdminClient/AdminClientService.cs @@ -157,7 +157,7 @@ public class AdminClientService : IAdminClientService, IDisposable, ISingletonDe adminClientConfig.SecurityProtocol = SecurityProtocol.SaslPlaintext; adminClientConfig.SaslMechanism = SaslMechanism.Plain; adminClientConfig.SaslUsername = _kafkaOptionConfig.SaslUserName; - adminClientConfig.SaslPassword = _kafkaOptionConfig.SaslUserName; + adminClientConfig.SaslPassword = _kafkaOptionConfig.SaslPassword; } return new AdminClientBuilder(adminClientConfig).Build(); } diff --git a/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs b/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs index 96237bb..028762f 100644 --- a/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs +++ b/modules/JiShe.CollectBus.Kafka/KafkaSubscribeExtensions.cs @@ -21,6 +21,10 @@ namespace JiShe.CollectBus.Kafka public static class KafkaSubscribeExtensions { + private static long _threadCount = 0; + private static long _topicSubscribeCount = 0; + private static long _threadStartCount = 0; + public static void UseInitKafkaTopic(this IServiceProvider provider) { //初始化主题信息 @@ -46,12 +50,12 @@ namespace JiShe.CollectBus.Kafka lifetime.ApplicationStarted.Register(() => { var logger = provider.GetRequiredService>(); - var threadCount = 0; - var topicCount = 0; + //var threadCount = 0; + //var topicCount = 0; var assemblyPath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location); if (string.IsNullOrWhiteSpace(assemblyPath)) { - logger.LogInformation($"kafka订阅未能找到程序路径"); + logger.LogWarning($"kafka订阅未能找到程序路径"); return; } var dllFiles = Directory.GetFiles(assemblyPath, "*.dll"); @@ -69,21 +73,35 @@ namespace JiShe.CollectBus.Kafka if (subscribeTypes.Count == 0) continue; - foreach (var subscribeType in subscribeTypes) + // 并行处理 + Parallel.ForEach(subscribeTypes, subscribeType => { var subscribes = provider.GetServices(subscribeType).ToList(); - subscribes.ForEach(subscribe => + Parallel.ForEach(subscribes,subscribe => { if (subscribe != null) { Tuple tuple = BuildKafkaSubscribe(subscribe, provider, logger, kafkaOptions.Value); - threadCount += tuple.Item1; - topicCount += tuple.Item2; + //threadCount += tuple.Item1; + //topicCount += tuple.Item2; } }); - } + }); + //foreach (var subscribeType in subscribeTypes) + //{ + // var subscribes = provider.GetServices(subscribeType).ToList(); + // subscribes.ForEach(subscribe => + // { + // if (subscribe != null) + // { + // Tuple tuple = BuildKafkaSubscribe(subscribe, provider, logger, kafkaOptions.Value); + // threadCount += tuple.Item1; + // topicCount += tuple.Item2; + // } + // }); + //} } - logger.LogInformation($"kafka订阅主题:{topicCount}数,共启动:{threadCount}线程"); + logger.LogWarning($"kafka订阅主题:{_topicSubscribeCount}数,共启动:{_threadCount}线程"); }); } @@ -135,26 +153,50 @@ namespace JiShe.CollectBus.Kafka //var configuration = provider.GetRequiredService(); int threadCount = 0; - foreach (var sub in subscribedMethods) + Parallel.ForEach(subscribedMethods, sub => { - //int partitionCount = sub.Attribute!.TaskCount==-1?3: sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; + Interlocked.Increment(ref _topicSubscribeCount); + int partitionCount = sub.Attribute!.TaskCount == -1 ? 3 : sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; var adminClientService = provider.GetRequiredService(); int topicCount = adminClientService.GetTopicPartitionsNum(sub.Attribute!.Topic); - int partitionCount = sub.Attribute!.TaskCount == -1 ? topicCount : sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; + //int partitionCount = sub.Attribute!.TaskCount == -1 ? topicCount : sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; partitionCount = partitionCount > topicCount ? topicCount : partitionCount; //partitionCount = sub.Attribute!.TaskCount == -1 ? adminClientService.GetTopicPartitionsNum(sub.Attribute!.Topic) : sub.Attribute!.TaskCount; if (partitionCount <= 0) partitionCount = 1; - for (int i = 0; i < partitionCount; i++) + Parallel.For(0,partitionCount, async (partition) => { - //if (sub.Attribute!.Topic == ProtocolConst.SubscriberLoginReceivedEventName) - Task.Run(() => StartConsumerAsync(provider, sub.Attribute!, sub.Method, subscribe, logger)); - threadCount++; - } - } + Interlocked.Increment(ref _threadCount); + //Task.Run(() => StartConsumerAsync(provider, sub.Attribute!, sub.Method, subscribe, logger)); + //threadCount++; + await StartConsumerAsync(provider, sub.Attribute!, sub.Method, subscribe, logger); + }); + + }); + + //foreach (var sub in subscribedMethods) + //{ + // //int partitionCount = sub.Attribute!.TaskCount==-1?3: sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; + // var adminClientService = provider.GetRequiredService(); + + // int topicCount = adminClientService.GetTopicPartitionsNum(sub.Attribute!.Topic); + + // int partitionCount = sub.Attribute!.TaskCount == -1 ? topicCount : sub.Attribute!.TaskCount;// kafkaOptionConfig.NumPartitions; + + // partitionCount = partitionCount > topicCount ? topicCount : partitionCount; + // //partitionCount = sub.Attribute!.TaskCount == -1 ? adminClientService.GetTopicPartitionsNum(sub.Attribute!.Topic) : sub.Attribute!.TaskCount; + // if (partitionCount <= 0) + // partitionCount = 1; + // for (int i = 0; i < partitionCount; i++) + // { + // //if (sub.Attribute!.Topic == ProtocolConst.SubscriberLoginReceivedEventName) + // Task.Run(() => StartConsumerAsync(provider, sub.Attribute!, sub.Method, subscribe, logger)); + // threadCount++; + // } + //} return Tuple.Create(threadCount, subscribedMethods.Length); } @@ -167,6 +209,8 @@ namespace JiShe.CollectBus.Kafka if (attr.EnableBatch) { + Interlocked.Increment(ref _threadStartCount); + logger.LogInformation($"kafka开启线程消费:{_threadStartCount}"); await consumerService.SubscribeBatchAsync(attr.Topic, async (message) => { try @@ -187,6 +231,8 @@ namespace JiShe.CollectBus.Kafka } else { + Interlocked.Increment(ref _threadStartCount); + logger.LogInformation($"kafka开启线程消费:{_threadStartCount}"); await consumerService.SubscribeAsync(attr.Topic, async (message) => { try diff --git a/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbContext.cs b/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbContext.cs index ebc5ad1..c0ddd77 100644 --- a/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbContext.cs +++ b/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbContext.cs @@ -13,6 +13,7 @@ using JiShe.CollectBus.IotSystems.MessageIssueds; using Volo.Abp.Data; using Volo.Abp.MongoDB; using Volo.Abp.MultiTenancy; +using JiShe.CollectBus.IotSystems.LogRecord; namespace JiShe.CollectBus.MongoDB; @@ -32,7 +33,6 @@ public class CollectBusMongoDbContext : AbpMongoDbContext, ICollectBusMongoDbCon public IMongoCollection MessageIssueds => Collection(); - protected override void CreateModel(IMongoModelBuilder modelBuilder) { diff --git a/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbModule.cs b/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbModule.cs index f427d19..89fd079 100644 --- a/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbModule.cs +++ b/modules/JiShe.CollectBus.MongoDB/MongoDB/CollectBusMongoDbModule.cs @@ -1,5 +1,7 @@ -using JiShe.CollectBus.IotSystems.MeterReadingRecords; +using JiShe.CollectBus.IotSystems.LogRecord; +using JiShe.CollectBus.IotSystems.MeterReadingRecords; using JiShe.CollectBus.Repository; +using JiShe.CollectBus.Repository.LogRecord; using JiShe.CollectBus.Repository.MeterReadingRecord; using JiShe.CollectBus.ShardingStrategy; using Microsoft.Extensions.DependencyInjection; @@ -35,10 +37,14 @@ public class CollectBusMongoDbModule : AbpModule typeof(IShardingStrategy<>), typeof(DayShardingStrategy<>)); + + context.Services.AddTransient(typeof(HourShardingStrategy<>)); + //// 分表策略仓储 替换默认仓储 //options.AddRepository(); - }); + options.AddRepository(); + }); context.Services.AddAlwaysDisableUnitOfWorkTransaction(); Configure(options => { diff --git a/modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/ILogRecordRepository.cs b/modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/ILogRecordRepository.cs new file mode 100644 index 0000000..8d1c203 --- /dev/null +++ b/modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/ILogRecordRepository.cs @@ -0,0 +1,57 @@ +using JiShe.CollectBus.IotSystems.LogRecord; +using JiShe.CollectBus.IotSystems.MeterReadingRecords; +using MongoDB.Driver; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace JiShe.CollectBus.Repository.LogRecord +{ + public interface ILogRecordRepository : IRepository + { + /// + /// 批量插入 + /// + /// + /// + /// + Task InsertManyAsync(List entities, + DateTime? dateTime); + + /// + /// 单个插入 + /// + /// + /// + /// + Task InsertAsync(LogRecords entity, DateTime? dateTime); + + /// + /// 单条更新 + /// + /// 过滤条件,示例:Builders.Filter.Eq(x => x.Id, filter.Id) + /// 包含待更新的内容,示例:Builders.Update.Set(x => x.SendHexMessage, SendHexMessage).Set(x => x.MessageId, MessageId) + /// 数据实体,用于获取对应的分片库 + /// + Task UpdateOneAsync(FilterDefinition filter, UpdateDefinition update, LogRecords entity); + + /// + /// 单个获取 + /// + /// + /// + /// + Task FirOrDefaultAsync(LogRecords entity, DateTime dateTime); + + /// + /// 多集合数据查询 + /// + /// + /// + /// + Task> ParallelQueryAsync(DateTime startTime, DateTime endTime); + } +} diff --git a/modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/LogRecordRepository.cs b/modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/LogRecordRepository.cs new file mode 100644 index 0000000..415ad06 --- /dev/null +++ b/modules/JiShe.CollectBus.MongoDB/Repository/LogRecord/LogRecordRepository.cs @@ -0,0 +1,166 @@ +using JiShe.CollectBus.IotSystems.LogRecord; +using JiShe.CollectBus.IotSystems.MeterReadingRecords; +using JiShe.CollectBus.MongoDB; +using JiShe.CollectBus.Repository.MeterReadingRecord; +using JiShe.CollectBus.ShardingStrategy; +using MongoDB.Driver; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MongoDB; + +namespace JiShe.CollectBus.Repository.LogRecord +{ + public class LogRecordRepository : MongoDbRepository, ILogRecordRepository + { + + private readonly HourShardingStrategy _hourShardingStrategy; + private readonly IMongoDbContextProvider _dbContextProvider; + + public LogRecordRepository( + IMongoDbContextProvider dbContextProvider, + HourShardingStrategy hourShardingStrategy + ) + : base(dbContextProvider) + { + _dbContextProvider = dbContextProvider; + _hourShardingStrategy = hourShardingStrategy; + } + + /// + /// 批量插入 + /// + /// + /// + /// + public override async Task> InsertManyAsync(IEnumerable entities, bool autoSave = false, CancellationToken cancellationToken = default(CancellationToken)) + { + var collection = await GetShardedCollection(DateTime.Now); + await collection.InsertManyAsync(entities); + + return entities; + } + + /// + /// 批量插入 + /// + /// + /// + /// + public async Task InsertManyAsync(List entities, DateTime? dateTime) + { + var collection = await GetShardedCollection(dateTime); + await collection.InsertManyAsync(entities); + } + + + /// + /// 单条插入 + /// + /// + /// + /// + public override async Task InsertAsync(LogRecords entity, bool autoSave = false, CancellationToken cancellationToken = default(CancellationToken)) + { + var collection = await GetShardedCollection(DateTime.Now); + await collection.InsertOneAsync(entity); + return entity; + } + + + /// + /// 单条插入 + /// + /// + /// + /// + public async Task InsertAsync(LogRecords entity, DateTime? dateTime) + { + var collection = await GetShardedCollection(dateTime); + await collection.InsertOneAsync(entity); + return entity; + } + + /// + /// 单条更新 + /// + /// 过滤条件,示例:Builders.Filter.Eq(x => x.Id, filter.Id) + /// 包含待更新的内容,示例:Builders.Update.Set(x => x.SendHexMessage, SendHexMessage).Set(x => x.MessageId, MessageId) + /// 数据实体,用于获取对应的分片库 + /// + public async Task UpdateOneAsync(FilterDefinition filter, UpdateDefinition update, LogRecords entity) + { + var collection = await GetShardedCollection(entity.CreationTime); + + await collection.UpdateOneAsync(filter, update); + return entity; + } + + + /// + /// 单个获取 + /// + /// + /// + /// + /// + public async Task FirOrDefaultAsync(LogRecords entity, DateTime dateTime) + { + var collection = await GetShardedCollection(dateTime); + var query = await collection.FindAsync(d => d.CreationTime == dateTime && d.AFN == entity.AFN && d.Fn == entity.Fn && d.Code == entity.Code); + return await query.FirstOrDefaultAsync(); + } + + /// + /// 多集合数据查询 + /// + /// + /// + /// + public async Task> ParallelQueryAsync(DateTime startTime, DateTime endTime) + { + var collectionNames = _hourShardingStrategy.GetQueryCollectionNames(startTime, endTime); + + var dbContext = await DbContextProvider.GetDbContextAsync(); + + var tasks = collectionNames.Select(async name => + { + var collection = dbContext.Database.GetCollection(name); + var filter = Builders.Filter.And( + Builders.Filter.Gte(x => x.CreationTime, startTime), + Builders.Filter.Lte(x => x.CreationTime, endTime) + ); + return await collection.Find(filter).ToListAsync(); + }); + + var results = await Task.WhenAll(tasks); + return results.SelectMany(r => r).ToList(); + } + + /// + /// 获得分片集合 + /// + /// + private async Task> GetShardedCollection(DateTime? dateTime) + { + var dbContext = await DbContextProvider.GetDbContextAsync(); + string collectionName = string.Empty; + + if (dateTime != null) + { + collectionName = _hourShardingStrategy.GetCollectionName(dateTime.Value); + } + else + { + collectionName = _hourShardingStrategy.GetCurrentCollectionName(); + } + + return dbContext.Database.GetCollection(collectionName); + } + } +} diff --git a/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/DayShardingStrategy.cs b/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/DayShardingStrategy.cs index f26136d..0c721a5 100644 --- a/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/DayShardingStrategy.cs +++ b/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/DayShardingStrategy.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using System; using System.Collections.Generic; using System.Linq; @@ -22,7 +23,7 @@ namespace JiShe.CollectBus.ShardingStrategy public string GetCollectionName(DateTime dateTime) { var baseName = typeof(TEntity).Name; - return $"{baseName}_{dateTime.GetDataTableShardingStrategy()}"; + return $"{baseName}_{dateTime.GetDataTableShardingStrategy(TableTimeStrategyEnum.DayShardingStrategy)}"; } /// @@ -32,7 +33,7 @@ namespace JiShe.CollectBus.ShardingStrategy public string GetCurrentCollectionName() { var baseName = typeof(TEntity).Name; - return $"{baseName}_{DateTime.Now.GetDataTableShardingStrategy()}"; + return $"{baseName}_{DateTime.Now.GetDataTableShardingStrategy(TableTimeStrategyEnum.DayShardingStrategy)}"; } /// @@ -50,7 +51,7 @@ namespace JiShe.CollectBus.ShardingStrategy while (current <= end) { - months.Add($"{baseName}_{current.GetDataTableShardingStrategy()}"); + months.Add($"{baseName}_{current.GetDataTableShardingStrategy(TableTimeStrategyEnum.DayShardingStrategy)}"); current = current.AddMonths(1); } diff --git a/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/HourShardingStrategy.cs b/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/HourShardingStrategy.cs new file mode 100644 index 0000000..20f65de --- /dev/null +++ b/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/HourShardingStrategy.cs @@ -0,0 +1,58 @@ +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace JiShe.CollectBus.ShardingStrategy +{ + /// + /// 按小时分表 + /// + /// + public class HourShardingStrategy + { + /// + /// 获取指定时间对应的集合名 + /// + /// + /// + public string GetCollectionName(DateTime dateTime) + { + var baseName = typeof(TEntity).Name; + return $"{baseName}_{dateTime.GetDataTableShardingStrategy(TableTimeStrategyEnum.HourShardingStrategy)}"; + } + + /// + /// 获取当前时间对应的集合名 + /// + /// + public string GetCurrentCollectionName() + { + var baseName = typeof(TEntity).Name; + return $"{baseName}_{DateTime.Now.GetDataTableShardingStrategy(TableTimeStrategyEnum.HourShardingStrategy)}"; + } + + /// + /// 用于查询时确定目标集合 + /// + /// + /// + /// + public IEnumerable GetQueryCollectionNames(DateTime? startTime, DateTime? endTime) + { + var list = new List(); + var current = startTime ?? DateTime.MinValue; + var end = endTime ?? DateTime.MaxValue; + var baseName = typeof(TEntity).Name; + + while (current <= end) + { + list.Add($"{baseName}_{current.GetDataTableShardingStrategy(TableTimeStrategyEnum.HourShardingStrategy)}"); + current = current.AddHours(1); + } + + return list.Distinct(); + } + } +} diff --git a/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/IHourShardingStrategy.cs b/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/IHourShardingStrategy.cs new file mode 100644 index 0000000..ad0654c --- /dev/null +++ b/modules/JiShe.CollectBus.MongoDB/ShardingStrategy/IHourShardingStrategy.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.CollectBus.ShardingStrategy +{ + public interface IHourShardingStrategy : IShardingStrategy + { + } +} diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs index 73c8e5e..fdeb25f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs @@ -1,4 +1,6 @@ using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol3761; @@ -12,39 +14,57 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H public class AFN0_F1_Analysis: IAnalysisStrategy { private readonly ILogger _logger; + private readonly DataStorage _dataStorage; - public AFN0_F1_Analysis(ILogger logger) + public AFN0_F1_Analysis(ILogger logger, DataStorage dataStorage) { _logger = logger; + _dataStorage= dataStorage; } - public Task ExecuteAsync(TB3761 input, Action? result = null) + public async Task ExecuteAsync(TB3761 input, Action? result = null) { try { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.A.Code); - UnitDataAnalysis dto = new UnitDataAnalysis + var data = new AnalysisBaseDto() + { + FiledDesc = "全部确认", + DataValue = true + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.FocusId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.Address; + data.DeviceType = MeterTypeEnum.Focus; + } + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, - Data = true, - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; result?.Invoke(dto); - return Task.FromResult(true); + await _dataStorage.SaveDataToIotDbAsync(dto); + return await Task.FromResult(true); } catch (Exception ex) { _logger.LogError(ex, $"00_1解析失败:{input.A.Code}-{input.DT.Fn}-{input.BaseHexMessage.HexMessageString},{ex.Message}"); } - return Task.FromResult(false); + return await Task.FromResult(false); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs index 27fd11f..09c65c2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs @@ -1,4 +1,6 @@ using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol3761; @@ -12,25 +14,41 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H public class AFN0_F2_Analysis : IAnalysisStrategy { private readonly ILogger _logger; - - public AFN0_F2_Analysis(ILogger logger) + private readonly DataStorage _dataStorage; + public AFN0_F2_Analysis(ILogger logger, DataStorage dataStorage) { _logger = logger; + _dataStorage = dataStorage; } - public Task ExecuteAsync(TB3761 input, Action? result = null) + public async Task ExecuteAsync(TB3761 input, Action? result = null) { try { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.A.Code); - UnitDataAnalysis dto = new UnitDataAnalysis + var data = new AnalysisBaseDto() + { + FiledDesc = "全部否认", + DataValue = false + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.FocusId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.Address; + data.DeviceType = MeterTypeEnum.Focus; + } + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, - Data = false, - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime =input.ReceivedTime, DensityUnit = DensityUnit.None, @@ -40,13 +58,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H #if DEBUG _logger.LogWarning($"全部否认:{input.A.Code}-{input.DT.Fn}-{input.BaseHexMessage.HexMessageString}"); #endif - return Task.FromResult(true); + await _dataStorage.SaveDataToIotDbAsync(dto); + return await Task.FromResult(true); } catch (Exception ex) { _logger.LogError(ex, $"00_2解析失败:{input.A.Code}-{input.DT.Fn}-{input.BaseHexMessage.HexMessageString},{ex.Message}"); - return Task.FromResult(false); } + return await Task.FromResult(false); } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs index e7e6655..6a83dbc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs @@ -3,16 +3,8 @@ using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; -using JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using static FreeSql.Internal.GlobalFilter; -using static System.Runtime.InteropServices.JavaScript.JSType; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H { @@ -58,7 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs index fe3efcc..8992d82 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs @@ -5,11 +5,6 @@ using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H { @@ -55,7 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs index ce982b3..4015131 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs @@ -5,11 +5,6 @@ using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H { @@ -55,7 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs index 19521aa..2580ec9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs @@ -1,9 +1,11 @@ using System.Text; using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; @@ -16,41 +18,60 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H { private readonly ILogger _logger; - public AFN9_F1_Analysis(ILogger logger) + private readonly DataStorage _dataStorage; + + public AFN9_F1_Analysis(ILogger logger, DataStorage dataStorage) { _logger = logger; + _dataStorage = dataStorage; } - public Task ExecuteAsync(TB3761 input, Action? result = null) + public async Task ExecuteAsync(TB3761 input, Action? result = null) { try { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); - var data = AnalysisDataUnit(input.UnitData.HexMessageList); - data.AreaCode = input.A.Code?.Substring(0, 4); - data.Address = input.A.Code?.Substring(4, 5); - UnitDataAnalysis dto = new UnitDataAnalysis + var version = AnalysisDataUnit(input.UnitData.HexMessageList); + version.AreaCode = input.A.Code?.Substring(0, 4); + version.Address = input.A.Code?.Substring(4, 5); + var data = new AnalysisBaseDto() + { + FiledDesc = "终端版本信息", + DataValue = version + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.FocusId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.Address; + data.DeviceType = MeterTypeEnum.Focus; + } + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; result?.Invoke(dto); - return Task.FromResult(true); + await _dataStorage.SaveDataToIotDbAsync(dto); + return await Task.FromResult(true); } catch (Exception ex) { _logger.LogError(ex, $"09_1解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}"); } - return Task.FromResult(false); + return await Task.FromResult(false); } private AFN9_F1_AnalysisDto AnalysisDataUnit(List hexMessageList) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs index 7de40a1..1df4a32 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs @@ -1,6 +1,8 @@ using System.Text; using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol3761; @@ -14,39 +16,57 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H public class AFN9_F9_Analysis : IAnalysisStrategy { private readonly ILogger _logger; - - public AFN9_F9_Analysis(ILogger logger) + private readonly DataStorage _dataStorage; + public AFN9_F9_Analysis(ILogger logger, DataStorage dataStorage) { _logger = logger; + _dataStorage = dataStorage; } - public Task ExecuteAsync(TB3761 input, Action? result = null) + public async Task ExecuteAsync(TB3761 input, Action? result = null) { try { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); - UnitDataAnalysis dto = new UnitDataAnalysis + var data = new AnalysisBaseDto() + { + FiledDesc = "远程通信模块版本信息", + DataValue = Encoding.ASCII.GetString(string.Join("", input.UnitData.HexMessageList.Skip(30).Take(20).ToList()).HexToByte()).Replace("\0", "") + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.FocusId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.Address; + data.DeviceType = MeterTypeEnum.Focus; + } + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, - Data = Encoding.ASCII.GetString(string.Join("", input.UnitData.HexMessageList.Skip(30).Take(20).ToList()).HexToByte()).Replace("\0", ""), //SIM卡 - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, //SIM卡 + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; result?.Invoke(dto); - return Task.FromResult(true); + await _dataStorage.SaveDataToIotDbAsync(dto); + + return await Task.FromResult(true); } catch (Exception ex) { _logger.LogError(ex, $"00_1解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}"); } - return Task.FromResult(false); + return await Task.FromResult(false); } } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs index 7df7b1b..0e66af9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs @@ -1,5 +1,6 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; @@ -15,42 +16,61 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH { private readonly ILogger _logger; - public AFN10_F10_Analysis(ILogger logger) + private readonly DataStorage _dataStorage; + public AFN10_F10_Analysis(ILogger logger, DataStorage dataStorage) { _logger = logger; + _dataStorage = dataStorage; } - public Task ExecuteAsync(TB3761 input, Action? result = null) + public async Task ExecuteAsync(TB3761 input, Action? result = null) { try { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); Tuple> tuple = AFN10F10EntityAnalysis(input.UnitData.HexMessageList); - UnitDataAnalysis dto = new UnitDataAnalysis + + var data = new AnalysisBaseDto() + { + FiledDesc = "终端电能表/交流采样装置配置参数", + DataValue = new AFN10_F10_AnalysisDto() + { + AFN10F10Entitys = tuple.Item2, + ConfigNum = tuple.Item1 + } + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.FocusId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.Address; + data.DeviceType = MeterTypeEnum.Focus; + } + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, - Data = new AFN10_F10_AnalysisDto() - { - AFN10F10Entitys = tuple.Item2, - ConfigNum = tuple.Item1 - }, - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; result?.Invoke(dto); - return Task.FromResult(true); + await _dataStorage.SaveDataToIotDbAsync(dto); + return await Task.FromResult(true); } catch (Exception ex) { _logger.LogError(ex, $"0A_10解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}"); } - return Task.FromResult(false); + return await Task.FromResult(false); } public Tuple> AFN10F10EntityAnalysis(List hexMessageList) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs index b23abef..2a01edc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs @@ -1,11 +1,13 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using System; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH { @@ -16,11 +18,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH { private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN10_F66_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN10_F66_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; - _analysisStrategyContext= analysisStrategyContext; + _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } public async Task ExecuteAsync(TB3761 input, Action? result = null) @@ -29,22 +32,38 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); - var data = await GenerateFinalResult(input.UnitData.HexMessageList); - data.Pn = input.DA.Pn; - UnitDataAnalysis dto = new UnitDataAnalysis + + var data = new AnalysisBaseDto() + { + FiledDesc = "终端电能表/交流采样装置配置参数", + DataValue = await GenerateFinalResult(input.UnitData.HexMessageList) + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.FocusId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.Address; + data.DeviceType = MeterTypeEnum.Focus; + } + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; result?.Invoke(dto); + await _dataStorage.SaveDataToIotDbAsync(dto); + return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs index 254ebc6..e69f8e3 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs @@ -1,4 +1,6 @@ using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol3761; @@ -12,39 +14,57 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH public class AFN10_F68_Analysis : IAnalysisStrategy { private readonly ILogger _logger; - - public AFN10_F68_Analysis(ILogger logger) + private readonly DataStorage _dataStorage; + public AFN10_F68_Analysis(ILogger logger, DataStorage dataStorage) { _logger = logger; + _dataStorage = dataStorage; } - public Task ExecuteAsync(TB3761 input, Action? result = null) + public async Task ExecuteAsync(TB3761 input, Action? result = null) { try { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); - UnitDataAnalysis dto = new UnitDataAnalysis + var data = new AnalysisBaseDto() + { + FiledDesc = "终端电能表/交流采样装置配置参数", + DataValue = input.UnitData.HexMessageList[4].Equals("55") + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.FocusId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.Address; + data.DeviceType = MeterTypeEnum.Focus; + } + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, - Data = input.UnitData.HexMessageList[4].Equals("55"), - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; result?.Invoke(dto); - return Task.FromResult(true); + await _dataStorage.SaveDataToIotDbAsync(dto); + + return await Task.FromResult(true); } catch (Exception ex) { _logger.LogError(ex, $"0A_68解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}"); } - return Task.FromResult(false); + return await Task.FromResult(false); } } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs index a7538ca..f4e9fa6 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs @@ -1,12 +1,14 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IoTDB.Interface; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { @@ -17,13 +19,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - private readonly IIoTDbProvider _dbProvider; - - public AFN12_F129_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, IIoTDbProvider dbProvider) + private readonly DataStorage _dataStorage; + public AFN12_F129_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; - _dbProvider= dbProvider; + _dataStorage = dataStorage; } public async Task ExecuteAsync(TB3761 input, Action? result = null) @@ -41,7 +42,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH Pn = input.DA.Pn, MSA = input.A.A3.D1_D7, PSEQ = input.SEQ.PSEQ, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, @@ -49,8 +50,24 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH }; List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn); + if (list.Count > 0) + { + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + list.ForEach(item => + { + item.ProjectId = ammeterInfo.ProjectID; + item.DeviceId = ammeterInfo.MeterId; + item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + item.DeviceAddress = ammeterInfo.AmmerterAddress; + }); + } + } unitDataAnalysis.Data= list; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs index 59ae0fc..ed4e4d0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs @@ -1,5 +1,6 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; @@ -17,11 +18,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F130_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F130_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } public async Task ExecuteAsync(TB3761 input, Action? result = null) @@ -32,6 +34,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List> list = GenerateFinalResult(2, datas, "正向无功电能示值", input.AFN_FC.AFN, input.DT.Fn); + if (list.Count > 0) + { + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + list.ForEach(item => + { + item.ProjectId = ammeterInfo.ProjectID; + item.DeviceId = ammeterInfo.MeterId; + item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + item.DeviceAddress = ammeterInfo.AmmerterAddress; + }); + } + } UnitDataAnalysis>> unitDataAnalysis = new UnitDataAnalysis>> { Code = input.A.Code!, @@ -39,13 +56,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH Fn = input.DT.Fn, Pn = input.DA.Pn, Data = list, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs index 9b57ea1..2fc30e0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs @@ -1,5 +1,6 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; @@ -18,11 +19,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F131_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F131_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } public async Task ExecuteAsync(TB3761 input, Action? result = null) @@ -33,6 +35,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List> list = GenerateFinalResult(2, datas, "反向有功总电能示值", input.AFN_FC.AFN, input.DT.Fn); + if (list.Count > 0) + { + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + list.ForEach(item => + { + item.ProjectId = ammeterInfo.ProjectID; + item.DeviceId = ammeterInfo.MeterId; + item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + item.DeviceAddress = ammeterInfo.AmmerterAddress; + }); + } + } UnitDataAnalysis>> unitDataAnalysis = new UnitDataAnalysis>> { Code = input.A.Code!, @@ -40,13 +57,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH Fn = input.DT.Fn, Pn = input.DA.Pn, Data = list, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs index 70db824..1b420f6 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs @@ -1,6 +1,7 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; @@ -19,11 +20,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F132_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F132_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } @@ -36,6 +38,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; List> list = GenerateFinalResult(2, datas, "反向无功电能示值", dataType); + if (list.Count > 0) + { + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + list.ForEach(item => + { + item.ProjectId = ammeterInfo.ProjectID; + item.DeviceId = ammeterInfo.MeterId; + item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + item.DeviceAddress = ammeterInfo.AmmerterAddress; + }); + } + } UnitDataAnalysis>> unitDataAnalysis = new UnitDataAnalysis>> { Code = input.A.Code!, @@ -43,13 +60,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH Fn = input.DT.Fn , Pn = input.DA.Pn, Data = list, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs index ecbaef0..485e75e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs @@ -1,12 +1,14 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using System.Collections.Generic; using System.Diagnostics.Metrics; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH @@ -18,11 +20,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F145_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F145_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } @@ -36,6 +39,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; AnalysisBaseDto data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", dataType); + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.MeterId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.AmmerterAddress; + + } + UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { Code = input.A.Code!, @@ -43,13 +57,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs index 671e625..8464ba9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs @@ -57,7 +57,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH MSA=input.A.A3!.D1_D7!, PSEQ=input.SEQ.PSEQ, Data = data, - HexMessage=input.BaseHexMessage.HexMessageString, + ReceivedHexMessage=input.BaseHexMessage.HexMessageString, MessageId=input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs index e48cdc4..d4850d5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs @@ -1,9 +1,11 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; using YamlDotNet.Core.Tokens; @@ -18,11 +20,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F188_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F188_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } public async Task ExecuteAsync(TB3761 input, Action? result = null) @@ -36,6 +39,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH ArgumentNullException.ThrowIfNull(input.DT.Fn); string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; AnalysisBaseDto data = GenerateFinalResult(input.UnitData.HexMessageList, dataType); + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.MeterId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.AmmerterAddress; + + } UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, @@ -43,13 +56,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(dto); + await _dataStorage.SaveDataToIotDbAsync(dto); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs index 4c754e3..90f3c6f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs @@ -1,9 +1,11 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; @@ -19,11 +21,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F25_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F25_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } public List DataType { get; set; } = new List() { "YGGL", "YGGL_A", "YGGL_B", "YGGL_C", "WGGL", "WGGL_A", "WGGL_B", "WGGL_C", "GLYS", "GLYS_A", "GLYS_B", "GLYS_C", "DY_A", "DY_B", "DY_C", "DL_A", "DL_B", "DL_C", "LXDL", "SZGL", "SZGL_A", "SZGL_B", "SZGL_C" }; @@ -62,6 +65,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH dto.FiledDesc = remarks[i - 1]; list.Add(dto); } + if (list.Count > 0) + { + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DataType.ToString(), "15"); + if (ammeterInfo != null) + { + list.ForEach(item => + { + item.ProjectId = ammeterInfo.ProjectID; + item.DeviceId = ammeterInfo.MeterId; + item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + item.DeviceAddress = ammeterInfo.AmmerterAddress; + }); + } + } + UnitDataAnalysis>> unitDataAnalysis = new UnitDataAnalysis>> { Code = input.A.Code!, @@ -69,13 +88,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH Fn = input.DT.Fn, Pn = input.DA.Pn, Data = list, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs index 5bac5c7..45e2ba9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs @@ -8,6 +8,8 @@ using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; using static System.Runtime.InteropServices.JavaScript.JSType; using System.Diagnostics.Metrics; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; +using JiShe.CollectBus.IotSystems.Ammeters; namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { @@ -18,11 +20,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F2_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F2_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } public async Task ExecuteAsync(TB3761 input, Action? result = null) @@ -35,6 +38,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, dataType); + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.MeterId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.AmmerterAddress; + + } UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, @@ -42,13 +55,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(dto); + await _dataStorage.SaveDataToIotDbAsync(dto); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs index cea1330..e1d4341 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs @@ -1,10 +1,13 @@ using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using System; namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { @@ -16,11 +19,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH private List DataUnitHexList { get; set; }=new List(); private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F33_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F33_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } @@ -34,20 +38,36 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH DataUnitHexList = input.UnitData.HexMessageList.GetRange(24, (5 * (rationgCount + 1)) + (4 * (rationgCount + 1)) * 3); GetDataUnitHexString(input.UnitData.HexMessageList, rationgCount); - UnitDataAnalysis unitDataAnalysis = new UnitDataAnalysis + var data = new AnalysisBaseDto() + { + FiledDesc = "当前正向有/无功电能示值、一/四象限无功电能示值", + DataValue = await AnalysisDataUnit(input.UnitData.HexMessageList, rationgCount) + }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.MeterId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.AmmerterAddress; + + } + UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, - Data = await AnalysisDataUnit(input.UnitData.HexMessageList, rationgCount), - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs index f4dd742..33a06b9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs @@ -1,9 +1,11 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; @@ -18,11 +20,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { private readonly ILogger _logger; private readonly AnalysisStrategyContext _analysisStrategyContext; - - public AFN12_F49_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext) + private readonly DataStorage _dataStorage; + public AFN12_F49_Analysis(ILogger logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage) { _logger = logger; _analysisStrategyContext = analysisStrategyContext; + _dataStorage = dataStorage; } public List DataType { get; set; } = new List() { "Uab_Ua", "Ub", "Ucb_Uc", "Ia", "Ib", "Ic" }; @@ -58,6 +61,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH dto.FiledDesc= remarks[i]; list.Add(dto); } + if (list.Count > 0) + { + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + list.ForEach(item => + { + item.ProjectId = ammeterInfo.ProjectID; + item.DeviceId = ammeterInfo.MeterId; + item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + item.DeviceAddress = ammeterInfo.AmmerterAddress; + }); + } + } UnitDataAnalysis>> unitDataAnalysis = new UnitDataAnalysis>> { Code = input.A.Code!, @@ -65,13 +83,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH Fn = input.DT.Fn, Pn = input.DA.Pn, Data= list, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, TimeDensity = 0 }; result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs index 3df913f..4f66190 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs @@ -65,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs index f4d4c0a..db6b1ab 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs index 4e02149..19af1d5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs index 94faa02..c9c85ca 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs index a76189a..ef8b3bd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs index 05fa701..cd0f340 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs index ce50726..1c7fbdd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs index a07cce6..fb4495e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs index 520970c..f5b8d24 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs index 661dce8..698a180 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs index cff5120..97c2f64 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs index 28c8244..0f7ca95 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs index 3fa0625..c5306b2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs index 9c7346b..a155216 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs index b46161d..57a84f0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs index c4d6ac4..7ac836e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs index 3fdee69..0dc4362 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs index 6ecc824..5e0c7a4 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs index f52b8d1..315dc66 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs index 12c012c..0b7d121 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs index 2e76d9f..2487d84 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs index 566b374..7b6dbab 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs index d685851..25063a3 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs @@ -60,7 +60,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs index 20a9ccb..9b942a5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs index 10234b0..e6ce2b7 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs index f896e59..e4d0f3c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs @@ -60,7 +60,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs index 2e8ef47..2c4c58d 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs index f21f425..b124158 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs index 81a8710..6a6ce65 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs @@ -60,7 +60,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs index e2f6747..ed75e71 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs @@ -61,7 +61,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs index 40fc28c..73068c7 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs @@ -62,7 +62,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs index 2270784..62f8d44 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs @@ -55,7 +55,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs index b7e920f..77df07e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs @@ -56,7 +56,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs index ef5bc1f..a688d57 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs @@ -56,7 +56,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs index e8f200f..7984be2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs index 5267153..1329f0f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs @@ -66,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs index 1fb68ad..cc283f7 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs @@ -65,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs index acf04cd..e6fd687 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs index ce5d692..ab2d42f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs index a5ea520..d31ae3e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs index 648be75..2f350ca 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs index 3fd2907..c4e8a74 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs index 2dad0e8..e93e737 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs index de93427..6f618a9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs index 3e24bb4..071fb0b 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs index a89b0c7..e784710 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs index 30f16b0..4cd618d 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs index 1b5e012..760e405 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs @@ -63,7 +63,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs index b3b41aa..a919b18 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs index f6282a5..421f430 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs index 6d6025f..fada7f7 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs index d4174da..9ae2af2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs index 0e790dc..043dd67 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs index d772796..11a97be 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs index f22d2f1..ba3b9f5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs @@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs index 39b36c8..d44d45f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs @@ -65,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH Fn = input.DT.Fn, Pn = input.DA.Pn, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs index 5f62f56..4d23dd0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs @@ -1,9 +1,12 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using System.Text; namespace GatherService.WattMeter.AnalysisData.AFN_10H { @@ -13,40 +16,47 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H public class AFN16_F101_Analysis : IAnalysisStrategy { private readonly ILogger _logger; - - public AFN16_F101_Analysis(ILogger logger) + private readonly DataStorage _dataStorage; + public AFN16_F101_Analysis(ILogger logger, DataStorage dataStorage) { _logger = logger; + _dataStorage = dataStorage; } - public Task ExecuteAsync(TB3761 input, Action? result = null) + public async Task ExecuteAsync(TB3761 input, Action? result = null) { try { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); - UnitDataAnalysis dto = new UnitDataAnalysis + var data = new AnalysisBaseDto() + { + FiledDesc = "透读取SIM卡信息", + DataValue = AnalysisDataUnit(input.UnitData.HexMessageList) + }; + UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, Fn = input.DT.Fn, Pn = input.DA.Pn, - Data = AnalysisDataUnit(input.UnitData.HexMessageList), //SIM卡 - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, //SIM卡 + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; result?.Invoke(dto); - return Task.FromResult(true); + await _dataStorage.SaveDataToIotDbAsync(dto); + return await Task.FromResult(true); } catch (Exception ex) { _logger.LogError(ex, $"10_101解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}"); } - return Task.FromResult(false); + return await Task.FromResult(false); } private string AnalysisDataUnit(List hexMessageList) { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs index 7fa1d92..6a15d69 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs @@ -59,14 +59,15 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, Data = data, - HexMessage = input.BaseHexMessage.HexMessageString, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Hour, ReceivedTime = input.ReceivedTime }; - await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); + return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs index 5495942..dec2a3b 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs @@ -1,6 +1,8 @@ using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol; +using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.T37612012.AnalysisData; @@ -33,17 +35,23 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); List datas = AnalysisDataUnit(input.UnitData.HexMessageList); - + + var data = new AnalysisBaseDto() + { + FiledDesc = "跳合闸", + DataValue = (datas[2].Equals("9C") || datas[2].Equals("94")) ? true : false + }; + // 查询电表信息 - //AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.MeterType.ToString(), "15"); - //if (ammeterInfo != null) - //{ - // data.ProjectId = ammeterInfo.ProjectID; - // data.MeterId = ammeterInfo.MeterId; - // data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; - // data.MeterAddress = ammeterInfo.AmmerterAddress; - //} - UnitDataAnalysis unitDataAnalysis = new UnitDataAnalysis + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.MeterId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.AmmerterAddress; + } + UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { Code = input.A.Code!, AFN = input.AFN_FC.AFN, @@ -51,15 +59,15 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H Pn = input.DA.Pn, MSA = input.A.A3!.D1_D7!, PSEQ = input.SEQ.PSEQ, - Data = (datas[2].Equals("9C") || datas[2].Equals("94")) ? true : false, - HexMessage = input.BaseHexMessage.HexMessageString, + Data = data, + ReceivedHexMessage = input.BaseHexMessage.HexMessageString, MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, TimeDensity = -1 }; - //await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); + await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); return await Task.FromResult(true); } catch (Exception ex) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs index d43276d..f7009bb 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs @@ -10,11 +10,15 @@ using JiShe.CollectBus.IoTDB.Model; using JiShe.CollectBus.IoTDB.Options; using JiShe.CollectBus.IoTDB.Provider; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.IotSystems.LogRecord; using JiShe.CollectBus.IotSystems.MeterReadingRecords; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using System.Diagnostics; using System.Diagnostics.Metrics; +using System.Threading.Channels; using Volo.Abp.DependencyInjection; using Volo.Abp.Guids; using static FreeSql.Internal.GlobalFilter; @@ -28,12 +32,36 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData private readonly IIoTDbProvider _dbProvider; private readonly ServerApplicationOptions _applicationOptions; private readonly IoTDBRuntimeContext _runtimeContext; - public DataStorage(IIoTDbProvider dbProvider, IOptions applicationOptions, IGuidGenerator guidGenerator, IoTDBRuntimeContext runtimeContext) + private readonly ILogger _logger; + + public DataStorage(IIoTDbProvider dbProvider, IOptions applicationOptions, + IGuidGenerator guidGenerator, IoTDBRuntimeContext runtimeContext, ILogger logger) { _dbProvider= dbProvider; _applicationOptions = applicationOptions.Value; _guidGenerator= guidGenerator; _runtimeContext= runtimeContext; + _logger= logger; + } + + + + /// + /// 日志保存通道写入 + /// + /// + public async Task LogSaveWriterAsync(ChannelWriter channelWriter, dynamic dataItems) + { + await channelWriter.WriteAsync(dataItems); + } + + /// + /// 日志刷新通道写入 + /// + /// + public async Task LogRefreshSaveWriterAsync(ChannelWriter channelWriter, dynamic dataItems) + { + await channelWriter.WriteAsync(dataItems); } /// @@ -107,7 +135,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData // 更新 meter.Timestamps = taskData.PendingCopyReadTime.GetDateTimeOffset().ToUnixTimeNanoseconds(); taskData.IsReceived=true; - taskData.ReceivedMessageHexString= analysisBaseDto.HexMessage; + taskData.ReceivedMessageHexString= analysisBaseDto.ReceivedHexMessage; taskData.ReceivedMessageId= analysisBaseDto.MessageId ?? string.Empty; } else @@ -135,10 +163,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ManualOrNot = false, Pn = analysisBaseDto.Pn, ReceivedMessageId = analysisBaseDto.MessageId?? string.Empty, - ReceivedMessageHexString = analysisBaseDto.HexMessage, + ReceivedMessageHexString = analysisBaseDto.ReceivedHexMessage, IsReceived = true, ReceivedRemark = data.ErrorCodeMsg ?? string.Empty, ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(), + ReceivedTime = analysisBaseDto.ReceivedTime, }; } @@ -158,12 +187,13 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData /// /// /// + /// /// public async Task SaveMultipleDataToIotDbAsync(UnitDataAnalysis>> analysisBaseDto) { var data = analysisBaseDto.Data!; List meterReadingTelemetryPacketInfos = new List(); - List< TreeModelSingleMeasuringEntity> treeModelSingleMeasuringEntities = new List>(); + List> treeModelSingleMeasuringEntities = new List>(); foreach (var item in data) { if(!item.TimeSpan.HasValue) @@ -211,7 +241,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData // 更新 meter.Timestamps = taskData.PendingCopyReadTime.GetDateTimeOffset().ToUnixTimeNanoseconds(); taskData.IsReceived = true; - taskData.ReceivedMessageHexString = analysisBaseDto.HexMessage; + taskData.ReceivedMessageHexString = analysisBaseDto.ReceivedHexMessage; taskData.ReceivedMessageId = analysisBaseDto.MessageId ?? string.Empty; } else @@ -239,20 +269,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ManualOrNot = false, Pn = analysisBaseDto.Pn, ReceivedMessageId = analysisBaseDto.MessageId ?? string.Empty, - ReceivedMessageHexString = analysisBaseDto.HexMessage, + ReceivedMessageHexString = analysisBaseDto.ReceivedHexMessage, IsReceived = true, ReceivedRemark = item.ErrorCodeMsg ?? string.Empty, ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(), + ReceivedTime = analysisBaseDto.ReceivedTime, }; } meterReadingTelemetryPacketInfos.Add(taskData); - //如果无字段名,则不保存数据 + //如果无字段名,则不保存数据,如saveData=false 也不保存数据 if (!string.IsNullOrWhiteSpace(item.FiledName)) { treeModelSingleMeasuringEntities.Add(meter); } } // 批量保存数据 + _runtimeContext.UseTableSessionPool = true; // 使树模型池 await _dbProvider.BatchInsertAsync(meterReadingTelemetryPacketInfos); if (treeModelSingleMeasuringEntities.Count > 0) { @@ -273,6 +305,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ArgumentNullException.ThrowIfNull(nameof(analysisBaseDto.Data)); ArgumentException.ThrowIfNullOrWhiteSpace(nameof(analysisBaseDto.Data.FiledName)); ArgumentException.ThrowIfNullOrWhiteSpace(nameof(analysisBaseDto.Data.DataValue)); + List> treeModelSingleMeasuringEntities = new List>(); + var data = analysisBaseDto.Data!; if (!data.TimeSpan.HasValue) data.TimeSpan = analysisBaseDto.ReceivedTime; @@ -299,7 +333,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ProjectId = $"{data.ProjectId}", DataType = IOTDBDataTypeConst.Status, Timestamps = timestamps, - SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.HexMessage ?? string.Empty) + SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty) }; _runtimeContext.UseTableSessionPool = false; // 使树模型池 @@ -318,20 +352,40 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData }; _runtimeContext.UseTableSessionPool = false; // 使树模型池 await _dbProvider.InsertAsync(treeRecordingTimeData); - // 备注 - var treeRemarkData = new TreeModelSingleMeasuringEntity() + + // 新建 + string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ); + var currentTime = DateTime.Now; + var taskData = new MeterReadingTelemetryPacketInfo() { SystemName = _applicationOptions.SystemType, - DeviceId = $"{data.DeviceId}", - DeviceType = $"{data.DeviceType}", ProjectId = $"{data.ProjectId}", - DataType = IOTDBDataTypeConst.Status, - Timestamps = timestamps, - SingleMeasuring = (ConcentratorStatusFieldConst.Remark, data.FiledDesc ?? string.Empty) + DeviceType = $"{data.DeviceType}", + DeviceId = $"{data.DeviceId}", + Timestamps = DateTime.Now.GetDateTimeOffset().ToUnixTimeNanoseconds(), + DatabaseBusiID = data.DatabaseBusiID, + PendingCopyReadTime = data.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), + CreationTime = currentTime, + MeterAddress = data.DeviceAddress, + AFN = analysisBaseDto.AFN, + Fn = analysisBaseDto.Fn, + Seq = analysisBaseDto.PSEQ, + MSA = analysisBaseDto.MSA, + ItemCode = data.DataType, + TaskMark = taskMark, + IsSend = false, + ManualOrNot = false, + Pn = analysisBaseDto.Pn, + ReceivedMessageId = analysisBaseDto.MessageId ?? string.Empty, + ReceivedMessageHexString = analysisBaseDto.ReceivedHexMessage, + IsReceived = true, + ReceivedRemark = data.ErrorCodeMsg ?? string.Empty, + ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(), + ReceivedTime=analysisBaseDto.ReceivedTime, }; - _runtimeContext.UseTableSessionPool = false; // 使树模型池 - await _dbProvider.InsertAsync(treeRemarkData); - + _runtimeContext.UseTableSessionPool = true; // 使表模型池 + await _dbProvider.InsertAsync(taskData); + return await Task.FromResult(true); } @@ -344,7 +398,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData public async Task SaveMultipleStatusToIotDbAsync(UnitDataAnalysis>> analysisBaseDto) { ArgumentNullException.ThrowIfNull(nameof(analysisBaseDto.Data)); - + List meterReadingTelemetryPacketInfos = new List(); + var data = analysisBaseDto.Data!; foreach (var item in data) { @@ -375,7 +430,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ProjectId = $"{item.ProjectId}", DataType = IOTDBDataTypeConst.Status, Timestamps = timestamps, - SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.HexMessage ?? string.Empty) + SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty) }; _runtimeContext.UseTableSessionPool = false; // 使树模型池 @@ -393,21 +448,48 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData }; _runtimeContext.UseTableSessionPool = false; // 使树模型池 await _dbProvider.InsertAsync(treeRecordingTimeData); - // 备注 - var treeRemarkData = new TreeModelSingleMeasuringEntity() + + // 新建 + string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ); + var currentTime = DateTime.Now; + var taskData = new MeterReadingTelemetryPacketInfo() { SystemName = _applicationOptions.SystemType, - DeviceType = $"{item.DeviceType}", ProjectId = $"{item.ProjectId}", - DataType = IOTDBDataTypeConst.Status, - Timestamps = timestamps, - SingleMeasuring =(ConcentratorStatusFieldConst.Remark, item.FiledDesc ?? string.Empty) + DeviceType = $"{item.DeviceType}", + DeviceId = $"{item.DeviceId}", + Timestamps = DateTime.Now.GetDateTimeOffset().ToUnixTimeNanoseconds(), + DatabaseBusiID = item.DatabaseBusiID, + PendingCopyReadTime = item.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), + CreationTime = currentTime, + MeterAddress = item.DeviceAddress, + AFN = analysisBaseDto.AFN, + Fn = analysisBaseDto.Fn, + Seq = analysisBaseDto.PSEQ, + MSA = analysisBaseDto.MSA, + ItemCode = item.DataType, + TaskMark = taskMark, + IsSend = false, + ManualOrNot = false, + Pn = analysisBaseDto.Pn, + ReceivedMessageId = analysisBaseDto.MessageId ?? string.Empty, + ReceivedMessageHexString = analysisBaseDto.ReceivedHexMessage, + IsReceived = true, + ReceivedRemark = item.ErrorCodeMsg ?? string.Empty, + ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(), + ReceivedTime = analysisBaseDto.ReceivedTime, }; - _runtimeContext.UseTableSessionPool = false; // 使树模型池 - await _dbProvider.InsertAsync(treeRemarkData); + meterReadingTelemetryPacketInfos.Add(taskData); + } + if (meterReadingTelemetryPacketInfos.Count > 0) + { + _runtimeContext.UseTableSessionPool = true; // 使表模型池 + await _dbProvider.BatchInsertAsync(meterReadingTelemetryPacketInfos); } return await Task.FromResult(true); } + + } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/CollectBusProtocolT37612012Module.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/CollectBusProtocolT37612012Module.cs index d38b2ea..8f3cec4 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/CollectBusProtocolT37612012Module.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/CollectBusProtocolT37612012Module.cs @@ -1,5 +1,7 @@ using System.Reflection; +using System.Threading.Channels; using JiShe.CollectBus.Protocol.Interfaces; +using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Volo.Abp; diff --git a/services/JiShe.CollectBus.Application/CollectBusApplicationModule.cs b/services/JiShe.CollectBus.Application/CollectBusApplicationModule.cs index ed86fd7..1feb894 100644 --- a/services/JiShe.CollectBus.Application/CollectBusApplicationModule.cs +++ b/services/JiShe.CollectBus.Application/CollectBusApplicationModule.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Threading.Channels; -using System.Threading.Tasks; -using Cassandra.Mapping; +using Cassandra.Mapping; using JiShe.CollectBus.Cassandra; using JiShe.CollectBus.DataChannels; -using JiShe.CollectBus.DataMigration.Options; using JiShe.CollectBus.FreeRedis; using JiShe.CollectBus.FreeSql; using JiShe.CollectBus.Interceptors; @@ -16,9 +9,14 @@ using JiShe.CollectBus.IotSystems.MeterReadingRecords; using JiShe.CollectBus.Kafka; using JiShe.CollectBus.Mappers; using JiShe.CollectBus.Protocol; -using JiShe.CollectBus.Protocol.Contracts; using JiShe.CollectBus.ScheduledMeterReading; using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Channels; +using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Application; using Volo.Abp.Autofac; @@ -83,6 +81,17 @@ public class CollectBusApplicationModule : AbpModule //下发任务通道构建 DataChannelManage.TaskDataChannel = Channel.CreateUnbounded>>(); + + // 日志存储通道构建 + DataChannelManage.LogSaveChannel = Channel.CreateUnbounded(); + + // 日志刷新通道构建 + DataChannelManage.LogRefreshChannel = Channel.CreateUnbounded(); + + // 启动通道任务 + var _dataChannelManage = context.ServiceProvider.GetRequiredService(); + _ = _dataChannelManage.LogSaveAsync(DataChannelManage.LogSaveChannel.Reader); + //默认初始化表计信息 var dbContext = context.ServiceProvider.GetRequiredService(); _= dbContext.InitAmmeterCacheData(); diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManage.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManage.cs index 6a8eeed..6130a25 100644 --- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManage.cs +++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManage.cs @@ -1,4 +1,5 @@ using JiShe.CollectBus.IotSystems.MeterReadingRecords; +using JiShe.CollectBus.Protocol.Dto; using System; using System.Collections.Generic; using System.Linq; @@ -14,5 +15,16 @@ namespace JiShe.CollectBus.DataChannels /// 下发任务通道 /// public static Channel>> TaskDataChannel; + + /// + /// 日志保存管道 + /// + public static Channel LogSaveChannel; + + /// + /// 日志刷新管道 + /// + public static Channel LogRefreshChannel; + } } diff --git a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs index c24ad18..8a4862c 100644 --- a/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs +++ b/services/JiShe.CollectBus.Application/DataChannels/DataChannelManageService.cs @@ -1,15 +1,24 @@ -using JiShe.CollectBus.Common; +using Amazon.Runtime.Internal.Transform; +using DnsClient.Protocol; +using JiShe.CollectBus.Common; using JiShe.CollectBus.Common.DeviceBalanceControl; using JiShe.CollectBus.IoTDB.Context; using JiShe.CollectBus.IoTDB.Interface; +using JiShe.CollectBus.IotSystems.LogRecord; using JiShe.CollectBus.IotSystems.MeterReadingRecords; using JiShe.CollectBus.Kafka.Internal; using JiShe.CollectBus.Kafka.Producer; +using JiShe.CollectBus.Protocol.Dto; +using JiShe.CollectBus.Protocol.Models; +using JiShe.CollectBus.Repository.LogRecord; +using Mapster; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; +using System.Linq; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; @@ -28,6 +37,7 @@ namespace JiShe.CollectBus.DataChannels private readonly KafkaOptionConfig _kafkaOptions; private readonly ServerApplicationOptions _applicationOptions; private readonly IoTDBRuntimeContext _runtimeContext; + private readonly ILogRecordRepository _logRecordRepository; public DataChannelManageService( ILogger logger, @@ -35,7 +45,8 @@ namespace JiShe.CollectBus.DataChannels IoTDBRuntimeContext runtimeContext, IProducerService producerService, IOptions kafkaOptions, - IOptions applicationOptions) + IOptions applicationOptions, + ILogRecordRepository logRecordRepository) { _logger = logger; _dbProvider = dbProvider; @@ -44,6 +55,7 @@ namespace JiShe.CollectBus.DataChannels _kafkaOptions = kafkaOptions.Value; _applicationOptions = applicationOptions.Value; _runtimeContext.UseTableSessionPool = true; + _logRecordRepository= logRecordRepository; } /// @@ -54,9 +66,6 @@ namespace JiShe.CollectBus.DataChannels { await _telemetryPacketInfoWriter.WriteAsync(dataItems); } - - - /// /// 定时任务数据入库和Kafka推送通道 /// @@ -200,5 +209,127 @@ namespace JiShe.CollectBus.DataChannels } + + /// + /// 日志保存 + /// + /// + /// + public async Task LogSaveAsync(ChannelReader channelReader) + { + const int BatchSize = 1000; + const int EmptyWaitMilliseconds = 1000; + var timeout = TimeSpan.FromSeconds(2); + var timer = Stopwatch.StartNew(); + long timeoutMilliseconds = 0; + try + { + while (true) + { + var batch = new List(); + var canRead = channelReader.Count; + if (canRead <= 0) + { + if (timeoutMilliseconds > 0) + { + _logger.LogError($"{nameof(LogSaveAsync)} 通道处理数据耗时{timeoutMilliseconds}毫秒"); + } + timeoutMilliseconds = 0; + //无消息时短等待1秒 + await Task.Delay(EmptyWaitMilliseconds); + continue; + } + + timer.Restart(); + var startTime = DateTime.Now; + + try + { + // 异步批量读取数据 + while (batch != null && batch.Count < BatchSize && (DateTime.Now - startTime) < timeout) + { + try + { + if (channelReader.TryRead(out var dataItem)) + { + batch.Add(dataItem); + } + } + catch (Exception) + { + throw; + } + } + } + catch (Exception) + { + throw; + } + + if (batch == null || batch.Count == 0) + { + await Task.Delay(EmptyWaitMilliseconds); + continue; + } + try + { + + // 按小时分组 + var hourGroups = new Dictionary>(); + DateTime? dateTime = null; + List batchList = new List(); + int index = 1; + foreach (var item in batch) + { + var records = item.Adapt(); + + if (!records.ReceivedTime.HasValue) + records.ReceivedTime = DateTime.Now; + var curDateTime = new DateTime(records.ReceivedTime.Value.Year, records.ReceivedTime.Value.Month, records.ReceivedTime.Value.Hour, records.ReceivedTime.Value.Day, records.ReceivedTime.Value.Hour, 0, 0); + if (!dateTime.HasValue || curDateTime != dateTime) + { + dateTime = curDateTime; + if (batchList.Count > 0) + { + var immutableList = ImmutableList.CreateRange(batchList); + hourGroups.Add(dateTime.Value, immutableList.ToList()); + batchList.Clear(); + } + } + batchList.Add(records); + // 最后一批 + if(index== batch.Count) + { + var immutableList = ImmutableList.CreateRange(batchList); + hourGroups.Add(dateTime.Value, immutableList.ToList()); + batchList.Clear(); + } + index++; + } + foreach (var (time, records) in hourGroups) + { + // 批量写入数据库 + await _logRecordRepository.InsertManyAsync(records, time); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "数据通道处理日志数据时发生异常"); + } + batch.Clear(); + timer.Stop(); + + timeoutMilliseconds = timeoutMilliseconds + timer.ElapsedMilliseconds; + + startTime = DateTime.Now; + } + } + catch (Exception ex) + { + _logger.LogCritical(ex, "日志处理发生致命错误"); + throw; + } + } + } } diff --git a/services/JiShe.CollectBus.Application/Workers/CreateToBeIssueTaskWorker.cs b/services/JiShe.CollectBus.Application/Workers/CreateToBeIssueTaskWorker.cs index 654abc4..d1de00a 100644 --- a/services/JiShe.CollectBus.Application/Workers/CreateToBeIssueTaskWorker.cs +++ b/services/JiShe.CollectBus.Application/Workers/CreateToBeIssueTaskWorker.cs @@ -1,43 +1,43 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Hangfire; -using JiShe.CollectBus.Common.Consts; -using JiShe.CollectBus.ScheduledMeterReading; -using Microsoft.Extensions.Logging; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Uow; +//using System; +//using System.Threading; +//using System.Threading.Tasks; +//using Hangfire; +//using JiShe.CollectBus.Common.Consts; +//using JiShe.CollectBus.ScheduledMeterReading; +//using Microsoft.Extensions.Logging; +//using Volo.Abp.BackgroundWorkers.Hangfire; +//using Volo.Abp.DependencyInjection; +//using Volo.Abp.Uow; -namespace JiShe.CollectBus.Workers -{ - /// - /// 构建待处理的下发指令任务处理 - /// - public class CreateToBeIssueTaskWorker : HangfireBackgroundWorkerBase, ITransientDependency, ICollectWorker - { - private readonly ILogger _logger; - private readonly IScheduledMeterReadingService _scheduledMeterReadingService; +//namespace JiShe.CollectBus.Workers +//{ +// /// +// /// 构建待处理的下发指令任务处理 +// /// +// public class CreateToBeIssueTaskWorker : HangfireBackgroundWorkerBase, ITransientDependency, ICollectWorker +// { +// private readonly ILogger _logger; +// private readonly IScheduledMeterReadingService _scheduledMeterReadingService; - /// - /// Initializes a new instance of the class. - /// - /// The logger. - /// 定时任务 - public CreateToBeIssueTaskWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) - { - _logger = logger; - RecurringJobId = nameof(CreateToBeIssueTaskWorker); - CronExpression = "0 0/1 * * * *"; - TimeZone = TimeZoneInfo.Local; - this._scheduledMeterReadingService = scheduledMeterReadingService; - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The logger. +// /// 定时任务 +// public CreateToBeIssueTaskWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) +// { +// _logger = logger; +// RecurringJobId = nameof(CreateToBeIssueTaskWorker); +// CronExpression = "0 0/1 * * * *"; +// TimeZone = TimeZoneInfo.Local; +// this._scheduledMeterReadingService = scheduledMeterReadingService; +// } - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - _logger.LogError($"{DateTime.Now}"); - // await _scheduledMeterReadingService.CreateToBeIssueTasks(); - } - } -} +// public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) +// { +// _logger.LogError($"{DateTime.Now}"); +// // await _scheduledMeterReadingService.CreateToBeIssueTasks(); +// } +// } +//} diff --git a/services/JiShe.CollectBus.Application/Workers/DataDetectionFifteenMinuteWorker.cs b/services/JiShe.CollectBus.Application/Workers/DataDetectionFifteenMinuteWorker.cs index 7e991ce..392c801 100644 --- a/services/JiShe.CollectBus.Application/Workers/DataDetectionFifteenMinuteWorker.cs +++ b/services/JiShe.CollectBus.Application/Workers/DataDetectionFifteenMinuteWorker.cs @@ -1,39 +1,39 @@ -using JiShe.CollectBus.ScheduledMeterReading; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.DependencyInjection; +//using JiShe.CollectBus.ScheduledMeterReading; +//using Microsoft.Extensions.Logging; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using System.Threading; +//using System.Threading.Tasks; +//using Volo.Abp.BackgroundWorkers.Hangfire; +//using Volo.Abp.DependencyInjection; -namespace JiShe.CollectBus.Workers -{ - /// - /// 定时数据检测1小时一次 - /// - public class DataDetectionFifteenMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency, ICollectWorker - { +//namespace JiShe.CollectBus.Workers +//{ +// /// +// /// 定时数据检测1小时一次 +// /// +// public class DataDetectionFifteenMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency, ICollectWorker +// { - private readonly ILogger _logger; - private readonly IScheduledMeterReadingService _scheduledMeterReadingService; +// private readonly ILogger _logger; +// private readonly IScheduledMeterReadingService _scheduledMeterReadingService; - public DataDetectionFifteenMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) - { - _logger = logger; - RecurringJobId = nameof(CreateToBeIssueTaskWorker); - CronExpression = "0 0 0/1 * * ?"; - TimeZone = TimeZoneInfo.Local; - this._scheduledMeterReadingService = scheduledMeterReadingService; - } +// public DataDetectionFifteenMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) +// { +// _logger = logger; +// RecurringJobId = nameof(CreateToBeIssueTaskWorker); +// CronExpression = "0 0 0/1 * * ?"; +// TimeZone = TimeZoneInfo.Local; +// this._scheduledMeterReadingService = scheduledMeterReadingService; +// } - public override Task DoWorkAsync(CancellationToken cancellationToken = default) - { - //throw new NotImplementedException(); - return Task.CompletedTask; - } - } -} +// public override Task DoWorkAsync(CancellationToken cancellationToken = default) +// { +// //throw new NotImplementedException(); +// return Task.CompletedTask; +// } +// } +//} diff --git a/services/JiShe.CollectBus.Application/Workers/EpiCollectWorker.cs b/services/JiShe.CollectBus.Application/Workers/EpiCollectWorker.cs index 925692e..037e2e2 100644 --- a/services/JiShe.CollectBus.Application/Workers/EpiCollectWorker.cs +++ b/services/JiShe.CollectBus.Application/Workers/EpiCollectWorker.cs @@ -1,39 +1,39 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Hangfire; -using JiShe.CollectBus.Common.Attributes; -using Microsoft.Extensions.Logging; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Uow; +//using System; +//using System.Threading; +//using System.Threading.Tasks; +//using Hangfire; +//using JiShe.CollectBus.Common.Attributes; +//using Microsoft.Extensions.Logging; +//using Volo.Abp.BackgroundWorkers.Hangfire; +//using Volo.Abp.DependencyInjection; +//using Volo.Abp.Uow; -namespace JiShe.CollectBus.Workers -{ - public class EpiCollectWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker - { - private readonly ILogger _logger; +//namespace JiShe.CollectBus.Workers +//{ +// public class EpiCollectWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker +// { +// private readonly ILogger _logger; - /// - /// Initializes a new instance of the class. - /// - /// The logger. - public EpiCollectWorker(ILogger logger) - { - _logger = logger; - RecurringJobId = nameof(EpiCollectWorker); - CronExpression = Cron.Daily(); +// /// +// /// Initializes a new instance of the class. +// /// +// /// The logger. +// public EpiCollectWorker(ILogger logger) +// { +// _logger = logger; +// RecurringJobId = nameof(EpiCollectWorker); +// CronExpression = Cron.Daily(); - } +// } - public override Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - using (var uow = LazyServiceProvider.LazyGetRequiredService().Begin()) - { - Logger.LogInformation("Executed MyLogWorker..!"); - return Task.CompletedTask; - } - } - } -} +// public override Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) +// { +// using (var uow = LazyServiceProvider.LazyGetRequiredService().Begin()) +// { +// Logger.LogInformation("Executed MyLogWorker..!"); +// return Task.CompletedTask; +// } +// } +// } +//} diff --git a/services/JiShe.CollectBus.Application/Workers/SubscriberFifteenMinuteWorker.cs b/services/JiShe.CollectBus.Application/Workers/SubscriberFifteenMinuteWorker.cs index 005d46b..a7ca7c9 100644 --- a/services/JiShe.CollectBus.Application/Workers/SubscriberFifteenMinuteWorker.cs +++ b/services/JiShe.CollectBus.Application/Workers/SubscriberFifteenMinuteWorker.cs @@ -1,48 +1,48 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Hangfire; -using JiShe.CollectBus.ScheduledMeterReading; -using Microsoft.Extensions.Logging; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Uow; +//using System; +//using System.Threading; +//using System.Threading.Tasks; +//using Hangfire; +//using JiShe.CollectBus.ScheduledMeterReading; +//using Microsoft.Extensions.Logging; +//using Volo.Abp.BackgroundWorkers.Hangfire; +//using Volo.Abp.DependencyInjection; +//using Volo.Abp.Uow; -namespace JiShe.CollectBus.Workers -{ - /// - /// 15分钟采集数据 - /// - public class SubscriberFifteenMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency, ICollectWorker - { - private readonly ILogger _logger; - private readonly IScheduledMeterReadingService _scheduledMeterReadingService; +//namespace JiShe.CollectBus.Workers +//{ +// /// +// /// 15分钟采集数据 +// /// +// public class SubscriberFifteenMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency, ICollectWorker +// { +// private readonly ILogger _logger; +// private readonly IScheduledMeterReadingService _scheduledMeterReadingService; - /// - /// Initializes a new instance of the class. - /// - /// The logger. - /// 定时任务 - public SubscriberFifteenMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) - { - _logger = logger; - RecurringJobId = nameof(SubscriberFifteenMinuteWorker); - CronExpression = "0 0/15 * * * *"; - TimeZone = TimeZoneInfo.Local; - this._scheduledMeterReadingService = scheduledMeterReadingService; - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The logger. +// /// 定时任务 +// public SubscriberFifteenMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) +// { +// _logger = logger; +// RecurringJobId = nameof(SubscriberFifteenMinuteWorker); +// CronExpression = "0 0/15 * * * *"; +// TimeZone = TimeZoneInfo.Local; +// this._scheduledMeterReadingService = scheduledMeterReadingService; +// } - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - //await _scheduledMeterReadingService.AmmeterScheduledMeterFifteenMinuteReading(); - //await _scheduledMeterReadingService.WatermeterScheduledMeterFifteenMinuteReading(); +// public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) +// { +// //await _scheduledMeterReadingService.AmmeterScheduledMeterFifteenMinuteReading(); +// //await _scheduledMeterReadingService.WatermeterScheduledMeterFifteenMinuteReading(); - //using (var uow = LazyServiceProvider.LazyGetRequiredService().Begin()) - //{ - // Logger.LogInformation("Executed MyLogWorker..!"); - // return Task.CompletedTask; - //} - } - } -} +// //using (var uow = LazyServiceProvider.LazyGetRequiredService().Begin()) +// //{ +// // Logger.LogInformation("Executed MyLogWorker..!"); +// // return Task.CompletedTask; +// //} +// } +// } +//} diff --git a/services/JiShe.CollectBus.Application/Workers/SubscriberFiveMinuteWorker.cs b/services/JiShe.CollectBus.Application/Workers/SubscriberFiveMinuteWorker.cs index fbd3668..119421e 100644 --- a/services/JiShe.CollectBus.Application/Workers/SubscriberFiveMinuteWorker.cs +++ b/services/JiShe.CollectBus.Application/Workers/SubscriberFiveMinuteWorker.cs @@ -1,42 +1,42 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Hangfire; -using JiShe.CollectBus.ScheduledMeterReading; -using Microsoft.Extensions.Logging; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Uow; +//using System; +//using System.Threading; +//using System.Threading.Tasks; +//using Hangfire; +//using JiShe.CollectBus.ScheduledMeterReading; +//using Microsoft.Extensions.Logging; +//using Volo.Abp.BackgroundWorkers.Hangfire; +//using Volo.Abp.DependencyInjection; +//using Volo.Abp.Uow; -namespace JiShe.CollectBus.Workers -{ - /// - /// 5分钟采集数据 - /// - public class SubscriberFiveMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker - { - private readonly ILogger _logger; - private readonly IScheduledMeterReadingService _scheduledMeterReadingService; +//namespace JiShe.CollectBus.Workers +//{ +// /// +// /// 5分钟采集数据 +// /// +// public class SubscriberFiveMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker +// { +// private readonly ILogger _logger; +// private readonly IScheduledMeterReadingService _scheduledMeterReadingService; - /// - /// Initializes a new instance of the class. - /// - /// The logger. - /// 定时任务 - public SubscriberFiveMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) - { - _logger = logger; - RecurringJobId = nameof(SubscriberFiveMinuteWorker); - CronExpression = "0 0/5 * * * *"; - TimeZone = TimeZoneInfo.Local; - this._scheduledMeterReadingService = scheduledMeterReadingService; - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The logger. +// /// 定时任务 +// public SubscriberFiveMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) +// { +// _logger = logger; +// RecurringJobId = nameof(SubscriberFiveMinuteWorker); +// CronExpression = "0 0/5 * * * *"; +// TimeZone = TimeZoneInfo.Local; +// this._scheduledMeterReadingService = scheduledMeterReadingService; +// } - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - //await _scheduledMeterReadingService.AmmeterScheduledMeterFiveMinuteReading(); - //await _scheduledMeterReadingService.WatermeterScheduledMeterFiveMinuteReading(); - } - } -} +// public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) +// { +// //await _scheduledMeterReadingService.AmmeterScheduledMeterFiveMinuteReading(); +// //await _scheduledMeterReadingService.WatermeterScheduledMeterFiveMinuteReading(); +// } +// } +//} diff --git a/services/JiShe.CollectBus.Application/Workers/SubscriberOneMinuteWorker.cs b/services/JiShe.CollectBus.Application/Workers/SubscriberOneMinuteWorker.cs index e9e0240..419a681 100644 --- a/services/JiShe.CollectBus.Application/Workers/SubscriberOneMinuteWorker.cs +++ b/services/JiShe.CollectBus.Application/Workers/SubscriberOneMinuteWorker.cs @@ -1,44 +1,44 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Hangfire; -using JiShe.CollectBus.ScheduledMeterReading; -using Microsoft.Extensions.Logging; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Uow; +//using System; +//using System.Threading; +//using System.Threading.Tasks; +//using Hangfire; +//using JiShe.CollectBus.ScheduledMeterReading; +//using Microsoft.Extensions.Logging; +//using Volo.Abp.BackgroundWorkers.Hangfire; +//using Volo.Abp.DependencyInjection; +//using Volo.Abp.Uow; -namespace JiShe.CollectBus.Workers -{ - /// - /// 1分钟采集数据 - /// - public class SubscriberOneMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker - { - private readonly ILogger _logger; - private readonly IScheduledMeterReadingService _scheduledMeterReadingService; +//namespace JiShe.CollectBus.Workers +//{ +// /// +// /// 1分钟采集数据 +// /// +// public class SubscriberOneMinuteWorker : HangfireBackgroundWorkerBase, ITransientDependency,ICollectWorker +// { +// private readonly ILogger _logger; +// private readonly IScheduledMeterReadingService _scheduledMeterReadingService; - /// - /// Initializes a new instance of the class. - /// - /// The logger. - /// 定时任务 - public SubscriberOneMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) - { - _logger = logger; - RecurringJobId = nameof(SubscriberOneMinuteWorker); - CronExpression = "0 0/1 * * * *"; - TimeZone = TimeZoneInfo.Local; - this._scheduledMeterReadingService = scheduledMeterReadingService; - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The logger. +// /// 定时任务 +// public SubscriberOneMinuteWorker(ILogger logger, IScheduledMeterReadingService scheduledMeterReadingService) +// { +// _logger = logger; +// RecurringJobId = nameof(SubscriberOneMinuteWorker); +// CronExpression = "0 0/1 * * * *"; +// TimeZone = TimeZoneInfo.Local; +// this._scheduledMeterReadingService = scheduledMeterReadingService; +// } - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - //await _scheduledMeterReadingService.AmmeterScheduledMeterOneMinuteReading(); +// public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) +// { +// //await _scheduledMeterReadingService.AmmeterScheduledMeterOneMinuteReading(); - //await _scheduledMeterReadingService.WatermeterScheduledMeterOneMinuteReading(); +// //await _scheduledMeterReadingService.WatermeterScheduledMeterOneMinuteReading(); - } - } -} +// } +// } +//} diff --git a/services/JiShe.CollectBus.Domain/IotSystems/LogRecord/LogRecords.cs b/services/JiShe.CollectBus.Domain/IotSystems/LogRecord/LogRecords.cs new file mode 100644 index 0000000..2a18a02 --- /dev/null +++ b/services/JiShe.CollectBus.Domain/IotSystems/LogRecord/LogRecords.cs @@ -0,0 +1,99 @@ +using JiShe.CollectBus.Common.Enums; +using MongoDB.Bson.Serialization.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace JiShe.CollectBus.IotSystems.LogRecord +{ + /// + /// 日志记录集合 + /// + public class LogRecords : AggregateRoot + { + /// + /// 集中器地址 + /// + public string Code { get; set; } = null!; + + /// + /// AFN功能码 + /// + public int AFN { get; set; } + + /// + /// 信息点 + /// + public int Pn { get; set; } + + /// + /// 信息类 + /// + public int Fn { get; set; } + + /// + /// 主站地址 MSA + /// + public int MSA { get; set; } + + /// + /// 响应帧序号 + /// + public int PSEQ { get; set; } + + /// + /// 响应帧 + /// + public string? ReceivedHexMessage { get; set; } = null; + + /// + /// 发送帧 + /// + public string? SendHexMessage { get; set; } = null; + + /// + /// 消息ID + /// + public string? MessageId { get; set; } + + /// + /// 消息时间 + /// + [BsonDateTimeOptions(Kind = DateTimeKind.Local)] + public DateTime? ReceivedTime { get; set; } + + /// + /// 采集密度 + /// + public int TimeDensity { get; set; } + + /// + /// 采集密度单位 + /// + public DensityUnit DensityUnit { get; set; } = DensityUnit.None; + + /// + /// 项目ID + /// + public int ProjectId { get; set; } + + /// + /// 集中器ID + /// + public int FocusId { get; set; } + + /// + /// 数据 + /// + //public object? Data { get; set;} + + /// + /// 创建时间 + /// + [BsonDateTimeOptions(Kind = DateTimeKind.Local)] + public DateTime CreationTime { get; set; }=DateTime.Now; + } +} diff --git a/services/JiShe.CollectBus.Domain/JiShe.CollectBus.Domain.csproj b/services/JiShe.CollectBus.Domain/JiShe.CollectBus.Domain.csproj index f8880ec..e69f3b6 100644 --- a/services/JiShe.CollectBus.Domain/JiShe.CollectBus.Domain.csproj +++ b/services/JiShe.CollectBus.Domain/JiShe.CollectBus.Domain.csproj @@ -26,11 +26,11 @@ - + + diff --git a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AFN10_F66_AnalysisDto.cs b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AFN10_F66_AnalysisDto.cs index c3c8306..8a5853a 100644 --- a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AFN10_F66_AnalysisDto.cs +++ b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AFN10_F66_AnalysisDto.cs @@ -29,10 +29,6 @@ namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto /// public int CurveRatio { get; set; } - /// - /// 任务号 - /// - public int Pn { get; set; } public List Details { get; set; } = new List(); } diff --git a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs index 476a0db..d338693 100644 --- a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs +++ b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs @@ -1,5 +1,6 @@ using JiShe.CollectBus.Common.Enums; using System; +using System.Collections.Generic; namespace JiShe.CollectBus.Protocol.Dto { @@ -38,7 +39,7 @@ namespace JiShe.CollectBus.Protocol.Dto /// /// 响应帧 /// - public string? HexMessage { get; set; } = null; + public string? ReceivedHexMessage { get; set; } = null; /// /// 消息ID @@ -59,7 +60,6 @@ namespace JiShe.CollectBus.Protocol.Dto /// 采集密度单位 /// public DensityUnit DensityUnit { get; set; }= DensityUnit.Minute; - } public class UnitDataAnalysis: UnitDataAnalysis diff --git a/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs b/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs index 1d93ff8..35c457e 100644 --- a/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs +++ b/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs @@ -169,10 +169,6 @@ namespace JiShe.CollectBus.Common.Consts /// public const string FrameData = "FrameData"; - /// - /// 备注 - /// - public const string Remark="Remark"; } #endregion } diff --git a/shared/JiShe.CollectBus.Common/Enums/TableTimeStrategyEnum.cs b/shared/JiShe.CollectBus.Common/Enums/TableTimeStrategyEnum.cs new file mode 100644 index 0000000..db065af --- /dev/null +++ b/shared/JiShe.CollectBus.Common/Enums/TableTimeStrategyEnum.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.CollectBus.Common.Enums +{ + /// + /// 分表策略枚举 + /// + public enum TableTimeStrategyEnum + { + /// + /// 按分钟分表 + /// + MinuteShardingStrategy = 0, + + /// + /// 按小时分表 + /// + HourShardingStrategy = 1, + /// + /// 按天分表 + /// + DayShardingStrategy = 2, + /// + /// 按月分表 + /// + MonthShardingStrategy = 3, + /// + /// 按年分表 + /// + YearShardingStrategy = 4 + } +} diff --git a/shared/JiShe.CollectBus.Common/Extensions/DateTimeExtensions.cs b/shared/JiShe.CollectBus.Common/Extensions/DateTimeExtensions.cs index d7e12e3..3254edc 100644 --- a/shared/JiShe.CollectBus.Common/Extensions/DateTimeExtensions.cs +++ b/shared/JiShe.CollectBus.Common/Extensions/DateTimeExtensions.cs @@ -1,4 +1,5 @@ -using System; +using JiShe.CollectBus.Common.Enums; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -173,13 +174,24 @@ namespace JiShe.CollectBus.Common.Extensions /// /// /// - public static string GetDataTableShardingStrategy(this DateTime dateTime) + public static string GetDataTableShardingStrategy(this DateTime dateTime, TableTimeStrategyEnum tableStrategy) { -#if DEBUG - return $"{dateTime:yyyyMMddHHmm}"; -#else - return $"{dateTime:yyyyMMddHH}"; -#endif + switch (tableStrategy) + { + case TableTimeStrategyEnum.MinuteShardingStrategy: + return $"{dateTime:yyyyMMddHHmm}"; + case TableTimeStrategyEnum.HourShardingStrategy: + return $"{dateTime:yyyyMMddHH}"; + case TableTimeStrategyEnum.DayShardingStrategy: + return $"{dateTime:yyyyMMdd}"; + case TableTimeStrategyEnum.MonthShardingStrategy: + return $"{dateTime:yyyyMM}"; + case TableTimeStrategyEnum.YearShardingStrategy: + return $"{dateTime:yyyy}"; + default: + return $""; // 默认不分表 + + } } diff --git a/web/JiShe.CollectBus.Host/CollectBusHostModule.Configure.cs b/web/JiShe.CollectBus.Host/CollectBusHostModule.Configure.cs index e6f1e7e..696307c 100644 --- a/web/JiShe.CollectBus.Host/CollectBusHostModule.Configure.cs +++ b/web/JiShe.CollectBus.Host/CollectBusHostModule.Configure.cs @@ -37,7 +37,7 @@ namespace JiShe.CollectBus.Host Db = context.Services.GetConfiguration().GetValue("Redis:HangfireDB") }; - Configure(options => { options.IsJobExecutionEnabled = true; }); + Configure(options => { options.IsJobExecutionEnabled = false; }); context.Services.AddHangfire(config => { diff --git a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml index 9509b08..9c23d54 100644 --- a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml +++ b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml @@ -16,6 +16,7 @@ 后端服务 + diff --git a/web/JiShe.CollectBus.Host/appsettings.json b/web/JiShe.CollectBus.Host/appsettings.json index 43f1723..89c0175 100644 --- a/web/JiShe.CollectBus.Host/appsettings.json +++ b/web/JiShe.CollectBus.Host/appsettings.json @@ -44,7 +44,7 @@ "Configuration": "192.168.1.9:6380,password=1q2w3e!@#,syncTimeout=30000,abortConnect=false,connectTimeout=30000,allowAdmin=true", "MaxPoolSize": "50", "DefaultDB": "14", - "HangfireDB": "13" + "HangfireDB": "9" }, "Jwt": { "Audience": "JiShe.CollectBus", @@ -53,7 +53,7 @@ "ExpirationTime": 2 }, "HealthChecks": { - "IsEnable": true, + "IsEnable": false, "HealthCheckDatabaseName": "HealthChecks", "EvaluationTimeInSeconds": 10, "MinimumSecondsBetweenFailureNotifications": 60 @@ -141,7 +141,7 @@ } }, "ServerApplicationOptions": { - "ServerTagName": "JiSheCollectBus4", + "ServerTagName": "JiSheCollectBus99", "SystemType": "Energy", "FirstCollectionTime": "2025-04-28 15:07:00", "AutomaticVerificationTime": "16:07:00", From eaf6f22bdc8404b317acb3d500d1b47c26c3dcf2 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Mon, 12 May 2025 15:14:19 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIoTDB=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E7=B1=BB=E5=9E=8B=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JiShe.CollectBus.IoTDB/Model/Class1.cs | 12 -- .../Provider/DeviceMetadata.cs | 19 ++- .../Provider/IoTDBProvider.cs | 143 ++++++++++-------- .../Samples/SampleAppService.cs | 88 ++++++++++- .../BasicScheduledMeterReadingService.cs | 2 +- .../IotSystems/Devices/DeviceDataInfo.cs | 22 +++ 6 files changed, 200 insertions(+), 86 deletions(-) delete mode 100644 modules/JiShe.CollectBus.IoTDB/Model/Class1.cs create mode 100644 services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceDataInfo.cs diff --git a/modules/JiShe.CollectBus.IoTDB/Model/Class1.cs b/modules/JiShe.CollectBus.IoTDB/Model/Class1.cs deleted file mode 100644 index 9bcd5ff..0000000 --- a/modules/JiShe.CollectBus.IoTDB/Model/Class1.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace JiShe.CollectBus.IoTDB.Model -{ - internal class Class1 - { - } -} diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs b/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs index 92c33ee..a93ba35 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/DeviceMetadata.cs @@ -60,14 +60,29 @@ namespace JiShe.CollectBus.IoTDB.Provider public string ColumnName; /// - /// 值获取委托 + /// 数据类型 + /// + public TSDataType TSDataType { get; set;} + + /// + /// 值获取委托(参数:实体对象) /// public Func ValueGetter; + /// + /// 值设置委托(参数:实体对象,新值) + /// + public Action ValueSetter; + /// /// 类型转换委托 /// - public Func Converter; + public Func GetConverter; + + /// + /// 类型转换委托 + /// + public Func SetConverter; /// /// 是否单测点 diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs index 6d77ce3..88c6b92 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs @@ -274,7 +274,6 @@ namespace JiShe.CollectBus.IoTDB.Provider var sessionDataSet = await CurrentSession.ExecuteQueryStatementAsync(query); - _logger.LogWarning($"{nameof(QueryAsync)} 主题的任务 {options.TableNameOrTreePath} 路径批次{options.PageIndex}任务数据读取完成,共消耗{stopwatch2.ElapsedMilliseconds}毫秒。"); var result = new BusPagedResult { TotalCount = await GetTotalCount(options), @@ -284,7 +283,7 @@ namespace JiShe.CollectBus.IoTDB.Provider }; stopwatch2.Stop(); - _logger.LogWarning($"{nameof(QueryAsync)} 主题的任务 {options.TableNameOrTreePath} 路径批次{options.PageIndex}任务数据读取完成,共消耗{stopwatch2.ElapsedMilliseconds}毫秒。"); + //int totalPageCount = (int)Math.Ceiling((double)result.TotalCount / options.PageSize); if (result.Items.Count() < result.PageSize) @@ -467,7 +466,7 @@ namespace JiShe.CollectBus.IoTDB.Provider private async Task BuildQuerySQL(IoTDBQueryOptions options) where T : IoTEntity { var metadata = await GetMetadata(); - var sb = new StringBuilder("SELECT TIME as Timestamps,"); + var sb = new StringBuilder("SELECT "); sb.AppendJoin(", ", metadata.ColumnNames); sb.Append($" FROM {options.TableNameOrTreePath}"); @@ -577,12 +576,7 @@ namespace JiShe.CollectBus.IoTDB.Provider var accessor = SourceEntityAccessorFactory.GetAccessor(); var memberCache = BuildMemberCache(accessor); - - var columns = new List() { "Timestamps" }; - var dataTypes = new List() { TSDataType.TIMESTAMP }; - columns.AddRange(metadata.ColumnNames); - dataTypes.AddRange(metadata.DataTypes); - + while (dataSet.HasNext() && results.Count < pageSize) { @@ -592,30 +586,12 @@ namespace JiShe.CollectBus.IoTDB.Provider Timestamps = record.Timestamps }; - foreach (var measurement in columns) + for (int i = 0; i < metadata.Processors.Count; i++) { - int indexOf = columns.IndexOf(measurement); - var value = record.Values[indexOf]; - TSDataType tSDataType = dataTypes[indexOf]; - - if (!memberCache.TryGetValue(measurement, out var member) && !(value is System.DBNull)) - { - throw new Exception($"{nameof(ParseResults)} 解析查询结果 {accessor.EntityName} 属性赋值出现异常,没有找到{measurement}对应的 member信息"); - } - - dynamic tempValue = GetTSDataValue(tSDataType, value); - - if (measurement.ToLower().EndsWith("time")) - { - member.Setter(entity, TimestampHelper.ConvertToDateTime(tempValue, TimestampUnit.Nanoseconds)); - } - else - { - member.Setter(entity, tempValue); - } - + var value = record.Values[i]; + metadata.Processors[i].ValueSetter(entity, value); } - + results.Add(entity); } @@ -715,7 +691,9 @@ namespace JiShe.CollectBus.IoTDB.Provider { ColumnName = column.Name, IsSingleMeasuring = column.IsSingleMeasuring, - Converter = CreateConverter(column.DeclaredTypeName.ToUpper()) + GetConverter = GetterConverter(column.DeclaredTypeName.ToUpper()), + SetConverter = SetterConverter(column.Name.ToUpper()), + TSDataType = column.DataType, }; // 处理单测点 @@ -730,37 +708,7 @@ namespace JiShe.CollectBus.IoTDB.Provider object rawValue = item1Member.Getter(obj); string value = rawValue?.ToString(); - if (!string.IsNullOrWhiteSpace(value)) - { - // 规则1: 严格检查ASCII字母和数字(0-9, A-Z, a-z) - bool hasInvalidChars = value.Any(c => - !((c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') || - (c >= '0' && c <= '9'))); - - // 规则2: 首字符不能是数字 - bool startsWithDigit = value[0] >= '0' && value[0] <= '9'; - - // 规则3: 全字符串不能都是数字 - bool allDigits = value.All(c => c >= '0' && c <= '9'); - - // 按优先级抛出具体异常 - if (hasInvalidChars) - { - throw new InvalidOperationException( - $"SingleMeasuring name '{value}' 包含非法字符,只允许字母和数字"); - } - else if (startsWithDigit) - { - throw new InvalidOperationException( - $"SingleMeasuring name '{value}' 不能以数字开头"); - } - else if (allDigits) - { - throw new InvalidOperationException( - $"SingleMeasuring name '{value}' 不能全为数字"); - } - } + ValidateSingleMeasuringName(value); return value; }; @@ -769,7 +717,7 @@ namespace JiShe.CollectBus.IoTDB.Provider .First(m => m.NameOrPath == $"{column.Name}.Item2"); processor.ValueGetter = (obj) => { object rawValue = item2Member.Getter(obj); - return processor.Converter(rawValue); + return processor.GetConverter(rawValue); }; } else @@ -778,7 +726,15 @@ namespace JiShe.CollectBus.IoTDB.Provider var member = accessor.MemberList.First(m => m.NameOrPath == column.Name); processor.ValueGetter = (obj) => { object rawValue = member.Getter(obj); - return processor.Converter(rawValue); + return processor.GetConverter(rawValue); + }; + + //对应的属性成员进行赋值 + processor.ValueSetter = (obj, value) => + { + dynamic tempValue = GetTSDataValue(processor.TSDataType, value); + var rawValue = processor.SetConverter(value); + member.Setter(obj, rawValue); }; } @@ -788,7 +744,52 @@ namespace JiShe.CollectBus.IoTDB.Provider return metadata; } - private Func CreateConverter(string declaredTypeName) + /// + /// 验证单测点名称格式 + /// + private void ValidateSingleMeasuringName(string value) + { + if (string.IsNullOrWhiteSpace(value)) + { + return; + } + + // 规则1: 严格检查ASCII字母和数字(0-9, A-Z, a-z) + bool hasInvalidChars = value.Any(c => + !((c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + (c >= '0' && c <= '9'))); + + // 规则2: 首字符不能是数字 + bool startsWithDigit = value[0] >= '0' && value[0] <= '9'; + + // 规则3: 全字符串不能都是数字 + bool allDigits = value.All(c => c >= '0' && c <= '9'); + + // 按优先级抛出具体异常 + if (hasInvalidChars) + { + throw new InvalidOperationException( + $"SingleMeasuring name '{value}' 包含非法字符,只允许字母和数字"); + } + else if (startsWithDigit) + { + throw new InvalidOperationException( + $"SingleMeasuring name '{value}' 不能以数字开头"); + } + else if (allDigits) + { + throw new InvalidOperationException( + $"SingleMeasuring name '{value}' 不能全为数字"); + } + } + + /// + /// 取值的处理器 + /// + /// + /// + private Func GetterConverter(string declaredTypeName) { return declaredTypeName switch { @@ -797,6 +798,16 @@ namespace JiShe.CollectBus.IoTDB.Provider }; } + /// + /// 设置值的处理 + /// + /// + /// + private Func SetterConverter(string columnName) => + columnName.ToLower().EndsWith("time") + ? value => new DateTime(Convert.ToInt64(value), DateTimeKind.Utc) + : value => value; + /// /// 处理不同列类型的逻辑 /// diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs index ffbfadb..3035633 100644 --- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs +++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Ammeters; +using FreeSql.Internal.CommonProvider; +using JiShe.CollectBus.Ammeters; using JiShe.CollectBus.Application.Contracts; using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.DeviceBalanceControl; @@ -10,7 +11,10 @@ using JiShe.CollectBus.IoTDB.Context; using JiShe.CollectBus.IoTDB.Interface; using JiShe.CollectBus.IoTDB.Model; using JiShe.CollectBus.IoTDB.Options; +using JiShe.CollectBus.IoTDB.Provider; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.IotSystems.Devices; +using JiShe.CollectBus.IotSystems.MeterReadingRecords; using JiShe.CollectBus.IotSystems.PrepayModel; using JiShe.CollectBus.Kafka.Attributes; using JiShe.CollectBus.Kafka.Internal; @@ -27,6 +31,7 @@ using System.Diagnostics; using System.Threading.Tasks; using TouchSocket.Core; using TouchSocket.Sockets; +using static IdentityModel.ClaimComparer; namespace JiShe.CollectBus.Samples; @@ -205,18 +210,63 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS public async Task TestTreeModelSingleMeasuringEntity2(string measuring, int value, DateTime time) { time = DateTime.Now; - var meter = new TreeModelSingleMeasuringEntity() + var meter = new TreeModelSingleMeasuringEntity() { SystemName = "energy", DeviceId = "402440506", DeviceType = "Ammeter", ProjectId = "10059", Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(), - SingleMeasuring = (measuring, value) + SingleMeasuring = (measuring, true) }; await _iotDBProvider.InsertAsync(meter); } + /// + /// 测试树模型单个测点数据项查询 + /// + /// + /// + [HttpGet] + public async Task TestTreeModelSingleMeasuringEntityQuery() + { + + var time = DateTime.Now; + + var meter = new TreeModelSingleMeasuringEntity() + { + SystemName = "energy", + DeviceId = "402440506", + DeviceType = "Ammeter", + ProjectId = "10059", + Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(), + SingleMeasuring = ("measuring", true) + }; + + + + + QueryCondition conditions = new QueryCondition() + { + Field = "DeviceId", + Operator = "=", + Value = meter.DeviceId + }; + + + var query = new IoTDBQueryOptions() + { + TableNameOrTreePath = meter.DevicePath, + PageIndex = 1, + PageSize = 1, + Conditions = new List() { conditions }, + }; + + var pageResult = await _iotDBProvider.QueryAsync(query); + + await _iotDBProvider.InsertAsync(meter); + } + /// /// 测试表模型单个测点数据项 /// @@ -250,14 +300,14 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS { time = DateTime.Now; - var meter = new TableModelSingleMeasuringEntity() + var meter = new TableModelSingleMeasuringEntity() { SystemName = "energy", DeviceId = "402440506", DeviceType = "Ammeter", ProjectId = "10059", Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(), - SingleColumn = (measuring, true) + SingleColumn = (measuring, value) }; _dbContext.UseTableSessionPool = true; await _iotDBProvider.InsertAsync(meter); @@ -462,5 +512,33 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS // 测试不管是否上线都ACK return SubscribeAck.Success(); } + + + /// + /// 测试Redis批量读取10万条数据性能 + /// + /// + [HttpGet] + public async Task TestRedisCacheGetData(string scores) + { + var timeDensity = "15"; + string SystemType = "Energy"; + string ServerTagName = "JiSheCollectBus5"; + var redisCacheMeterInfoHashKeyTemp = $"{string.Format(RedisConst.CacheMeterInfoHashKey, SystemType, ServerTagName, MeterTypeEnum.Ammeter, timeDensity)}"; + var redisCacheMeterInfoSetIndexKeyTemp = $"{string.Format(RedisConst.CacheMeterInfoSetIndexKey, SystemType, ServerTagName, MeterTypeEnum.Ammeter, timeDensity)}"; + var redisCacheMeterInfoZSetScoresIndexKeyTemp = $"{string.Format(RedisConst.CacheMeterInfoZSetScoresIndexKey, SystemType, ServerTagName, MeterTypeEnum.Ammeter, timeDensity)}"; + + var page = await _redisDataCacheService.GetSingleData( + redisCacheMeterInfoHashKeyTemp, + redisCacheMeterInfoZSetScoresIndexKeyTemp, + "973219481:17", + pageSize: 1000, + lastScore: 100, + lastMember: "memberId", + descending: true + ); + + await Task.CompletedTask; + } } diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index 7b407b4..c8826ba 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -322,7 +322,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading /// public virtual async Task InitAmmeterCacheData(string gatherCode = "") { - //return; + return; // 创建取消令牌源 //var cts = new CancellationTokenSource(); diff --git a/services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceDataInfo.cs b/services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceDataInfo.cs new file mode 100644 index 0000000..a3a0e21 --- /dev/null +++ b/services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceDataInfo.cs @@ -0,0 +1,22 @@ +using JiShe.CollectBus.Analyzers.Shared; +using JiShe.CollectBus.IoTDB.Attributes; +using JiShe.CollectBus.IoTDB.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.CollectBus.IotSystems.Devices +{ + /// + /// 设备树模型数据信息 + /// + [SourceAnalyzers(EntityTypeEnum.TableModel)] + public class DeviceTreeModelDataInfo: IoTEntity + { + + [FIELDColumn] + public bool xfdsa { get; set; } + } +} From dac786593829ed2634ef73d4cf480bd988c3bfee Mon Sep 17 00:00:00 2001 From: zenghongyao <873884283@qq.com> Date: Mon, 12 May 2025 16:09:53 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BF=9D=E5=AD=98IOTDB?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=81=9ADataType=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisData/AFN_00H/AFN0_F1_Analysis.cs | 11 +++++-- .../AnalysisData/AFN_00H/AFN0_F2_Analysis.cs | 10 +++++-- .../AnalysisData/AFN_02H/AFN2_F1_Analysis.cs | 10 +++++-- .../AnalysisData/AFN_02H/AFN2_F2_Analysis.cs | 10 +++++-- .../AnalysisData/AFN_02H/AFN2_F3_Analysis.cs | 10 +++++-- .../AnalysisData/AFN_09H/AFN9_F1_Analysis.cs | 7 +++-- .../AnalysisData/AFN_09H/AFN9_F9_Analysis.cs | 7 +++-- .../AFN_0AH/AFN10_F10_Analysis.cs | 9 ++++-- .../AFN_0AH/AFN10_F66_Analysis.cs | 9 ++++-- .../AFN_0AH/AFN10_F68_Analysis.cs | 10 +++++-- .../AFN_0CH/AFN12_F129_Analysis.cs | 11 ++++--- .../AFN_0CH/AFN12_F130_Analysis.cs | 10 ++++--- .../AFN_0CH/AFN12_F131_Analysis.cs | 10 ++++--- .../AFN_0CH/AFN12_F132_Analysis.cs | 12 ++++---- .../AFN_0CH/AFN12_F145_Analysis.cs | 14 +++++---- .../AFN_0CH/AFN12_F149_Analysis.cs | 16 +++++----- .../AFN_0CH/AFN12_F188_Analysis.cs | 16 +++++----- .../AFN_0CH/AFN12_F25_Analysis.cs | 14 +++++---- .../AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs | 12 ++++---- .../AFN_0CH/AFN12_F33_Analysis.cs | 14 +++++---- .../AFN_0CH/AFN12_F49_Analysis.cs | 12 ++++---- .../AFN_0DH/AFN13_F100_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F101_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F103_Analysis.cs | 10 ++++--- .../AFN_0DH/AFN13_F104_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F105_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F106_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F107_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F108_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F11_Analysis.cs | 10 ++++--- .../AFN_0DH/AFN13_F145_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F146_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F147_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F148_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F161_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F162_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F163_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F164_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F165_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F166_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F167_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F168_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F177_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F178_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F179_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F180_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F181_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F182_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F183_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F184_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F189_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F190_Analysis.cs | 10 ++++--- .../AFN_0DH/AFN13_F193_Analysis.cs | 8 +++-- .../AFN_0DH/AFN13_F195_Analysis.cs | 8 +++-- .../AFN_0DH/AFN13_F19_Analysis.cs | 8 +++-- .../AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs | 8 +++-- .../AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs | 8 +++-- .../AFN_0DH/AFN13_F81_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F82_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F83_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F84_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F85_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F86_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F87_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F88_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F89_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F90_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F91_Analysis.cs | 6 ++-- .../AFN_0DH/AFN13_F92_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F93_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F94_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F95_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F97_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F98_Analysis.cs | 4 ++- .../AFN_0DH/AFN13_F99_Analysis.cs | 4 ++- .../AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs | 6 ++-- .../AFN_10H/AFN16_F101_Analysis.cs | 9 ++++-- .../AFN_10H/AFN16_F97_Analysis.cs | 10 +++++-- .../AFN_10H/AFN16_F98_Analysis.cs | 9 ++++-- .../AnalysisData/DataStorage.cs | 30 +++++++++++-------- .../Protocol3761Extensions.cs | 14 ++++----- .../Protocol3761/Dto/AnalysisBaseDto.cs | 4 +-- .../Protocol3761/Dto/UnitDataAnalysis.cs | 12 ++++++++ .../Consts/IOTDBDataTypeConst.cs | 10 +++++++ .../Consts/T37612012PacketItemCodeConst.cs | 12 +++++++- .../Pages/Monitor.cshtml | 3 +- 86 files changed, 437 insertions(+), 222 deletions(-) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs index fdeb25f..b9a91b9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs @@ -1,4 +1,7 @@ -using JiShe.CollectBus.Common.Enums; +using Apache.IoTDB; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -31,7 +34,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H var data = new AnalysisBaseDto() { FiledDesc = "全部确认", - DataValue = true + DataValue = true, + ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -54,7 +58,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType= IOTDBDataTypeConst.Log }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs index 09c65c2..dea4ecc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs @@ -1,4 +1,6 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -29,7 +31,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H var data = new AnalysisBaseDto() { FiledDesc = "全部否认", - DataValue = false + DataValue = false, + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -52,7 +55,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H MessageId = input.MessageId, ReceivedTime =input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Log }; result?.Invoke(dto); #if DEBUG diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs index 6a83dbc..e03727c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs @@ -1,4 +1,6 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -31,7 +33,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H { FiledDesc = "登录", FiledName = "Type", - DataValue = "Login" + DataValue = "Login", + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -54,7 +57,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Status }; result?.Invoke(dto); await _dataStorage.SaveStatusToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs index 8992d82..9d63c23 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs @@ -1,4 +1,6 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -31,7 +33,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H { FiledDesc = "退出登录", FiledName = "Type", - DataValue = "LogOut" + DataValue = "LogOut", + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -54,7 +57,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Status }; result?.Invoke(dto); await _dataStorage.SaveStatusToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs index 4015131..146b2ab 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs @@ -1,4 +1,6 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -31,7 +33,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H { FiledDesc = "心跳", FiledName = "Type", - DataValue = "Heartbeat" + DataValue = "Heartbeat", + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -54,7 +57,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Status }; result?.Invoke(dto); await _dataStorage.SaveStatusToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs index 2580ec9..679350e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs @@ -1,4 +1,5 @@ using System.Text; +using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; @@ -38,7 +39,8 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H var data = new AnalysisBaseDto() { FiledDesc = "终端版本信息", - DataValue = version + DataValue = version, + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -61,7 +63,8 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType=IOTDBDataTypeConst.Data }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs index 1df4a32..c8f1cd2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs @@ -1,4 +1,5 @@ using System.Text; +using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; @@ -32,7 +33,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H var data = new AnalysisBaseDto() { FiledDesc = "远程通信模块版本信息", - DataValue = Encoding.ASCII.GetString(string.Join("", input.UnitData.HexMessageList.Skip(30).Take(20).ToList()).HexToByte()).Replace("\0", "") + DataValue = Encoding.ASCII.GetString(string.Join("", input.UnitData.HexMessageList.Skip(30).Take(20).ToList()).HexToByte()).Replace("\0", ""), + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -55,7 +57,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType= IOTDBDataTypeConst.Data }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs index 0e66af9..4fd5ce9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -37,7 +38,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH { AFN10F10Entitys = tuple.Item2, ConfigNum = tuple.Item1 - } + }, + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -60,7 +62,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType=IOTDBDataTypeConst.Param }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs index 2a01edc..6d3772b 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -36,7 +37,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH var data = new AnalysisBaseDto() { FiledDesc = "终端电能表/交流采样装置配置参数", - DataValue = await GenerateFinalResult(input.UnitData.HexMessageList) + DataValue = await GenerateFinalResult(input.UnitData.HexMessageList), + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -59,7 +61,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Param }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs index e69f8e3..68e82c0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs @@ -1,4 +1,6 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -30,7 +32,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH var data = new AnalysisBaseDto() { FiledDesc = "终端电能表/交流采样装置配置参数", - DataValue = input.UnitData.HexMessageList[4].Equals("55") + DataValue = input.UnitData.HexMessageList[4].Equals("55"), + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); @@ -53,7 +56,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Param }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs index f4e9fa6..dc65192 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs @@ -1,4 +1,6 @@ -using JiShe.CollectBus.Common.Enums; +using Apache.IoTDB; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IoTDB.Interface; using JiShe.CollectBus.IotSystems.Ammeters; @@ -46,7 +48,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn); @@ -127,14 +130,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH if(decimal.TryParse(data[i], out decimal value)) meter.DataValue = value; } - meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}"; + meter.ItemType = i - index == 0 ? $"{afn.ToString().PadLeft(2, '0')}_{fn}": $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}"; string timeSpan = $"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00"; if (DateTime.TryParse(timeSpan, out DateTime readingDate)) { meter.TimeSpan = readingDate; } meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } return list; diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs index ed4e4d0..b211f7e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -60,7 +61,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); @@ -116,12 +118,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH if(decimal.TryParse(data[i], out decimal value)) meter.DataValue = value; } - meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}"; + meter.ItemType = i - index==0 ? $"{afn.ToString().PadLeft(2, '0')}_{fn}": $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}"; string timeSpan = $"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00"; if(DateTime.TryParse(timeSpan, out DateTime readingDate)) meter.TimeSpan = readingDate; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } return list; diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs index 2fc30e0..6560a17 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -61,7 +62,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); @@ -118,12 +120,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH if(decimal.TryParse(data[i], out decimal value)) meter.DataValue = value; } - meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}"; + meter.ItemType = i - index==0? $"{afn.ToString().PadLeft(2, '0')}_{fn}" : $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}"; string timeSpan = $"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00"; if(DateTime.TryParse(timeSpan, out DateTime readTime)) meter.TimeSpan = readTime; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } return list; diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs index 1b420f6..12a0226 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -64,7 +65,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); @@ -100,7 +102,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH } return values; } - public List> GenerateFinalResult(int index, List data, string dataType, string filedDesc = "") + public List> GenerateFinalResult(int index, List data, string itemType, string filedDesc = "") { List> list = new List>(); for (int i = index; i < data.Count; i++) @@ -121,14 +123,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH meter.DataValue = value; } - meter.DataType = $"{dataType}_{i - index}"; + meter.ItemType = i - index==0?itemType:$"{itemType}_{i - index}"; string timeSpan = $"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00"; if (DateTime.TryParse(timeSpan,out DateTime readingDate)) { meter.TimeSpan = readingDate; } meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } return list; diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs index 485e75e..eaabe84 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -36,7 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); - string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; + string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; AnalysisBaseDto data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", dataType); // 查询电表信息 @@ -61,7 +62,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); @@ -111,7 +113,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH return values; } - public AnalysisBaseDto GenerateFinalResult(List data, string filedDesc,string dataType) + public AnalysisBaseDto GenerateFinalResult(List data, string filedDesc,string itemType) { AnalysisBaseDto dto = new AnalysisBaseDto { @@ -134,9 +136,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { dto.TimeSpan = readingDate; } - dto.DataType = dataType; + dto.ItemType = itemType; dto.FiledDesc = filedDesc; - dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + dto.FiledName = dto.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; return dto; } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs index 8464ba9..4cd3981 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -36,9 +37,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); List datas = await AnalysisDataUnit(input.UnitData.HexMessageList); - string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; + string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; - AnalysisBaseDto data = GenerateFinalResult(datas, dataType,"上月(上一结算日)正向有功最大需量及发生时间"); + AnalysisBaseDto data = GenerateFinalResult(datas, itemType,"上月(上一结算日)正向有功最大需量及发生时间"); // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); if (ammeterInfo != null) @@ -61,7 +62,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH MessageId=input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -110,7 +112,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH } return values; } - public AnalysisBaseDto GenerateFinalResult(List data,string dataType, string filedDesc = "") + public AnalysisBaseDto GenerateFinalResult(List data,string itemType, string filedDesc = "") { AnalysisBaseDto dto = new AnalysisBaseDto { @@ -144,9 +146,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { dto.TimeSpan= dto.TimeSpan.Value.AddYears(-1); } - dto.DataType = dataType; + dto.ItemType = itemType; dto.FiledDesc = "上月(上一结算日)正向有功最大需量及发生时间"; - dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + dto.FiledName = dto.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; return dto; } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs index d4850d5..ea534b5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -37,8 +38,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN); ArgumentNullException.ThrowIfNull(input.DT.Fn); - string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; - AnalysisBaseDto data = GenerateFinalResult(input.UnitData.HexMessageList, dataType); + string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; + AnalysisBaseDto data = GenerateFinalResult(input.UnitData.HexMessageList, itemType); // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); if (ammeterInfo != null) @@ -60,7 +61,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); @@ -73,7 +75,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH } return await Task.FromResult(false); } - public AnalysisBaseDto GenerateFinalResult(List hexMessageList,string dataType) + public AnalysisBaseDto GenerateFinalResult(List hexMessageList,string itemType) { AnalysisBaseDto dto = new AnalysisBaseDto { @@ -91,9 +93,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH if (decimal.TryParse($"{arr[11]}{arr[12]}{arr[13]}.{arr[14]}", out decimal value)) dto.DataValue = value; } - dto.DataType = dataType; + dto.ItemType = itemType; dto.FiledDesc = "水示值"; - dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + dto.FiledName = dto.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; return dto; } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs index 90f3c6f..86c283a 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -29,7 +30,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH _dataStorage = dataStorage; } - public List DataType { get; set; } = new List() { "YGGL", "YGGL_A", "YGGL_B", "YGGL_C", "WGGL", "WGGL_A", "WGGL_B", "WGGL_C", "GLYS", "GLYS_A", "GLYS_B", "GLYS_C", "DY_A", "DY_B", "DY_C", "DL_A", "DL_B", "DL_C", "LXDL", "SZGL", "SZGL_A", "SZGL_B", "SZGL_C" }; + public List ItemType { get; set; } = new List() { "YGGL", "AYGGL", "BYGGL", "CYGGL", "WGGL", "AWGGL", "BWGGL", "CWGGL", "GLYS", "AGLYS", "BGLYS", "CGLYS", "ADY", "BDY", "CDY", "ADL", "BDL", "CDL", "LXDL", "SZGL", "ASZGL", "BSZGL", "CSZGL" }; public async Task ExecuteAsync(TB3761 input, Action? result = null) { @@ -59,8 +60,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH dto.DataValue = value; } - dto.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}_{DataType[i-1]}"; - dto.FiledName = DataType[i - 1].GetDataFieldByGatherDataType() ?? string.Empty; + dto.ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}_{ItemType[i-1]}"; + dto.FiledName = ItemType[i - 1].GetDataFieldByGatherDataType() ?? string.Empty; dto.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00"); dto.FiledDesc = remarks[i - 1]; list.Add(dto); @@ -68,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH if (list.Count > 0) { // 查询电表信息 - AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DataType.ToString(), "15"); + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].ItemType.ToString(), "15"); if (ammeterInfo != null) { list.ForEach(item => @@ -92,7 +93,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs index 45e2ba9..054968e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs @@ -10,6 +10,7 @@ using static System.Runtime.InteropServices.JavaScript.JSType; using System.Diagnostics.Metrics; using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { @@ -35,9 +36,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); - string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; + string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; - var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, dataType); + var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, itemType); // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); if (ammeterInfo != null) @@ -59,7 +60,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Param, }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); @@ -73,7 +75,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH return await Task.FromResult(false); } - public async Task> GenerateFinalResultAsync(List hexMessageList,string dataType) + public async Task> GenerateFinalResultAsync(List hexMessageList,string itemType) { AnalysisBaseDto dto = new AnalysisBaseDto(); var arr = hexMessageList.GetRange(4, 6); @@ -91,7 +93,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH dto.DataValue = $"{data.Item1} {data.Item2}"; }); } - dto.DataType = dataType; + dto.ItemType = itemType; dto.FiledName = "TerminalTime"; dto.FiledDesc = "召读终端时间"; return await Task.FromResult(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs index e1d4341..f813fbe 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs @@ -1,4 +1,6 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -27,7 +29,6 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH _dataStorage = dataStorage; } - public async Task ExecuteAsync(TB3761 input, Action? result = null) { try @@ -41,7 +42,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH var data = new AnalysisBaseDto() { FiledDesc = "当前正向有/无功电能示值、一/四象限无功电能示值", - DataValue = await AnalysisDataUnit(input.UnitData.HexMessageList, rationgCount) + DataValue = await AnalysisDataUnit(input.UnitData.HexMessageList, rationgCount), + ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); @@ -51,7 +53,6 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; - } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { @@ -64,7 +65,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); @@ -137,7 +139,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { ChildNodes model = new ChildNodes() { - Value = value //29,4 33,4 37,4 41,4 + Value = value }; children.Add(model); }); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs index 33a06b9..05a53dc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -28,7 +29,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH _dataStorage = dataStorage; } - public List DataType { get; set; } = new List() { "Uab_Ua", "Ub", "Ucb_Uc", "Ia", "Ib", "Ic" }; + public List ItemType { get; set; } = new List() { "Uab_Ua", "Ub", "Ucb_Uc", "Ia", "Ib", "Ic" }; public async Task ExecuteAsync(TB3761 input, Action? result = null) { @@ -56,8 +57,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH if(decimal.TryParse(data[i], out decimal value)) dto.DataValue = value; } - dto.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}_{DataType[i]}"; - dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + dto.ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}_{ItemType[i]}"; + dto.FiledName = dto.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; dto.FiledDesc= remarks[i]; list.Add(dto); } @@ -87,7 +88,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.Second, - TimeDensity = 0 + TimeDensity = 0, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs index 4f66190..b606a6e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -69,7 +70,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs index db6b1ab..bc4fe29 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs index c9c85ca..546fe4a 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -36,9 +37,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); - string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; + string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; - List> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向有功总电能示值"); + List> data = datas.GenerateFinalResultTd_c(3, density, itemType, "反向有功总电能示值"); if (data.Count > 0) { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs index ef8b3bd..64106cc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs index cd0f340..4afe541 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs index 1c7fbdd..bc431a6 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs index fb4495e..96bda8c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度,注意这里会兼容存储做判断 DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs index f5b8d24..a178327 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs index 698a180..72cb7a3 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -148,10 +150,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { meter.TimeSpan = readingDate; } - meter.DataType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; + meter.ItemType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; filedDesc = i == 1 ? filedDesc : filedDesc.Replace("有功", "无功"); meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs index 97c2f64..9392cc0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs index 0f7ca95..629cd5f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs index c5306b2..321831e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs index a155216..a72fc64 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs index 57a84f0..42452cb 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs index 7ac836e..a299913 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs index 0dc4362..ad4d2aa 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F163_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs index 5e0c7a4..ff22921 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs index 315dc66..1d5e2ed 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs index 0b7d121..c957c6a 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs index 2487d84..9f44bf5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs index 7b6dbab..c323505 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs index 25063a3..509cb01 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -64,7 +65,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs index 9b942a5..963d5cf 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs index e6ce2b7..06cceef 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs index e4d0f3c..d3fa418 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -64,7 +65,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs index 2c4c58d..667eb46 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs index b124158..ddd1656 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs index 6a6ce65..53b58ff 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -64,7 +65,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs index ed75e71..628f69e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -65,7 +66,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs index 73068c7..91c1910 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -66,7 +67,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs index 62f8d44..d19b6b6 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -59,7 +60,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -136,9 +138,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { meter.TimeSpan = readingDate; } - meter.DataType = dataType; + meter.ItemType = dataType; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; return meter; } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs index 77df07e..58e32fa 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -60,7 +61,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -128,9 +130,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { meter.TimeSpan = readingDate; } - meter.DataType = dataType; + meter.ItemType = dataType; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; return meter; } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs index a688d57..920dc2d 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -60,7 +61,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Month, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -128,9 +130,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { meter.TimeSpan = readingDate; } - meter.DataType = dataType; + meter.ItemType = dataType; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; return meter; } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs index 7984be2..b5d1eb4 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs @@ -11,6 +11,7 @@ using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; using YamlDotNet.Core.Tokens; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -146,10 +148,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { meter.TimeSpan = readingDate; } - meter.DataType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; + meter.ItemType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; filedDesc = i == 1 ? filedDesc : filedDesc.Replace("有功", "无功"); meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } return list; diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs index 1329f0f..e68b551 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs @@ -11,6 +11,7 @@ using JiShe.CollectBus.Common.Extensions; using Volo.Abp.Domain.Entities; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -70,7 +71,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -162,10 +164,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH else meter.TimeSpan=tsField; } - meter.DataType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; + meter.ItemType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; filedDesc = i == 1 ? filedDesc : filedDesc.Replace("有功", "无功"); meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs index cc283f7..4a79cae 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs @@ -10,6 +10,7 @@ using JiShe.CollectBus.Common.Extensions; using AutoMapper.Internal.Mappers; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -69,7 +70,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Day, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); @@ -164,10 +166,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH else meter.TimeSpan = tsField; } - meter.DataType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; + meter.ItemType = i == 1 ? dataType : $"{dataType}_{ i - 1}"; filedDesc = i == 1 ? filedDesc : filedDesc.Replace("有功", "无功"); meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } return list; diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs index e6fd687..2120c0e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs index ab2d42f..8ee773e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs index d31ae3e..27c34db 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs index 2f350ca..8e75f29 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs index c4e8a74..826bf83 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs index e93e737..9e65a48 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs index 6f618a9..0fdc075 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs index 071fb0b..3d1ca53 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs index e784710..74ecebd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs index 4cd618d..4f399f1 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs index 760e405..e5a91c3 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.IotSystems.Ammeters; @@ -67,7 +68,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs index a919b18..97442c9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs index 421f430..94e168d 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs index fada7f7..e25aa14 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs index 9ae2af2..812511f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs index 043dd67..3fc8e0c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs index 11a97be..2abf579 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs index ba3b9f5..2809eca 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; +using JiShe.CollectBus.Common.Consts; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -68,7 +69,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH MessageId = input.MessageId, TimeDensity = density,//密度-间隔分钟数, DensityUnit = DensityUnit.Minute, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data, }; await _dataStorage.SaveMultipleDataToIotDbAsync(unitDataAnalysis); result?.Invoke(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs index d44d45f..ccca966 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; @@ -69,7 +70,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Event, }; // meterData.DataType = "0E_1"; result?.Invoke(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs index 4d23dd0..087d8f0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; @@ -32,7 +33,8 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H var data = new AnalysisBaseDto() { FiledDesc = "透读取SIM卡信息", - DataValue = AnalysisDataUnit(input.UnitData.HexMessageList) + DataValue = AnalysisDataUnit(input.UnitData.HexMessageList), + ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; UnitDataAnalysis> dto = new UnitDataAnalysis> { @@ -45,7 +47,8 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Data, }; result?.Invoke(dto); await _dataStorage.SaveDataToIotDbAsync(dto); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs index 6a15d69..0a34f2a 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs @@ -1,4 +1,5 @@ using GatherService.WattMeter.AnalysisData.AFN_10H; +using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Helpers; @@ -41,6 +42,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); AnalysisBaseDto data = GenerateFinalResult(datas); + // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); if (ammeterInfo != null) @@ -63,7 +65,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H MessageId = input.MessageId, TimeDensity = 1,//密度-间隔, DensityUnit = DensityUnit.Hour, - ReceivedTime = input.ReceivedTime + ReceivedTime = input.ReceivedTime, + DataType = IOTDBDataTypeConst.Data + }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); @@ -93,10 +97,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H meter.DataValue = value; } - meter.DataType = "10_97"; + meter.ItemType = "10_97"; meter.ValidData = data[2].Equals("91") || data[2].Equals("B1"); meter.FiledDesc = "电网频率";//"电网频率"; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; return meter; } private async Task> AnalysisDataUnitAsync(List hexMessageList) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs index dec2a3b..9504cb2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs @@ -1,4 +1,5 @@ -using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Consts; +using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol; @@ -39,7 +40,8 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H var data = new AnalysisBaseDto() { FiledDesc = "跳合闸", - DataValue = (datas[2].Equals("9C") || datas[2].Equals("94")) ? true : false + DataValue = (datas[2].Equals("9C") || datas[2].Equals("94")) ? true : false, + ItemType= "10_98", }; // 查询电表信息 @@ -64,7 +66,8 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H MessageId = input.MessageId, ReceivedTime = input.ReceivedTime, DensityUnit = DensityUnit.None, - TimeDensity = -1 + TimeDensity = -1, + DataType = IOTDBDataTypeConst.Data }; result?.Invoke(unitDataAnalysis); await _dataStorage.SaveDataToIotDbAsync(unitDataAnalysis); diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs index f7009bb..9c97a80 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs @@ -123,7 +123,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceId = $"{data.DeviceId}", DeviceType = $"{data.DeviceType.ToString()}", ProjectId = $"{data.ProjectId}", - DataType = IOTDBDataTypeConst.Data, + DataType = analysisBaseDto.DataType, Timestamps = data.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(), SingleMeasuring = (data.FiledName ?? string.Empty, data.DataValue ?? default) }; @@ -148,6 +148,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ProjectId = $"{data.ProjectId}", DeviceType = $"{data.DeviceType}", DeviceId = $"{data.DeviceId}", + DataType = analysisBaseDto.DataType, Timestamps = DateTime.Now.GetDateTimeOffset().ToUnixTimeNanoseconds(), DatabaseBusiID = data.DatabaseBusiID, PendingCopyReadTime = data.TimeSpan.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), @@ -157,7 +158,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, MSA = analysisBaseDto.MSA, - ItemCode = data.DataType, + ItemCode = data.ItemType, TaskMark = taskMark, IsSend = false, ManualOrNot = false, @@ -229,7 +230,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceId = $"{item.DeviceId}", DeviceType = $"{item.DeviceType}", ProjectId = $"{item.ProjectId}", - DataType = IOTDBDataTypeConst.Data, + DataType = analysisBaseDto.DataType, Timestamps = item.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(), // TODO:这里暂时格式化15分钟数据,需要进行调整 SingleMeasuring =(item.FiledName ?? string.Empty, item.DataValue ?? default) }; @@ -253,7 +254,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData SystemName = _applicationOptions.SystemType, ProjectId = $"{item.ProjectId}", DeviceType = $"{item.DeviceType}", - DeviceId = $"{item.DeviceId}", + DeviceId = $"{item.DeviceId}", + DataType = analysisBaseDto.DataType, Timestamps = DateTime.Now.CheckTimePoint().GetDateTimeOffset().ToUnixTimeNanoseconds(), DatabaseBusiID = item.DatabaseBusiID, PendingCopyReadTime = item.TimeSpan.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), @@ -263,7 +265,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, MSA = analysisBaseDto.MSA, - ItemCode = item.DataType, + ItemCode = item.ItemType, TaskMark = taskMark, IsSend = false, ManualOrNot = false, @@ -318,7 +320,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceId = $"{data.DeviceId}", DeviceType = $"{data.DeviceType}", ProjectId = $"{data.ProjectId}", - DataType = IOTDBDataTypeConst.Status, + DataType = analysisBaseDto.DataType, Timestamps = timestamps, SingleMeasuring = (data.FiledName!, data.DataValue!) }; @@ -331,7 +333,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceId = $"{data.DeviceId}", DeviceType = $"{data.DeviceType}", ProjectId = $"{data.ProjectId}", - DataType = IOTDBDataTypeConst.Status, + DataType = analysisBaseDto.DataType, Timestamps = timestamps, SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty) }; @@ -347,7 +349,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceType = $"{data.DeviceType}", ProjectId = $"{data.ProjectId}", Timestamps = timestamps, - DataType = IOTDBDataTypeConst.Status, + DataType = analysisBaseDto.DataType, SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, (data.TimeSpan.HasValue ? data.TimeSpan.Value : DateTime.Now).GetDateTimeOffset().ToUnixTimeNanoseconds()) }; _runtimeContext.UseTableSessionPool = false; // 使树模型池 @@ -362,6 +364,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ProjectId = $"{data.ProjectId}", DeviceType = $"{data.DeviceType}", DeviceId = $"{data.DeviceId}", + DataType = analysisBaseDto.DataType, Timestamps = DateTime.Now.GetDateTimeOffset().ToUnixTimeNanoseconds(), DatabaseBusiID = data.DatabaseBusiID, PendingCopyReadTime = data.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), @@ -371,7 +374,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, MSA = analysisBaseDto.MSA, - ItemCode = data.DataType, + ItemCode = data.ItemType, TaskMark = taskMark, IsSend = false, ManualOrNot = false, @@ -416,7 +419,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceId = $"{item.DeviceId}", DeviceType = $"{item.DeviceType}", ProjectId = $"{item.ProjectId}", - DataType = IOTDBDataTypeConst.Status, + DataType = analysisBaseDto.DataType, Timestamps = timestamps, SingleMeasuring = (item.FiledName!, item.DataValue!) }; @@ -428,7 +431,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData SystemName = _applicationOptions.SystemType, DeviceType = $"{item.DeviceType}", ProjectId = $"{item.ProjectId}", - DataType = IOTDBDataTypeConst.Status, + DataType = analysisBaseDto.DataType, Timestamps = timestamps, SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty) }; @@ -442,7 +445,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData SystemName = _applicationOptions.SystemType, DeviceType = $"{item.DeviceType}", ProjectId = $"{item.ProjectId}", - DataType = IOTDBDataTypeConst.Status, + DataType = analysisBaseDto.DataType, Timestamps = timestamps, SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, (item.TimeSpan.HasValue ? item.TimeSpan.Value : DateTime.Now).GetDateTimeOffset().ToUnixTimeNanoseconds()) }; @@ -458,6 +461,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ProjectId = $"{item.ProjectId}", DeviceType = $"{item.DeviceType}", DeviceId = $"{item.DeviceId}", + DataType = analysisBaseDto.DataType, Timestamps = DateTime.Now.GetDateTimeOffset().ToUnixTimeNanoseconds(), DatabaseBusiID = item.DatabaseBusiID, PendingCopyReadTime = item.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), @@ -467,7 +471,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, MSA = analysisBaseDto.MSA, - ItemCode = item.DataType, + ItemCode = item.ItemType, TaskMark = taskMark, IsSend = false, ManualOrNot = false, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/Protocol3761Extensions.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/Protocol3761Extensions.cs index dcfd2f7..7ac67a2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/Protocol3761Extensions.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/Protocol3761Extensions.cs @@ -262,9 +262,9 @@ namespace JiShe.CollectBus.Protocol.T37612012 meter.DataValue = value; } } - meter.DataType = dataType; + meter.ItemType = dataType; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; if (DateTime.TryParse(CalculateTimeSpan(i - 3, data[0], density), out DateTime readingDate)) meter.TimeSpan = readingDate; list.Add(meter); @@ -305,9 +305,9 @@ namespace JiShe.CollectBus.Protocol.T37612012 { meter.TimeSpan = readingDate; } - meter.DataType = i - index == 0 ? dataType : $"{dataType}_{i - index}"; + meter.ItemType = i - index == 0 ? dataType : $"{dataType}_{i - index}"; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); } return list; @@ -348,9 +348,9 @@ namespace JiShe.CollectBus.Protocol.T37612012 { meter.TimeSpan = readingDate; } - meter.DataType = i - index == 0 ? dataType : $"{dataType}_{i - index}"; + meter.ItemType = i - index == 0 ? dataType : $"{dataType}_{i - index}"; meter.FiledDesc = filedDesc; - meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty; + meter.FiledName = meter.ItemType.GetDataFieldByGatherDataType() ?? string.Empty; list.Add(meter); typeIndex++; } @@ -385,7 +385,7 @@ namespace JiShe.CollectBus.Protocol.T37612012 if (item.ValidData && item.DataValue.HasValue) jfpgSum += item.DataValue.Value; } - var totalItem = meterDatas.FirstOrDefault(f => f.DataType.Equals(mark[0]));//meterDatas.Find(f => f.DataType.Equals(mark[0])); + var totalItem = meterDatas.FirstOrDefault(f => f.ItemType.Equals(mark[0]));//meterDatas.Find(f => f.DataType.Equals(mark[0])); if (totalItem != null) { var floatingNum = (jfpgSum * 5 / 100);//上下浮动数据 diff --git a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs index 331fce6..a9200ad 100644 --- a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs +++ b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs @@ -17,9 +17,9 @@ namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto public bool ValidData { get; set; } = true; /// - /// 数据类型 + /// 数据项类型 /// - public string DataType { get; set; } = null!; + public string ItemType { get; set; } = null!; /// /// 错误码信息 diff --git a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs index d338693..8572819 100644 --- a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs +++ b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/UnitDataAnalysis.cs @@ -1,4 +1,5 @@ using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Extensions; using System; using System.Collections.Generic; @@ -60,6 +61,17 @@ namespace JiShe.CollectBus.Protocol.Dto /// 采集密度单位 /// public DensityUnit DensityUnit { get; set; }= DensityUnit.Minute; + + /// + /// 数据类型 + /// + public string DataType { get; set; }= null!; + + /// + /// 数据项编码 + /// + public string ItemCode => $"{AFN.HexToDecStr().PadLeft(2, '0')}_{Fn}"; + } public class UnitDataAnalysis: UnitDataAnalysis diff --git a/shared/JiShe.CollectBus.Common/Consts/IOTDBDataTypeConst.cs b/shared/JiShe.CollectBus.Common/Consts/IOTDBDataTypeConst.cs index 7c076c9..872c099 100644 --- a/shared/JiShe.CollectBus.Common/Consts/IOTDBDataTypeConst.cs +++ b/shared/JiShe.CollectBus.Common/Consts/IOTDBDataTypeConst.cs @@ -25,5 +25,15 @@ namespace JiShe.CollectBus.Common.Consts /// 状态 /// public const string Status = "Status"; + + /// + /// 日志 + /// + public const string Log = "Log"; + + /// + /// 参数 + /// + public const string Param= "Param"; } } diff --git a/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs b/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs index 35c457e..2f16084 100644 --- a/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs +++ b/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs @@ -98,6 +98,10 @@ namespace JiShe.CollectBus.Common.Consts public const string Ib = "Ib"; public const string Ic = "Ic"; + public const string SZGL = "SZGL"; + public const string ASZGL = "ASZGL"; + public const string BSZGL = "BSZGL"; + public const string CSZGL = "CSZGL"; } public class ConstGatherDataType @@ -150,8 +154,14 @@ namespace JiShe.CollectBus.Common.Consts public const string Ib = "0C_49_Ib"; // 当前电压、电流相位角 public const string Ic = "0C_49_Ic"; // 当前电压、电流相位角 + + public const string SZGL = "0C_25_SZGL"; // 视在功率曲线 + public const string ASZGL = "0C_25_ASZGL"; // A相视在功率曲线 + public const string BSZGL = "0C_25_BSZGL"; // B相视在功率曲线 + public const string CSZGL = "0C_25_CSZGL"; // C相视在功率曲线 + } - + /// /// 集中器状态字段 diff --git a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml index 9c23d54..a58ded5 100644 --- a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml +++ b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml @@ -15,8 +15,7 @@ - 后端服务 - + 后端服务 From ff52fdc46a33d3185811ad00dbff6c7ad2eef2f1 Mon Sep 17 00:00:00 2001 From: zenghongyao <873884283@qq.com> Date: Mon, 12 May 2025 16:48:45 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisData/AFN_00H/AFN0_F1_Analysis.cs | 1 + .../AnalysisData/AFN_00H/AFN0_F2_Analysis.cs | 1 + .../AnalysisData/AFN_02H/AFN2_F1_Analysis.cs | 1 + .../AnalysisData/AFN_02H/AFN2_F2_Analysis.cs | 1 + .../AnalysisData/AFN_02H/AFN2_F3_Analysis.cs | 1 + .../AnalysisData/AFN_09H/AFN9_F1_Analysis.cs | 1 + .../AnalysisData/AFN_09H/AFN9_F9_Analysis.cs | 1 + .../AFN_0AH/AFN10_F10_Analysis.cs | 1 + .../AFN_0AH/AFN10_F66_Analysis.cs | 1 + .../AFN_0AH/AFN10_F68_Analysis.cs | 1 + .../AFN_0CH/AFN12_F129_Analysis.cs | 1 + .../AFN_0CH/AFN12_F130_Analysis.cs | 2 ++ .../AFN_0CH/AFN12_F131_Analysis.cs | 2 ++ .../AFN_0CH/AFN12_F132_Analysis.cs | 1 + .../AFN_0CH/AFN12_F145_Analysis.cs | 5 +++-- .../AFN_0CH/AFN12_F149_Analysis.cs | 2 ++ .../AFN_0CH/AFN12_F188_Analysis.cs | 3 ++- .../AFN_0CH/AFN12_F25_Analysis.cs | 1 + .../AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs | 3 ++- .../AFN_0CH/AFN12_F33_Analysis.cs | 2 ++ .../AFN_0CH/AFN12_F49_Analysis.cs | 1 + .../AFN_0DH/AFN13_F100_Analysis.cs | 1 + .../AFN_0DH/AFN13_F101_Analysis.cs | 1 + .../AFN_0DH/AFN13_F102_Analysis.cs | 1 + .../AFN_0DH/AFN13_F103_Analysis.cs | 1 + .../AFN_0DH/AFN13_F104_Analysis.cs | 1 + .../AFN_0DH/AFN13_F105_Analysis.cs | 1 + .../AFN_0DH/AFN13_F106_Analysis.cs | 1 + .../AFN_0DH/AFN13_F107_Analysis.cs | 1 + .../AFN_0DH/AFN13_F108_Analysis.cs | 1 + .../AFN_0DH/AFN13_F11_Analysis.cs | 1 + .../AFN_0DH/AFN13_F145_Analysis.cs | 1 + .../AFN_0DH/AFN13_F146_Analysis.cs | 1 + .../AFN_0DH/AFN13_F147_Analysis.cs | 1 + .../AFN_0DH/AFN13_F148_Analysis.cs | 1 + .../AFN_0DH/AFN13_F161_Analysis.cs | 1 + .../AFN_0DH/AFN13_F162_Analysis.cs | 1 + .../AFN_0DH/AFN13_F164_Analysis.cs | 1 + .../AFN_0DH/AFN13_F165_Analysis.cs | 1 + .../AFN_0DH/AFN13_F166_Analysis.cs | 1 + .../AFN_0DH/AFN13_F167_Analysis.cs | 1 + .../AFN_0DH/AFN13_F168_Analysis.cs | 1 + .../AFN_0DH/AFN13_F177_Analysis.cs | 1 + .../AFN_0DH/AFN13_F178_Analysis.cs | 1 + .../AFN_0DH/AFN13_F179_Analysis.cs | 1 + .../AFN_0DH/AFN13_F180_Analysis.cs | 1 + .../AFN_0DH/AFN13_F181_Analysis.cs | 1 + .../AFN_0DH/AFN13_F182_Analysis.cs | 1 + .../AFN_0DH/AFN13_F183_Analysis.cs | 1 + .../AFN_0DH/AFN13_F184_Analysis.cs | 1 + .../AFN_0DH/AFN13_F189_Analysis.cs | 1 + .../AFN_0DH/AFN13_F190_Analysis.cs | 2 ++ .../AFN_0DH/AFN13_F193_Analysis.cs | 2 ++ .../AFN_0DH/AFN13_F195_Analysis.cs | 2 ++ .../AFN_0DH/AFN13_F19_Analysis.cs | 1 + .../AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs | 1 + .../AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs | 1 + .../AFN_0DH/AFN13_F81_Analysis.cs | 1 + .../AFN_0DH/AFN13_F82_Analysis.cs | 1 + .../AFN_0DH/AFN13_F83_Analysis.cs | 1 + .../AFN_0DH/AFN13_F84_Analysis.cs | 1 + .../AFN_0DH/AFN13_F85_Analysis.cs | 1 + .../AFN_0DH/AFN13_F86_Analysis.cs | 1 + .../AFN_0DH/AFN13_F87_Analysis.cs | 1 + .../AFN_0DH/AFN13_F88_Analysis.cs | 1 + .../AFN_0DH/AFN13_F89_Analysis.cs | 1 + .../AFN_0DH/AFN13_F90_Analysis.cs | 1 + .../AFN_0DH/AFN13_F91_Analysis.cs | 1 + .../AFN_0DH/AFN13_F92_Analysis.cs | 1 + .../AFN_0DH/AFN13_F93_Analysis.cs | 1 + .../AFN_0DH/AFN13_F94_Analysis.cs | 1 + .../AFN_0DH/AFN13_F95_Analysis.cs | 1 + .../AFN_0DH/AFN13_F97_Analysis.cs | 1 + .../AFN_0DH/AFN13_F98_Analysis.cs | 1 + .../AFN_0DH/AFN13_F99_Analysis.cs | 1 + .../AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs | 1 + .../AFN_10H/AFN16_F101_Analysis.cs | 11 ++++++++++ .../AFN_10H/AFN16_F97_Analysis.cs | 1 + .../AFN_10H/AFN16_F98_Analysis.cs | 1 + .../AnalysisData/DataStorage.cs | 22 +++++++++++++------ .../Protocol3761/Dto/AnalysisBaseDto.cs | 4 ++++ .../Pages/Monitor.cshtml | 1 + web/JiShe.CollectBus.Host/appsettings.json | 2 +- 83 files changed, 121 insertions(+), 12 deletions(-) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs index b9a91b9..c34358a 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F1_Analysis.cs @@ -46,6 +46,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId= ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs index dea4ecc..f96e9dc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_00H/AFN0_F2_Analysis.cs @@ -43,6 +43,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs index e03727c..c46f935 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F1_Analysis.cs @@ -45,6 +45,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs index 9d63c23..e9f6edd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F2_Analysis.cs @@ -45,6 +45,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs index 146b2ab..348fc6f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_02H/AFN2_F3_Analysis.cs @@ -45,6 +45,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs index 679350e..b990da1 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F1_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs index c8f1cd2..3a62e56 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_09H/AFN9_F9_Analysis.cs @@ -45,6 +45,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs index 4fd5ce9..c90a0a2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F10_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs index 6d3772b..6f9562e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F66_Analysis.cs @@ -49,6 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs index 68e82c0..9636477 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0AH/AFN10_F68_Analysis.cs @@ -44,6 +44,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.Address; data.DeviceType = MeterTypeEnum.Focus; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs index dc65192..127b177 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F129_Analysis.cs @@ -65,6 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs index b211f7e..b0685b9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F130_Analysis.cs @@ -8,6 +8,7 @@ using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { @@ -47,6 +48,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs index 6560a17..92e9b89 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F131_Analysis.cs @@ -10,6 +10,7 @@ using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; using Newtonsoft.Json.Linq; using YamlDotNet.Core.Tokens; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { @@ -48,6 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs index 12a0226..7fb4ec2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F132_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs index eaabe84..cec80bc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F145_Analysis.cs @@ -11,6 +11,7 @@ using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; using System.Collections.Generic; using System.Diagnostics.Metrics; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH { @@ -39,7 +40,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH List datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; - AnalysisBaseDto data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", dataType); + AnalysisBaseDto data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", itemType); // 查询电表信息 AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); if (ammeterInfo != null) @@ -48,7 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; - + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs index 4cd3981..355dae5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F149_Analysis.cs @@ -10,6 +10,7 @@ using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { @@ -48,6 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID=ammeterInfo.DatabaseBusiID; data.DeviceAddress= ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs index ea534b5..4c36960 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F188_Analysis.cs @@ -10,6 +10,7 @@ using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; using YamlDotNet.Core.Tokens; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { @@ -48,7 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; - + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs index 86c283a..af324f6 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F25_Analysis.cs @@ -78,6 +78,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs index 054968e..234a0fc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F2_Analysis.cs @@ -11,6 +11,7 @@ using System.Diagnostics.Metrics; using JiShe.CollectBus.Protocol.T37612012.AnalysisData; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Consts; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { @@ -47,7 +48,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; - + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> dto = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs index f813fbe..d4ecf6c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F33_Analysis.cs @@ -10,6 +10,7 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; using System; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH { @@ -53,6 +54,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs index 05a53dc..3945a8e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0CH/AFN12_F49_Analysis.cs @@ -74,6 +74,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs index b606a6e..4dc5ff0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F100_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs index bc4fe29..030fb1f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F101_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs index 19af1d5..bfe05b2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F102_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs index 546fe4a..4cdba9e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F103_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs index 64106cc..7558385 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F104_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs index 4afe541..b31dd10 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F105_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs index bc431a6..7ae5776 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F106_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs index 96bda8c..1c400b5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F107_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs index a178327..c3b0fd5 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F108_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs index 72cb7a3..1bd0717 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F11_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs index 9392cc0..d21fc7a 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F145_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs index 629cd5f..4e85957 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F146_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs index 321831e..8f0f934 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F147_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs index a72fc64..66f4715 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F148_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs index 42452cb..582c9a1 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F161_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs index a299913..039c4cb 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F162_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs index ff22921..93f0a7c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F164_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs index 1d5e2ed..934e4fc 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F165_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs index c957c6a..bded83e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F166_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs index 9f44bf5..a969778 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F167_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs index c323505..2696dab 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F168_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs index 509cb01..027d64c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F177_Analysis.cs @@ -49,6 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs index 963d5cf..3ee3193 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F178_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs index 06cceef..e0e866e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F179_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs index d3fa418..3cbec39 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F180_Analysis.cs @@ -49,6 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs index 667eb46..c241e2c 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F181_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs index ddd1656..d5cab85 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F182_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs index 53b58ff..f320aa3 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F183_Analysis.cs @@ -49,6 +49,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs index 628f69e..12e9e5f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F184_Analysis.cs @@ -50,6 +50,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs index 91c1910..1f406e1 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F189_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs index d19b6b6..d11be74 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F190_Analysis.cs @@ -9,6 +9,7 @@ using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol3761; using Microsoft.Extensions.Logging; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -46,6 +47,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs index 58e32fa..76a4e4d 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F193_Analysis.cs @@ -10,6 +10,7 @@ using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Consts; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -47,6 +48,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs index 920dc2d..0fc8ad0 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F195_Analysis.cs @@ -10,6 +10,7 @@ using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Consts; +using static FreeSql.Internal.GlobalFilter; namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH { @@ -47,6 +48,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs index b5d1eb4..4f0c5c3 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F19_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs index e68b551..cb456cd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F3_Analysis.cs @@ -55,6 +55,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs index 4a79cae..0fddd41 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F4_Analysis.cs @@ -54,6 +54,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs index 2120c0e..b8ffddd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F81_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs index 8ee773e..c5ee665 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F82_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs index 27c34db..853aeeb 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F83_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs index 8e75f29..2d0d100 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F84_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs index 826bf83..6c063cd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F85_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs index 9e65a48..af1a33e 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F86_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs index 0fdc075..82b3b97 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F87_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs index 3d1ca53..598f9fd 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F88_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs index 74ecebd..89d5f71 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F89_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs index 4f399f1..7ab37b9 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F90_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs index e5a91c3..27cfbff 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F91_Analysis.cs @@ -52,6 +52,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs index 97442c9..7013558 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F92_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs index 94e168d..5a86c82 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F93_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs index e25aa14..c73619f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F94_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs index 812511f..3633567 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F95_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs index 3fc8e0c..1e04f6f 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F97_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs index 2abf579..c3fe639 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F98_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs index 2809eca..ac93186 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0DH/AFN13_F99_Analysis.cs @@ -53,6 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH item.DeviceId = ammeterInfo.MeterId; item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.AmmerterAddress; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs index ccca966..2c29612 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_0EH/AFN14_F1_Analysis.cs @@ -56,6 +56,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DeviceAddress = ammeterInfo.Address; item.DeviceType = MeterTypeEnum.Focus; + item.FocusId = ammeterInfo.FocusId; }); } } diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs index 087d8f0..27bee6b 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F101_Analysis.cs @@ -1,6 +1,7 @@ using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Extensions; +using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Interfaces; @@ -36,6 +37,16 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H DataValue = AnalysisDataUnit(input.UnitData.HexMessageList), ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" }; + // 查询电表信息 + AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); + if (ammeterInfo != null) + { + data.ProjectId = ammeterInfo.ProjectID; + data.DeviceId = ammeterInfo.MeterId; + data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; + data.DeviceAddress = ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; + } UnitDataAnalysis> dto = new UnitDataAnalysis> { Code = input.A.Code!, diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs index 0a34f2a..0da9f88 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F97_Analysis.cs @@ -51,6 +51,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs index 9504cb2..e54cc09 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F98_Analysis.cs @@ -52,6 +52,7 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H data.DeviceId = ammeterInfo.MeterId; data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DeviceAddress = ammeterInfo.AmmerterAddress; + data.FocusId = ammeterInfo.FocusId; } UnitDataAnalysis> unitDataAnalysis = new UnitDataAnalysis> { diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs index 9c97a80..87a2abf 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs @@ -149,11 +149,13 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceType = $"{data.DeviceType}", DeviceId = $"{data.DeviceId}", DataType = analysisBaseDto.DataType, + FocusId = data.FocusId, + FocusAddress = analysisBaseDto.Code, Timestamps = DateTime.Now.GetDateTimeOffset().ToUnixTimeNanoseconds(), DatabaseBusiID = data.DatabaseBusiID, - PendingCopyReadTime = data.TimeSpan.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), + PendingCopyReadTime = data.TimeSpan.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), CreationTime = currentTime, - MeterAddress = data.DeviceAddress, + MeterAddress = analysisBaseDto.Code == data.DeviceAddress ? "" : data.DeviceAddress, // 判断是否能取到表地址 AFN = analysisBaseDto.AFN, Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, @@ -163,7 +165,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData IsSend = false, ManualOrNot = false, Pn = analysisBaseDto.Pn, - ReceivedMessageId = analysisBaseDto.MessageId?? string.Empty, + ReceivedMessageId = analysisBaseDto.MessageId ?? string.Empty, ReceivedMessageHexString = analysisBaseDto.ReceivedHexMessage, IsReceived = true, ReceivedRemark = data.ErrorCodeMsg ?? string.Empty, @@ -255,12 +257,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ProjectId = $"{item.ProjectId}", DeviceType = $"{item.DeviceType}", DeviceId = $"{item.DeviceId}", - DataType = analysisBaseDto.DataType, + DataType = IOTDBDataTypeConst.Log, // 匹配不到下发记录标记为LOG Timestamps = DateTime.Now.CheckTimePoint().GetDateTimeOffset().ToUnixTimeNanoseconds(), DatabaseBusiID = item.DatabaseBusiID, PendingCopyReadTime = item.TimeSpan.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), CreationTime = currentTime, - MeterAddress = item.DeviceAddress, + FocusId = item.FocusId, + FocusAddress = analysisBaseDto.Code, + MeterAddress = analysisBaseDto.Code == item.DeviceAddress ? "" : item.DeviceAddress, // 判断是否能取到表地址 AFN = analysisBaseDto.AFN, Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, @@ -365,11 +369,13 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DeviceType = $"{data.DeviceType}", DeviceId = $"{data.DeviceId}", DataType = analysisBaseDto.DataType, + FocusId = data.FocusId, + FocusAddress = analysisBaseDto.Code, Timestamps = DateTime.Now.GetDateTimeOffset().ToUnixTimeNanoseconds(), DatabaseBusiID = data.DatabaseBusiID, PendingCopyReadTime = data.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), CreationTime = currentTime, - MeterAddress = data.DeviceAddress, + MeterAddress = analysisBaseDto.Code == data.DeviceAddress ? "" : data.DeviceAddress,// 判断是否能取到表地址 AFN = analysisBaseDto.AFN, Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, @@ -466,7 +472,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData DatabaseBusiID = item.DatabaseBusiID, PendingCopyReadTime = item.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity), CreationTime = currentTime, - MeterAddress = item.DeviceAddress, + FocusId = item.FocusId, + FocusAddress = analysisBaseDto.Code, + MeterAddress= analysisBaseDto.Code== item.DeviceAddress?"": item.DeviceAddress,// 判断是否能取到表地址 AFN = analysisBaseDto.AFN, Fn = analysisBaseDto.Fn, Seq = analysisBaseDto.PSEQ, diff --git a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs index a9200ad..c02ee76 100644 --- a/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs +++ b/services/JiShe.CollectBus.Domain/Protocol3761/Dto/AnalysisBaseDto.cs @@ -67,6 +67,10 @@ namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto /// public string DeviceAddress { get; set; } = null!; + /// + /// 集中器ID + /// + public int FocusId { get; set; } } public class AnalysisBaseDto : AnalysisBaseDto diff --git a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml index a58ded5..30e91e8 100644 --- a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml +++ b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml @@ -16,6 +16,7 @@ 后端服务 + diff --git a/web/JiShe.CollectBus.Host/appsettings.json b/web/JiShe.CollectBus.Host/appsettings.json index 89c0175..bc90b01 100644 --- a/web/JiShe.CollectBus.Host/appsettings.json +++ b/web/JiShe.CollectBus.Host/appsettings.json @@ -88,7 +88,7 @@ "ClusterList": [ "192.168.1.9:6667" ], "PoolSize": 32, "DataBaseName": "energy", - "OpenDebugMode": false, + "OpenDebugMode": true, "UseTableSessionPoolByDefault": false }, "Cassandra": { From fa84f42ca21574a512bb8f0a20503e26b8ebd9d3 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Mon, 12 May 2025 17:08:09 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIoTDB=E5=8F=AF=E7=A9=BA?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2=E8=B5=8B=E5=80=BC=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComplexTypeSourceAnalyzers.cs | 9 +- .../Provider/IoTDBProvider.cs | 37 +++-- .../Samples/SampleAppService.cs | 24 ++- .../BasicScheduledMeterReadingService.cs | 4 +- .../Ammeters/ElectricityMeter.cs | 4 + .../Ammeters/ElectricityMeterTreeModel.cs | 2 - .../IotSystems/Ammeters/AmmeterInfo.cs | 7 +- .../IotSystems/Devices/DeviceCacheInfo.cs | 156 ++++++++++++++++++ .../Models/DeviceCacheBasicModel.cs | 5 + 9 files changed, 218 insertions(+), 30 deletions(-) create mode 100644 services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceCacheInfo.cs diff --git a/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs b/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs index ecb9c78..9212cda 100644 --- a/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs +++ b/modules/JiShe.CollectBus.Analyzers/ComplexTypeSourceAnalyzers.cs @@ -531,7 +531,14 @@ namespace JiShe.CollectBus.IncrementalGenerator var entityType = prop.ContainingType.ToDisplayString();//entity 实体类型名称 var propType = prop.Type;//实体属性的类型 var propTypeName = propType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); - var declaredTypeName = propType.Name; // 直接获取类型名称(如 "Int32") + // var declaredTypeName = propType.Name; // 直接获取类型名称(如 "Int32") + // 处理可空类型,获取底层具体类型名称 + var declaredTypeName = propType switch + { + INamedTypeSymbol { OriginalDefinition.SpecialType: SpecialType.System_Nullable_T } nullableType => + nullableType.TypeArguments[0].Name, // 提取如 "Int32" + _ => propType.Name + }; // 处理主属性 var propAttributes = prop.GetAttributes() diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs index 88c6b92..963d45f 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs @@ -283,7 +283,7 @@ namespace JiShe.CollectBus.IoTDB.Provider }; stopwatch2.Stop(); - + //int totalPageCount = (int)Math.Ceiling((double)result.TotalCount / options.PageSize); if (result.Items.Count() < result.PageSize) @@ -400,7 +400,7 @@ namespace JiShe.CollectBus.IoTDB.Provider { tempColumnNames[i] = (string)processor.SingleMeasuringNameGetter(entity); } - + // 获取并转换值 values[row][i] = processor.ValueGetter(entity); } @@ -576,7 +576,7 @@ namespace JiShe.CollectBus.IoTDB.Provider var accessor = SourceEntityAccessorFactory.GetAccessor(); var memberCache = BuildMemberCache(accessor); - + while (dataSet.HasNext() && results.Count < pageSize) { @@ -589,9 +589,12 @@ namespace JiShe.CollectBus.IoTDB.Provider for (int i = 0; i < metadata.Processors.Count; i++) { var value = record.Values[i]; - metadata.Processors[i].ValueSetter(entity, value); + if (!(value is System.DBNull)) + { + metadata.Processors[i].ValueSetter(entity, value); + } } - + results.Add(entity); } @@ -614,10 +617,8 @@ namespace JiShe.CollectBus.IoTDB.Provider // 过滤元组子项 if (member.NameOrPath.Contains(".Item")) continue; - // 类型名称处理 - Type declaredType = member.DeclaredType; - var underlyingType = Nullable.GetUnderlyingType(declaredType); - string declaredTypeName = underlyingType?.Name ?? member.DeclaredTypeName; + // 类型名称处理 + string declaredTypeName = member.DeclaredTypeName; // 特性查询优化 var attributes = member.CustomAttributes ?? Enumerable.Empty(); @@ -630,15 +631,15 @@ namespace JiShe.CollectBus.IoTDB.Provider ColumnInfo? column = null; if (tagAttr != null) { - column = new ColumnInfo(member.NameOrPath, ColumnCategory.TAG, GetDataTypeFromTypeName(declaredTypeName), false, member.DeclaredTypeName); + column = new ColumnInfo(member.NameOrPath, ColumnCategory.TAG, GetDataTypeFromTypeName(member.DeclaredTypeName), false, member.DeclaredTypeName); } else if (attrColumn != null) { - column = new ColumnInfo(member.NameOrPath, ColumnCategory.ATTRIBUTE, GetDataTypeFromTypeName(declaredTypeName), false, member.DeclaredTypeName); + column = new ColumnInfo(member.NameOrPath, ColumnCategory.ATTRIBUTE, GetDataTypeFromTypeName(member.DeclaredTypeName), false, member.DeclaredTypeName); } else if (fieldColumn != null) { - column = new ColumnInfo(member.NameOrPath, ColumnCategory.FIELD, GetDataTypeFromTypeName(declaredTypeName), false, member.DeclaredTypeName); + column = new ColumnInfo(member.NameOrPath, ColumnCategory.FIELD, GetDataTypeFromTypeName(member.DeclaredTypeName), false, member.DeclaredTypeName); } // 单测模式处理 @@ -715,7 +716,8 @@ namespace JiShe.CollectBus.IoTDB.Provider var item2Member = accessor.MemberList .First(m => m.NameOrPath == $"{column.Name}.Item2"); - processor.ValueGetter = (obj) => { + processor.ValueGetter = (obj) => + { object rawValue = item2Member.Getter(obj); return processor.GetConverter(rawValue); }; @@ -724,7 +726,8 @@ namespace JiShe.CollectBus.IoTDB.Provider { // 获取对应的成员访问器 var member = accessor.MemberList.First(m => m.NameOrPath == column.Name); - processor.ValueGetter = (obj) => { + processor.ValueGetter = (obj) => + { object rawValue = member.Getter(obj); return processor.GetConverter(rawValue); }; @@ -793,7 +796,7 @@ namespace JiShe.CollectBus.IoTDB.Provider { return declaredTypeName switch { - "DATETIME" => value => ((DateTime)value).GetDateTimeOffset().ToUnixTimeNanoseconds(), + "DATETIME" => value => value != null ? ((DateTime)value).GetDateTimeOffset().ToUnixTimeNanoseconds() : null, _ => value => value }; } @@ -803,9 +806,9 @@ namespace JiShe.CollectBus.IoTDB.Provider /// /// /// - private Func SetterConverter(string columnName) => + private Func SetterConverter(string columnName) => columnName.ToLower().EndsWith("time") - ? value => new DateTime(Convert.ToInt64(value), DateTimeKind.Utc) + ? value => value != null ? TimestampHelper.ConvertToDateTime(Convert.ToInt64(value), TimestampUnit.Nanoseconds) : null : value => value; /// diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs index 3035633..e4c61d6 100644 --- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs +++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs @@ -87,8 +87,9 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS //ElectricityMeterTreeModelAccessor. //TableModelSingleMeasuringEntityExtension - //TableModelSingleMeasuringEntityAccessor.GetSystemName(meter); - await _iotDBProvider.InsertAsync(meter); + //TableModelSingleMeasuringEntityAccessor.GetSystemName(meter); + //ElectricityMeterAccessor + await _iotDBProvider.InsertAsync(meter); } /// @@ -124,10 +125,29 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS MeterModel = "DDZY-1980", ProjectId = "10059", Voltage = 10, + CurrentdDateTime = DateTime.Now, Timestamps = DateTimeOffset.Now.ToUnixTimeNanoseconds(), }; await _iotDBProvider.InsertAsync(meter); + QueryCondition conditions = new QueryCondition() + { + Field = "DeviceId", + Operator = "=", + Value = meter.DeviceId + }; + + + var query = new IoTDBQueryOptions() + { + TableNameOrTreePath = nameof(ElectricityMeter), + PageIndex = 1, + PageSize = 1, + Conditions = new List() { conditions }, + }; + + var pageResult = await _iotDBProvider.QueryAsync(query); + } /// diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index c8826ba..cd694cf 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -371,8 +371,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading timer1.Stop(); _logger.LogError($"电表初始化读取数据总共花费时间{timer1.ElapsedMilliseconds}毫秒"); - DeviceGroupBalanceControl.InitializeCache(focusAddressDataLista, _kafkaOptions.NumPartitions); - return; + //DeviceGroupBalanceControl.InitializeCache(focusAddressDataLista, _kafkaOptions.NumPartitions); + //return; #else var meterInfos = await GetAmmeterInfoList(gatherCode); #endif diff --git a/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeter.cs b/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeter.cs index 1e1e6cb..796f328 100644 --- a/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeter.cs +++ b/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeter.cs @@ -1,6 +1,7 @@ using JiShe.CollectBus.Analyzers.Shared; using JiShe.CollectBus.IoTDB.Attributes; using JiShe.CollectBus.IoTDB.Model; +using System; namespace JiShe.CollectBus.Ammeters { @@ -33,5 +34,8 @@ namespace JiShe.CollectBus.Ammeters [FIELDColumn] public double? Currentd { get; set; } + + [FIELDColumn] + public DateTime? CurrentdDateTime { get; set; } } } diff --git a/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeterTreeModel.cs b/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeterTreeModel.cs index 49b5abe..6eb5ef4 100644 --- a/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeterTreeModel.cs +++ b/services/JiShe.CollectBus.Domain/Ammeters/ElectricityMeterTreeModel.cs @@ -34,7 +34,5 @@ namespace JiShe.CollectBus.Ammeters [FIELDColumn] public double? Currentd { get; set; } - - public ValueTuple TupleData { get; set; } } } diff --git a/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs b/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs index 4cd69ba..a7792c3 100644 --- a/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs +++ b/services/JiShe.CollectBus.Domain/IotSystems/Ammeters/AmmeterInfo.cs @@ -79,12 +79,7 @@ namespace JiShe.CollectBus.IotSystems.Ammeters /// 电表密码 /// public string Password { get; set; } - - /// - /// 采集时间间隔(分钟,如15) - /// - public int TimeDensity { get; set; } - + /// /// 该电表方案下采集项,JSON格式,如:["0D_80","0D_80"] /// diff --git a/services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceCacheInfo.cs b/services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceCacheInfo.cs new file mode 100644 index 0000000..26bc6aa --- /dev/null +++ b/services/JiShe.CollectBus.Domain/IotSystems/Devices/DeviceCacheInfo.cs @@ -0,0 +1,156 @@ +using FreeSql.DataAnnotations; +using JiShe.CollectBus.Analyzers.Shared; +using JiShe.CollectBus.Common.Enums; +using JiShe.CollectBus.Common.Models; +using JiShe.CollectBus.IoTDB.Attributes; +using JiShe.CollectBus.IoTDB.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.CollectBus.IotSystems.Devices +{ + /// + /// 设备缓存信息 + /// + public class DeviceCacheInfo : DeviceCacheBasicModel + { + /// + /// 关系映射标识,用于ZSet的Member字段和Set的Value字段,具体值可以根据不同业务场景进行定义 + /// + [Column(IsIgnore = true)] + public override string MemberId => $"{FocusAddress}:{MeteringCode}"; + + /// + /// ZSet排序索引分数值,具体值可以根据不同业务场景进行定义,例如时间戳 + /// + [Column(IsIgnore = true)] + public override long ScoreValue => Common.Helpers.CommonHelper.GetFocusScores(FocusAddress, MeteringCode); + + /// + /// 标记信息设备类型 + /// + [Column(IsIgnore = true)] + public MeterTypeEnum MeterType { get; set; } + + /// + /// 电表名称 + /// + public string Name { get; set; } + + /// + /// 集中器地址 + /// + public string Address { get; set; } + + /// + /// 集中器区域代码 + /// + public string AreaCode { get; set; } + + /// + /// 电表类别 (1单相、2三相三线、3三相四线), + /// 07协议: 开合闸指令(1A开闸断电,1C单相表合闸,1B多相表合闸) 645 2007 表 + /// 97协议://true(合闸);false(跳闸) 545 1997 没有单相多相 之分 "true" ? "9966" : "3355" + /// + public int TypeName { get; set; } + + /// + /// 跳合闸状态字段: 0 合闸,1 跳闸 + /// 电表:TripState (0 合闸-通电, 1 断开、跳闸); + /// + public int TripState { get; set; } + + /// + /// 规约 -电表default(30) 1:97协议,30:07协议 + /// + public int? Protocol { get; set; } + + /// + /// 一个集中器下的[MeteringCode]必须唯一。 PN + /// + public int MeteringCode { get; set; } + + /// + /// 电表通信地址 + /// + public string AmmerterAddress { get; set; } + + /// + /// 波特率 default(2400) + /// + public int Baudrate { get; set; } + + /// + /// MeteringPort 端口就几个可以枚举。 + /// + public int MeteringPort { get; set; } + + /// + /// 电表密码 + /// + public string Password { get; set; } + + /// + /// 该电表方案下采集项,JSON格式,如:["0D_80","0D_80"] + /// + public string ItemCodes { get; set; } + + /// + /// State表状态: + /// 0新装(未下发),1运行(档案下发成功时设置状态值1), 2暂停, 100销表(销表后是否重新启用) + /// 特定:State -1 已删除 + /// + public int State { get; set; } + + /// + /// 是否自动采集(0:主动采集,1:自动采集) + /// + public int AutomaticReport { get; set; } + + /// + /// 该电表方案下采集项编号 + /// + public string DataTypes { get; set; } + + /// + /// 品牌型号 + /// + public string BrandType { get; set; } + + /// + /// 采集器编号 + /// + public string GatherCode { get; set; } + + /// + /// 是否特殊表,1是特殊电表 + /// + public int Special { get; set; } + + /// + /// 费率类型,单、多 (SingleRate :单费率(单相表1),多费率(其他0) ,与TypeName字段无关) + /// SingleRate ? "单" : "复" + /// [SingleRate] --0 复费率 false , 1 单费率 true (与PayPlanID保持一致) + ///对应 TB_PayPlan.Type: 1复费率,2单费率 + /// + public bool SingleRate { get; set; } + + /// + /// 项目ID + /// + public int ProjectID { get; set; } + + /// + /// 数据库业务ID + /// + public int DatabaseBusiID { get; set; } + + /// + /// 是否异常集中器 0:正常,1异常 + /// + public int AbnormalState { get; set; } + } +} diff --git a/shared/JiShe.CollectBus.Common/Models/DeviceCacheBasicModel.cs b/shared/JiShe.CollectBus.Common/Models/DeviceCacheBasicModel.cs index 1edc46a..e3f79ce 100644 --- a/shared/JiShe.CollectBus.Common/Models/DeviceCacheBasicModel.cs +++ b/shared/JiShe.CollectBus.Common/Models/DeviceCacheBasicModel.cs @@ -40,5 +40,10 @@ namespace JiShe.CollectBus.Common.Models /// 集中器地址 /// public string FocusAddress { get; set;} + + /// + /// 采集时间间隔(分钟,如15) + /// + public int TimeDensity { get; set; } } } From 5b4673adef9f8cd7a4f35b71c1f7f13c0247a0ce Mon Sep 17 00:00:00 2001 From: zenghongyao <873884283@qq.com> Date: Mon, 12 May 2025 17:24:47 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BC=98=E5=8C=96iotdb=20=E5=AD=98?= =?UTF-8?q?=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisData/DataStorage.cs | 10 +++++----- web/JiShe.CollectBus.Host/Pages/Monitor.cshtml | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs index 87a2abf..2183ca2 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/DataStorage.cs @@ -173,7 +173,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ReceivedTime = analysisBaseDto.ReceivedTime, }; } - + _runtimeContext.UseTableSessionPool = true; // 使树模型池 await _dbProvider.InsertAsync(taskData); //如果无字段名,则不保存数据 if (!string.IsNullOrWhiteSpace(data.FiledName)) @@ -346,7 +346,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData await _dbProvider.InsertAsync(treeFrameData); // 时间 - var treeRecordingTimeData = new TreeModelSingleMeasuringEntity() + var treeRecordingTimeData = new TreeModelSingleMeasuringEntity() { SystemName = _applicationOptions.SystemType, DeviceId = $"{data.DeviceId}", @@ -354,7 +354,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData ProjectId = $"{data.ProjectId}", Timestamps = timestamps, DataType = analysisBaseDto.DataType, - SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, (data.TimeSpan.HasValue ? data.TimeSpan.Value : DateTime.Now).GetDateTimeOffset().ToUnixTimeNanoseconds()) + SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, data.TimeSpan.HasValue ? data.TimeSpan.Value : DateTime.Now) }; _runtimeContext.UseTableSessionPool = false; // 使树模型池 await _dbProvider.InsertAsync(treeRecordingTimeData); @@ -446,14 +446,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData await _dbProvider.InsertAsync(treeFrameData); // 时间 - var treeRecordingTimeData = new TreeModelSingleMeasuringEntity() + var treeRecordingTimeData = new TreeModelSingleMeasuringEntity() { SystemName = _applicationOptions.SystemType, DeviceType = $"{item.DeviceType}", ProjectId = $"{item.ProjectId}", DataType = analysisBaseDto.DataType, Timestamps = timestamps, - SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, (item.TimeSpan.HasValue ? item.TimeSpan.Value : DateTime.Now).GetDateTimeOffset().ToUnixTimeNanoseconds()) + SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, item.TimeSpan.HasValue ? item.TimeSpan.Value : DateTime.Now) }; _runtimeContext.UseTableSessionPool = false; // 使树模型池 await _dbProvider.InsertAsync(treeRecordingTimeData); diff --git a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml index 30e91e8..a58ded5 100644 --- a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml +++ b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml @@ -16,7 +16,6 @@ 后端服务 - From 705a5cbbf727ed5dd88bffcef63a50301b8cc9a8 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Mon, 12 May 2025 23:18:02 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E4=BF=A1=E6=81=AFRedis=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RedisDataCache/IRedisDataCacheService.cs | 18 ++++++ .../RedisDataCache/RedisDataCacheService.cs | 63 ++++++++++++++++++- .../BasicScheduledMeterReadingService.cs | 25 +++++++- .../Consts/RedisConst.cs | 4 +- 4 files changed, 103 insertions(+), 7 deletions(-) diff --git a/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs b/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs index b5f492c..d870202 100644 --- a/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs +++ b/services/JiShe.CollectBus.Application.Contracts/RedisDataCache/IRedisDataCacheService.cs @@ -1,4 +1,5 @@ using JiShe.CollectBus.Common.Models; +using JiShe.CollectBus.IotSystems.Ammeters; using System; using System.Collections.Generic; using System.Linq; @@ -34,14 +35,31 @@ namespace JiShe.CollectBus.Application.Contracts /// 主数据存储Hash缓存Key /// Set索引缓存Key /// ZSET索引缓存Key + /// 设备缓存信息 /// 待缓存数据集合 /// Task BatchInsertDataAsync( string redisHashCacheKey, string redisSetIndexCacheKey, string redisZSetScoresIndexCacheKey, + string redisDeviceInfoHashCacheKey, IEnumerable items) where T : DeviceCacheBasicModel; + + /// + /// 批量添加数据 + /// + /// + /// Set索引缓存Key + /// 设备缓存信息 + /// 待缓存数据集合 + /// + Task BatchInsertDataAsync2( + string redisSetIndexCacheKey, + string redisDeviceInfoHashCacheKey, + Dictionary> items) where T : DeviceCacheBasicModel; + + /// /// 删除缓存信息 /// diff --git a/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs b/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs index ebf1d2b..d648c89 100644 --- a/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs +++ b/services/JiShe.CollectBus.Application/RedisDataCache/RedisDataCacheService.cs @@ -16,6 +16,7 @@ using Volo.Abp.DependencyInjection; using static FreeSql.Internal.GlobalFilter; using static System.Runtime.InteropServices.JavaScript.JSType; using static Volo.Abp.UI.Navigation.DefaultMenuNames.Application; +using JiShe.CollectBus.IotSystems.Ammeters; namespace JiShe.CollectBus.RedisDataCache { @@ -102,13 +103,16 @@ namespace JiShe.CollectBus.RedisDataCache string redisHashCacheKey, string redisSetIndexCacheKey, string redisZSetScoresIndexCacheKey, + string redisDeviceInfoHashCacheKey, IEnumerable items) where T : DeviceCacheBasicModel { if (items == null || items.Count() <= 0 || string.IsNullOrWhiteSpace(redisHashCacheKey) || string.IsNullOrWhiteSpace(redisSetIndexCacheKey) - || string.IsNullOrWhiteSpace(redisZSetScoresIndexCacheKey)) + || string.IsNullOrWhiteSpace(redisZSetScoresIndexCacheKey) + || string.IsNullOrWhiteSpace(redisDeviceInfoHashCacheKey) + ) { _logger.LogError($"{nameof(BatchInsertDataAsync)} 参数异常,-101"); return; @@ -131,10 +135,65 @@ namespace JiShe.CollectBus.RedisDataCache pipe.HSet(redisHashCacheKey, item.MemberId, item.Serialize()); // Set索引缓存 - pipe.SAdd(redisSetIndexCacheKey, item.MemberId); + pipe.SAdd(redisSetIndexCacheKey, $"{item.TimeDensity.ToString().PadLeft(2, '0')}:{item.FocusAddress}"); // ZSET索引缓存Key pipe.ZAdd(redisZSetScoresIndexCacheKey, item.ScoreValue, item.MemberId); + + //设备信息缓存 + pipe.HSet(redisDeviceInfoHashCacheKey, item.FocusAddress, item.Serialize()); + + } + pipe.EndPipe(); + } + semaphore.Release(); + }); + } + + await Task.CompletedTask; + } + + /// + /// 批量添加数据 + /// + /// + /// Set索引缓存Key + /// 待缓存数据集合 + /// + public async Task BatchInsertDataAsync2( + string redisSetIndexCacheKey, + string redisDeviceInfoHashCacheKey, + Dictionary> items) where T : DeviceCacheBasicModel + { + if (items == null + || items.Count() <= 0 + || string.IsNullOrWhiteSpace(redisSetIndexCacheKey) + || string.IsNullOrWhiteSpace(redisDeviceInfoHashCacheKey) + ) + { + _logger.LogError($"{nameof(BatchInsertDataAsync)} 参数异常,-101"); + return; + } + + const int BATCH_SIZE = 1000; // 每批1000条 + var semaphore = new SemaphoreSlim(Environment.ProcessorCount * 2); + + foreach (var batch in items.Batch(BATCH_SIZE)) + { + await semaphore.WaitAsync(); + + _ = Task.Run(() => + { + using (var pipe = Instance.StartPipe()) + { + foreach (var item in batch) + { + // Set索引缓存 + pipe.SAdd(redisSetIndexCacheKey, $"{item.Value.First().TimeDensity.ToString().PadLeft(2, '0')}:{item.Value.First().FocusAddress}"); + + //设备信息缓存 + pipe.HSet(redisDeviceInfoHashCacheKey, item.Key, item.Value.Serialize()); + } pipe.EndPipe(); } diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index cd694cf..8e02627 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -322,7 +322,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading /// public virtual async Task InitAmmeterCacheData(string gatherCode = "") { - return; + //return; // 创建取消令牌源 //var cts = new CancellationTokenSource(); @@ -412,6 +412,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading var taskRedisCacheKey = string.Format(RedisConst.CacheTasksToBeIssuedKey, SystemType, ServerTagName, MeterTypeEnum.Ammeter, item.Key); await FreeRedisProvider.Instance.SetAsync(taskRedisCacheKey, nextTask); } + string redisDeviceInfoHashCacheKey = $"{string.Format(RedisConst.DeviceInfoHashCacheKey, SystemType, ServerTagName)}"; + Dictionary> keyValuePairs = new Dictionary>(); foreach (var itemTimeDensity in meterInfoGroupByTimeDensity) { @@ -476,13 +478,29 @@ namespace JiShe.CollectBus.ScheduledMeterReading } ammeterInfos.Add(ammeter); + + if (!keyValuePairs.ContainsKey(ammeter.FocusAddress)) + { + keyValuePairs[ammeter.FocusAddress] = new List() {ammeter }; + } + else + { + keyValuePairs[ammeter.FocusAddress].Add(ammeter); + } } } + //await _redisDataCacheService.BatchInsertDataAsync2( + // redisCacheMeterInfoSetIndexKey, + // redisDeviceInfoHashCacheKey, + // keyValuePairs); + await _redisDataCacheService.BatchInsertDataAsync( redisCacheMeterInfoHashKey, redisCacheMeterInfoSetIndexKey, - redisCacheMeterInfoZSetScoresIndexKey, ammeterInfos); + redisCacheMeterInfoZSetScoresIndexKey, + redisDeviceInfoHashCacheKey, + ammeterInfos); } //初始化设备组负载控制 @@ -1126,7 +1144,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading var taskRedisCacheKey = string.Format(RedisConst.CacheTasksToBeIssuedKey, SystemType, ServerTagName, MeterTypeEnum.WaterMeter, item.Key); await FreeRedisProvider.Instance.SetAsync(taskRedisCacheKey, nextTask); } - + string redisDeviceInfoHashCacheKey = $"{string.Format(RedisConst.DeviceInfoHashCacheKey, SystemType, ServerTagName)}"; foreach (var itemTimeDensity in meterInfoGroupByTimeDensity) { List watermeterInfo = new List(); @@ -1155,6 +1173,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading await _redisDataCacheService.BatchInsertDataAsync( redisCacheMeterInfoHashKey, redisCacheMeterInfoSetIndexKey, + redisDeviceInfoHashCacheKey, redisCacheMeterInfoZSetScoresIndexKey, watermeterInfo); } } diff --git a/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs b/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs index 60340bc..be4ae4b 100644 --- a/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs +++ b/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs @@ -29,9 +29,9 @@ namespace JiShe.CollectBus.Common.Consts public const string FifteenMinuteAcquisitionTimeInterval = "Fifteen"; /// - /// 集中器连接信息缓存数据,{0}=>系统类型,{1}=>应用服务部署标记 + /// 设备信息缓存数据,{0}=>系统类型,{1}=>应用服务部署标记 /// - public const string ConcentratorCacheHashKey = $"{CacheBasicDirectoryKey}{"{0}:{1}"}:Concentrator"; + public const string DeviceInfoHashCacheKey = $"{CacheBasicDirectoryKey}{"{0}:{1}"}:DeviceInfo"; public const string MeterInfo = "MeterInfo";