Merge branch 'dev' of https://310.jisheyun.com/daizan/JiShe.CollectBus into dev
This commit is contained in:
commit
97bdcb238a
@ -66,6 +66,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Analyzers.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Analyzers", "modules\JiShe.CollectBus.Analyzers\JiShe.CollectBus.Analyzers.csproj", "{EB97C7BB-1E4A-CBA4-04C1-22DBF48A253A}"
|
||||
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
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
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}.Release|Any CPU.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -187,6 +211,10 @@ Global
|
||||
{75B7D419-C261-577D-58D6-AA3ACED9129F} = {3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC}
|
||||
{DD68F314-BC66-5601-B094-B1A7BE93F4E0} = {EBF7C01F-9B4F-48E6-8418-2CBFDA51EB0B}
|
||||
{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
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}
|
||||
|
||||
@ -577,19 +577,43 @@ namespace JiShe.CollectBus.IncrementalGenerator
|
||||
var elementDeclaredName = element.Type.Name;//元组元素类型名称
|
||||
|
||||
initializerLines.Add(
|
||||
$"new EntityMemberInfo(" +
|
||||
$"\"{prop.Name}.{elementName}\", " +
|
||||
$"typeof({elementType}), " +
|
||||
$"typeof({elementType}).Name, " +//$"\"{elementDeclaredName}\", " +
|
||||
$"(e) => Get{prop.Name}_{elementName}(({entityType})e), " +
|
||||
$"(e, v) => Set{prop.Name}_{elementName}(({entityType})e, ({elementType})v))");
|
||||
}
|
||||
}
|
||||
}
|
||||
$"new EntityMemberInfo(" +
|
||||
$"\"{prop.Name}.{elementName}\", " +
|
||||
$"typeof({elementType}), " +
|
||||
$"GetValueTupleElementDeclaredTypeName(typeof({elementType})), " +//$"\"{elementDeclaredName}\", " +
|
||||
$"(e) => Get{prop.Name}_{elementName}(({entityType})e), " +
|
||||
$"(e, v) => Set{prop.Name}_{elementName}(({entityType})e, ({elementType})v))");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code.AppendLine(string.Join(",\n", initializerLines));
|
||||
code.AppendLine(" };");
|
||||
}
|
||||
code.AppendLine(string.Join(",\n", initializerLines));
|
||||
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)
|
||||
|
||||
@ -7,7 +7,7 @@ namespace JiShe.CollectBus.IoTDB.Context
|
||||
/// <summary>
|
||||
/// IoTDB SessionPool 运行时上下文
|
||||
/// </summary>
|
||||
public class IoTDBRuntimeContext: IScopedDependency
|
||||
public class IoTDBRuntimeContext: IScopedDependency//ITransientDependency
|
||||
{
|
||||
private readonly bool _defaultValue;
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@ namespace JiShe.CollectBus.IoTDB.Interface
|
||||
///// <param name="useTableSession">是否使用表模型</param>
|
||||
//void SwitchSessionPool(bool useTableSession);
|
||||
|
||||
IIoTDbProvider GetSessionPool(bool sessionpolType);
|
||||
|
||||
/// <summary>
|
||||
/// 插入数据
|
||||
/// </summary>
|
||||
|
||||
@ -44,7 +44,11 @@ namespace JiShe.CollectBus.IoTDB.Model
|
||||
/// 时标,也就是业务时间戳,单位毫秒,必须通过DateTimeOffset获取
|
||||
/// </summary>
|
||||
public long Timestamps { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设备路径
|
||||
/// </summary>
|
||||
private string _devicePath;
|
||||
/// <summary>
|
||||
/// 设备路径
|
||||
/// </summary>
|
||||
@ -52,18 +56,16 @@ namespace JiShe.CollectBus.IoTDB.Model
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`";
|
||||
// 如果未手动设置路径,则自动生成
|
||||
if (string.IsNullOrWhiteSpace(_devicePath))
|
||||
{
|
||||
return $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`";
|
||||
}
|
||||
return _devicePath;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
DevicePath = $"root.{SystemName.ToLower()}.`{ProjectId}`.`{DeviceType}`.{DataType}.`{DeviceId}`";
|
||||
}
|
||||
else
|
||||
{
|
||||
DevicePath = value;
|
||||
}
|
||||
{
|
||||
_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>
|
||||
/// 查询条件
|
||||
@ -19,10 +22,43 @@
|
||||
/// 是否数值,如果是数值,则进行数值比较,否则进行字符串比较
|
||||
/// </summary>
|
||||
public bool IsNumber { get; set; } = false;
|
||||
|
||||
|
||||
private object _rawValue;
|
||||
/// <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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,11 +36,22 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
{
|
||||
private static readonly ConcurrentDictionary<Type, DeviceMetadata> MetadataCache = new();
|
||||
private readonly ILogger<IoTDbProvider> _logger;
|
||||
private readonly IIoTDbSessionFactory _sessionFactory;
|
||||
private readonly IoTDBRuntimeContext _runtimeContext;
|
||||
private readonly IIoTDbSessionFactory _sessionFactory;
|
||||
|
||||
/// <summary>
|
||||
/// 存储模型切换标识,是否使用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;
|
||||
}
|
||||
|
||||
private IIoTDbSessionPool CurrentSession =>
|
||||
_sessionFactory.GetSessionPool(_runtimeContext.UseTableSessionPool);
|
||||
|
||||
/// <summary>
|
||||
/// IoTDbProvider
|
||||
@ -50,12 +61,10 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
/// <param name="runtimeContext"></param>
|
||||
public IoTDbProvider(
|
||||
ILogger<IoTDbProvider> logger,
|
||||
IIoTDbSessionFactory sessionFactory,
|
||||
IoTDBRuntimeContext runtimeContext)
|
||||
IIoTDbSessionFactory sessionFactory)
|
||||
{
|
||||
_logger = logger;
|
||||
_sessionFactory = sessionFactory;
|
||||
_runtimeContext = runtimeContext;
|
||||
|
||||
}
|
||||
|
||||
@ -77,6 +86,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null");
|
||||
return;
|
||||
}
|
||||
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 路径为 {tablet.First().InsertTargetName}");
|
||||
|
||||
await CurrentSession.InsertAsync(tablet.First());
|
||||
}
|
||||
@ -96,6 +106,11 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
{
|
||||
try
|
||||
{
|
||||
if (entities == null || entities.Count() <= 0)
|
||||
{
|
||||
_logger.LogError($"{nameof(BatchInsertAsync)} 参数异常,-101");
|
||||
return;
|
||||
}
|
||||
var metadata = await GetMetadata<T>();
|
||||
|
||||
var batchSize = 1000;
|
||||
@ -109,8 +124,11 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 tablet 为null");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var item in tablet)
|
||||
{
|
||||
_logger.LogError($"{nameof(InsertAsync)} IoTDB插入{typeof(T).Name}的数据时 路径为 {item.InsertTargetName}");
|
||||
|
||||
await CurrentSession.InsertAsync(item);
|
||||
}
|
||||
}
|
||||
@ -320,10 +338,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//var accessor = SourceEntityAccessorFactory.GetAccessor<T>();
|
||||
|
||||
//var memberCache = BuildMemberCache(accessor);
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
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;
|
||||
if (_runtimeContext.UseTableSessionPool)//表模型
|
||||
if ( UseTableSessionPool)//表模型
|
||||
{
|
||||
//如果指定了路径
|
||||
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())
|
||||
: 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 sb = new StringBuilder();
|
||||
|
||||
if (!_runtimeContext.UseTableSessionPool)
|
||||
if (!UseTableSessionPool)
|
||||
{
|
||||
sb.Append("DELETE ");
|
||||
}
|
||||
@ -519,16 +534,16 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotSupportedException"></exception>
|
||||
private string TranslateCondition(QueryCondition condition)
|
||||
{
|
||||
{
|
||||
return condition.Operator switch
|
||||
{
|
||||
">" => condition.IsNumber ? $"{condition.Field} > {condition.Value}" : $"{condition.Field} > '{condition.Value}'",
|
||||
"<" => condition.IsNumber ? $"{condition.Field} < {condition.Value}" : $"{condition.Field} < '{condition.Value}'",
|
||||
"=" => condition.IsNumber ? $"{condition.Field} = {condition.Value}" : $"{condition.Field} = '{condition.Value}'",
|
||||
">" => $"{condition.Field} > {condition.Value}",
|
||||
"<" => $"{condition.Field} < {condition.Value}",
|
||||
"=" => $"{condition.Field} = {condition.Value}",
|
||||
_ => throw new NotSupportedException($"{nameof(TranslateCondition)} 将查询条件转换为SQL语句时操作符 {condition.Operator} 属于异常情况")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取查询条件的总数量
|
||||
/// </summary>
|
||||
@ -795,7 +810,8 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
{
|
||||
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
|
||||
};
|
||||
}
|
||||
@ -897,7 +913,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
["DATETIME"] = TSDataType.TIMESTAMP,
|
||||
["DATE"] = TSDataType.DATE,
|
||||
["BLOB"] = TSDataType.BLOB,
|
||||
["DECIMAL"] = TSDataType.STRING,
|
||||
["DECIMAL"] = TSDataType.DOUBLE,
|
||||
["STRING"] = TSDataType.STRING
|
||||
};
|
||||
|
||||
@ -933,7 +949,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
||||
TSDataType.BOOLEAN => Convert.ToBoolean(value),
|
||||
TSDataType.INT32 => Convert.ToInt32(value),
|
||||
TSDataType.INT64 => Convert.ToInt64(value),
|
||||
TSDataType.FLOAT => Convert.ToDouble(value),
|
||||
TSDataType.FLOAT => Convert.ToSingle(value),
|
||||
TSDataType.DOUBLE => Convert.ToDouble(value),
|
||||
TSDataType.TEXT => Convert.ToString(value),
|
||||
TSDataType.NONE => null,
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"profiles": {
|
||||
"WSL": {
|
||||
"commandName": "WSL2",
|
||||
"distributionName": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
using Confluent.Kafka;
|
||||
using JiShe.CollectBus.Common;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Kafka.Internal;
|
||||
using JiShe.CollectBus.Kafka.Serialization;
|
||||
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
||||
@ -127,80 +128,88 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
||||
/// <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
|
||||
{
|
||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||
try
|
||||
{
|
||||
|
||||
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 () =>
|
||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||
{
|
||||
while (!cts.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)} 开始拉取消息....");
|
||||
|
||||
var result = consumer.Consume(cts.Token);
|
||||
if (result == null || result.Message == null || result.Message.Value == null)
|
||||
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
|
||||
{
|
||||
await Task.Delay(DelayTime, cts.Token);
|
||||
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))
|
||||
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)} 开始拉取消息....");
|
||||
|
||||
var result = consumer.Consume(cts.Token);
|
||||
if (result == null || result.Message == null || result.Message.Value == null)
|
||||
{
|
||||
consumer.Commit(result); // 提交偏移量
|
||||
// 跳过消息
|
||||
await Task.Delay(DelayTime, cts.Token);
|
||||
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))
|
||||
{
|
||||
_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;
|
||||
});
|
||||
}, cts.Token);
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -215,76 +224,84 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
||||
/// <returns></returns>
|
||||
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}";
|
||||
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 () =>
|
||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||
{
|
||||
int count = 0;
|
||||
while (!cts.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)}_{count} 开始拉取消息....");
|
||||
count++;
|
||||
var result = consumer.Consume(cts.Token);
|
||||
if (result == null || result.Message == null || result.Message.Value == null)
|
||||
{
|
||||
await Task.Delay(DelayTime, cts.Token);
|
||||
continue;
|
||||
}
|
||||
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>;
|
||||
|
||||
if (result.IsPartitionEOF)
|
||||
consumer!.Subscribe(topics);
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
int count = 0;
|
||||
while (!cts.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
#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))
|
||||
//_logger.LogInformation($"Kafka消费: {string.Join("", topics)}_{count} 开始拉取消息....");
|
||||
count++;
|
||||
var result = consumer.Consume(cts.Token);
|
||||
if (result == null || result.Message == null || result.Message.Value == null)
|
||||
{
|
||||
consumer.Commit(result); // 提交偏移量
|
||||
// 跳过消息
|
||||
await Task.Delay(DelayTime, cts.Token);
|
||||
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))
|
||||
{
|
||||
_logger.LogError(ex, $"{string.Join("、", topics)}消息消费失败: {ex.Error.Reason}");
|
||||
throw; // 抛出异常,以便重试
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
//ignore
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "处理消息时发生未知错误");
|
||||
}
|
||||
}
|
||||
}, cts.Token);
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
}, cts.Token);
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -300,7 +317,15 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
||||
/// <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
|
||||
{
|
||||
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>
|
||||
@ -315,117 +340,125 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
||||
/// <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
|
||||
{
|
||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||
try
|
||||
{
|
||||
|
||||
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 () =>
|
||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||
{
|
||||
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
|
||||
{
|
||||
// 非阻塞快速累积消息
|
||||
while (messages.Count < batchSize && (DateTime.UtcNow - startTime) < timeout)
|
||||
{
|
||||
var result = consumer.Consume(TimeSpan.Zero); // 非阻塞调用
|
||||
var messages = new List<(TValue Value, TopicPartitionOffset Offset)>();
|
||||
var startTime = DateTime.UtcNow;
|
||||
|
||||
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
|
||||
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
||||
_logger.LogInformation("Kafka消费: {Topic} 分区 {Partition} 已消费完", result.Topic, result.Partition);
|
||||
#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);
|
||||
}
|
||||
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) } };
|
||||
// 检查 Header 是否符合条件
|
||||
if (!headersFilter.Match(result.Message.Headers))
|
||||
var tp = msg.Offset.TopicPartition;
|
||||
var offset = msg.Offset.Offset;
|
||||
if (!offsetsByPartition.TryGetValue(tp, out var currentMax) || offset > currentMax)
|
||||
{
|
||||
consumer.Commit(result); // 提交偏移量
|
||||
// 跳过消息
|
||||
continue;
|
||||
offsetsByPartition[tp] = offset;
|
||||
}
|
||||
}
|
||||
messages.Add((result.Message.Value, result.TopicPartitionOffset));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 无消息时短暂等待
|
||||
await Task.Delay(DelayTime, cts.Token);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理批次
|
||||
if (messages.Count > 0)
|
||||
var offsetsToCommit = offsetsByPartition
|
||||
.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());
|
||||
if (success)
|
||||
{
|
||||
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();
|
||||
_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);
|
||||
|
||||
startTime = DateTime.UtcNow;
|
||||
}
|
||||
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, "处理批量消息时发生未知错误");
|
||||
}
|
||||
}
|
||||
}, cts.Token);
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -441,7 +474,15 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
||||
/// <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
|
||||
{
|
||||
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>
|
||||
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
|
||||
{
|
||||
|
||||
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 () =>
|
||||
await _kafkaPollyPipeline.KafkaPipeline.ExecuteAsync(async token =>
|
||||
{
|
||||
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
|
||||
{
|
||||
// 非阻塞快速累积消息
|
||||
while (messages.Count < batchSize && (DateTime.UtcNow - startTime) < timeout)
|
||||
{
|
||||
var result = consumer.Consume(TimeSpan.Zero); // 非阻塞调用
|
||||
var messages = new List<(TValue Value, TopicPartitionOffset Offset)>();
|
||||
var startTime = DateTime.UtcNow;
|
||||
|
||||
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);
|
||||
}
|
||||
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) } };
|
||||
// 检查 Header 是否符合条件
|
||||
if (!headersFilter.Match(result.Message.Headers))
|
||||
var tp = msg.Offset.TopicPartition;
|
||||
var offset = msg.Offset.Offset;
|
||||
if (!offsetsByPartition.TryGetValue(tp, out var currentMax) || offset > currentMax)
|
||||
{
|
||||
consumer.Commit(result); // 提交偏移量
|
||||
// 跳过消息
|
||||
continue;
|
||||
offsetsByPartition[tp] = offset;
|
||||
}
|
||||
}
|
||||
messages.Add((result.Message.Value, result.TopicPartitionOffset));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 无消息时短暂等待
|
||||
await Task.Delay(DelayTime, cts.Token);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理批次
|
||||
if (messages.Count > 0)
|
||||
var offsetsToCommit = offsetsByPartition
|
||||
.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());
|
||||
if (success)
|
||||
{
|
||||
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();
|
||||
_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);
|
||||
|
||||
startTime = DateTime.UtcNow;
|
||||
}
|
||||
catch (ConsumeException ex) when (KafkaPollyPipeline.IsRecoverableError(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;
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -578,12 +627,20 @@ namespace JiShe.CollectBus.Kafka.Consumer
|
||||
/// <typeparam name="TValue"></typeparam>
|
||||
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}";
|
||||
if (_consumerStore.TryRemove(consumerKey, out var entry))
|
||||
try
|
||||
{
|
||||
entry.CTS.Cancel();
|
||||
(entry.Consumer as IDisposable)?.Dispose();
|
||||
entry.CTS.Dispose();
|
||||
var consumerKey = $"{groupId}_{string.Join("_", topics)}_{typeof(TKey).Name}_{typeof(TValue).Name}";
|
||||
if (_consumerStore.TryRemove(consumerKey, out var entry))
|
||||
{
|
||||
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}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理消费错误
|
||||
logger.LogError($"kafka批量消费异常:{ex.Message}");
|
||||
}
|
||||
return await Task.FromResult(false);
|
||||
}, attr.GroupId, attr.BatchSize, attr.BatchTimeout);
|
||||
}
|
||||
@ -248,6 +253,11 @@ namespace JiShe.CollectBus.Kafka
|
||||
// 处理消费错误
|
||||
logger.LogError($"kafka消费异常:{ex.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 处理消费错误
|
||||
logger.LogError($"kafka批量消费异常:{ex.Message}");
|
||||
}
|
||||
return await Task.FromResult(false);
|
||||
}, attr.GroupId);
|
||||
}
|
||||
@ -260,125 +270,133 @@ namespace JiShe.CollectBus.Kafka
|
||||
/// </summary>
|
||||
private static async Task<bool> ProcessMessageAsync(List<dynamic> messages, MethodInfo method, object subscribe)
|
||||
{
|
||||
var parameters = method.GetParameters();
|
||||
bool isGenericTask = method.ReturnType.IsGenericType
|
||||
&& method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>);
|
||||
bool existParameters = parameters.Length > 0;
|
||||
object[]? executeParameters = null;
|
||||
|
||||
if (existParameters)
|
||||
try
|
||||
{
|
||||
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);
|
||||
// }
|
||||
var parameters = method.GetParameters();
|
||||
bool isGenericTask = method.ReturnType.IsGenericType
|
||||
&& method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>);
|
||||
bool existParameters = parameters.Length > 0;
|
||||
object[]? executeParameters = null;
|
||||
|
||||
// }
|
||||
// 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++)
|
||||
if (existParameters)
|
||||
{
|
||||
foreach (var item in messages)
|
||||
{
|
||||
|
||||
object? tempParameter=null;
|
||||
var parameterDescriptor = parameterDescriptors[i];
|
||||
if (KafkaSerialization.IsJsonType(item))
|
||||
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);
|
||||
// }
|
||||
|
||||
// }
|
||||
// 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)
|
||||
{
|
||||
tempParameter = KafkaSerialization.Deserialize(item, tuple.Item2 != null? tuple.Item2: parameterDescriptor.ParameterType);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var converter = TypeDescriptor.GetConverter(parameterDescriptor.ParameterType);
|
||||
if (converter.CanConvertFrom(item.GetType()))
|
||||
|
||||
object? tempParameter = null;
|
||||
var parameterDescriptor = parameterDescriptors[i];
|
||||
if (KafkaSerialization.IsJsonType(item))
|
||||
{
|
||||
tempParameter = converter.ConvertFrom(item);
|
||||
tempParameter = KafkaSerialization.Deserialize(item, tuple.Item2 != null ? tuple.Item2 : parameterDescriptor.ParameterType);
|
||||
}
|
||||
else
|
||||
{
|
||||
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(list!=null && list.Count>0)
|
||||
executeParameters[i] = list;
|
||||
}
|
||||
}
|
||||
|
||||
var result = method.Invoke(subscribe, executeParameters);
|
||||
if (result is Task<ISubscribeAck> genericTask)
|
||||
{
|
||||
await genericTask.ConfigureAwait(false);
|
||||
return genericTask.Result.Ack;
|
||||
var converter = TypeDescriptor.GetConverter(parameterDescriptor.ParameterType);
|
||||
if (converter.CanConvertFrom(item.GetType()))
|
||||
{
|
||||
tempParameter = converter.ConvertFrom(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
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 (list != null && list.Count > 0)
|
||||
executeParameters[i] = list;
|
||||
}
|
||||
}
|
||||
|
||||
var result = method.Invoke(subscribe, executeParameters);
|
||||
if (result is Task<ISubscribeAck> genericTask)
|
||||
{
|
||||
await genericTask.ConfigureAwait(false);
|
||||
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>
|
||||
public async Task ProduceAsync<TKey, TValue>(string topic, TKey key, TValue value)where TKey : notnull where TValue : class
|
||||
{
|
||||
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
||||
var producer = GetProducer<TKey, TValue>(typeKey);
|
||||
var message = new Message<TKey, TValue>
|
||||
try
|
||||
{
|
||||
Key = key,
|
||||
Value = value,
|
||||
Headers = new Headers{
|
||||
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
||||
var producer = GetProducer<TKey, TValue>(typeKey);
|
||||
var message = new Message<TKey, TValue>
|
||||
{
|
||||
Key = key,
|
||||
Value = value,
|
||||
Headers = new Headers{
|
||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||
}
|
||||
};
|
||||
await producer.ProduceAsync(topic, message);
|
||||
};
|
||||
await producer.ProduceAsync(topic, message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -139,16 +147,24 @@ namespace JiShe.CollectBus.Kafka.Producer
|
||||
/// <returns></returns>
|
||||
public async Task ProduceAsync<TValue>(string topic, TValue value) where TValue : class
|
||||
{
|
||||
var typeKey = typeof(KafkaProducer<string, TValue>);
|
||||
var producer = GetProducer<Null, TValue>(typeKey);
|
||||
var message = new Message<Null, TValue>
|
||||
try
|
||||
{
|
||||
Value = value,
|
||||
Headers = new Headers{
|
||||
var typeKey = typeof(KafkaProducer<string, TValue>);
|
||||
var producer = GetProducer<Null, TValue>(typeKey);
|
||||
var message = new Message<Null, TValue>
|
||||
{
|
||||
Value = value,
|
||||
Headers = new Headers{
|
||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||
}
|
||||
};
|
||||
await producer.ProduceAsync(topic, message);
|
||||
};
|
||||
await producer.ProduceAsync(topic, message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -164,26 +180,34 @@ namespace JiShe.CollectBus.Kafka.Producer
|
||||
/// <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
|
||||
{
|
||||
var message = new Message<TKey, TValue>
|
||||
try
|
||||
{
|
||||
Key = key,
|
||||
Value = value,
|
||||
Headers = new Headers{
|
||||
var message = new Message<TKey, TValue>
|
||||
{
|
||||
Key = key,
|
||||
Value = value,
|
||||
Headers = new Headers{
|
||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||
}
|
||||
};
|
||||
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
||||
var producer = GetProducer<TKey, TValue>(typeKey);
|
||||
if (partition.HasValue)
|
||||
{
|
||||
var topicPartition = new TopicPartition(topic, new Partition(partition.Value));
|
||||
producer.Produce(topicPartition, message, deliveryHandler);
|
||||
};
|
||||
var typeKey = typeof(KafkaProducer<TKey, TValue>);
|
||||
var producer = GetProducer<TKey, TValue>(typeKey);
|
||||
if (partition.HasValue)
|
||||
{
|
||||
var topicPartition = new TopicPartition(topic, new Partition(partition.Value));
|
||||
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>
|
||||
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,
|
||||
Headers = new Headers{
|
||||
var message = new Message<Null, TValue>
|
||||
{
|
||||
Value = value,
|
||||
Headers = new Headers{
|
||||
{ "route-key", Encoding.UTF8.GetBytes(_applicationOptions.ServerTagName) }
|
||||
}
|
||||
};
|
||||
var typeKey = typeof(KafkaProducer<Null, TValue>);
|
||||
var producer = GetProducer<Null, TValue>(typeKey);
|
||||
if (partition.HasValue)
|
||||
{
|
||||
var topicPartition = new TopicPartition(topic,new Partition(partition.Value));
|
||||
//_logger.LogError($"push消息:{topic}-{partition.Value}");
|
||||
producer.Produce(topicPartition, message, deliveryHandler);
|
||||
};
|
||||
var typeKey = typeof(KafkaProducer<Null, TValue>);
|
||||
var producer = GetProducer<Null, TValue>(typeKey);
|
||||
if (partition.HasValue)
|
||||
{
|
||||
var topicPartition = new TopicPartition(topic, new Partition(partition.Value));
|
||||
//_logger.LogError($"push消息:{topic}-{partition.Value}");
|
||||
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()
|
||||
|
||||
@ -19,6 +19,7 @@ namespace JiShe.CollectBus.Kafka.Serialization
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
||||
WriteIndented = false,// 设置格式化输出
|
||||
IncludeFields = true,// 允许反序列化到非公共 setter 和字段
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,// 允许特殊字符
|
||||
IgnoreReadOnlyFields = true,
|
||||
IgnoreReadOnlyProperties = true,
|
||||
@ -53,7 +54,7 @@ namespace JiShe.CollectBus.Kafka.Serialization
|
||||
{
|
||||
if (data.IsEmpty)
|
||||
return default;
|
||||
return JsonSerializer.Deserialize<T>(data, _options)!;
|
||||
return JsonSerializer.Deserialize<T>(data, _options)!;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -102,24 +103,37 @@ namespace JiShe.CollectBus.Kafka.Serialization
|
||||
}
|
||||
public static object? Deserialize(object value, Type valueType)
|
||||
{
|
||||
var _jsonSerializerOptions = new JsonSerializerOptions
|
||||
try
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
||||
WriteIndented = false,// 设置格式化输出
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,// 允许特殊字符
|
||||
IgnoreReadOnlyFields = true,
|
||||
IgnoreReadOnlyProperties = true,
|
||||
NumberHandling = JsonNumberHandling.AllowReadingFromString, // 允许数字字符串
|
||||
AllowTrailingCommas = true, // 忽略尾随逗号
|
||||
ReadCommentHandling = JsonCommentHandling.Skip, // 忽略注释
|
||||
PropertyNameCaseInsensitive = true, // 属性名称大小写不敏感
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, // 属性名称使用驼峰命名规则
|
||||
Converters = { new DateTimeJsonConverter() } // 注册你的自定义转换器,
|
||||
};
|
||||
var _jsonSerializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.Never,
|
||||
WriteIndented = false,// 设置格式化输出
|
||||
IncludeFields = true,// 允许反序列化到非公共 setter 和字段
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,// 允许特殊字符
|
||||
IgnoreReadOnlyFields = true,
|
||||
IgnoreReadOnlyProperties = true,
|
||||
NumberHandling = JsonNumberHandling.AllowReadingFromString, // 允许数字字符串
|
||||
AllowTrailingCommas = true, // 忽略尾随逗号
|
||||
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 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 dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
||||
|
||||
@ -64,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T1882018.SendData
|
||||
{
|
||||
var itemCodeArr = request.ItemCode.Split('_');
|
||||
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 dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
||||
|
||||
|
||||
@ -92,7 +92,9 @@ namespace JiShe.CollectBus.Protocol.T1882018
|
||||
List<string> dataUnit = new List<string>();
|
||||
//数据转发场景 10H_F1
|
||||
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";
|
||||
Telemetry1882018PacketResponse t645PacketResponse = null;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
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}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId= ammeterInfo.FocusId;
|
||||
data.FocusId= deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
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}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
|
||||
DataValue = "Login",
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
|
||||
DataValue = "LogOut",
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
|
||||
DataValue = "Heartbeat",
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -32,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||
var version = AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||
version.AreaCode = input.A.Code?.Substring(0, 4);
|
||||
@ -42,16 +44,16 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H
|
||||
DataValue = version,
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -29,6 +30,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||
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", ""),
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -28,6 +29,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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(),
|
||||
Point = $"{sArray[3]}{sArray[2]}".HexToDec(),
|
||||
RuleType= GetProtocol(sArray[5]),
|
||||
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),
|
||||
ElectricityRatesNum= sArray[18].HexToBin().Substring(2, 6).BinToDec(),
|
||||
CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}",
|
||||
//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),
|
||||
//ElectricityRatesNum= sArray[18].HexToBin().Substring(2, 6).BinToDec(),
|
||||
//CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}",
|
||||
|
||||
};
|
||||
|
||||
string baudPort = sArray[4].HexToBin().PadLeft(8, '0'); //波特率和端口号放在一个字节内
|
||||
aFN10F10Entity.ComAddress = $"{sArray[11]}{sArray[10]}{sArray[9]}{sArray[8]}{sArray[7]}{sArray[6]}";
|
||||
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.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.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(4, 4).BinToDec() + 1;
|
||||
aFN10F10Entitys.Add(aFN10F10Entity);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -32,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||
|
||||
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),
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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 cycleValueBin = cycleBin.Substring(2, 6);
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -28,6 +29,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||
var data = new AnalysisBaseDto<bool?>()
|
||||
{
|
||||
@ -35,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
|
||||
DataValue = input.UnitData.HexMessageList[4].Equals("55"),
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.FocusId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.Address;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.FocusId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.FocusAddress;
|
||||
data.DeviceType = MeterTypeEnum.Focus;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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.IoTDB.Interface;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -34,6 +35,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
ArgumentNullException.ThrowIfNull(input.A.A3?.D1_D7);
|
||||
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);
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code,input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -33,22 +34,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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);
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -34,22 +35,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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);
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -35,23 +36,24 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向无功电能示值", dataType);
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -36,22 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", itemType);
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
|
||||
|
||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||
{
|
||||
Code = input.A.Code!,
|
||||
|
||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -36,21 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
List<string> datas = await AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, itemType,"上月(上一结算日)正向有功最大需量及发生时间");
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID=ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress= ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
|
||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||
{
|
||||
Code = input.A.Code!,
|
||||
|
||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -36,21 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN);
|
||||
ArgumentNullException.ThrowIfNull(input.DT.Fn);
|
||||
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(input.UnitData.HexMessageList, itemType);
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
|
||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> dto = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||
{
|
||||
Code = input.A.Code!,
|
||||
|
||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -37,6 +38,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
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<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
|
||||
@ -68,17 +70,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].ItemType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ using JiShe.CollectBus.Protocol.T37612012.AnalysisData;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using static FreeSql.Internal.GlobalFilter;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
{
|
||||
@ -36,19 +37,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, itemType);
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -35,6 +36,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||
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),
|
||||
ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -36,7 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
List<string> data = await AnalysisDataUnitAsync(input.UnitData?.HexMessageList!);
|
||||
List<string> remarks = new List<string>() { "Uab/Ua 相位角", "Ub 相位角", "Ucb/Uc 相位角", "Ia 相位角", "Ib 相位角", "Ic 相位角" };
|
||||
List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
|
||||
@ -64,17 +65,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
||||
}
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -33,27 +35,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -66,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能示值");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能示值");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,6 +34,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相功率因数");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相功率因数");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度,注意这里会兼容存储做判断
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
@ -33,25 +35,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "一象限无功电能示值");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "一象限无功电能示值");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
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)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "四象限无功电能示值");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "四象限无功电能示值");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "二象限无功电能示值");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "二象限无功电能示值");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,27 +33,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,26 +33,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -2,12 +2,14 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 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" });
|
||||
if (data.Count > 0)
|
||||
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 (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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 dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "抄表日冻结正向有功最大需量及发生时间");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "抄表日冻结正向有功最大需量及发生时间");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -33,21 +34,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "抄表日冻结正向无功最大需量及发生时间", dataType);
|
||||
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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.Consts;
|
||||
using static FreeSql.Internal.GlobalFilter;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,21 +35,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结正向有功最大需量及发生时间", dataType);
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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.Consts;
|
||||
using static FreeSql.Internal.GlobalFilter;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,21 +35,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结反向有功最大需量及发生时间", dataType);
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
|
||||
{
|
||||
|
||||
@ -12,6 +12,8 @@ using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -35,24 +37,25 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas, dataType, "月冻结电能表正向有功最大需量及发生时间");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas, dataType, "月冻结电能表正向有功最大需量及发生时间");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -12,6 +12,8 @@ using Volo.Abp.Domain.Entities;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -35,6 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas,dataType, "日冻结正向有/无功最大需量及发生时间");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas,dataType, "日冻结正向有/无功最大需量及发生时间");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -67,7 +70,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -11,6 +11,8 @@ using AutoMapper.Internal.Mappers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,6 +36,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(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";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas, dataType, "日冻结反向有/无功最大需量及发生时间");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas, dataType, "日冻结反向有/无功最大需量及发生时间");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -66,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = 1,//密度-间隔,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "有功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "有功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相有功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相有功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相有功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相有功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相有功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相有功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "无功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "无功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相无功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相无功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相无功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相无功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相无功功率曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相无功功率曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电压曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电压曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电压曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电压曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||
using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电压曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电压曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电流曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电流曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电流曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电流曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电流曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电流曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "测量点零序电流曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "测量点零序电流曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能量曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能量曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能量曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能量曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
{
|
||||
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
|
||||
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||
|
||||
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向有功总电能量曲线");
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "反向有功总电能量曲线");
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.MeterId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
item.FocusId = ammeterInfo.FocusId;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
item.FocusId = deviceInfo.FocusId;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
|
||||
Pn = input.DA.Pn,
|
||||
MSA = input.A.A3!.D1_D7!,
|
||||
PSEQ = input.SEQ.PSEQ,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
TimeDensity = density,//密度-间隔分钟数,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -9,6 +10,7 @@ using JiShe.CollectBus.Protocol3761;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
||||
{
|
||||
@ -31,8 +33,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
||||
{
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(nameof(input));
|
||||
ArgumentNullException.ThrowIfNull(nameof(input.UnitData.HexMessageList));
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||
int erc = input.UnitData.HexMessageList![8].HexToDec();
|
||||
bool isOnOffPower = erc.Equals(14) ? true : false;
|
||||
if (!isOnOffPower)
|
||||
@ -42,21 +45,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
List<AnalysisBaseDto<string>> data = AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||
if (data.Count > 0)
|
||||
List<AnalysisBaseDto<string>> list = AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||
if (list.Count > 0)
|
||||
{
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ForEach(item =>
|
||||
list.ForEach(item =>
|
||||
{
|
||||
item.ProjectId = ammeterInfo.ProjectID;
|
||||
item.DeviceId = ammeterInfo.FocusId;
|
||||
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = ammeterInfo.Address;
|
||||
item.ProjectId = deviceInfo.ProjectID;
|
||||
item.DeviceId = deviceInfo.MeterId;
|
||||
item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
item.DeviceAddress = deviceInfo.MeterAddress;
|
||||
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,
|
||||
Fn = input.DT.Fn,
|
||||
Pn = input.DA.Pn,
|
||||
Data = data,
|
||||
Data = list,
|
||||
ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
|
||||
MessageId = input.MessageId,
|
||||
ReceivedTime = input.ReceivedTime,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -30,6 +31,7 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
|
||||
var data = new AnalysisBaseDto<string?>()
|
||||
{
|
||||
@ -37,15 +39,15 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
||||
DataValue = AnalysisDataUnit(input.UnitData.HexMessageList),
|
||||
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
|
||||
};
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
|
||||
{
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
using GatherService.WattMeter.AnalysisData.AFN_10H;
|
||||
using JiShe.CollectBus.Common.Consts;
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
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 AnalysisStrategyContext _analysisStrategyContext;
|
||||
|
||||
public AFN16_F1_Analysis(ILogger<AFN16_F1_Analysis> logger, AnalysisStrategyContext analysisStrategyContext)
|
||||
private readonly DataStorage _dataStorage;
|
||||
public AFN16_F1_Analysis(ILogger<AFN16_F1_Analysis> logger, AnalysisStrategyContext analysisStrategyContext, DataStorage dataStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_analysisStrategyContext = analysisStrategyContext;
|
||||
_dataStorage = dataStorage;
|
||||
}
|
||||
|
||||
public async Task<bool> ExecuteAsync(TB3761 input, Action<dynamic>? result = null)
|
||||
@ -33,6 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.BaseHexMessage.HexMessageList);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageString);
|
||||
// TODO: 待定,等确认如何匹配规则
|
||||
@ -44,10 +49,45 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
{
|
||||
result?.Invoke(dto);
|
||||
});
|
||||
//else if (value.Contains(F10TranspondMatch.ReadData))//读取电表地址
|
||||
// result = "AFN16_F105_Analysis";
|
||||
else if (value.Contains(F10TranspondMatch.JumpClosingNormal) || value.Contains(F10TranspondMatch.JumpClosingError))//跳合闸
|
||||
await _analysisStrategyContext.ExecuteAsync<TB3761>(nameof(AFN16_F98_Analysis), input, dto =>
|
||||
{
|
||||
result?.Invoke(dto);
|
||||
});
|
||||
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}");
|
||||
}
|
||||
}
|
||||
@ -56,7 +96,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
}
|
||||
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);
|
||||
|
||||
@ -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.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Interfaces;
|
||||
@ -38,20 +40,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas);
|
||||
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn, datas[1]);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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)
|
||||
{
|
||||
AnalysisBaseDto<decimal?> meter = new AnalysisBaseDto<decimal?>();
|
||||
|
||||
var errorCode = data[7].CheckErrorCode();
|
||||
meter.DeviceType = MeterTypeEnum.Ammeter;
|
||||
var errorCode = data[4].CheckErrorCode();
|
||||
if (errorCode != null)
|
||||
{
|
||||
meter.ValidData = false;
|
||||
@ -94,7 +97,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
|
||||
}
|
||||
else
|
||||
{
|
||||
if(decimal.TryParse(data[7], out decimal value))
|
||||
if(decimal.TryParse(data[4], out decimal 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));
|
||||
values.Add(dataMark);//数据标识
|
||||
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());
|
||||
});
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.Protocol;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
@ -33,6 +34,7 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(input);
|
||||
ArgumentNullException.ThrowIfNull(input.A.Code);
|
||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||
|
||||
List<string> datas = AnalysisDataUnit(input.UnitData.HexMessageList);
|
||||
@ -44,15 +46,15 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
|
||||
ItemType= "10_98",
|
||||
};
|
||||
|
||||
// 查询电表信息
|
||||
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15");
|
||||
if (ammeterInfo != null)
|
||||
// 查询设备信息
|
||||
DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
|
||||
if (deviceInfo != null)
|
||||
{
|
||||
data.ProjectId = ammeterInfo.ProjectID;
|
||||
data.DeviceId = ammeterInfo.MeterId;
|
||||
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = ammeterInfo.AmmerterAddress;
|
||||
data.FocusId = ammeterInfo.FocusId;
|
||||
data.ProjectId = deviceInfo.ProjectID;
|
||||
data.DeviceId = deviceInfo.MeterId;
|
||||
data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
|
||||
data.DeviceAddress = deviceInfo.MeterAddress;
|
||||
data.FocusId = deviceInfo.FocusId;
|
||||
}
|
||||
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.Encrypt;
|
||||
using JiShe.CollectBus.Common.Enums;
|
||||
using JiShe.CollectBus.Common.Extensions;
|
||||
using JiShe.CollectBus.Common.Helpers;
|
||||
using JiShe.CollectBus.FreeRedis;
|
||||
using JiShe.CollectBus.IoTDB.Context;
|
||||
using JiShe.CollectBus.IoTDB.Interface;
|
||||
using JiShe.CollectBus.IoTDB.Model;
|
||||
using JiShe.CollectBus.IoTDB.Options;
|
||||
using JiShe.CollectBus.IoTDB.Provider;
|
||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||
using JiShe.CollectBus.IotSystems.Devices;
|
||||
using JiShe.CollectBus.IotSystems.LogRecord;
|
||||
using JiShe.CollectBus.IotSystems.MeterReadingRecords;
|
||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||
using JiShe.CollectBus.Protocol.Dto;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Threading.Channels;
|
||||
using TouchSocket.Core;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Guids;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
using static FreeSql.Internal.GlobalFilter;
|
||||
using static JiShe.CollectBus.Common.Consts.T37612012PacketItemCodeConst;
|
||||
|
||||
@ -30,22 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
{
|
||||
private readonly IGuidGenerator _guidGenerator;
|
||||
private readonly IIoTDbProvider _dbProvider;
|
||||
private readonly ServerApplicationOptions _applicationOptions;
|
||||
private readonly IoTDBRuntimeContext _runtimeContext;
|
||||
private readonly ServerApplicationOptions _applicationOptions;
|
||||
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,
|
||||
IGuidGenerator guidGenerator, IoTDBRuntimeContext runtimeContext, ILogger<DataStorage> logger)
|
||||
IGuidGenerator guidGenerator, ILogger<DataStorage> logger, IMemoryCache memoryCache, IFreeRedisProvider freeRedisProvider)
|
||||
{
|
||||
_dbProvider= dbProvider;
|
||||
_applicationOptions = applicationOptions.Value;
|
||||
_guidGenerator= guidGenerator;
|
||||
_runtimeContext= runtimeContext;
|
||||
_guidGenerator= guidGenerator;
|
||||
_logger= logger;
|
||||
_imemoryCache = memoryCache;
|
||||
_freeRedisProvider = freeRedisProvider;
|
||||
Instance = _freeRedisProvider.Instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 日志保存通道写入
|
||||
/// </summary>
|
||||
@ -64,21 +72,43 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
await channelWriter.WriteAsync(dataItems);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存电表信息
|
||||
/// 获取缓存设备信息
|
||||
/// </summary>
|
||||
/// <param name="meterType"></param>
|
||||
/// <param name="timeDensity"></param>
|
||||
/// <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)}";
|
||||
// TODO:临时写死,等确认后如何取再调整
|
||||
return await Task.FromResult(new AmmeterInfo() {
|
||||
ProjectID = 10000,
|
||||
MeterId=11111,
|
||||
FocusId=22222
|
||||
string redisCacheDeviceInfoHashKey = $"{string.Format(RedisConst.CacheDeviceInfoHashKey, _applicationOptions.SystemType, _applicationOptions.ServerTagName)}";
|
||||
string deviceKey= $"{code}:{pn}";
|
||||
var deviceInfo= await _imemoryCache.GetOrCreateAsync(deviceKey, async entry =>
|
||||
{
|
||||
List<DeviceInfo> devices= await Instance.HGetAsync<List<DeviceInfo>>(redisCacheDeviceInfoHashKey, code) ?? new List<DeviceInfo>();
|
||||
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>
|
||||
@ -127,8 +157,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
Timestamps = data.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(),
|
||||
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();
|
||||
if (taskData != null)
|
||||
{
|
||||
@ -172,14 +202,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(),
|
||||
ReceivedTime = analysisBaseDto.ReceivedTime,
|
||||
};
|
||||
}
|
||||
_runtimeContext.UseTableSessionPool = true; // 使树模型池
|
||||
await _dbProvider.InsertAsync(taskData);
|
||||
}
|
||||
await _dbProvider.GetSessionPool(true).InsertAsync(taskData);
|
||||
//如果无字段名,则不保存数据
|
||||
if (!string.IsNullOrWhiteSpace(data.FiledName))
|
||||
{
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.InsertAsync(meter);
|
||||
{
|
||||
await _dbProvider.GetSessionPool(false).InsertAsync(meter);
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
@ -235,9 +263,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
DataType = analysisBaseDto.DataType,
|
||||
Timestamps = item.TimeSpan!.Value.GetFormatTime(analysisBaseDto.DensityUnit, analysisBaseDto.TimeDensity).GetDateTimeOffset().ToUnixTimeNanoseconds(), // TODO:这里暂时格式化15分钟数据,需要进行调整
|
||||
SingleMeasuring =(item.FiledName ?? string.Empty, item.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();
|
||||
if (taskData != null)
|
||||
{
|
||||
@ -289,13 +316,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
treeModelSingleMeasuringEntities.Add(meter);
|
||||
}
|
||||
}
|
||||
// 批量保存数据
|
||||
_runtimeContext.UseTableSessionPool = true; // 使树模型池
|
||||
await _dbProvider.BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
||||
// 批量保存数据
|
||||
await _dbProvider.GetSessionPool(true).BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
||||
if (treeModelSingleMeasuringEntities.Count > 0)
|
||||
{
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.BatchInsertAsync(treeModelSingleMeasuringEntities);
|
||||
{
|
||||
await _dbProvider.GetSessionPool(false).BatchInsertAsync(treeModelSingleMeasuringEntities);
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
@ -324,12 +349,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
DeviceId = $"{data.DeviceId}",
|
||||
DeviceType = $"{data.DeviceType}",
|
||||
ProjectId = $"{data.ProjectId}",
|
||||
DataType = analysisBaseDto.DataType,
|
||||
DataType = IOTDBDataTypeConst.Status,
|
||||
Timestamps = timestamps,
|
||||
SingleMeasuring = (data.FiledName!, data.DataValue!)
|
||||
};
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.InsertAsync(treeData);
|
||||
};
|
||||
await _dbProvider.GetSessionPool(false).InsertAsync(treeData);
|
||||
// 数据帧
|
||||
var treeFrameData = new TreeModelSingleMeasuringEntity<string>()
|
||||
{
|
||||
@ -337,13 +361,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
DeviceId = $"{data.DeviceId}",
|
||||
DeviceType = $"{data.DeviceType}",
|
||||
ProjectId = $"{data.ProjectId}",
|
||||
DataType = analysisBaseDto.DataType,
|
||||
DataType = IOTDBDataTypeConst.Status,
|
||||
Timestamps = timestamps,
|
||||
SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty)
|
||||
};
|
||||
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.InsertAsync(treeFrameData);
|
||||
|
||||
await _dbProvider.GetSessionPool(false).InsertAsync(treeFrameData);
|
||||
|
||||
// 时间
|
||||
var treeRecordingTimeData = new TreeModelSingleMeasuringEntity<DateTime>()
|
||||
@ -353,11 +376,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
DeviceType = $"{data.DeviceType}",
|
||||
ProjectId = $"{data.ProjectId}",
|
||||
Timestamps = timestamps,
|
||||
DataType = analysisBaseDto.DataType,
|
||||
DataType = IOTDBDataTypeConst.Status,
|
||||
SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, data.TimeSpan.HasValue ? data.TimeSpan.Value : DateTime.Now)
|
||||
};
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.InsertAsync(treeRecordingTimeData);
|
||||
};
|
||||
await _dbProvider.GetSessionPool(true).InsertAsync(treeRecordingTimeData);
|
||||
|
||||
// 新建
|
||||
string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ);
|
||||
@ -391,9 +413,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
ReceivedRemark = data.ErrorCodeMsg ?? string.Empty,
|
||||
ScoreValue = $"{analysisBaseDto.Code}.{taskMark}".Md5Fun(),
|
||||
ReceivedTime=analysisBaseDto.ReceivedTime,
|
||||
};
|
||||
_runtimeContext.UseTableSessionPool = true; // 使表模型池
|
||||
await _dbProvider.InsertAsync(taskData);
|
||||
};
|
||||
await _dbProvider.GetSessionPool(true).InsertAsync(taskData);
|
||||
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
@ -425,25 +446,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
DeviceId = $"{item.DeviceId}",
|
||||
DeviceType = $"{item.DeviceType}",
|
||||
ProjectId = $"{item.ProjectId}",
|
||||
DataType = analysisBaseDto.DataType,
|
||||
DataType = IOTDBDataTypeConst.Status,
|
||||
Timestamps = timestamps,
|
||||
SingleMeasuring = (item.FiledName!, item.DataValue!)
|
||||
};
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.InsertAsync(treeData);
|
||||
};
|
||||
await _dbProvider.GetSessionPool(false).InsertAsync(treeData);
|
||||
// 数据帧
|
||||
var treeFrameData = new TreeModelSingleMeasuringEntity<string>()
|
||||
{
|
||||
SystemName = _applicationOptions.SystemType,
|
||||
DeviceType = $"{item.DeviceType}",
|
||||
ProjectId = $"{item.ProjectId}",
|
||||
DataType = analysisBaseDto.DataType,
|
||||
DataType = IOTDBDataTypeConst.Status,
|
||||
Timestamps = timestamps,
|
||||
SingleMeasuring = (ConcentratorStatusFieldConst.FrameData, analysisBaseDto.ReceivedHexMessage ?? string.Empty)
|
||||
};
|
||||
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.InsertAsync(treeFrameData);
|
||||
|
||||
await _dbProvider.GetSessionPool(false).InsertAsync(treeFrameData);
|
||||
|
||||
// 时间
|
||||
var treeRecordingTimeData = new TreeModelSingleMeasuringEntity<DateTime>()
|
||||
@ -451,12 +470,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
SystemName = _applicationOptions.SystemType,
|
||||
DeviceType = $"{item.DeviceType}",
|
||||
ProjectId = $"{item.ProjectId}",
|
||||
DataType = analysisBaseDto.DataType,
|
||||
DataType = IOTDBDataTypeConst.Status,
|
||||
Timestamps = timestamps,
|
||||
SingleMeasuring = (ConcentratorStatusFieldConst.RecordingTime, item.TimeSpan.HasValue ? item.TimeSpan.Value : DateTime.Now)
|
||||
};
|
||||
_runtimeContext.UseTableSessionPool = false; // 使树模型池
|
||||
await _dbProvider.InsertAsync(treeRecordingTimeData);
|
||||
};
|
||||
await _dbProvider.GetSessionPool(false).InsertAsync(treeRecordingTimeData);
|
||||
|
||||
// 新建
|
||||
string taskMark = CommonHelper.GetTaskMark(analysisBaseDto.AFN, analysisBaseDto.Fn, analysisBaseDto.Pn, analysisBaseDto.MSA, analysisBaseDto.PSEQ);
|
||||
@ -495,9 +513,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
|
||||
meterReadingTelemetryPacketInfos.Add(taskData);
|
||||
}
|
||||
if (meterReadingTelemetryPacketInfos.Count > 0)
|
||||
{
|
||||
_runtimeContext.UseTableSessionPool = true; // 使表模型池
|
||||
await _dbProvider.BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
||||
{
|
||||
await _dbProvider.GetSessionPool(true).BatchInsertAsync(meterReadingTelemetryPacketInfos);
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
@ -19,18 +19,19 @@ namespace JiShe.CollectBus.Protocol.T37612012.Appendix
|
||||
{
|
||||
try
|
||||
{
|
||||
if (data.Count != 2)
|
||||
return null;
|
||||
var value = string.Join(".", data);
|
||||
var values= new List<string>() { "电网频率", "10_97", "1", value };
|
||||
result?.Invoke(values);
|
||||
return Task.FromResult(true);
|
||||
if (data.Count == 2)
|
||||
{
|
||||
var value = string.Join(".", data);
|
||||
//电网频率
|
||||
result?.Invoke(value);
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_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)
|
||||
{
|
||||
context.Services.AddKeyedSingleton<IProtocolPlugin, T37612012ProtocolPlugin>(nameof(T37612012ProtocolPlugin));
|
||||
|
||||
context.Services.AddMemoryCache();
|
||||
// TODO:先用之前的策略注册方式,后续验证后采用LoadAnalysisStrategy
|
||||
RegisterProtocolAnalysis(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.Enums;
|
||||
using JiShe.CollectBus.Common.Models;
|
||||
@ -55,7 +56,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
|
||||
@ -80,7 +81,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
|
||||
@ -105,7 +106,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
|
||||
@ -129,7 +130,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
@ -154,7 +155,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
|
||||
@ -178,7 +179,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
@ -203,7 +204,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
|
||||
@ -227,7 +228,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Fn = request.Fn
|
||||
};
|
||||
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
|
||||
|
||||
@ -252,13 +253,19 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
#region AFN10H 数据转发
|
||||
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()
|
||||
{
|
||||
AFN = AFN.数据转发,
|
||||
@ -275,8 +282,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
Pn = request.Pn,
|
||||
Fn = request.Fn
|
||||
};
|
||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter, request.DataUnit);
|
||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA, };
|
||||
var bytes = Build3761SendData.BuildSendCommandBytes(reqParameter, dataUnit);
|
||||
return new Telemetry3761PacketResponse() { Seq = reqParameter.Seq.PRSEQ, Data = bytes, MSA = reqParameter.MSA,Pn = reqParameter.Pn,AFn = (int)reqParameter.AFN,Fn = reqParameter.Fn };
|
||||
}
|
||||
|
||||
#region SpecialAmmeter 特殊电表转发
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
using JiShe.CollectBus.Protocol.Models;
|
||||
|
||||
namespace JiShe.CollectBus.Protocol.T37612012.SendData
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建3761报文参数
|
||||
@ -20,8 +22,13 @@
|
||||
/// </summary>
|
||||
public int Pn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子协议请求
|
||||
/// </summary>
|
||||
public SubProtocolBuildRequest SubRequest { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 透明转发单元
|
||||
/// 透明转发数据单元
|
||||
/// </summary>
|
||||
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