暂存
This commit is contained in:
parent
3490fc22f1
commit
2e7d76d8aa
@ -8,7 +8,6 @@ namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|||||||
{
|
{
|
||||||
public class AnalysisBaseDto
|
public class AnalysisBaseDto
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否有效数据
|
/// 是否有效数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -17,22 +16,22 @@ namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据类型
|
/// 数据类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DataType { get; set; }
|
public string PointDataType { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 错误码信息
|
/// 错误码信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ErrorCodeMsg { get; set; }
|
public string? ErrorCodeMsg { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字段名
|
/// 字段名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FiledName { get; set; }
|
public string FiledName { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字段描述
|
/// 字段描述
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FiledDesc { get; set; }
|
public string FiledDesc { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AnalysisBaseDto<T> : AnalysisBaseDto
|
public class AnalysisBaseDto<T> : AnalysisBaseDto
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 集中器地址
|
/// 集中器地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Code { get; set; }
|
public string Code { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// AFN功能码
|
/// AFN功能码
|
||||||
@ -22,6 +22,15 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Fn { get; set; }
|
public int Fn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主站地址 MSA
|
||||||
|
/// </summary>
|
||||||
|
public int MSA { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 响应帧序号
|
||||||
|
/// </summary>
|
||||||
|
public int PSEQ { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,14 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using FreeSql.Internal.CommonProvider;
|
||||||
|
using JiShe.CollectBus.Common.Consts;
|
||||||
|
using JiShe.CollectBus.Common.Encrypt;
|
||||||
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
|
using JiShe.CollectBus.EnergySystems.Entities;
|
||||||
|
using JiShe.CollectBus.IoTDB.Interface;
|
||||||
|
using JiShe.CollectBus.IoTDB.Options;
|
||||||
|
using JiShe.CollectBus.IoTDB.Provider;
|
||||||
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
|
using JiShe.CollectBus.IotSystems.MeterReadingRecords;
|
||||||
using JiShe.CollectBus.Protocol.AnalysisData.Appendix;
|
using JiShe.CollectBus.Protocol.AnalysisData.Appendix;
|
||||||
using JiShe.CollectBus.Protocol.Contracts;
|
using JiShe.CollectBus.Protocol.Contracts;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
|
||||||
@ -6,6 +16,7 @@ using JiShe.CollectBus.Protocol.Contracts.Models;
|
|||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using NUglify.JavaScript.Syntax;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_0CH
|
namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_0CH
|
||||||
{
|
{
|
||||||
@ -16,11 +27,13 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_0CH
|
|||||||
{
|
{
|
||||||
private readonly ILogger<AFN12_F129_Analysis> _logger;
|
private readonly ILogger<AFN12_F129_Analysis> _logger;
|
||||||
private readonly AnalysisStrategyContext _analysisStrategyContext;
|
private readonly AnalysisStrategyContext _analysisStrategyContext;
|
||||||
|
private readonly IIoTDbProvider _dbProvider;
|
||||||
|
|
||||||
public AFN12_F129_Analysis(ILogger<AFN12_F129_Analysis> logger, AnalysisStrategyContext analysisStrategyContext)
|
public AFN12_F129_Analysis(ILogger<AFN12_F129_Analysis> logger, AnalysisStrategyContext analysisStrategyContext, IIoTDbProvider dbProvider)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_analysisStrategyContext = analysisStrategyContext;
|
_analysisStrategyContext = analysisStrategyContext;
|
||||||
|
_dbProvider= dbProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UnitDataAnalysis<List<AFN12_F129_AnalysisDto>>> ExecuteAsync(TB3761 input)
|
public async Task<UnitDataAnalysis<List<AFN12_F129_AnalysisDto>>> ExecuteAsync(TB3761 input)
|
||||||
@ -29,16 +42,34 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_0CH
|
|||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.A.A3?.D1_D7);
|
||||||
List<AFN12_F129_AnalysisDto> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
|
||||||
UnitDataAnalysis<List<AFN12_F129_AnalysisDto>> unitDataAnalysis = new UnitDataAnalysis<List<AFN12_F129_AnalysisDto>>
|
UnitDataAnalysis<List<AFN12_F129_AnalysisDto>> unitDataAnalysis = new UnitDataAnalysis<List<AFN12_F129_AnalysisDto>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code,
|
Code = input.A.Code,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
Fn = input.DT.Fn,
|
Fn = input.DT.Fn,
|
||||||
Pn = input.DA.Pn,
|
Pn = input.DA.Pn,
|
||||||
Data = list
|
MSA= input.A.A3.D1_D7,
|
||||||
|
PSEQ= input.SEQ.PSEQ,
|
||||||
};
|
};
|
||||||
|
string taskMark = CommonHelper.GetTaskMark(unitDataAnalysis.AFN, unitDataAnalysis.Fn, unitDataAnalysis.Pn, unitDataAnalysis.MSA, unitDataAnalysis.PSEQ);
|
||||||
|
string scoreValue = $"{unitDataAnalysis.Code}.{taskMark}".Md5Fun();
|
||||||
|
|
||||||
|
var conditions = new List<QueryCondition>();
|
||||||
|
conditions.Add(new QueryCondition()
|
||||||
|
{
|
||||||
|
Field = "ScoreValue",
|
||||||
|
Operator = "=",
|
||||||
|
IsNumber = false,
|
||||||
|
Value = scoreValue
|
||||||
|
});
|
||||||
|
var taskSendInfo = await _dbProvider.QueryAsync<MeterReadingTelemetryPacketInfo>(new IoTDBQueryOptions() { TableNameOrTreePath = DevicePathBuilder.GetTableName<MeterReadingTelemetryPacketInfo>(), Conditions = conditions,PageIndex=0,PageSize=1});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
|
List<AFN12_F129_AnalysisDto> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
||||||
|
unitDataAnalysis.Data= list;
|
||||||
|
|
||||||
return await Task.FromResult(unitDataAnalysis);
|
return await Task.FromResult(unitDataAnalysis);
|
||||||
}
|
}
|
||||||
@ -98,6 +129,13 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_0CH
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成最终结果
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<bool> SaveIotDbAsync()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
119
shared/JiShe.CollectBus.Common/Consts/DataFieldConst.cs
Normal file
119
shared/JiShe.CollectBus.Common/Consts/DataFieldConst.cs
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Common.Consts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据保存字段常量
|
||||||
|
/// </summary>
|
||||||
|
public class DataFieldConst
|
||||||
|
{
|
||||||
|
public const string ZYGDN = "ZYGDN";
|
||||||
|
public const string ZWGDN = "ZWGDN";
|
||||||
|
public const string FYGDN = "FYGDN";
|
||||||
|
public const string FWGDN = "FWGDN";
|
||||||
|
|
||||||
|
public const string ZYGDNSZ = "ZYGDNSZ";
|
||||||
|
public const string ZWGDNSZ = "ZWGDNSZ";
|
||||||
|
public const string FYGDNSZ = "FYGDNSZ";
|
||||||
|
public const string FWGDNSZ = "FWGDNSZ";
|
||||||
|
|
||||||
|
public const string WGDN1 = "WGDN1";
|
||||||
|
public const string WGDN2 = "WGDN2";
|
||||||
|
public const string WGDN3 = "WGDN3";
|
||||||
|
public const string WGDN4 = "WGDN4";
|
||||||
|
|
||||||
|
public const string WGDNSZ1 = "WGDNSZ1";
|
||||||
|
public const string WGDNSZ2 = "WGDNSZ2";
|
||||||
|
public const string WGDNSZ3 = "WGDNSZ3";
|
||||||
|
public const string WGDNSZ4 = "WGDNSZ4";
|
||||||
|
|
||||||
|
public const string YGGL = "YGGL";
|
||||||
|
public const string AYGGL = "AYGGL";
|
||||||
|
public const string BYGGL = "BYGGL";
|
||||||
|
public const string CYGGL = "CYGGL";
|
||||||
|
|
||||||
|
public const string WGGL = "WGGL";
|
||||||
|
public const string AWGGL = "AWGGL";
|
||||||
|
public const string BWGGL = "BWGGL";
|
||||||
|
public const string CWGGL = "CWGGL";
|
||||||
|
|
||||||
|
public const string GLYS = "GLYS";
|
||||||
|
public const string AGLYS = "AGLYS";
|
||||||
|
public const string BGLYS = "BGLYS";
|
||||||
|
public const string CGLYS = "CGLYS";
|
||||||
|
|
||||||
|
public const string ADY = "ADY";
|
||||||
|
public const string BDY = "BDY";
|
||||||
|
public const string CDY = "CDY";
|
||||||
|
|
||||||
|
public const string ADL = "ADL";
|
||||||
|
public const string BDL = "BDL";
|
||||||
|
public const string CDL = "CDL";
|
||||||
|
|
||||||
|
public const string PowerGridFrequency = "PowerGridFrequency";
|
||||||
|
|
||||||
|
public const string Ua = "Ua";
|
||||||
|
public const string Ub = "Ub";
|
||||||
|
public const string Uc = "Uc";
|
||||||
|
|
||||||
|
public const string Ia = "Ia";
|
||||||
|
public const string Ib = "Ib";
|
||||||
|
public const string Ic = "Ic";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ConstGatherDataType
|
||||||
|
{
|
||||||
|
public const string ZYGDN = "0D_97"; //正向有功总电能量
|
||||||
|
public const string ZWGDN = "0D_98"; //正向无功总电能量曲线
|
||||||
|
public const string FYGDN = "0D_99"; //反向有功总电能量曲线
|
||||||
|
public const string FWGDN = "0D_100"; //反向无功总电能量曲线
|
||||||
|
|
||||||
|
public const string ZYGDNSZ = "0D_101"; //正向有功总电能示值曲线
|
||||||
|
public const string ZWGDNSZ = "0D_102"; //正向无功总电能示值曲线
|
||||||
|
public const string FYGDNSZ = "0D_103"; //反向有功总电能示值曲线
|
||||||
|
public const string FWGDNSZ = "0D_104"; //反向无功总电能示值曲线
|
||||||
|
|
||||||
|
public const string WGDNSZ1 = "0D_145"; //一象限无功总电能示值曲线
|
||||||
|
public const string WGDNSZ4 = "0D_146"; //四象限无功总电能示值曲线
|
||||||
|
public const string WGDNSZ2 = "0D_147"; //二象限无功总电能示值曲线
|
||||||
|
public const string WGDNSZ3 = "0D_148"; //三象限无功总电能示值曲线
|
||||||
|
|
||||||
|
public const string YGGL = "0D_81"; //有功功率曲线
|
||||||
|
public const string AYGGL = "0D_82"; //A相有功功率曲线
|
||||||
|
public const string BYGGL = "0D_83"; //B相有功功率曲线
|
||||||
|
public const string CYGGL = "0D_84"; //C相有功功率曲线
|
||||||
|
|
||||||
|
public const string WGGL = "0D_85"; //无功功率曲线
|
||||||
|
public const string AWGGL = "0D_86"; //A相无功功率曲线
|
||||||
|
public const string BWGGL = "0D_87"; //B相无功功率曲线
|
||||||
|
public const string CWGGL = "0D_88"; //C相无功功率曲线
|
||||||
|
|
||||||
|
public const string GLYS = "0D_105"; // 功率因数曲线
|
||||||
|
public const string AGLYS = "0D_106"; // A相功率因数曲线
|
||||||
|
public const string BGLYS = "0D_107"; // B相功率因数曲线
|
||||||
|
public const string CGLYS = "0D_108"; // C相功率因数曲线
|
||||||
|
|
||||||
|
public const string ADY = "0D_89"; //A相电压曲线
|
||||||
|
public const string BDY = "0D_90"; //B相电压曲线
|
||||||
|
public const string CDY = "0D_91"; //C相电压曲线
|
||||||
|
|
||||||
|
public const string ADL = "0D_92"; //A相电流曲线
|
||||||
|
public const string BDL = "0D_93"; //B相电流曲线
|
||||||
|
public const string CDL = "0D_94"; //C相电流曲线
|
||||||
|
|
||||||
|
public const string PowerGridFrequency = "10_97"; //电网频率
|
||||||
|
|
||||||
|
public const string Ua = "0C_49_Uab_Ua"; // 当前电压、电流相位角
|
||||||
|
public const string Ub = "0C_49_Ub"; // 当前电压、电流相位角
|
||||||
|
public const string Uc = "0C_49_Ucb_Uc"; // 当前电压、电流相位角
|
||||||
|
public const string Ia = "0C_49_Ia"; // 当前电压、电流相位角
|
||||||
|
public const string Ib = "0C_49_Ib"; // 当前电压、电流相位角
|
||||||
|
public const string Ic = "0C_49_Ic"; // 当前电压、电流相位角
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
26
shared/JiShe.CollectBus.Common/Helpers/DataFieldHelper.cs
Normal file
26
shared/JiShe.CollectBus.Common/Helpers/DataFieldHelper.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace JiShe.CollectBus.Common.Helpers
|
||||||
|
{
|
||||||
|
public class DataFieldHelper
|
||||||
|
{
|
||||||
|
public static string GetDataField(string dataField)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(dataField))
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dataField.Contains("."))
|
||||||
|
{
|
||||||
|
return dataField.Split('.')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user