dev #4
@ -66,6 +66,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Analyzers.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Analyzers", "modules\JiShe.CollectBus.Analyzers\JiShe.CollectBus.Analyzers.csproj", "{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Analyzers", "modules\JiShe.CollectBus.Analyzers\JiShe.CollectBus.Analyzers.csproj", "{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.Application.Contracts", "services\JiShe.CollectBus.Migration.Application.Contracts\JiShe.CollectBus.Migration.Application.Contracts.csproj", "{E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.Application", "services\JiShe.CollectBus.Migration.Application\JiShe.CollectBus.Migration.Application.csproj", "{B955C5DA-3C20-35D2-0770-8FE473C41C44}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.Host", "web\JiShe.CollectBus.Migration.Host\JiShe.CollectBus.Migration.Host.csproj", "{995D3D91-7221-D4A3-A7B2-FEC202328A18}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Migration.HttpApi", "web\JiShe.CollectBus.Migration.HttpApi\JiShe.CollectBus.Migration.HttpApi.csproj", "{8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -160,6 +168,22 @@ Global
|
|||||||
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Release|Any CPU.Build.0 = Release|Any CPU
|
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B955C5DA-3C20-35D2-0770-8FE473C41C44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B955C5DA-3C20-35D2-0770-8FE473C41C44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B955C5DA-3C20-35D2-0770-8FE473C41C44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B955C5DA-3C20-35D2-0770-8FE473C41C44}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{995D3D91-7221-D4A3-A7B2-FEC202328A18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{995D3D91-7221-D4A3-A7B2-FEC202328A18}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{995D3D91-7221-D4A3-A7B2-FEC202328A18}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{995D3D91-7221-D4A3-A7B2-FEC202328A18}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -187,6 +211,10 @@ Global
|
|||||||
{75B7D419-C261-577D-58D6-AA3ACED9129F} = {3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC}
|
{75B7D419-C261-577D-58D6-AA3ACED9129F} = {3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC}
|
||||||
{DD68F314-BC66-5601-B094-B1A7BE93F4E0} = {EBF7C01F-9B4F-48E6-8418-2CBFDA51EB0B}
|
{DD68F314-BC66-5601-B094-B1A7BE93F4E0} = {EBF7C01F-9B4F-48E6-8418-2CBFDA51EB0B}
|
||||||
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A} = {2E0FE301-34C3-4561-9CAE-C7A9E65AEE59}
|
{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A} = {2E0FE301-34C3-4561-9CAE-C7A9E65AEE59}
|
||||||
|
{E01625B5-B5B7-7A4B-468F-EC12C1BDBA2A} = {BA4DA3E7-9AD0-47AD-A0E6-A0BB6700DA23}
|
||||||
|
{B955C5DA-3C20-35D2-0770-8FE473C41C44} = {BA4DA3E7-9AD0-47AD-A0E6-A0BB6700DA23}
|
||||||
|
{995D3D91-7221-D4A3-A7B2-FEC202328A18} = {A02F7D8A-04DC-44D6-94D4-3F65712D6B94}
|
||||||
|
{8A113DE5-7D50-6E6B-739F-B6EEAD5E13B4} = {A02F7D8A-04DC-44D6-94D4-3F65712D6B94}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}
|
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}
|
||||||
|
|||||||
@ -577,19 +577,43 @@ namespace JiShe.CollectBus.IncrementalGenerator
|
|||||||
var elementDeclaredName = element.Type.Name;//元组元素类型名称
|
var elementDeclaredName = element.Type.Name;//元组元素类型名称
|
||||||
|
|
||||||
initializerLines.Add(
|
initializerLines.Add(
|
||||||
$"new EntityMemberInfo(" +
|
$"new EntityMemberInfo(" +
|
||||||
$"\"{prop.Name}.{elementName}\", " +
|
$"\"{prop.Name}.{elementName}\", " +
|
||||||
$"typeof({elementType}), " +
|
$"typeof({elementType}), " +
|
||||||
$"typeof({elementType}).Name, " +//$"\"{elementDeclaredName}\", " +
|
$"GetValueTupleElementDeclaredTypeName(typeof({elementType})), " +//$"\"{elementDeclaredName}\", " +
|
||||||
$"(e) => Get{prop.Name}_{elementName}(({entityType})e), " +
|
$"(e) => Get{prop.Name}_{elementName}(({entityType})e), " +
|
||||||
$"(e, v) => Set{prop.Name}_{elementName}(({entityType})e, ({elementType})v))");
|
$"(e, v) => Set{prop.Name}_{elementName}(({entityType})e, ({elementType})v))");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code.AppendLine(string.Join(",\n", initializerLines));
|
code.AppendLine(string.Join(",\n", initializerLines));
|
||||||
code.AppendLine(" };");
|
code.AppendLine(" };");
|
||||||
}
|
|
||||||
|
code.AppendLine(GetValueTupleElementName());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetValueTupleElementName()
|
||||||
|
{
|
||||||
|
return """
|
||||||
|
public static string GetValueTupleElementDeclaredTypeName(Type declaredType)
|
||||||
|
{
|
||||||
|
string typeName;
|
||||||
|
// 处理可空类型
|
||||||
|
if (declaredType.IsGenericType && declaredType.GetGenericTypeDefinition() == typeof(Nullable<>))
|
||||||
|
{
|
||||||
|
Type underlyingType = Nullable.GetUnderlyingType(declaredType);
|
||||||
|
typeName = underlyingType.Name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
typeName = declaredType.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static string GenerateAttributeInitializer(AttributeData attribute)
|
private static string GenerateAttributeInitializer(AttributeData attribute)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace JiShe.CollectBus.IoTDB.Context
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// IoTDB SessionPool 运行时上下文
|
/// IoTDB SessionPool 运行时上下文
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class IoTDBRuntimeContext: IScopedDependency
|
public class IoTDBRuntimeContext: IScopedDependency//ITransientDependency
|
||||||
{
|
{
|
||||||
private readonly bool _defaultValue;
|
private readonly bool _defaultValue;
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,8 @@ namespace JiShe.CollectBus.IoTDB.Interface
|
|||||||
///// <param name="useTableSession">是否使用表模型</param>
|
///// <param name="useTableSession">是否使用表模型</param>
|
||||||
//void SwitchSessionPool(bool useTableSession);
|
//void SwitchSessionPool(bool useTableSession);
|
||||||
|
|
||||||
|
IIoTDbProvider GetSessionPool(bool sessionpolType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 插入数据
|
/// 插入数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -45,6 +45,10 @@ namespace JiShe.CollectBus.IoTDB.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public long Timestamps { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
public long Timestamps { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备路径
|
||||||
|
/// </summary>
|
||||||
|
private string _devicePath;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备路径
|
/// 设备路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -52,18 +56,16 @@ namespace JiShe.CollectBus.IoTDB.Model
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`";
|
// 如果未手动设置路径,则自动生成
|
||||||
|
if (string.IsNullOrWhiteSpace(_devicePath))
|
||||||
|
{
|
||||||
|
return $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`";
|
||||||
|
}
|
||||||
|
return _devicePath;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(value))
|
_devicePath = value; // 直接赋值给支持字段,避免递归
|
||||||
{
|
|
||||||
DevicePath = $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DevicePath = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
namespace JiShe.CollectBus.IoTDB.Options
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.IoTDB.Options
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询条件
|
/// 查询条件
|
||||||
@ -20,9 +23,42 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsNumber { get; set; } = false;
|
public bool IsNumber { get; set; } = false;
|
||||||
|
|
||||||
|
private object _rawValue;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 值
|
/// 值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object Value { get; set; }
|
public object Value
|
||||||
|
{
|
||||||
|
get => ApplyValueConversion(_rawValue);
|
||||||
|
set => _rawValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 值转换
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rawValue"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private object ApplyValueConversion(object rawValue)
|
||||||
|
{
|
||||||
|
string declaredTypeName = rawValue.GetType().Name;
|
||||||
|
|
||||||
|
Func<object, object> converter = GetQueryConditionValue(declaredTypeName);
|
||||||
|
return converter(rawValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询条件值转换委托
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="declaredTypeName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private Func<object, object> GetQueryConditionValue(string declaredTypeName)
|
||||||
|
{
|
||||||
|
return declaredTypeName?.ToUpper() switch
|
||||||
|
{
|
||||||
|
"DATETIME" => v => v != null ? ((DateTime)v).ToUniversalTime().Ticks : null,
|
||||||
|
"STRING" => v => v != null ? $"'{v}'" : "''",
|
||||||
|
_ => v => v
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,10 +37,21 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
private static readonly ConcurrentDictionary<Type, DeviceMetadata> MetadataCache = new();
|
private static readonly ConcurrentDictionary<Type, DeviceMetadata> MetadataCache = new();
|
||||||
private readonly ILogger<IoTDbProvider> _logger;
|
private readonly ILogger<IoTDbProvider> _logger;
|
||||||
private readonly IIoTDbSessionFactory _sessionFactory;
|
private readonly IIoTDbSessionFactory _sessionFactory;
|
||||||
private readonly IoTDBRuntimeContext _runtimeContext;
|
|
||||||
|
|
||||||
private IIoTDbSessionPool CurrentSession =>
|
/// <summary>
|
||||||
_sessionFactory.GetSessionPool(_runtimeContext.UseTableSessionPool);
|
/// 存储模型切换标识,是否使用table模型存储, 默认为false,标识tree模型存储
|
||||||
|
/// </summary>
|
||||||
|
public bool UseTableSessionPool { get; set; }
|
||||||
|
|
||||||
|
private IIoTDbSessionPool CurrentSession { get; set; }
|
||||||
|
|
||||||
|
public IIoTDbProvider GetSessionPool(bool useTableSessionPool)
|
||||||
|
{
|
||||||
|
CurrentSession = _sessionFactory.GetSessionPool(useTableSessionPool);
|
||||||
|
UseTableSessionPool = useTableSessionPool;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IoTDbProvider
|
/// IoTDbProvider
|
||||||
@ -50,12 +61,10 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
/// <param name="runtimeContext"></param>
|
/// <param name="runtimeContext"></param>
|
||||||
public IoTDbProvider(
|
public IoTDbProvider(
|
||||||
ILogger<IoTDbProvider> logger,
|
ILogger<IoTDbProvider> logger,
|
||||||
IIoTDbSessionFactory sessionFactory,
|
IIoTDbSessionFactory sessionFactory)
|
||||||
IoTDBRuntimeContext runtimeContext)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_sessionFactory = sessionFactory;
|
_sessionFactory = sessionFactory;
|
||||||
_runtimeContext = runtimeContext;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +86,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null");
|
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 路径为 {tablet.First().InsertTargetName}");
|
||||||
|
|
||||||
await CurrentSession.InsertAsync(tablet.First());
|
await CurrentSession.InsertAsync(tablet.First());
|
||||||
}
|
}
|
||||||
@ -96,6 +106,11 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (entities == null || entities.Count() <= 0)
|
||||||
|
{
|
||||||
|
_logger.LogError($"{nameof(BatchInsertAsync)} 参数异常,-101");
|
||||||
|
return;
|
||||||
|
}
|
||||||
var metadata = await GetMetadata<T>();
|
var metadata = await GetMetadata<T>();
|
||||||
|
|
||||||
var batchSize = 1000;
|
var batchSize = 1000;
|
||||||
@ -109,8 +124,11 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null");
|
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var item in tablet)
|
foreach (var item in tablet)
|
||||||
{
|
{
|
||||||
|
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 路径为 {item.InsertTargetName}");
|
||||||
|
|
||||||
await CurrentSession.InsertAsync(item);
|
await CurrentSession.InsertAsync(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,9 +339,6 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//var accessor = SourceEntityAccessorFactory.GetAccessor<T>();
|
|
||||||
|
|
||||||
//var memberCache = BuildMemberCache(accessor);
|
|
||||||
|
|
||||||
if (metadata.EntityType == null)
|
if (metadata.EntityType == null)
|
||||||
{
|
{
|
||||||
@ -335,16 +350,16 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 不属于IoTDB数据模型实体,属于异常情况,-102");
|
throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 {nameof(T)}的EntityType 不属于IoTDB数据模型实体,属于异常情况,-102");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metadata.EntityType == EntityTypeEnum.TreeModel && _runtimeContext.UseTableSessionPool == true)
|
if (metadata.EntityType == EntityTypeEnum.TreeModel && UseTableSessionPool == true)
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 tree模型不能使用table模型Session连接,属于异常情况,-103");
|
throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 tree模型不能使用table模型Session连接,属于异常情况,-103");
|
||||||
}
|
}
|
||||||
else if (metadata.EntityType == EntityTypeEnum.TableModel && _runtimeContext.UseTableSessionPool == false)
|
else if (metadata.EntityType == EntityTypeEnum.TableModel && UseTableSessionPool == false)
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 table模型不能使用tree模型Session连接,属于异常情况,-104");
|
throw new Exception($"{nameof(BuildTablet)} 构建存储结构{nameof(Tablet)}时 table模型不能使用tree模型Session连接,属于异常情况,-104");
|
||||||
}
|
}
|
||||||
string tableNameOrTreePath = string.Empty;
|
string tableNameOrTreePath = string.Empty;
|
||||||
if (_runtimeContext.UseTableSessionPool)//表模型
|
if ( UseTableSessionPool)//表模型
|
||||||
{
|
{
|
||||||
//如果指定了路径
|
//如果指定了路径
|
||||||
if (!string.IsNullOrWhiteSpace(metadata.TableNameOrTreePath))
|
if (!string.IsNullOrWhiteSpace(metadata.TableNameOrTreePath))
|
||||||
@ -405,7 +420,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _runtimeContext.UseTableSessionPool
|
return UseTableSessionPool
|
||||||
? BuildTableSessionTablet(metadata, tableNameOrTreePath, tempColumnNames, values.Select(d => d.ToList()).ToList(), timestamps.ToList())
|
? BuildTableSessionTablet(metadata, tableNameOrTreePath, tempColumnNames, values.Select(d => d.ToList()).ToList(), timestamps.ToList())
|
||||||
: BuildSessionTablet(metadata, tableNameOrTreePath, tempColumnNames, values.Select(d => d.ToList()).ToList(), timestamps.ToList());
|
: BuildSessionTablet(metadata, tableNameOrTreePath, tempColumnNames, values.Select(d => d.ToList()).ToList(), timestamps.ToList());
|
||||||
}
|
}
|
||||||
@ -490,7 +505,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
var metadata = await GetMetadata<T>();
|
var metadata = await GetMetadata<T>();
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
if (!_runtimeContext.UseTableSessionPool)
|
if (!UseTableSessionPool)
|
||||||
{
|
{
|
||||||
sb.Append("DELETE ");
|
sb.Append("DELETE ");
|
||||||
}
|
}
|
||||||
@ -522,9 +537,9 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
{
|
{
|
||||||
return condition.Operator switch
|
return condition.Operator switch
|
||||||
{
|
{
|
||||||
">" => condition.IsNumber ? $"{condition.Field} > {condition.Value}" : $"{condition.Field} > '{condition.Value}'",
|
">" => $"{condition.Field} > {condition.Value}",
|
||||||
"<" => condition.IsNumber ? $"{condition.Field} < {condition.Value}" : $"{condition.Field} < '{condition.Value}'",
|
"<" => $"{condition.Field} < {condition.Value}",
|
||||||
"=" => condition.IsNumber ? $"{condition.Field} = {condition.Value}" : $"{condition.Field} = '{condition.Value}'",
|
"=" => $"{condition.Field} = {condition.Value}",
|
||||||
_ => throw new NotSupportedException($"{nameof(TranslateCondition)} 将查询条件转换为SQL语句时操作符 {condition.Operator} 属于异常情况")
|
_ => throw new NotSupportedException($"{nameof(TranslateCondition)} 将查询条件转换为SQL语句时操作符 {condition.Operator} 属于异常情况")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -795,7 +810,8 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
{
|
{
|
||||||
return declaredTypeName switch
|
return declaredTypeName switch
|
||||||
{
|
{
|
||||||
"DATETIME" => value => value != null ? ((DateTime)value).GetDateTimeOffset().ToUnixTimeNanoseconds() : null,
|
"DATETIME" => value => value != null ? Convert.ToDateTime(value).GetDateTimeOffset().ToUnixTimeNanoseconds() : null,
|
||||||
|
"DECIMAL" => value => value != null ? Convert.ToDouble( value) : null,
|
||||||
_ => value => value
|
_ => value => value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -897,7 +913,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
["DATETIME"] = TSDataType.TIMESTAMP,
|
["DATETIME"] = TSDataType.TIMESTAMP,
|
||||||
["DATE"] = TSDataType.DATE,
|
["DATE"] = TSDataType.DATE,
|
||||||
["BLOB"] = TSDataType.BLOB,
|
["BLOB"] = TSDataType.BLOB,
|
||||||
["DECIMAL"] = TSDataType.STRING,
|
["DECIMAL"] = TSDataType.DOUBLE,
|
||||||
["STRING"] = TSDataType.STRING
|
["STRING"] = TSDataType.STRING
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -933,7 +949,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
TSDataType.BOOLEAN => Convert.ToBoolean(value),
|
TSDataType.BOOLEAN => Convert.ToBoolean(value),
|
||||||
TSDataType.INT32 => Convert.ToInt32(value),
|
TSDataType.INT32 => Convert.ToInt32(value),
|
||||||
TSDataType.INT64 => Convert.ToInt64(value),
|
TSDataType.INT64 => Convert.ToInt64(value),
|
||||||
TSDataType.FLOAT => Convert.ToDouble(value),
|
TSDataType.FLOAT => Convert.ToSingle(value),
|
||||||
TSDataType.DOUBLE => Convert.ToDouble(value),
|
TSDataType.DOUBLE => Convert.ToDouble(value),
|
||||||
TSDataType.TEXT => Convert.ToString(value),
|
TSDataType.TEXT => Convert.ToString(value),
|
||||||
TSDataType.NONE => null,
|
TSDataType.NONE => null,
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"WSL": {
|
||||||
|
"commandName": "WSL2",
|
||||||
|
"distributionName": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
using Confluent.Kafka;
|
using Confluent.Kafka;
|
||||||
using JiShe.CollectBus.Common;
|
using JiShe.CollectBus.Common;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Kafka.Internal;
|
using JiShe.CollectBus.Kafka.Internal;
|
||||||
using JiShe.CollectBus.Kafka.Serialization;
|
using JiShe.CollectBus.Kafka.Serialization;
|
||||||
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
||||||
@ -127,80 +128,88 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task SubscribeAsync<TKey, TValue>(string[] topics, Func<TKey, TValue, Task<bool>> messageHandler, string? groupId = null) where TKey : notnull where TValue : class
|
public async Task SubscribeAsync<TKey, TValue>(string[] topics, Func<TKey, TValue, Task<bool>> messageHandler, string? groupId = null) where TKey : notnull where TValue : class
|
||||||
{
|
{
|
||||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
try
|
||||||
{
|
{
|
||||||
|
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||||
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(TKey).Name}_{typeof(TValue).Name}";
|
|
||||||
var cts = new CancellationTokenSource();
|
|
||||||
|
|
||||||
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
|
||||||
(
|
|
||||||
CreateConsumer<TKey, TValue>(groupId),
|
|
||||||
cts
|
|
||||||
)).Consumer as IConsumer<TKey, TValue>;
|
|
||||||
|
|
||||||
consumer!.Subscribe(topics);
|
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
{
|
||||||
while (!cts.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)} 开始拉取消息....");
|
|
||||||
|
|
||||||
var result = consumer.Consume(cts.Token);
|
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(TKey).Name}_{typeof(TValue).Name}";
|
||||||
if (result == null || result.Message == null || result.Message.Value == null)
|
var cts = new CancellationTokenSource();
|
||||||
|
|
||||||
|
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
||||||
|
(
|
||||||
|
CreateConsumer<TKey, TValue>(groupId),
|
||||||
|
cts
|
||||||
|
)).Consumer as IConsumer<TKey, TValue>;
|
||||||
|
|
||||||
|
consumer!.Subscribe(topics);
|
||||||
|
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
while (!cts.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)} 开始拉取消息....");
|
||||||
continue;
|
|
||||||
}
|
var result = consumer.Consume(cts.Token);
|
||||||
if (result.IsPartitionEOF)
|
if (result == null || result.Message == null || result.Message.Value == null)
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
|
||||||
#endif
|
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (_kafkaOptionConfig.EnableFilter)
|
|
||||||
{
|
|
||||||
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
|
||||||
// 检查 Header 是否符合条件
|
|
||||||
if (!headersFilter.Match(result.Message.Headers))
|
|
||||||
{
|
{
|
||||||
consumer.Commit(result); // 提交偏移量
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
// 跳过消息
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (result.IsPartitionEOF)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
||||||
|
#endif
|
||||||
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (_kafkaOptionConfig.EnableFilter)
|
||||||
|
{
|
||||||
|
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
||||||
|
// 检查 Header 是否符合条件
|
||||||
|
if (!headersFilter.Match(result.Message.Headers))
|
||||||
|
{
|
||||||
|
consumer.Commit(result); // 提交偏移量
|
||||||
|
// 跳过消息
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool sucess = await messageHandler(result.Message.Key, result.Message.Value);
|
||||||
|
if (sucess)
|
||||||
|
consumer.Commit(result); // 手动提交
|
||||||
|
}
|
||||||
|
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"{string.Join("、", topics)}消息消费失败: {ex.Error.Reason}");
|
||||||
|
throw; // 抛出异常,以便重试
|
||||||
|
}
|
||||||
|
catch (KafkaException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
||||||
|
throw; // 抛出异常,以便重试
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "处理消息时发生未知错误");
|
||||||
}
|
}
|
||||||
bool sucess = await messageHandler(result.Message.Key, result.Message.Value);
|
|
||||||
if (sucess)
|
|
||||||
consumer.Commit(result); // 手动提交
|
|
||||||
}
|
}
|
||||||
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
}, cts.Token);
|
||||||
{
|
await Task.CompletedTask;
|
||||||
_logger.LogError(ex, $"{string.Join("、", topics)}消息消费失败: {ex.Error.Reason}");
|
});
|
||||||
throw; // 抛出异常,以便重试
|
|
||||||
}
|
|
||||||
catch (KafkaException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
|
||||||
throw; // 抛出异常,以便重试
|
|
||||||
}
|
|
||||||
catch (OperationCanceledException)
|
|
||||||
{
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "处理消息时发生未知错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, cts.Token);
|
|
||||||
await Task.CompletedTask;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -215,76 +224,84 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task SubscribeAsync<TValue>(string[] topics, Func<TValue, Task<bool>> messageHandler, string? groupId) where TValue : class
|
public async Task SubscribeAsync<TValue>(string[] topics, Func<TValue, Task<bool>> messageHandler, string? groupId) where TValue : class
|
||||||
{
|
{
|
||||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
try
|
||||||
{
|
{
|
||||||
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(Ignore).Name}_{typeof(TValue).Name}";
|
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||||
var cts = new CancellationTokenSource();
|
|
||||||
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
|
||||||
(
|
|
||||||
CreateConsumer<Ignore, TValue>(groupId),
|
|
||||||
cts
|
|
||||||
)).Consumer as IConsumer<Ignore, TValue>;
|
|
||||||
|
|
||||||
consumer!.Subscribe(topics);
|
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
{
|
||||||
int count = 0;
|
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(Ignore).Name}_{typeof(TValue).Name}";
|
||||||
while (!cts.IsCancellationRequested)
|
var cts = new CancellationTokenSource();
|
||||||
{
|
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
||||||
try
|
(
|
||||||
{
|
CreateConsumer<Ignore, TValue>(groupId),
|
||||||
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)}_{count} 开始拉取消息....");
|
cts
|
||||||
count++;
|
)).Consumer as IConsumer<Ignore, TValue>;
|
||||||
var result = consumer.Consume(cts.Token);
|
|
||||||
if (result == null || result.Message == null || result.Message.Value == null)
|
|
||||||
{
|
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.IsPartitionEOF)
|
consumer!.Subscribe(topics);
|
||||||
|
|
||||||
|
_ = Task.Run(async () =>
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
while (!cts.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
#if DEBUG
|
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)}_{count} 开始拉取消息....");
|
||||||
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
count++;
|
||||||
#endif
|
var result = consumer.Consume(cts.Token);
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
if (result == null || result.Message == null || result.Message.Value == null)
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (_kafkaOptionConfig.EnableFilter)
|
|
||||||
{
|
|
||||||
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
|
||||||
// 检查 Header 是否符合条件
|
|
||||||
if (!headersFilter.Match(result.Message.Headers))
|
|
||||||
{
|
{
|
||||||
consumer.Commit(result); // 提交偏移量
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
// 跳过消息
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result.IsPartitionEOF)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
||||||
|
#endif
|
||||||
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (_kafkaOptionConfig.EnableFilter)
|
||||||
|
{
|
||||||
|
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
||||||
|
// 检查 Header 是否符合条件
|
||||||
|
if (!headersFilter.Match(result.Message.Headers))
|
||||||
|
{
|
||||||
|
consumer.Commit(result); // 提交偏移量
|
||||||
|
// 跳过消息
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool sucess = await messageHandler(result.Message.Value);
|
||||||
|
if (sucess)
|
||||||
|
consumer.Commit(result); // 手动提交
|
||||||
|
//else
|
||||||
|
// consumer.StoreOffset(result);
|
||||||
|
}
|
||||||
|
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"{string.Join("、", topics)}消息消费失败: {ex.Error.Reason}");
|
||||||
|
throw; // 抛出异常,以便重试
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "处理消息时发生未知错误");
|
||||||
}
|
}
|
||||||
bool sucess = await messageHandler(result.Message.Value);
|
|
||||||
if (sucess)
|
|
||||||
consumer.Commit(result); // 手动提交
|
|
||||||
//else
|
|
||||||
// consumer.StoreOffset(result);
|
|
||||||
}
|
}
|
||||||
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
}, cts.Token);
|
||||||
{
|
await Task.CompletedTask;
|
||||||
_logger.LogError(ex, $"{string.Join("、", topics)}消息消费失败: {ex.Error.Reason}");
|
});
|
||||||
throw; // 抛出异常,以便重试
|
}
|
||||||
}
|
catch (Exception ex)
|
||||||
catch (OperationCanceledException)
|
{
|
||||||
{
|
|
||||||
//ignore
|
throw;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "处理消息时发生未知错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, cts.Token);
|
|
||||||
await Task.CompletedTask;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -300,7 +317,15 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
|||||||
/// <param name="batchTimeout">批次超时时间</param>
|
/// <param name="batchTimeout">批次超时时间</param>
|
||||||
public async Task SubscribeBatchAsync<TKey, TValue>(string topic, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null) where TKey : notnull where TValue : class
|
public async Task SubscribeBatchAsync<TKey, TValue>(string topic, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null) where TKey : notnull where TValue : class
|
||||||
{
|
{
|
||||||
await SubscribeBatchAsync<TKey, TValue>(new[] { topic }, messageBatchHandler, groupId, batchSize, batchTimeout);
|
try
|
||||||
|
{
|
||||||
|
await SubscribeBatchAsync<TKey, TValue>(new[] { topic }, messageBatchHandler, groupId, batchSize, batchTimeout);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -315,117 +340,125 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
|||||||
/// <param name="batchTimeout">批次超时时间</param>
|
/// <param name="batchTimeout">批次超时时间</param>
|
||||||
public async Task SubscribeBatchAsync<TKey, TValue>(string[] topics, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null) where TKey : notnull where TValue : class
|
public async Task SubscribeBatchAsync<TKey, TValue>(string[] topics, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null) where TKey : notnull where TValue : class
|
||||||
{
|
{
|
||||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
try
|
||||||
{
|
{
|
||||||
|
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||||
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(TKey).Name}_{typeof(TValue).Name}";
|
|
||||||
var cts = new CancellationTokenSource();
|
|
||||||
|
|
||||||
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
|
||||||
(
|
|
||||||
CreateConsumer<TKey, TValue>(groupId),
|
|
||||||
cts
|
|
||||||
)).Consumer as IConsumer<TKey, TValue>;
|
|
||||||
consumer!.Subscribe(topics);
|
|
||||||
|
|
||||||
var timeout = batchTimeout ?? TimeSpan.FromSeconds(5); // 默认超时时间调整为5秒
|
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
{
|
||||||
var messages = new List<(TValue Value, TopicPartitionOffset Offset)>();
|
|
||||||
var startTime = DateTime.UtcNow;
|
|
||||||
|
|
||||||
while (!cts.IsCancellationRequested)
|
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(TKey).Name}_{typeof(TValue).Name}";
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
|
||||||
|
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
||||||
|
(
|
||||||
|
CreateConsumer<TKey, TValue>(groupId),
|
||||||
|
cts
|
||||||
|
)).Consumer as IConsumer<TKey, TValue>;
|
||||||
|
consumer!.Subscribe(topics);
|
||||||
|
|
||||||
|
var timeout = batchTimeout ?? TimeSpan.FromSeconds(5); // 默认超时时间调整为5秒
|
||||||
|
|
||||||
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
var messages = new List<(TValue Value, TopicPartitionOffset Offset)>();
|
||||||
{
|
var startTime = DateTime.UtcNow;
|
||||||
// 非阻塞快速累积消息
|
|
||||||
while (messages.Count < batchSize && (DateTime.UtcNow - startTime) < timeout)
|
|
||||||
{
|
|
||||||
var result = consumer.Consume(TimeSpan.Zero); // 非阻塞调用
|
|
||||||
|
|
||||||
if (result != null)
|
while (!cts.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 非阻塞快速累积消息
|
||||||
|
while (messages.Count < batchSize && (DateTime.UtcNow - startTime) < timeout)
|
||||||
{
|
{
|
||||||
if (result.IsPartitionEOF)
|
var result = consumer.Consume(TimeSpan.Zero); // 非阻塞调用
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
if (result.IsPartitionEOF)
|
||||||
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
||||||
#endif
|
#endif
|
||||||
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
|
}
|
||||||
|
else if (result.Message.Value != null)
|
||||||
|
{
|
||||||
|
if (_kafkaOptionConfig.EnableFilter)
|
||||||
|
{
|
||||||
|
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
||||||
|
// 检查 Header 是否符合条件
|
||||||
|
if (!headersFilter.Match(result.Message.Headers))
|
||||||
|
{
|
||||||
|
consumer.Commit(result); // 提交偏移量
|
||||||
|
// 跳过消息
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
messages.Add((result.Message.Value, result.TopicPartitionOffset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 无消息时短暂等待
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
}
|
}
|
||||||
else if (result.Message.Value != null)
|
}
|
||||||
|
|
||||||
|
// 处理批次
|
||||||
|
if (messages.Count > 0)
|
||||||
|
{
|
||||||
|
bool success = await messageBatchHandler(messages.Select(m => m.Value).ToList());
|
||||||
|
if (success)
|
||||||
{
|
{
|
||||||
if (_kafkaOptionConfig.EnableFilter)
|
var offsetsByPartition = new Dictionary<TopicPartition, long>();
|
||||||
|
foreach (var msg in messages)
|
||||||
{
|
{
|
||||||
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
var tp = msg.Offset.TopicPartition;
|
||||||
// 检查 Header 是否符合条件
|
var offset = msg.Offset.Offset;
|
||||||
if (!headersFilter.Match(result.Message.Headers))
|
if (!offsetsByPartition.TryGetValue(tp, out var currentMax) || offset > currentMax)
|
||||||
{
|
{
|
||||||
consumer.Commit(result); // 提交偏移量
|
offsetsByPartition[tp] = offset;
|
||||||
// 跳过消息
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
messages.Add((result.Message.Value, result.TopicPartitionOffset));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 无消息时短暂等待
|
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理批次
|
var offsetsToCommit = offsetsByPartition
|
||||||
if (messages.Count > 0)
|
.Select(kv => new TopicPartitionOffset(kv.Key, new Offset(kv.Value + 1)))
|
||||||
|
.ToList();
|
||||||
|
consumer.Commit(offsetsToCommit);
|
||||||
|
}
|
||||||
|
messages.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
startTime = DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
||||||
{
|
{
|
||||||
bool success = await messageBatchHandler(messages.Select(m => m.Value).ToList());
|
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
||||||
if (success)
|
throw; // 抛出异常,以便重试
|
||||||
{
|
|
||||||
var offsetsByPartition = new Dictionary<TopicPartition, long>();
|
|
||||||
foreach (var msg in messages)
|
|
||||||
{
|
|
||||||
var tp = msg.Offset.TopicPartition;
|
|
||||||
var offset = msg.Offset.Offset;
|
|
||||||
if (!offsetsByPartition.TryGetValue(tp, out var currentMax) || offset > currentMax)
|
|
||||||
{
|
|
||||||
offsetsByPartition[tp] = offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var offsetsToCommit = offsetsByPartition
|
|
||||||
.Select(kv => new TopicPartitionOffset(kv.Key, new Offset(kv.Value + 1)))
|
|
||||||
.ToList();
|
|
||||||
consumer.Commit(offsetsToCommit);
|
|
||||||
}
|
|
||||||
messages.Clear();
|
|
||||||
}
|
}
|
||||||
|
catch (KafkaException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
||||||
|
throw; // 抛出异常,以便重试
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "处理批量消息时发生未知错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, cts.Token);
|
||||||
|
|
||||||
startTime = DateTime.UtcNow;
|
await Task.CompletedTask;
|
||||||
}
|
});
|
||||||
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
{
|
||||||
throw; // 抛出异常,以便重试
|
|
||||||
}
|
|
||||||
catch (KafkaException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
|
||||||
throw; // 抛出异常,以便重试
|
|
||||||
}
|
|
||||||
catch (OperationCanceledException)
|
|
||||||
{
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "处理批量消息时发生未知错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, cts.Token);
|
|
||||||
|
|
||||||
await Task.CompletedTask;
|
throw;
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -441,7 +474,15 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
|||||||
/// <param name="consumeTimeout">消费等待时间</param>
|
/// <param name="consumeTimeout">消费等待时间</param>
|
||||||
public async Task SubscribeBatchAsync<TValue>(string topic, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null, TimeSpan? consumeTimeout = null) where TValue : class
|
public async Task SubscribeBatchAsync<TValue>(string topic, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null, TimeSpan? consumeTimeout = null) where TValue : class
|
||||||
{
|
{
|
||||||
await SubscribeBatchAsync(new[] { topic }, messageBatchHandler, groupId, batchSize, batchTimeout, consumeTimeout);
|
try
|
||||||
|
{
|
||||||
|
await SubscribeBatchAsync(new[] { topic }, messageBatchHandler, groupId, batchSize, batchTimeout, consumeTimeout);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,116 +499,124 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
|||||||
/// <param name="consumeTimeout">消费等待时间</param>
|
/// <param name="consumeTimeout">消费等待时间</param>
|
||||||
public async Task SubscribeBatchAsync<TValue>(string[] topics, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null, TimeSpan? consumeTimeout = null) where TValue : class
|
public async Task SubscribeBatchAsync<TValue>(string[] topics, Func<List<TValue>, Task<bool>> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null, TimeSpan? consumeTimeout = null) where TValue : class
|
||||||
{
|
{
|
||||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
try
|
||||||
{
|
{
|
||||||
|
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||||
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(Ignore).Name}_{typeof(TValue).Name}";
|
|
||||||
var cts = new CancellationTokenSource();
|
|
||||||
|
|
||||||
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
|
||||||
(
|
|
||||||
CreateConsumer<Ignore, TValue>(groupId),
|
|
||||||
cts
|
|
||||||
)).Consumer as IConsumer<Ignore, TValue>;
|
|
||||||
|
|
||||||
consumer!.Subscribe(topics);
|
|
||||||
|
|
||||||
var timeout = batchTimeout ?? TimeSpan.FromSeconds(5); // 默认超时时间调整为5秒
|
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
{
|
||||||
var messages = new List<(TValue Value, TopicPartitionOffset Offset)>();
|
|
||||||
var startTime = DateTime.UtcNow;
|
|
||||||
|
|
||||||
while (!cts.IsCancellationRequested)
|
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(Ignore).Name}_{typeof(TValue).Name}";
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
|
||||||
|
var consumer = _consumerStore.GetOrAdd(consumerKey, _ =>
|
||||||
|
(
|
||||||
|
CreateConsumer<Ignore, TValue>(groupId),
|
||||||
|
cts
|
||||||
|
)).Consumer as IConsumer<Ignore, TValue>;
|
||||||
|
|
||||||
|
consumer!.Subscribe(topics);
|
||||||
|
|
||||||
|
var timeout = batchTimeout ?? TimeSpan.FromSeconds(5); // 默认超时时间调整为5秒
|
||||||
|
|
||||||
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
var messages = new List<(TValue Value, TopicPartitionOffset Offset)>();
|
||||||
{
|
var startTime = DateTime.UtcNow;
|
||||||
// 非阻塞快速累积消息
|
|
||||||
while (messages.Count < batchSize && (DateTime.UtcNow - startTime) < timeout)
|
|
||||||
{
|
|
||||||
var result = consumer.Consume(TimeSpan.Zero); // 非阻塞调用
|
|
||||||
|
|
||||||
if (result != null)
|
while (!cts.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 非阻塞快速累积消息
|
||||||
|
while (messages.Count < batchSize && (DateTime.UtcNow - startTime) < timeout)
|
||||||
{
|
{
|
||||||
if (result.IsPartitionEOF)
|
var result = consumer.Consume(TimeSpan.Zero); // 非阻塞调用
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
{
|
{
|
||||||
//_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
if (result.IsPartitionEOF)
|
||||||
|
{
|
||||||
|
//_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
||||||
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
|
}
|
||||||
|
else if (result.Message.Value != null)
|
||||||
|
{
|
||||||
|
if (_kafkaOptionConfig.EnableFilter)
|
||||||
|
{
|
||||||
|
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
||||||
|
// 检查 Header 是否符合条件
|
||||||
|
if (!headersFilter.Match(result.Message.Headers))
|
||||||
|
{
|
||||||
|
consumer.Commit(result); // 提交偏移量
|
||||||
|
// 跳过消息
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
messages.Add((result.Message.Value, result.TopicPartitionOffset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 无消息时短暂等待
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
await Task.Delay(DelayTime, cts.Token);
|
||||||
}
|
}
|
||||||
else if (result.Message.Value != null)
|
}
|
||||||
|
|
||||||
|
// 处理批次
|
||||||
|
if (messages.Count > 0)
|
||||||
|
{
|
||||||
|
bool success = await messageBatchHandler(messages.Select(m => m.Value).ToList());
|
||||||
|
if (success)
|
||||||
{
|
{
|
||||||
if (_kafkaOptionConfig.EnableFilter)
|
var offsetsByPartition = new Dictionary<TopicPartition, long>();
|
||||||
|
foreach (var msg in messages)
|
||||||
{
|
{
|
||||||
var headersFilter = new HeadersFilter { { "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) } };
|
var tp = msg.Offset.TopicPartition;
|
||||||
// 检查 Header 是否符合条件
|
var offset = msg.Offset.Offset;
|
||||||
if (!headersFilter.Match(result.Message.Headers))
|
if (!offsetsByPartition.TryGetValue(tp, out var currentMax) || offset > currentMax)
|
||||||
{
|
{
|
||||||
consumer.Commit(result); // 提交偏移量
|
offsetsByPartition[tp] = offset;
|
||||||
// 跳过消息
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
messages.Add((result.Message.Value, result.TopicPartitionOffset));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 无消息时短暂等待
|
|
||||||
await Task.Delay(DelayTime, cts.Token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理批次
|
var offsetsToCommit = offsetsByPartition
|
||||||
if (messages.Count > 0)
|
.Select(kv => new TopicPartitionOffset(kv.Key, new Offset(kv.Value + 1)))
|
||||||
|
.ToList();
|
||||||
|
consumer.Commit(offsetsToCommit);
|
||||||
|
}
|
||||||
|
messages.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
startTime = DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
||||||
{
|
{
|
||||||
bool success = await messageBatchHandler(messages.Select(m => m.Value).ToList());
|
_logger.LogError(ex, $"消息消费失败: {ex.Error.Reason}");
|
||||||
if (success)
|
throw; // 抛出异常,以便重试
|
||||||
{
|
|
||||||
var offsetsByPartition = new Dictionary<TopicPartition, long>();
|
|
||||||
foreach (var msg in messages)
|
|
||||||
{
|
|
||||||
var tp = msg.Offset.TopicPartition;
|
|
||||||
var offset = msg.Offset.Offset;
|
|
||||||
if (!offsetsByPartition.TryGetValue(tp, out var currentMax) || offset > currentMax)
|
|
||||||
{
|
|
||||||
offsetsByPartition[tp] = offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var offsetsToCommit = offsetsByPartition
|
|
||||||
.Select(kv => new TopicPartitionOffset(kv.Key, new Offset(kv.Value + 1)))
|
|
||||||
.ToList();
|
|
||||||
consumer.Commit(offsetsToCommit);
|
|
||||||
}
|
|
||||||
messages.Clear();
|
|
||||||
}
|
}
|
||||||
|
catch (KafkaException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
||||||
|
throw; // 抛出异常,以便重试
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "处理批量消息时发生未知错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, cts.Token);
|
||||||
|
|
||||||
startTime = DateTime.UtcNow;
|
await Task.CompletedTask;
|
||||||
}
|
});
|
||||||
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_logger.LogError(ex, $"消息消费失败: {ex.Error.Reason}");
|
{
|
||||||
throw; // 抛出异常,以便重试
|
|
||||||
}
|
|
||||||
catch (KafkaException ex) when (KafkaPollyPipeline.IsRecoverableError(ex))
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, $"{string.Join("、", topics)} 消息消费失败: {ex.Error.Reason}");
|
|
||||||
throw; // 抛出异常,以便重试
|
|
||||||
}
|
|
||||||
catch (OperationCanceledException)
|
|
||||||
{
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "处理批量消息时发生未知错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, cts.Token);
|
|
||||||
|
|
||||||
await Task.CompletedTask;
|
throw;
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -578,12 +627,20 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
|||||||
/// <typeparam name="TValue"></typeparam>
|
/// <typeparam name="TValue"></typeparam>
|
||||||
public void Unsubscribe<TKey, TValue>(string[] topics, string? groupId) where TKey : notnull where TValue : class
|
public void Unsubscribe<TKey, TValue>(string[] topics, string? groupId) where TKey : notnull where TValue : class
|
||||||
{
|
{
|
||||||
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(TKey).Name}_{typeof(TValue).Name}";
|
try
|
||||||
if (_consumerStore.TryRemove(consumerKey, out var entry))
|
|
||||||
{
|
{
|
||||||
entry.CTS.Cancel();
|
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(TKey).Name}_{typeof(TValue).Name}";
|
||||||
(entry.Consumer as IDisposable)?.Dispose();
|
if (_consumerStore.TryRemove(consumerKey, out var entry))
|
||||||
entry.CTS.Dispose();
|
{
|
||||||
|
entry.CTS.Cancel();
|
||||||
|
(entry.Consumer as IDisposable)?.Dispose();
|
||||||
|
entry.CTS.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -226,6 +226,11 @@ namespace JiShe.CollectBus.Kafka
|
|||||||
// 处理消费错误
|
// 处理消费错误
|
||||||
logger.LogError($"kafka批量消费异常:{ex.Message}");
|
logger.LogError($"kafka批量消费异常:{ex.Message}");
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 处理消费错误
|
||||||
|
logger.LogError($"kafka批量消费异常:{ex.Message}");
|
||||||
|
}
|
||||||
return await Task.FromResult(false);
|
return await Task.FromResult(false);
|
||||||
}, attr.GroupId, attr.BatchSize, attr.BatchTimeout);
|
}, attr.GroupId, attr.BatchSize, attr.BatchTimeout);
|
||||||
}
|
}
|
||||||
@ -248,6 +253,11 @@ namespace JiShe.CollectBus.Kafka
|
|||||||
// 处理消费错误
|
// 处理消费错误
|
||||||
logger.LogError($"kafka消费异常:{ex.Message}");
|
logger.LogError($"kafka消费异常:{ex.Message}");
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 处理消费错误
|
||||||
|
logger.LogError($"kafka批量消费异常:{ex.Message}");
|
||||||
|
}
|
||||||
return await Task.FromResult(false);
|
return await Task.FromResult(false);
|
||||||
}, attr.GroupId);
|
}, attr.GroupId);
|
||||||
}
|
}
|
||||||
@ -260,125 +270,133 @@ namespace JiShe.CollectBus.Kafka
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static async Task<bool> ProcessMessageAsync(List<dynamic> messages, MethodInfo method, object subscribe)
|
private static async Task<bool> ProcessMessageAsync(List<dynamic> messages, MethodInfo method, object subscribe)
|
||||||
{
|
{
|
||||||
var parameters = method.GetParameters();
|
try
|
||||||
bool isGenericTask = method.ReturnType.IsGenericType
|
|
||||||
&& method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>);
|
|
||||||
bool existParameters = parameters.Length > 0;
|
|
||||||
object[]? executeParameters = null;
|
|
||||||
|
|
||||||
if (existParameters)
|
|
||||||
{
|
{
|
||||||
IList? list = null;
|
var parameters = method.GetParameters();
|
||||||
Tuple<Type, Type?> tuple = method.GetParameterTypeInfo();
|
bool isGenericTask = method.ReturnType.IsGenericType
|
||||||
bool isEnumerable = false;
|
&& method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>);
|
||||||
if (tuple.Item2 != null)
|
bool existParameters = parameters.Length > 0;
|
||||||
{
|
object[]? executeParameters = null;
|
||||||
Type listType = typeof(List<>).MakeGenericType(tuple.Item2);
|
|
||||||
list = (IList)Activator.CreateInstance(listType)!;
|
|
||||||
isEnumerable = tuple.Item2.IsConvertType();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
isEnumerable = tuple.Item1.IsConvertType();
|
|
||||||
}
|
|
||||||
#region 暂时
|
|
||||||
//foreach (var msg in messages)
|
|
||||||
//{
|
|
||||||
// if (tuple.Item2 != null)
|
|
||||||
// {
|
|
||||||
// if (isEnumerable)
|
|
||||||
// {
|
|
||||||
// var parameterType = parameters[0].ParameterType;
|
|
||||||
// var data=messages?.Serialize().Deserialize(parameterType);
|
|
||||||
// messageObj = data!=null? new[] { data }:null;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // 集合类型
|
|
||||||
// var data = msg?.Serialize().Deserialize(tuple.Item2) /*isEnumerable ? Convert.ChangeType(msg, tuple.Item2) : msg?.Serialize().Deserialize(tuple.Item2)*/;
|
|
||||||
// if (data != null)
|
|
||||||
// list?.Add(data);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
if (existParameters)
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // (dynamic)Convert.ChangeType(msg, tuple.Item1)
|
|
||||||
// using (var stream = new MemoryStream(msg))
|
|
||||||
// {
|
|
||||||
// var data1= System.Text.Json.JsonSerializer.Deserialize(stream, tuple.Item1);
|
|
||||||
// }
|
|
||||||
// var data = isEnumerable ? System.Text.Json.JsonSerializer.Deserialize(msg, tuple.Item1): msg?.ToString()?.Deserialize(tuple.Item1);
|
|
||||||
// if (data != null)
|
|
||||||
// messageObj = new[] { data };
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//if (tuple.Item2 != null && list != null && list.Count > 0)
|
|
||||||
//{
|
|
||||||
// messageObj = new[] { list };
|
|
||||||
//}
|
|
||||||
#endregion
|
|
||||||
var parameterDescriptors = method.GetParameters();
|
|
||||||
executeParameters = new object?[parameterDescriptors.Length];
|
|
||||||
for (var i = 0; i < parameterDescriptors.Length; i++)
|
|
||||||
{
|
{
|
||||||
foreach (var item in messages)
|
IList? list = null;
|
||||||
|
Tuple<Type, Type?> tuple = method.GetParameterTypeInfo();
|
||||||
|
bool isEnumerable = false;
|
||||||
|
if (tuple.Item2 != null)
|
||||||
{
|
{
|
||||||
|
Type listType = typeof(List<>).MakeGenericType(tuple.Item2);
|
||||||
|
list = (IList)Activator.CreateInstance(listType)!;
|
||||||
|
isEnumerable = tuple.Item2.IsConvertType();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isEnumerable = tuple.Item1.IsConvertType();
|
||||||
|
}
|
||||||
|
#region 暂时
|
||||||
|
//foreach (var msg in messages)
|
||||||
|
//{
|
||||||
|
// if (tuple.Item2 != null)
|
||||||
|
// {
|
||||||
|
// if (isEnumerable)
|
||||||
|
// {
|
||||||
|
// var parameterType = parameters[0].ParameterType;
|
||||||
|
// var data=messages?.Serialize().Deserialize(parameterType);
|
||||||
|
// messageObj = data!=null? new[] { data }:null;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// // 集合类型
|
||||||
|
// var data = msg?.Serialize().Deserialize(tuple.Item2) /*isEnumerable ? Convert.ChangeType(msg, tuple.Item2) : msg?.Serialize().Deserialize(tuple.Item2)*/;
|
||||||
|
// if (data != null)
|
||||||
|
// list?.Add(data);
|
||||||
|
// }
|
||||||
|
|
||||||
object? tempParameter=null;
|
// }
|
||||||
var parameterDescriptor = parameterDescriptors[i];
|
// else
|
||||||
if (KafkaSerialization.IsJsonType(item))
|
// {
|
||||||
{
|
// // (dynamic)Convert.ChangeType(msg, tuple.Item1)
|
||||||
tempParameter = KafkaSerialization.Deserialize(item, tuple.Item2 != null? tuple.Item2: parameterDescriptor.ParameterType);
|
// using (var stream = new MemoryStream(msg))
|
||||||
}
|
// {
|
||||||
else
|
// var data1= System.Text.Json.JsonSerializer.Deserialize(stream, tuple.Item1);
|
||||||
|
// }
|
||||||
|
// var data = isEnumerable ? System.Text.Json.JsonSerializer.Deserialize(msg, tuple.Item1): msg?.ToString()?.Deserialize(tuple.Item1);
|
||||||
|
// if (data != null)
|
||||||
|
// messageObj = new[] { data };
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//if (tuple.Item2 != null && list != null && list.Count > 0)
|
||||||
|
//{
|
||||||
|
// messageObj = new[] { list };
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
var parameterDescriptors = method.GetParameters();
|
||||||
|
executeParameters = new object?[parameterDescriptors.Length];
|
||||||
|
for (var i = 0; i < parameterDescriptors.Length; i++)
|
||||||
|
{
|
||||||
|
foreach (var item in messages)
|
||||||
{
|
{
|
||||||
|
|
||||||
var converter = TypeDescriptor.GetConverter(parameterDescriptor.ParameterType);
|
object? tempParameter = null;
|
||||||
if (converter.CanConvertFrom(item.GetType()))
|
var parameterDescriptor = parameterDescriptors[i];
|
||||||
|
if (KafkaSerialization.IsJsonType(item))
|
||||||
{
|
{
|
||||||
tempParameter = converter.ConvertFrom(item);
|
tempParameter = KafkaSerialization.Deserialize(item, tuple.Item2 != null ? tuple.Item2 : parameterDescriptor.ParameterType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (parameterDescriptor.ParameterType.IsInstanceOfType(item))
|
|
||||||
tempParameter = item;
|
var converter = TypeDescriptor.GetConverter(parameterDescriptor.ParameterType);
|
||||||
|
if (converter.CanConvertFrom(item.GetType()))
|
||||||
|
{
|
||||||
|
tempParameter = converter.ConvertFrom(item);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
tempParameter =Convert.ChangeType(item, parameterDescriptor.ParameterType);
|
{
|
||||||
|
if (parameterDescriptor.ParameterType.IsInstanceOfType(item))
|
||||||
|
tempParameter = item;
|
||||||
|
else
|
||||||
|
tempParameter = Convert.ChangeType(item, parameterDescriptor.ParameterType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tuple.Item2 == null)
|
||||||
|
{
|
||||||
|
executeParameters[i] = tempParameter;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list.Add(tempParameter);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (tuple.Item2 == null)
|
|
||||||
{
|
|
||||||
executeParameters[i] = tempParameter;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
list.Add(tempParameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (list != null && list.Count > 0)
|
||||||
|
executeParameters[i] = list;
|
||||||
}
|
}
|
||||||
if(list!=null && list.Count>0)
|
|
||||||
executeParameters[i] = list;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var result = method.Invoke(subscribe, executeParameters);
|
var result = method.Invoke(subscribe, executeParameters);
|
||||||
if (result is Task<ISubscribeAck> genericTask)
|
if (result is Task<ISubscribeAck> genericTask)
|
||||||
{
|
{
|
||||||
await genericTask.ConfigureAwait(false);
|
await genericTask.ConfigureAwait(false);
|
||||||
return genericTask.Result.Ack;
|
return genericTask.Result.Ack;
|
||||||
|
}
|
||||||
|
else if (result is Task nonGenericTask)
|
||||||
|
{
|
||||||
|
await nonGenericTask.ConfigureAwait(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (result is ISubscribeAck ackResult)
|
||||||
|
{
|
||||||
|
return ackResult.Ack;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else if (result is Task nonGenericTask)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await nonGenericTask.ConfigureAwait(false);
|
|
||||||
return true;
|
throw;
|
||||||
}
|
}
|
||||||
else if (result is ISubscribeAck ackResult)
|
|
||||||
{
|
|
||||||
return ackResult.Ack;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -117,17 +117,25 @@ namespace JiShe.CollectBus.Kafka.Producer
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ProduceAsync<TKey, TValue>(string topic, TKey key, TValue value)where TKey : notnull where TValue : class
|
public async Task ProduceAsync<TKey, TValue>(string topic, TKey key, TValue value)where TKey : notnull where TValue : class
|
||||||
{
|
{
|
||||||
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
try
|
||||||
var producer = GetProducer<TKey, TValue>(typeKey);
|
|
||||||
var message = new Message<TKey, TValue>
|
|
||||||
{
|
{
|
||||||
Key = key,
|
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
||||||
Value = value,
|
var producer = GetProducer<TKey, TValue>(typeKey);
|
||||||
Headers = new Headers{
|
var message = new Message<TKey, TValue>
|
||||||
|
{
|
||||||
|
Key = key,
|
||||||
|
Value = value,
|
||||||
|
Headers = new Headers{
|
||||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await producer.ProduceAsync(topic, message);
|
await producer.ProduceAsync(topic, message);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -139,16 +147,24 @@ namespace JiShe.CollectBus.Kafka.Producer
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ProduceAsync<TValue>(string topic, TValue value) where TValue : class
|
public async Task ProduceAsync<TValue>(string topic, TValue value) where TValue : class
|
||||||
{
|
{
|
||||||
var typeKey = typeof(KafkaProducer<string, TValue>);
|
try
|
||||||
var producer = GetProducer<Null, TValue>(typeKey);
|
|
||||||
var message = new Message<Null, TValue>
|
|
||||||
{
|
{
|
||||||
Value = value,
|
var typeKey = typeof(KafkaProducer<string, TValue>);
|
||||||
Headers = new Headers{
|
var producer = GetProducer<Null, TValue>(typeKey);
|
||||||
|
var message = new Message<Null, TValue>
|
||||||
|
{
|
||||||
|
Value = value,
|
||||||
|
Headers = new Headers{
|
||||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
await producer.ProduceAsync(topic, message);
|
await producer.ProduceAsync(topic, message);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -164,26 +180,34 @@ namespace JiShe.CollectBus.Kafka.Producer
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ProduceAsync<TKey, TValue>(string topic,TKey key,TValue value,int? partition=null, Action<DeliveryReport<TKey, TValue>>? deliveryHandler = null)where TKey : notnull where TValue : class
|
public async Task ProduceAsync<TKey, TValue>(string topic,TKey key,TValue value,int? partition=null, Action<DeliveryReport<TKey, TValue>>? deliveryHandler = null)where TKey : notnull where TValue : class
|
||||||
{
|
{
|
||||||
var message = new Message<TKey, TValue>
|
try
|
||||||
{
|
{
|
||||||
Key = key,
|
var message = new Message<TKey, TValue>
|
||||||
Value = value,
|
{
|
||||||
Headers = new Headers{
|
Key = key,
|
||||||
|
Value = value,
|
||||||
|
Headers = new Headers{
|
||||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
||||||
var producer = GetProducer<TKey, TValue>(typeKey);
|
var producer = GetProducer<TKey, TValue>(typeKey);
|
||||||
if (partition.HasValue)
|
if (partition.HasValue)
|
||||||
{
|
{
|
||||||
var topicPartition = new TopicPartition(topic, new Partition(partition.Value));
|
var topicPartition = new TopicPartition(topic, new Partition(partition.Value));
|
||||||
producer.Produce(topicPartition, message, deliveryHandler);
|
producer.Produce(topicPartition, message, deliveryHandler);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
producer.Produce(topic, message, deliveryHandler);
|
||||||
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
producer.Produce(topic, message, deliveryHandler);
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
await Task.CompletedTask;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,26 +223,34 @@ namespace JiShe.CollectBus.Kafka.Producer
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task ProduceAsync<TValue>(string topic, TValue value, int? partition=null, Action<DeliveryReport<Null, TValue>>? deliveryHandler = null) where TValue : class
|
public async Task ProduceAsync<TValue>(string topic, TValue value, int? partition=null, Action<DeliveryReport<Null, TValue>>? deliveryHandler = null) where TValue : class
|
||||||
{
|
{
|
||||||
var message = new Message<Null, TValue>
|
try
|
||||||
{
|
{
|
||||||
Value = value,
|
var message = new Message<Null, TValue>
|
||||||
Headers = new Headers{
|
{
|
||||||
|
Value = value,
|
||||||
|
Headers = new Headers{
|
||||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var typeKey = typeof(KafkaProducer<Null, TValue>);
|
var typeKey = typeof(KafkaProducer<Null, TValue>);
|
||||||
var producer = GetProducer<Null, TValue>(typeKey);
|
var producer = GetProducer<Null, TValue>(typeKey);
|
||||||
if (partition.HasValue)
|
if (partition.HasValue)
|
||||||
{
|
{
|
||||||
var topicPartition = new TopicPartition(topic,new Partition(partition.Value));
|
var topicPartition = new TopicPartition(topic, new Partition(partition.Value));
|
||||||
//_logger.LogError($"push消息:{topic}-{partition.Value}");
|
//_logger.LogError($"push消息:{topic}-{partition.Value}");
|
||||||
producer.Produce(topicPartition, message, deliveryHandler);
|
producer.Produce(topicPartition, message, deliveryHandler);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
producer.Produce(topic, message, deliveryHandler);
|
||||||
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
else
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
producer.Produce(topic, message, deliveryHandler);
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
await Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|||||||
@ -19,6 +19,7 @@ namespace JiShe.CollectBus.Kafka.Serialization
|
|||||||
{
|
{
|
||||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
||||||
WriteIndented = false,// 设置格式化输出
|
WriteIndented = false,// 设置格式化输出
|
||||||
|
IncludeFields = true,// 允许反序列化到非公共 setter 和字段
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,// 允许特殊字符
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,// 允许特殊字符
|
||||||
IgnoreReadOnlyFields = true,
|
IgnoreReadOnlyFields = true,
|
||||||
IgnoreReadOnlyProperties = true,
|
IgnoreReadOnlyProperties = true,
|
||||||
@ -53,7 +54,7 @@ namespace JiShe.CollectBus.Kafka.Serialization
|
|||||||
{
|
{
|
||||||
if (data.IsEmpty)
|
if (data.IsEmpty)
|
||||||
return default;
|
return default;
|
||||||
return JsonSerializer.Deserialize<T>(data, _options)!;
|
return JsonSerializer.Deserialize<T>(data, _options)!;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -102,24 +103,37 @@ namespace JiShe.CollectBus.Kafka.Serialization
|
|||||||
}
|
}
|
||||||
public static object? Deserialize(object value, Type valueType)
|
public static object? Deserialize(object value, Type valueType)
|
||||||
{
|
{
|
||||||
var _jsonSerializerOptions = new JsonSerializerOptions
|
try
|
||||||
{
|
{
|
||||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
var _jsonSerializerOptions = new JsonSerializerOptions
|
||||||
WriteIndented = false,// 设置格式化输出
|
{
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,// 允许特殊字符
|
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
||||||
IgnoreReadOnlyFields = true,
|
WriteIndented = false,// 设置格式化输出
|
||||||
IgnoreReadOnlyProperties = true,
|
IncludeFields = true,// 允许反序列化到非公共 setter 和字段
|
||||||
NumberHandling = JsonNumberHandling.AllowReadingFromString, // 允许数字字符串
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,// 允许特殊字符
|
||||||
AllowTrailingCommas = true, // 忽略尾随逗号
|
IgnoreReadOnlyFields = true,
|
||||||
ReadCommentHandling = JsonCommentHandling.Skip, // 忽略注释
|
IgnoreReadOnlyProperties = true,
|
||||||
PropertyNameCaseInsensitive = true, // 属性名称大小写不敏感
|
NumberHandling = JsonNumberHandling.AllowReadingFromString, // 允许数字字符串
|
||||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, // 属性名称使用驼峰命名规则
|
AllowTrailingCommas = true, // 忽略尾随逗号
|
||||||
Converters = { new DateTimeJsonConverter() } // 注册你的自定义转换器,
|
ReadCommentHandling = JsonCommentHandling.Skip, // 忽略注释
|
||||||
};
|
PropertyNameCaseInsensitive = true, // 属性名称大小写不敏感
|
||||||
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, // 属性名称使用驼峰命名规则
|
||||||
|
Converters = { new DateTimeJsonConverter() } // 注册你的自定义转换器,
|
||||||
|
};
|
||||||
|
|
||||||
if (value is JsonElement jsonElement) return jsonElement.Deserialize(valueType, _jsonSerializerOptions);
|
if (value is JsonElement jsonElement)
|
||||||
|
{
|
||||||
|
//return jsonElement.Deserialize(valueType, _jsonSerializerOptions);
|
||||||
|
return JsonSerializer.Deserialize(jsonElement, valueType, _jsonSerializerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
throw new NotSupportedException("Type is not of type JsonElement");
|
return null;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace JiShe.CollectBus.Protocol.T1882018.SendData
|
|||||||
{
|
{
|
||||||
var itemCodeArr = request.ItemCode.Split('_');
|
var itemCodeArr = request.ItemCode.Split('_');
|
||||||
var c_data = itemCodeArr[0];//01
|
var c_data = itemCodeArr[0];//01
|
||||||
var d_data = itemCodeArr[1];//91 或者 90
|
var d_data = itemCodeArr[2];//91 或者 90
|
||||||
var dataUnit = new List<string>() { "1F", d_data, "00" };
|
var dataUnit = new List<string>() { "1F", d_data, "00" };
|
||||||
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T1882018.SendData
|
|||||||
{
|
{
|
||||||
var itemCodeArr = request.ItemCode.Split('_');
|
var itemCodeArr = request.ItemCode.Split('_');
|
||||||
var c_data = itemCodeArr[0];//01
|
var c_data = itemCodeArr[0];//01
|
||||||
var d_data = itemCodeArr[1];//55 或者 99
|
var d_data = itemCodeArr[2];//55 或者 99
|
||||||
var dataUnit = new List<string>() { "A0", "17", "00", d_data };
|
var dataUnit = new List<string>() { "A0", "17", "00", d_data };
|
||||||
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
||||||
|
|
||||||
|
|||||||
@ -93,6 +93,8 @@ namespace JiShe.CollectBus.Protocol.T1882018
|
|||||||
//数据转发场景 10H_F1
|
//数据转发场景 10H_F1
|
||||||
if (request.ItemCode == T37612012PacketItemCodeConst.AFN10HFN01H && request.SubProtocolRequest != null && string.IsNullOrWhiteSpace(request.SubProtocolRequest.ItemCode) == false)
|
if (request.ItemCode == T37612012PacketItemCodeConst.AFN10HFN01H && request.SubProtocolRequest != null && string.IsNullOrWhiteSpace(request.SubProtocolRequest.ItemCode) == false)
|
||||||
{
|
{
|
||||||
|
//var subItemCodeArr = request.SubProtocolRequest.ItemCode.Split("_");
|
||||||
|
|
||||||
var t188PacketHandlerName = $"{T1882018PacketItemCodeConst.BasicT1882018}_{request.SubProtocolRequest.ItemCode}_Send";
|
var t188PacketHandlerName = $"{T1882018PacketItemCodeConst.BasicT1882018}_{request.SubProtocolRequest.ItemCode}_Send";
|
||||||
Telemetry1882018PacketResponse t645PacketResponse = null;
|
Telemetry1882018PacketResponse t645PacketResponse = null;
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Consts;
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -38,15 +39,15 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H
|
|||||||
ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询电表信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId= ammeterInfo.FocusId;
|
data.FocusId= deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -35,15 +36,15 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H
|
|||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询电表信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
|
|||||||
DataValue = "Login",
|
DataValue = "Login",
|
||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
|
|||||||
DataValue = "LogOut",
|
DataValue = "LogOut",
|
||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
|
|||||||
DataValue = "Heartbeat",
|
DataValue = "Heartbeat",
|
||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Consts;
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -32,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
var version = AnalysisDataUnit(input.UnitData.HexMessageList);
|
var version = AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||||
version.AreaCode = input.A.Code?.Substring(0, 4);
|
version.AreaCode = input.A.Code?.Substring(0, 4);
|
||||||
@ -42,16 +44,16 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H
|
|||||||
DataValue = version,
|
DataValue = version,
|
||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>>
|
UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Consts;
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -29,6 +30,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
var data = new AnalysisBaseDto<string?>()
|
var data = new AnalysisBaseDto<string?>()
|
||||||
{
|
{
|
||||||
@ -36,16 +38,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H
|
|||||||
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}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -28,6 +29,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
Tuple<int, List<AFN10F10Entity>> tuple = AFN10F10EntityAnalysis(input.UnitData.HexMessageList);
|
Tuple<int, List<AFN10F10Entity>> tuple = AFN10F10EntityAnalysis(input.UnitData.HexMessageList);
|
||||||
|
|
||||||
@ -41,16 +43,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
},
|
},
|
||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>>
|
UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>>
|
||||||
{
|
{
|
||||||
@ -90,22 +92,25 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
SerialNum = $"{sArray[1]}{sArray[0]}".HexToDec(),
|
SerialNum = $"{sArray[1]}{sArray[0]}".HexToDec(),
|
||||||
Point = $"{sArray[3]}{sArray[2]}".HexToDec(),
|
Point = $"{sArray[3]}{sArray[2]}".HexToDec(),
|
||||||
RuleType= GetProtocol(sArray[5]),
|
RuleType= GetProtocol(sArray[5]),
|
||||||
ComAddress= $"{sArray[11]}{sArray[10]}{sArray[9]}{sArray[8]}{sArray[7]}{sArray[6]}",
|
//ComAddress= $"{sArray[11]}{sArray[10]}{sArray[9]}{sArray[8]}{sArray[7]}{sArray[6]}";
|
||||||
ComPwd= $"{sArray[17]}{sArray[16]}{sArray[15]}{sArray[14]}{sArray[13]}{sArray[12]}".Substring(6, 6),
|
//ComPwd= $"{sArray[17]}{sArray[16]}{sArray[15]}{sArray[14]}{sArray[13]}{sArray[12]}".Substring(6, 6),
|
||||||
ElectricityRatesNum= sArray[18].HexToBin().Substring(2, 6).BinToDec(),
|
//ElectricityRatesNum= sArray[18].HexToBin().Substring(2, 6).BinToDec(),
|
||||||
CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}",
|
//CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
aFN10F10Entity.ComAddress = $"{sArray[11]}{sArray[10]}{sArray[9]}{sArray[8]}{sArray[7]}{sArray[6]}";
|
||||||
string baudPort = sArray[4].HexToBin().PadLeft(8, '0'); //波特率和端口号放在一个字节内
|
aFN10F10Entity.ComPwd = $"{sArray[17]}{sArray[16]}{sArray[15]}{sArray[14]}{sArray[13]}{sArray[12]}".Substring(6, 6);
|
||||||
|
aFN10F10Entity.ElectricityRatesNum = sArray[18].HexTo4BinZero().Substring(2, 6).BinToDec();
|
||||||
|
aFN10F10Entity.CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}";
|
||||||
|
string baudPort = sArray[4].HexTo4BinZero().PadLeft(8, '0'); //波特率和端口号放在一个字节内
|
||||||
aFN10F10Entity.BaudRate = GetBaudrate(baudPort.Substring(0, 3));
|
aFN10F10Entity.BaudRate = GetBaudrate(baudPort.Substring(0, 3));
|
||||||
aFN10F10Entity.Port = baudPort.Substring(3, 5).BinToDec();
|
aFN10F10Entity.Port = baudPort.Substring(3, 5).BinToDec();
|
||||||
|
|
||||||
string dataDigit = sArray[19].HexToBin().PadLeft(8, '0'); //有功电能示值整数位及小数位个数
|
string dataDigit = sArray[19].HexTo4BinZero().PadLeft(8, '0'); //有功电能示值整数位及小数位个数
|
||||||
aFN10F10Entity.IntegerBitsNum = dataDigit.Substring(4, 2).BinToDec() + 4;
|
aFN10F10Entity.IntegerBitsNum = dataDigit.Substring(4, 2).BinToDec() + 4;
|
||||||
aFN10F10Entity.DecimalPlacesNum = dataDigit.Substring(6, 2).BinToDec() + 1;
|
aFN10F10Entity.DecimalPlacesNum = dataDigit.Substring(6, 2).BinToDec() + 1;
|
||||||
|
|
||||||
string classNo = sArray[26].HexToBin().PadLeft(8, '0');//用户大类号及用户小类号
|
string classNo = sArray[26].HexTo4BinZero().PadLeft(8, '0');//用户大类号及用户小类号
|
||||||
aFN10F10Entity.UserCategoryNum = classNo.Substring(0, 4).BinToDec() + 1;
|
aFN10F10Entity.UserCategoryNum = classNo.Substring(0, 4).BinToDec() + 1;
|
||||||
aFN10F10Entity.UserCategoryNum = classNo.Substring(4, 4).BinToDec() + 1;
|
aFN10F10Entity.UserCategoryNum = classNo.Substring(4, 4).BinToDec() + 1;
|
||||||
aFN10F10Entitys.Add(aFN10F10Entity);
|
aFN10F10Entitys.Add(aFN10F10Entity);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -32,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
|
|
||||||
var data = new AnalysisBaseDto<AFN10_F66_AnalysisDto?>()
|
var data = new AnalysisBaseDto<AFN10_F66_AnalysisDto?>()
|
||||||
@ -40,16 +42,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
DataValue = await GenerateFinalResult(input.UnitData.HexMessageList),
|
DataValue = await GenerateFinalResult(input.UnitData.HexMessageList),
|
||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>>
|
UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>>
|
||||||
{
|
{
|
||||||
@ -80,7 +82,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
public async Task<AFN10_F66_AnalysisDto> GenerateFinalResult(List<string> hexMessageList)
|
public async Task<AFN10_F66_AnalysisDto> GenerateFinalResult(List<string> hexMessageList)
|
||||||
{
|
{
|
||||||
AFN10_F66_AnalysisDto entity = new AFN10_F66_AnalysisDto();
|
AFN10_F66_AnalysisDto entity = new AFN10_F66_AnalysisDto();
|
||||||
var cycleBin = hexMessageList[4].HexToBin().PadLeft(8, '0');
|
var cycleBin = hexMessageList[4].HexTo4BinZero().PadLeft(8, '0');
|
||||||
var cycleUnitBin = cycleBin.Substring(0, 2);
|
var cycleUnitBin = cycleBin.Substring(0, 2);
|
||||||
var cycleValueBin = cycleBin.Substring(2, 6);
|
var cycleValueBin = cycleBin.Substring(2, 6);
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -28,6 +29,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
var data = new AnalysisBaseDto<bool?>()
|
var data = new AnalysisBaseDto<bool?>()
|
||||||
{
|
{
|
||||||
@ -35,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
|||||||
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}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.FocusId;
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.Address;
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
data.DeviceType = MeterTypeEnum.Focus;
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IoTDB.Interface;
|
using JiShe.CollectBus.IoTDB.Interface;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -34,6 +35,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
ArgumentNullException.ThrowIfNull(input.A.A3?.D1_D7);
|
ArgumentNullException.ThrowIfNull(input.A.A3?.D1_D7);
|
||||||
UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>>
|
UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>>
|
||||||
@ -55,17 +57,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code,input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
list.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -33,22 +34,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向无功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向无功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
list.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -34,22 +35,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向有功总电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向有功总电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
list.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -35,23 +36,24 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向无功电能示值", dataType);
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向无功电能示值", dataType);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
list.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -36,20 +37,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string itemType = $"{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<decimal?> data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", itemType);
|
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", itemType);
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -36,21 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> datas = await AnalysisDataUnit(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||||
string itemType = $"{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<decimal?> data = GenerateFinalResult(datas, itemType,"上月(上一结算日)正向有功最大需量及发生时间");
|
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, itemType,"上月(上一结算日)正向有功最大需量及发生时间");
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID=ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress= ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -36,21 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN);
|
ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN);
|
||||||
ArgumentNullException.ThrowIfNull(input.DT.Fn);
|
ArgumentNullException.ThrowIfNull(input.DT.Fn);
|
||||||
string itemType = $"{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<decimal?> data = GenerateFinalResult(input.UnitData.HexMessageList, itemType);
|
AnalysisBaseDto<decimal?> data = GenerateFinalResult(input.UnitData.HexMessageList, itemType);
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> dto = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
UnitDataAnalysis<AnalysisBaseDto<decimal?>> dto = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -37,6 +38,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> remarks = new List<string>() { "当前总有功功率", "当前A相有功功率", "当前B相有功功率", "当前C相有功功率", "当前总无功功率", "当前A相无功功率", "当前B相无功功率", "当前C相无功功率", "当前总功率因数", "当前A相功率因数", "当前B相功率因数", "当前C相功率因数", "当前A相电压", "当前B相电压", "当前C相电压", "当前A相电流", "当前C相电流", "当前 C相电流", "当前零序电流", "当前总视在功率", "当前A相视在功率", "当前B相视在功率", "当前C相视在功率" };
|
List<string> remarks = new List<string>() { "当前总有功功率", "当前A相有功功率", "当前B相有功功率", "当前C相有功功率", "当前总无功功率", "当前A相无功功率", "当前B相无功功率", "当前C相无功功率", "当前总功率因数", "当前A相功率因数", "当前B相功率因数", "当前C相功率因数", "当前A相电压", "当前B相电压", "当前C相电压", "当前A相电流", "当前C相电流", "当前 C相电流", "当前零序电流", "当前总视在功率", "当前A相视在功率", "当前B相视在功率", "当前C相视在功率" };
|
||||||
List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
|
List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
|
||||||
@ -68,17 +70,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
}
|
}
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].ItemType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
list.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ using JiShe.CollectBus.Protocol.T37612012.AnalysisData;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
using static FreeSql.Internal.GlobalFilter;
|
using static FreeSql.Internal.GlobalFilter;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||||
{
|
{
|
||||||
@ -36,19 +37,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
string itemType = $"{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, itemType);
|
var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, itemType);
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -35,6 +36,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
int rationgCount = input.UnitData.HexMessageList!.GetRatingCount(23, 1);
|
int rationgCount = input.UnitData.HexMessageList!.GetRatingCount(23, 1);
|
||||||
|
|
||||||
@ -46,15 +48,15 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
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}"
|
ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>>
|
UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -36,7 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
List<string> data = await AnalysisDataUnitAsync(input.UnitData?.HexMessageList!);
|
List<string> data = await AnalysisDataUnitAsync(input.UnitData?.HexMessageList!);
|
||||||
List<string> remarks = new List<string>() { "Uab/Ua 相位角", "Ub 相位角", "Ucb/Uc 相位角", "Ia 相位角", "Ib 相位角", "Ic 相位角" };
|
List<string> remarks = new List<string>() { "Uab/Ua 相位角", "Ub 相位角", "Ucb/Uc 相位角", "Ia 相位角", "Ib 相位角", "Ic 相位角" };
|
||||||
List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
|
List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
|
||||||
@ -64,17 +65,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
}
|
}
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
list.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -33,27 +35,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能量");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能量");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能示值");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
@ -38,21 +41,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
|
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能示值");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,6 +34,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
@ -39,21 +42,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
|
|
||||||
string itemType = $"{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<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, itemType, "反向有功总电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, itemType, "反向有功总电能示值");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能示值");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "功率因数");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "功率因数");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相功率因数");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相功率因数");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相功率因数");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相功率因数");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相功率因数");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相功率因数");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
using YamlDotNet.Core.Tokens;
|
using YamlDotNet.Core.Tokens;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
@ -33,25 +35,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas,3, dataType, "抄表日冻结电能表正向有功最大需量及发生时间");
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas,3, dataType, "抄表日冻结电能表正向有功最大需量及发生时间");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "一象限无功电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "一象限无功电能示值");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -39,20 +41,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "四象限无功电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "四象限无功电能示值");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "二象限无功电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "二象限无功电能示值");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "三象限无功电能示值");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "三象限无功电能示值");
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,27 +33,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType,timeSpan, "正向有功总电能示值").IsValidData(new List<string>() { "0D_161", "0D_161_1", "0D_161_2", "0D_161_3", "0D_161_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType,timeSpan, "正向有功总电能示值").IsValidData(new List<string>() { "0D_161", "0D_161_1", "0D_161_2", "0D_161_3", "0D_161_4" });
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "正向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_162", "0D_162_1", "0D_162_2", "0D_162_3", "0D_162_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "正向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_162", "0D_162_1", "0D_162_2", "0D_162_3", "0D_162_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,26 +33,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_163", "0D_163_1", "0D_163_2", "0D_163_3", "0D_163_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_163", "0D_163_1", "0D_163_2", "0D_163_3", "0D_163_4" });
|
||||||
|
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结反向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_164", "0D_164_1", "0D_164_2", "0D_164_3", "0D_164_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结反向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_164", "0D_164_1", "0D_164_2", "0D_164_3", "0D_164_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结一象限无功电能示值").IsValidData(new List<string>() { "0D_165", "0D_165_1", "0D_165_2", "0D_165_3", "0D_165_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结一象限无功电能示值").IsValidData(new List<string>() { "0D_165", "0D_165_1", "0D_165_2", "0D_165_3", "0D_165_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结二象限无功电能示值").IsValidData(new List<string>() { "0D_166", "0D_166_1", "0D_166_2", "0D_166_3", "0D_166_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结二象限无功电能示值").IsValidData(new List<string>() { "0D_166", "0D_166_1", "0D_166_2", "0D_166_3", "0D_166_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结三象限无功电能示值").IsValidData(new List<string>() { "0D_167", "0D_167_1", "0D_167_2", "0D_167_3", "0D_167_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结三象限无功电能示值").IsValidData(new List<string>() { "0D_167", "0D_167_1", "0D_167_2", "0D_167_3", "0D_167_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结四象限无功电能示值").IsValidData(new List<string>() { "0D_168", "0D_168_1", "0D_168_2", "0D_168_3", "0D_168_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结四象限无功电能示值").IsValidData(new List<string>() { "0D_168", "0D_168_1", "0D_168_2", "0D_168_3", "0D_168_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向有功电能示值").IsValidData(new List<string>() { "0D_177", "0D_177_1", "0D_177_2", "0D_177_3", "0D_177_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向有功电能示值").IsValidData(new List<string>() { "0D_177", "0D_177_1", "0D_177_2", "0D_177_3", "0D_177_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_178", "0D_178_1", "0D_178_2", "0D_178_3", "0D_178_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_178", "0D_178_1", "0D_178_2", "0D_178_3", "0D_178_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_179", "0D_179_1", "0D_179_2", "0D_179_3", "0D_179_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_179", "0D_179_1", "0D_179_2", "0D_179_3", "0D_179_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结反向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_180", "0D_180_1", "0D_180_2", "0D_180_3", "0D_180_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结反向无功(组合无功 1)电能示值").IsValidData(new List<string>() { "0D_180", "0D_180_1", "0D_180_2", "0D_180_3", "0D_180_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结一象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_181", "0D_181_1", "0D_181_2", "0D_181_3", "0D_181_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结一象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_181", "0D_181_1", "0D_181_2", "0D_181_3", "0D_181_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结二象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_182", "0D_182_1", "0D_182_2", "0D_182_3", "0D_182_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结二象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_182", "0D_182_1", "0D_182_2", "0D_182_3", "0D_182_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结三象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_183", "0D_183_1", "0D_183_2", "0D_183_3", "0D_183_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结三象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_183", "0D_183_1", "0D_183_2", "0D_183_3", "0D_183_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结四象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_184", "0D_184_1", "0D_184_2", "0D_184_3", "0D_184_4" });
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结四象限无功电能示值(总、费率 1~M)").IsValidData(new List<string>() { "0D_184", "0D_184_1", "0D_184_2", "0D_184_3", "0D_184_4" });
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "抄表日冻结正向有功最大需量及发生时间");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "抄表日冻结正向有功最大需量及发生时间");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -33,21 +34,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "抄表日冻结正向无功最大需量及发生时间", dataType);
|
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "抄表日冻结正向无功最大需量及发生时间", dataType);
|
||||||
|
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using JiShe.CollectBus.IotSystems.Ammeters;
|
|||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
using static FreeSql.Internal.GlobalFilter;
|
using static FreeSql.Internal.GlobalFilter;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,21 +35,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结正向有功最大需量及发生时间", dataType);
|
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结正向有功最大需量及发生时间", dataType);
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using JiShe.CollectBus.IotSystems.Ammeters;
|
|||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
using static FreeSql.Internal.GlobalFilter;
|
using static FreeSql.Internal.GlobalFilter;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,21 +35,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结反向有功最大需量及发生时间", dataType);
|
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结反向有功最大需量及发生时间", dataType);
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,6 +12,8 @@ using JiShe.CollectBus.IotSystems.Ammeters;
|
|||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using YamlDotNet.Core.Tokens;
|
using YamlDotNet.Core.Tokens;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -35,24 +37,25 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas, dataType, "月冻结电能表正向有功最大需量及发生时间");
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas, dataType, "月冻结电能表正向有功最大需量及发生时间");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -12,6 +12,8 @@ using Volo.Abp.Domain.Entities;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -35,6 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
@ -42,20 +45,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
//冻结数据时标
|
//冻结数据时标
|
||||||
var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas,dataType, "日冻结正向有/无功最大需量及发生时间");
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas,dataType, "日冻结正向有/无功最大需量及发生时间");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,7 +70,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -11,6 +11,8 @@ using AutoMapper.Internal.Mappers;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,6 +36,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
@ -41,20 +44,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
//冻结数据时标
|
//冻结数据时标
|
||||||
var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas, dataType, "日冻结反向有/无功最大需量及发生时间");
|
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas, dataType, "日冻结反向有/无功最大需量及发生时间");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = 1,//密度-间隔,
|
TimeDensity = 1,//密度-间隔,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "有功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "有功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相有功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相有功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相有功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相有功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相有功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相有功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "无功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "无功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相无功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相无功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相无功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相无功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相无功功率曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相无功功率曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电压曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电压曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电压曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电压曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
|||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电压曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电压曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电流曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电流曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电流曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电流曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电流曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电流曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "测量点零序电流曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "测量点零序电流曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能量曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能量曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能量曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能量曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||||
{
|
{
|
||||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
|
|
||||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向有功总电能量曲线");
|
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "反向有功总电能量曲线");
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.MeterId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
|||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
MSA = input.A.A3!.D1_D7!,
|
MSA = input.A.A3!.D1_D7!,
|
||||||
PSEQ = input.SEQ.PSEQ,
|
PSEQ = input.SEQ.PSEQ,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
TimeDensity = density,//密度-间隔分钟数,
|
TimeDensity = density,//密度-间隔分钟数,
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -9,6 +10,7 @@ using JiShe.CollectBus.Protocol3761;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
||||||
{
|
{
|
||||||
@ -31,8 +33,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(nameof(input));
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
ArgumentNullException.ThrowIfNull(nameof(input.UnitData.HexMessageList));
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
int erc = input.UnitData.HexMessageList![8].HexToDec();
|
int erc = input.UnitData.HexMessageList![8].HexToDec();
|
||||||
bool isOnOffPower = erc.Equals(14) ? true : false;
|
bool isOnOffPower = erc.Equals(14) ? true : false;
|
||||||
if (!isOnOffPower)
|
if (!isOnOffPower)
|
||||||
@ -42,21 +45,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
|||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AnalysisBaseDto<string>> data = AnalysisDataUnit(input.UnitData.HexMessageList);
|
List<AnalysisBaseDto<string>> list = AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||||
if (data.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ForEach(item =>
|
list.ForEach(item =>
|
||||||
{
|
{
|
||||||
item.ProjectId = ammeterInfo.ProjectID;
|
item.ProjectId = deviceInfo.ProjectID;
|
||||||
item.DeviceId = ammeterInfo.FocusId;
|
item.DeviceId = deviceInfo.MeterId;
|
||||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
item.DeviceAddress = ammeterInfo.Address;
|
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
item.DeviceType = MeterTypeEnum.Focus;
|
item.DeviceType = MeterTypeEnum.Focus;
|
||||||
item.FocusId = ammeterInfo.FocusId;
|
item.FocusId = deviceInfo.FocusId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
|||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
Fn = input.DT.Fn,
|
Fn = input.DT.Fn,
|
||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
Data = data,
|
Data = list,
|
||||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
MessageId = input.MessageId,
|
MessageId = input.MessageId,
|
||||||
ReceivedTime = input.ReceivedTime,
|
ReceivedTime = input.ReceivedTime,
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -30,6 +31,7 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||||
var data = new AnalysisBaseDto<string?>()
|
var data = new AnalysisBaseDto<string?>()
|
||||||
{
|
{
|
||||||
@ -37,15 +39,15 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
|||||||
DataValue = AnalysisDataUnit(input.UnitData.HexMessageList),
|
DataValue = AnalysisDataUnit(input.UnitData.HexMessageList),
|
||||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
};
|
};
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
using GatherService.WattMeter.AnalysisData.AFN_10H;
|
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.Extensions;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -21,11 +24,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
{
|
{
|
||||||
private readonly ILogger<AFN16_F1_Analysis> _logger;
|
private readonly ILogger<AFN16_F1_Analysis> _logger;
|
||||||
private readonly AnalysisStrategyContext _analysisStrategyContext;
|
private readonly AnalysisStrategyContext _analysisStrategyContext;
|
||||||
|
private readonly DataStorage _dataStorage;
|
||||||
public AFN16_F1_Analysis(ILogger<AFN16_F1_Analysis> logger, AnalysisStrategyContext analysisStrategyContext)
|
public AFN16_F1_Analysis(ILogger<AFN16_F1_Analysis> logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_analysisStrategyContext = analysisStrategyContext;
|
_analysisStrategyContext = analysisStrategyContext;
|
||||||
|
_dataStorage = dataStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> ExecuteAsync(TB3761 input, Action<dynamic>? result = null)
|
public async Task<bool> ExecuteAsync(TB3761 input, Action<dynamic>? result = null)
|
||||||
@ -33,6 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.BaseHexMessage.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.BaseHexMessage.HexMessageList);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageString);
|
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageString);
|
||||||
// TODO: 待定,等确认如何匹配规则
|
// TODO: 待定,等确认如何匹配规则
|
||||||
@ -44,10 +49,45 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
{
|
{
|
||||||
result?.Invoke(dto);
|
result?.Invoke(dto);
|
||||||
});
|
});
|
||||||
//else if (value.Contains(F10TranspondMatch.ReadData))//读取电表地址
|
else if (value.Contains(F10TranspondMatch.JumpClosingNormal) || value.Contains(F10TranspondMatch.JumpClosingError))//跳合闸
|
||||||
// result = "AFN16_F105_Analysis";
|
await _analysisStrategyContext.ExecuteAsync<TB3761>(nameof(AFN16_F98_Analysis), input, dto =>
|
||||||
|
{
|
||||||
|
result?.Invoke(dto);
|
||||||
|
});
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//TODO: 写入1条日志
|
||||||
|
var data = new AnalysisBaseDto<string?>()
|
||||||
|
{
|
||||||
|
FiledDesc = "透明转发",
|
||||||
|
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||||
|
};
|
||||||
|
// 查询设备信息
|
||||||
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||||
|
if (deviceInfo != null)
|
||||||
|
{
|
||||||
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
|
data.DeviceId = deviceInfo.FocusId;
|
||||||
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
|
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||||
|
data.DeviceType = MeterTypeEnum.Focus;
|
||||||
|
data.FocusId = deviceInfo.FocusId;
|
||||||
|
}
|
||||||
|
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
||||||
|
{
|
||||||
|
Code = input.A.Code,
|
||||||
|
AFN = input.AFN_FC.AFN,
|
||||||
|
Fn = input.DT.Fn,
|
||||||
|
Pn = input.DA.Pn,
|
||||||
|
Data = data,
|
||||||
|
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||||
|
MessageId = input.MessageId,
|
||||||
|
ReceivedTime = input.ReceivedTime,
|
||||||
|
DensityUnit = DensityUnit.None,
|
||||||
|
TimeDensity = -1,
|
||||||
|
DataType = IOTDBDataTypeConst.Log
|
||||||
|
};
|
||||||
|
await _dataStorage.SaveDataToIotDbAsync<string?>(dto);
|
||||||
_logger.LogWarning($"未能找到透明传发解析方式:{input.BaseHexMessage.HexMessageString}");
|
_logger.LogWarning($"未能找到透明传发解析方式:{input.BaseHexMessage.HexMessageString}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +96,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, $"10_101解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
|
_logger.LogError(ex, $"10_1解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
|
||||||
|
|
||||||
}
|
}
|
||||||
return await Task.FromResult(false);
|
return await Task.FromResult(false);
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
using GatherService.WattMeter.AnalysisData.AFN_10H;
|
using DeviceDetectorNET.Parser.Device;
|
||||||
|
using GatherService.WattMeter.AnalysisData.AFN_10H;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -38,20 +40,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas);
|
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas);
|
||||||
|
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn, datas[1]);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||||
{
|
{
|
||||||
@ -85,8 +88,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
private AnalysisBaseDto<decimal?> GenerateFinalResult(List<string> data)
|
private AnalysisBaseDto<decimal?> GenerateFinalResult(List<string> data)
|
||||||
{
|
{
|
||||||
AnalysisBaseDto<decimal?> meter = new AnalysisBaseDto<decimal?>();
|
AnalysisBaseDto<decimal?> meter = new AnalysisBaseDto<decimal?>();
|
||||||
|
meter.DeviceType = MeterTypeEnum.Ammeter;
|
||||||
var errorCode = data[7].CheckErrorCode();
|
var errorCode = data[4].CheckErrorCode();
|
||||||
if (errorCode != null)
|
if (errorCode != null)
|
||||||
{
|
{
|
||||||
meter.ValidData = false;
|
meter.ValidData = false;
|
||||||
@ -94,7 +97,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(decimal.TryParse(data[7], out decimal value))
|
if(decimal.TryParse(data[4], out decimal value))
|
||||||
meter.DataValue = value;
|
meter.DataValue = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +134,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
|||||||
string dataMark = string.Join("",dataField.GetRange(0, 4).ReduceHex33(true));
|
string dataMark = string.Join("",dataField.GetRange(0, 4).ReduceHex33(true));
|
||||||
values.Add(dataMark);//数据标识
|
values.Add(dataMark);//数据标识
|
||||||
var readValue = dataField.GetRange(4, len - 4).ReduceHex33(true);//值
|
var readValue = dataField.GetRange(4, len - 4).ReduceHex33(true);//值
|
||||||
await _analysisStrategyContext.ExecuteAsync<List<string>>($" Appendix_{dataMark}", readValue, (value) =>
|
await _analysisStrategyContext.ExecuteAsync<List<string>>($"Appendix_{dataMark}", readValue, (value) =>
|
||||||
{
|
{
|
||||||
values.Add(value.ToString());
|
values.Add(value.ToString());
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.Protocol;
|
using JiShe.CollectBus.Protocol;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
@ -33,6 +34,7 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
|
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
|
|
||||||
List<string> datas = AnalysisDataUnit(input.UnitData.HexMessageList);
|
List<string> datas = AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||||
@ -44,15 +46,15 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
|||||||
ItemType= "10_98",
|
ItemType= "10_98",
|
||||||
};
|
};
|
||||||
|
|
||||||
// 查询电表信息
|
// 查询设备信息
|
||||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||||
if (ammeterInfo != null)
|
if (deviceInfo != null)
|
||||||
{
|
{
|
||||||
data.ProjectId = ammeterInfo.ProjectID;
|
data.ProjectId = deviceInfo.ProjectID;
|
||||||
data.DeviceId = ammeterInfo.MeterId;
|
data.DeviceId = deviceInfo.MeterId;
|
||||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||||
data.FocusId = ammeterInfo.FocusId;
|
data.FocusId = deviceInfo.FocusId;
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<AnalysisBaseDto<bool?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
UnitDataAnalysis<AnalysisBaseDto<bool?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,26 +1,33 @@
|
|||||||
using JiShe.CollectBus.Common;
|
using FreeRedis;
|
||||||
|
using JiShe.CollectBus.Common;
|
||||||
using JiShe.CollectBus.Common.Consts;
|
using JiShe.CollectBus.Common.Consts;
|
||||||
using JiShe.CollectBus.Common.Encrypt;
|
using JiShe.CollectBus.Common.Encrypt;
|
||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
|
using JiShe.CollectBus.FreeRedis;
|
||||||
using JiShe.CollectBus.IoTDB.Context;
|
using JiShe.CollectBus.IoTDB.Context;
|
||||||
using JiShe.CollectBus.IoTDB.Interface;
|
using JiShe.CollectBus.IoTDB.Interface;
|
||||||
using JiShe.CollectBus.IoTDB.Model;
|
using JiShe.CollectBus.IoTDB.Model;
|
||||||
using JiShe.CollectBus.IoTDB.Options;
|
using JiShe.CollectBus.IoTDB.Options;
|
||||||
using JiShe.CollectBus.IoTDB.Provider;
|
using JiShe.CollectBus.IoTDB.Provider;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.Devices;
|
||||||
using JiShe.CollectBus.IotSystems.LogRecord;
|
using JiShe.CollectBus.IotSystems.LogRecord;
|
||||||
using JiShe.CollectBus.IotSystems.MeterReadingRecords;
|
using JiShe.CollectBus.IotSystems.MeterReadingRecords;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.Metrics;
|
using System.Diagnostics.Metrics;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
using TouchSocket.Core;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
using Volo.Abp.Guids;
|
using Volo.Abp.Guids;
|
||||||
|
using YamlDotNet.Core.Tokens;
|
||||||
using static FreeSql.Internal.GlobalFilter;
|
using static FreeSql.Internal.GlobalFilter;
|
||||||
using static JiShe.CollectBus.Common.Consts.T37612012PacketItemCodeConst;
|
using static JiShe.CollectBus.Common.Consts.T37612012PacketItemCodeConst;
|
||||||
|
|
||||||
@ -31,21 +38,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
private readonly IGuidGenerator _guidGenerator;
|
private readonly IGuidGenerator _guidGenerator;
|
||||||
private readonly IIoTDbProvider _dbProvider;
|
private readonly IIoTDbProvider _dbProvider;
|
||||||
private readonly ServerApplicationOptions _applicationOptions;
|
private readonly ServerApplicationOptions _applicationOptions;
|
||||||
private readonly IoTDBRuntimeContext _runtimeContext;
|
|
||||||
private readonly ILogger<DataStorage> _logger;
|
private readonly ILogger<DataStorage> _logger;
|
||||||
|
private readonly IMemoryCache _imemoryCache;
|
||||||
|
private readonly IFreeRedisProvider _freeRedisProvider;
|
||||||
|
private RedisClient Instance { get; set; }
|
||||||
public DataStorage(IIoTDbProvider dbProvider, IOptions<ServerApplicationOptions> applicationOptions,
|
public DataStorage(IIoTDbProvider dbProvider, IOptions<ServerApplicationOptions> applicationOptions,
|
||||||
IGuidGenerator guidGenerator, IoTDBRuntimeContext runtimeContext, ILogger<DataStorage> logger)
|
IGuidGenerator guidGenerator, ILogger<DataStorage> logger, IMemoryCache memoryCache, IFreeRedisProvider freeRedisProvider)
|
||||||
{
|
{
|
||||||
_dbProvider= dbProvider;
|
_dbProvider= dbProvider;
|
||||||
_applicationOptions = applicationOptions.Value;
|
_applicationOptions = applicationOptions.Value;
|
||||||
_guidGenerator= guidGenerator;
|
_guidGenerator= guidGenerator;
|
||||||
_runtimeContext= runtimeContext;
|
|
||||||
_logger= logger;
|
_logger= logger;
|
||||||
|
_imemoryCache = memoryCache;
|
||||||
|
_freeRedisProvider = freeRedisProvider;
|
||||||
|
Instance = _freeRedisProvider.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 日志保存通道写入
|
/// 日志保存通道写入
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -64,21 +72,43 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
await channelWriter.WriteAsync(dataItems);
|
await channelWriter.WriteAsync(dataItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取缓存电表信息
|
/// 获取缓存设备信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="meterType"></param>
|
/// <param name="meterType"></param>
|
||||||
/// <param name="timeDensity"></param>
|
/// <param name="timeDensity"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<AmmeterInfo> GetMeterInfoAsync(string meterType,string timeDensity="15")
|
public async Task<DeviceInfo?> GetDeviceInfoAsync(string code,int pn=1,string meterAddress=null)
|
||||||
{
|
{
|
||||||
var redisCacheMeterInfoHashKeyTemp = $"{string.Format(RedisConst.CacheDeviceInfoHashKey, _applicationOptions.SystemType, _applicationOptions.ServerTagName, meterType, timeDensity)}";
|
string redisCacheDeviceInfoHashKey = $"{string.Format(RedisConst.CacheDeviceInfoHashKey, _applicationOptions.SystemType, _applicationOptions.ServerTagName)}";
|
||||||
// TODO:临时写死,等确认后如何取再调整
|
string deviceKey= $"{code}:{pn}";
|
||||||
return await Task.FromResult(new AmmeterInfo() {
|
var deviceInfo= await _imemoryCache.GetOrCreateAsync(deviceKey, async entry =>
|
||||||
ProjectID = 10000,
|
{
|
||||||
MeterId=11111,
|
List<DeviceInfo> devices= await Instance.HGetAsync<List<DeviceInfo>>(redisCacheDeviceInfoHashKey, code) ?? new List<DeviceInfo>();
|
||||||
FocusId=22222
|
var data = devices.Where(s => s.MeteringCode == pn).FirstOrDefault();
|
||||||
|
if (data != null)
|
||||||
|
entry.SetSlidingExpiration(TimeSpan.FromMinutes(5));
|
||||||
|
else
|
||||||
|
entry.SetSlidingExpiration(TimeSpan.FromSeconds(5));
|
||||||
|
return data ?? default;
|
||||||
});
|
});
|
||||||
|
if (deviceInfo == null && !string.IsNullOrWhiteSpace(meterAddress))
|
||||||
|
{
|
||||||
|
// TODO:透明转发回来的pn为0情况
|
||||||
|
string deviceAddressKey = $"{code}:{meterAddress}";
|
||||||
|
deviceInfo = await _imemoryCache.GetOrCreateAsync(deviceAddressKey, async entry =>
|
||||||
|
{
|
||||||
|
List<DeviceInfo> devices = await Instance.HGetAsync<List<DeviceInfo>>(redisCacheDeviceInfoHashKey, code) ?? new List<DeviceInfo>();
|
||||||
|
var data = devices.Where(s => s.MeterAddress == meterAddress).FirstOrDefault();
|
||||||
|
if (data != null)
|
||||||
|
entry.SetSlidingExpiration(TimeSpan.FromMinutes(5));
|
||||||
|
else
|
||||||
|
entry.SetSlidingExpiration(TimeSpan.FromSeconds(5));
|
||||||
|
return data ?? default;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return deviceInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -127,8 +157,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
Timestamps = data.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(),
|
Timestamps = data.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(),
|
||||||
SingleMeasuring = (data.FiledName ?? string.Empty, data.DataValue ?? default)
|
SingleMeasuring = (data.FiledName ?? string.Empty, data.DataValue ?? default)
|
||||||
};
|
};
|
||||||
_runtimeContext.UseTableSessionPool = true; // 使用表模型池
|
|
||||||
var taskSendInfo = await _dbProvider.QueryAsync<MeterReadingTelemetryPacketInfo>(new IoTDBQueryOptions() { TableNameOrTreePath = DevicePathBuilder.GetTableName<MeterReadingTelemetryPacketInfo>(), Conditions = conditions, PageIndex = 0, PageSize = 1 });
|
var taskSendInfo = await _dbProvider.GetSessionPool(true).QueryAsync<MeterReadingTelemetryPacketInfo>(new IoTDBQueryOptions() { TableNameOrTreePath = DevicePathBuilder.GetTableName<MeterReadingTelemetryPacketInfo>(), Conditions = conditions, PageIndex = 0, PageSize = 1 });
|
||||||
var taskData = taskSendInfo?.Items.FirstOrDefault();
|
var taskData = taskSendInfo?.Items.FirstOrDefault();
|
||||||
if (taskData != null)
|
if (taskData != null)
|
||||||
{
|
{
|
||||||
@ -173,13 +203,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
ReceivedTime = analysisBaseDto.ReceivedTime,
|
ReceivedTime = analysisBaseDto.ReceivedTime,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
_runtimeContext.UseTableSessionPool = true; // 使树模型池
|
await _dbProvider.GetSessionPool(true).InsertAsync(taskData);
|
||||||
await _dbProvider.InsertAsync(taskData);
|
|
||||||
//如果无字段名,则不保存数据
|
//如果无字段名,则不保存数据
|
||||||
if (!string.IsNullOrWhiteSpace(data.FiledName))
|
if (!string.IsNullOrWhiteSpace(data.FiledName))
|
||||||
{
|
{
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(false).InsertAsync(meter);
|
||||||
await _dbProvider.InsertAsync(meter);
|
|
||||||
}
|
}
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
@ -236,8 +264,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
Timestamps = item.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(), // TODO:这里暂时格式化15分钟数据,需要进行调整
|
Timestamps = item.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(), // TODO:这里暂时格式化15分钟数据,需要进行调整
|
||||||
SingleMeasuring =(item.FiledName ?? string.Empty, item.DataValue ?? default)
|
SingleMeasuring =(item.FiledName ?? string.Empty, item.DataValue ?? default)
|
||||||
};
|
};
|
||||||
_runtimeContext.UseTableSessionPool = true; // 使用表模型池
|
var taskSendInfo = await _dbProvider.GetSessionPool(true).QueryAsync<MeterReadingTelemetryPacketInfo>(new IoTDBQueryOptions() { TableNameOrTreePath = DevicePathBuilder.GetTableName<MeterReadingTelemetryPacketInfo>(), Conditions = conditions, PageIndex = 0, PageSize = 1 });
|
||||||
var taskSendInfo = await _dbProvider.QueryAsync<MeterReadingTelemetryPacketInfo>(new IoTDBQueryOptions() { TableNameOrTreePath = DevicePathBuilder.GetTableName<MeterReadingTelemetryPacketInfo>(), Conditions = conditions, PageIndex = 0, PageSize = 1 });
|
|
||||||
var taskData = taskSendInfo?.Items.FirstOrDefault();
|
var taskData = taskSendInfo?.Items.FirstOrDefault();
|
||||||
if (taskData != null)
|
if (taskData != null)
|
||||||
{
|
{
|
||||||
@ -290,12 +317,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 批量保存数据
|
// 批量保存数据
|
||||||
_runtimeContext.UseTableSessionPool = true; // 使树模型池
|
await _dbProvider.GetSessionPool(true).BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
||||||
await _dbProvider.BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
|
||||||
if (treeModelSingleMeasuringEntities.Count > 0)
|
if (treeModelSingleMeasuringEntities.Count > 0)
|
||||||
{
|
{
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(false).BatchInsertAsync(treeModelSingleMeasuringEntities);
|
||||||
await _dbProvider.BatchInsertAsync(treeModelSingleMeasuringEntities);
|
|
||||||
}
|
}
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
@ -324,12 +349,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
DeviceId = $"{data.DeviceId}",
|
DeviceId = $"{data.DeviceId}",
|
||||||
DeviceType = $"{data.DeviceType}",
|
DeviceType = $"{data.DeviceType}",
|
||||||
ProjectId = $"{data.ProjectId}",
|
ProjectId = $"{data.ProjectId}",
|
||||||
DataType = analysisBaseDto.DataType,
|
DataType = IOTDBDataTypeConst.Status,
|
||||||
Timestamps = timestamps,
|
Timestamps = timestamps,
|
||||||
SingleMeasuring = (data.FiledName!, data.DataValue!)
|
SingleMeasuring = (data.FiledName!, data.DataValue!)
|
||||||
};
|
};
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(false).InsertAsync(treeData);
|
||||||
await _dbProvider.InsertAsync(treeData);
|
|
||||||
// 数据帧
|
// 数据帧
|
||||||
var treeFrameData = new TreeModelSingleMeasuringEntity<string>()
|
var treeFrameData = new TreeModelSingleMeasuringEntity<string>()
|
||||||
{
|
{
|
||||||
@ -337,13 +361,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
DeviceId = $"{data.DeviceId}",
|
DeviceId = $"{data.DeviceId}",
|
||||||
DeviceType = $"{data.DeviceType}",
|
DeviceType = $"{data.DeviceType}",
|
||||||
ProjectId = $"{data.ProjectId}",
|
ProjectId = $"{data.ProjectId}",
|
||||||
DataType = analysisBaseDto.DataType,
|
DataType = IOTDBDataTypeConst.Status,
|
||||||
Timestamps = timestamps,
|
Timestamps = timestamps,
|
||||||
SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty)
|
SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty)
|
||||||
};
|
};
|
||||||
|
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(false).InsertAsync(treeFrameData);
|
||||||
await _dbProvider.InsertAsync(treeFrameData);
|
|
||||||
|
|
||||||
// 时间
|
// 时间
|
||||||
var treeRecordingTimeData = new TreeModelSingleMeasuringEntity<DateTime>()
|
var treeRecordingTimeData = new TreeModelSingleMeasuringEntity<DateTime>()
|
||||||
@ -353,11 +376,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
DeviceType = $"{data.DeviceType}",
|
DeviceType = $"{data.DeviceType}",
|
||||||
ProjectId = $"{data.ProjectId}",
|
ProjectId = $"{data.ProjectId}",
|
||||||
Timestamps = timestamps,
|
Timestamps = timestamps,
|
||||||
DataType = analysisBaseDto.DataType,
|
DataType = IOTDBDataTypeConst.Status,
|
||||||
SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, data.TimeSpan.HasValue ? data.TimeSpan.Value : DateTime.Now)
|
SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, data.TimeSpan.HasValue ? data.TimeSpan.Value : DateTime.Now)
|
||||||
};
|
};
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(true).InsertAsync(treeRecordingTimeData);
|
||||||
await _dbProvider.InsertAsync(treeRecordingTimeData);
|
|
||||||
|
|
||||||
// 新建
|
// 新建
|
||||||
string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ);
|
string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ);
|
||||||
@ -392,8 +414,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(),
|
ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(),
|
||||||
ReceivedTime=analysisBaseDto.ReceivedTime,
|
ReceivedTime=analysisBaseDto.ReceivedTime,
|
||||||
};
|
};
|
||||||
_runtimeContext.UseTableSessionPool = true; // 使表模型池
|
await _dbProvider.GetSessionPool(true).InsertAsync(taskData);
|
||||||
await _dbProvider.InsertAsync(taskData);
|
|
||||||
|
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
@ -425,25 +446,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
DeviceId = $"{item.DeviceId}",
|
DeviceId = $"{item.DeviceId}",
|
||||||
DeviceType = $"{item.DeviceType}",
|
DeviceType = $"{item.DeviceType}",
|
||||||
ProjectId = $"{item.ProjectId}",
|
ProjectId = $"{item.ProjectId}",
|
||||||
DataType = analysisBaseDto.DataType,
|
DataType = IOTDBDataTypeConst.Status,
|
||||||
Timestamps = timestamps,
|
Timestamps = timestamps,
|
||||||
SingleMeasuring = (item.FiledName!, item.DataValue!)
|
SingleMeasuring = (item.FiledName!, item.DataValue!)
|
||||||
};
|
};
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(false).InsertAsync(treeData);
|
||||||
await _dbProvider.InsertAsync(treeData);
|
|
||||||
// 数据帧
|
// 数据帧
|
||||||
var treeFrameData = new TreeModelSingleMeasuringEntity<string>()
|
var treeFrameData = new TreeModelSingleMeasuringEntity<string>()
|
||||||
{
|
{
|
||||||
SystemName = _applicationOptions.SystemType,
|
SystemName = _applicationOptions.SystemType,
|
||||||
DeviceType = $"{item.DeviceType}",
|
DeviceType = $"{item.DeviceType}",
|
||||||
ProjectId = $"{item.ProjectId}",
|
ProjectId = $"{item.ProjectId}",
|
||||||
DataType = analysisBaseDto.DataType,
|
DataType = IOTDBDataTypeConst.Status,
|
||||||
Timestamps = timestamps,
|
Timestamps = timestamps,
|
||||||
SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty)
|
SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty)
|
||||||
};
|
};
|
||||||
|
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(false).InsertAsync(treeFrameData);
|
||||||
await _dbProvider.InsertAsync(treeFrameData);
|
|
||||||
|
|
||||||
// 时间
|
// 时间
|
||||||
var treeRecordingTimeData = new TreeModelSingleMeasuringEntity<DateTime>()
|
var treeRecordingTimeData = new TreeModelSingleMeasuringEntity<DateTime>()
|
||||||
@ -451,12 +470,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
SystemName = _applicationOptions.SystemType,
|
SystemName = _applicationOptions.SystemType,
|
||||||
DeviceType = $"{item.DeviceType}",
|
DeviceType = $"{item.DeviceType}",
|
||||||
ProjectId = $"{item.ProjectId}",
|
ProjectId = $"{item.ProjectId}",
|
||||||
DataType = analysisBaseDto.DataType,
|
DataType = IOTDBDataTypeConst.Status,
|
||||||
Timestamps = timestamps,
|
Timestamps = timestamps,
|
||||||
SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, item.TimeSpan.HasValue ? item.TimeSpan.Value : DateTime.Now)
|
SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, item.TimeSpan.HasValue ? item.TimeSpan.Value : DateTime.Now)
|
||||||
};
|
};
|
||||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
await _dbProvider.GetSessionPool(false).InsertAsync(treeRecordingTimeData);
|
||||||
await _dbProvider.InsertAsync(treeRecordingTimeData);
|
|
||||||
|
|
||||||
// 新建
|
// 新建
|
||||||
string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ);
|
string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ);
|
||||||
@ -496,8 +514,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
|||||||
}
|
}
|
||||||
if (meterReadingTelemetryPacketInfos.Count > 0)
|
if (meterReadingTelemetryPacketInfos.Count > 0)
|
||||||
{
|
{
|
||||||
_runtimeContext.UseTableSessionPool = true; // 使表模型池
|
await _dbProvider.GetSessionPool(true).BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
||||||
await _dbProvider.BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
|
||||||
}
|
}
|
||||||
return await Task.FromResult(true);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,18 +19,19 @@ namespace JiShe.CollectBus.Protocol.T37612012.Appendix
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (data.Count != 2)
|
if (data.Count == 2)
|
||||||
return null;
|
{
|
||||||
var value = string.Join(".", data);
|
var value = string.Join(".", data);
|
||||||
var values= new List<string>() { "电网频率", "10_97", "1", value };
|
//电网频率
|
||||||
result?.Invoke(values);
|
result?.Invoke(value);
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, $"Appendix_02800002解析失败:{ex.Message}");
|
_logger.LogError(ex, $"Appendix_02800002解析失败:{ex.Message}");
|
||||||
return Task.FromResult(false);
|
|
||||||
}
|
}
|
||||||
|
return Task.FromResult(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace JiShe.CollectBus.Protocol.T37612012
|
|||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
context.Services.AddKeyedSingleton<IProtocolPlugin, T37612012ProtocolPlugin>(nameof(T37612012ProtocolPlugin));
|
context.Services.AddKeyedSingleton<IProtocolPlugin, T37612012ProtocolPlugin>(nameof(T37612012ProtocolPlugin));
|
||||||
|
context.Services.AddMemoryCache();
|
||||||
// TODO:先用之前的策略注册方式,后续验证后采用LoadAnalysisStrategy
|
// TODO:先用之前的策略注册方式,后续验证后采用LoadAnalysisStrategy
|
||||||
RegisterProtocolAnalysis(context.Services);
|
RegisterProtocolAnalysis(context.Services);
|
||||||
//LoadAnalysisStrategy(context.Services);
|
//LoadAnalysisStrategy(context.Services);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Reflection;
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
using JiShe.CollectBus.Common.BuildSendDatas;
|
using JiShe.CollectBus.Common.BuildSendDatas;
|
||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
@ -55,7 +56,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -154,7 +155,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -178,7 +179,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -203,7 +204,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -227,7 +228,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -252,13 +253,19 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
};
|
};
|
||||||
|
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter,request.DataUnit);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter,request.DataUnit);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region AFN10H 数据转发
|
#region AFN10H 数据转发
|
||||||
public static Telemetry3761PacketResponse AFN10_Fn_Send(Telemetry3761PacketRequest request)
|
public static Telemetry3761PacketResponse AFN10_Fn_Send(Telemetry3761PacketRequest request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var baudRateValue = Build3761SendData.GetBaudreate($"{request.SubRequest.Baudrate}");
|
||||||
|
|
||||||
|
var dataUnit = Build3761SendData.BuildTransparentForwardingSendDataUnit(request.SubRequest.MeteringPort, baudRateValue, request.DataUnit);
|
||||||
|
dataUnit.AddRange(Build3761SendData.GetPW());
|
||||||
|
|
||||||
var reqParameter = new ReqParameter2()
|
var reqParameter = new ReqParameter2()
|
||||||
{
|
{
|
||||||
AFN = AFN.数据转发,
|
AFN = AFN.数据转发,
|
||||||
@ -275,8 +282,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
|||||||
Pn = request.Pn,
|
Pn = request.Pn,
|
||||||
Fn = request.Fn
|
Fn = request.Fn
|
||||||
};
|
};
|
||||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter, request.DataUnit);
|
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter, dataUnit);
|
||||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SpecialAmmeter 特殊电表转发
|
#region SpecialAmmeter 特殊电表转发
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
using JiShe.CollectBus.Protocol.Models;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建3761报文参数
|
/// 构建3761报文参数
|
||||||
@ -20,8 +22,13 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Pn { get; set; }
|
public int Pn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子协议请求
|
||||||
|
/// </summary>
|
||||||
|
public SubProtocolBuildRequest SubRequest { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 透明转发单元
|
/// 透明转发数据单元
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> DataUnit { get; set; }
|
public List<string> DataUnit { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user