优化解析,移除不必要的DTO
This commit is contained in:
parent
1e85f894a8
commit
be4c25519d
@ -31,7 +31,7 @@ var host = Host.CreateDefaultBuilder(args)
|
|||||||
.AddJsonFile("appsettings.json")
|
.AddJsonFile("appsettings.json")
|
||||||
.Build();
|
.Build();
|
||||||
// 直接读取配置项
|
// 直接读取配置项
|
||||||
var greeting = config["Kafka:ServerTagName"];
|
var greeting = config["ServerApplicationOptions:ServerTagName"];
|
||||||
Console.WriteLine(greeting); // 输出: Hello, World!
|
Console.WriteLine(greeting); // 输出: Hello, World!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,6 @@
|
|||||||
"SaslPassword": "lixiao1980",
|
"SaslPassword": "lixiao1980",
|
||||||
"KafkaReplicationFactor": 3,
|
"KafkaReplicationFactor": 3,
|
||||||
"NumPartitions": 30,
|
"NumPartitions": 30,
|
||||||
"ServerTagName": "JiSheCollectBus4",
|
|
||||||
"FirstCollectionTime": "2025-04-22 16:07:00"
|
"FirstCollectionTime": "2025-04-22 16:07:00"
|
||||||
},
|
},
|
||||||
"IoTDBOptions": {
|
"IoTDBOptions": {
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace JiShe.CollectBus.Kafka.Producer
|
|||||||
BootstrapServers = _kafkaOptionConfig.BootstrapServers,
|
BootstrapServers = _kafkaOptionConfig.BootstrapServers,
|
||||||
//AllowAutoCreateTopics = true,
|
//AllowAutoCreateTopics = true,
|
||||||
QueueBufferingMaxKbytes = 4_194_304, // 4_194_304 2_097_151 // 修改缓冲区最大为2GB,默认为1GB
|
QueueBufferingMaxKbytes = 4_194_304, // 4_194_304 2_097_151 // 修改缓冲区最大为2GB,默认为1GB
|
||||||
QueueBufferingMaxMessages = int.MaxValue, // 修改缓冲区消息条
|
QueueBufferingMaxMessages = int.MaxValue, // 缓冲区消息条
|
||||||
CompressionType = CompressionType.Lz4, // 配置使用压缩算法LZ4,其他:gzip/snappy/zstd
|
CompressionType = CompressionType.Lz4, // 配置使用压缩算法LZ4,其他:gzip/snappy/zstd
|
||||||
BatchSize = 32_768, // 修改批次大小为32K
|
BatchSize = 32_768, // 修改批次大小为32K
|
||||||
LingerMs = 20, // 修改等待时间为20ms,默认为5ms
|
LingerMs = 20, // 修改等待时间为20ms,默认为5ms
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.IoTDB.Interface;
|
using JiShe.CollectBus.IoTDB.Interface;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
@ -89,7 +90,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public List<AnalysisBaseDto<decimal>> GenerateFinalResult(int index, List<string> data, string remark = "", int afn = 0, int fn = 0)
|
public List<AnalysisBaseDto<decimal>> GenerateFinalResult(int index, List<string> data, string filedDesc = "", int afn = 0, int fn = 0)
|
||||||
{
|
{
|
||||||
List<AnalysisBaseDto<decimal>> list = new List<AnalysisBaseDto<decimal>>();
|
List<AnalysisBaseDto<decimal>> list = new List<AnalysisBaseDto<decimal>>();
|
||||||
for (int i = index; i < data.Count; i++)
|
for (int i = index; i < data.Count; i++)
|
||||||
@ -105,6 +106,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
meter.DataValue = value;
|
meter.DataValue = value;
|
||||||
meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}";
|
meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}";
|
||||||
meter.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
meter.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
||||||
|
meter.FiledDesc = filedDesc;
|
||||||
|
meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
||||||
list.Add(meter);
|
list.Add(meter);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -30,8 +31,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.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);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
List<AFN12_F130_AnalysisDto> list = GenerateFinalResult(2, datas, "正向无功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
List<AnalysisBaseDto<decimal>> list = GenerateFinalResult(2, datas, "正向无功电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
||||||
UnitDataAnalysis<List<AFN12_F130_AnalysisDto>> unitDataAnalysis = new UnitDataAnalysis<List<AFN12_F130_AnalysisDto>>
|
UnitDataAnalysis<List<AnalysisBaseDto<decimal>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal>>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
@ -77,12 +78,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
public List<AFN12_F130_AnalysisDto> GenerateFinalResult(int index, List<string> data, string remark = "", int afn = 0, int fn = 0)
|
public List<AnalysisBaseDto<decimal>> GenerateFinalResult(int index, List<string> data, string filedDesc = "", int afn = 0, int fn = 0)
|
||||||
{
|
{
|
||||||
List<AFN12_F130_AnalysisDto> list = new List<AFN12_F130_AnalysisDto>();
|
List<AnalysisBaseDto<decimal>> list = new List<AnalysisBaseDto<decimal>>();
|
||||||
for (int i = index; i < data.Count; i++)
|
for (int i = index; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
AFN12_F130_AnalysisDto meter = new AFN12_F130_AnalysisDto();
|
AnalysisBaseDto<decimal> meter = new AnalysisBaseDto<decimal>();
|
||||||
decimal value = 0;
|
decimal value = 0;
|
||||||
var errorCode = data[i].CheckErrorCode();
|
var errorCode = data[i].CheckErrorCode();
|
||||||
if (errorCode != null)
|
if (errorCode != null)
|
||||||
@ -92,6 +93,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
meter.DataValue = value;
|
meter.DataValue = value;
|
||||||
meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}";
|
meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}";
|
||||||
meter.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
meter.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
||||||
|
meter.FiledDesc = filedDesc;
|
||||||
|
meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
||||||
list.Add(meter);
|
list.Add(meter);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -29,8 +30,8 @@ namespace JiShe.CollectBus.Protocol.T37612012.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);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
List<AFN12_F131_AnalysisDto> list = GenerateFinalResult(2, datas, "反向有功总电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
List<AnalysisBaseDto<decimal>> list = GenerateFinalResult(2, datas, "反向有功总电能示值", input.AFN_FC.AFN, input.DT.Fn);
|
||||||
UnitDataAnalysis<List<AFN12_F131_AnalysisDto>> unitDataAnalysis = new UnitDataAnalysis<List<AFN12_F131_AnalysisDto>>
|
UnitDataAnalysis<List<AnalysisBaseDto<decimal>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal>>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
@ -77,12 +78,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
public List<AFN12_F131_AnalysisDto> GenerateFinalResult(int index, List<string> data, string remark = "", int afn = 0, int fn = 0)
|
public List<AnalysisBaseDto<decimal>> GenerateFinalResult(int index, List<string> data, string filedDesc = "", int afn = 0, int fn = 0)
|
||||||
{
|
{
|
||||||
List<AFN12_F131_AnalysisDto> list = new List<AFN12_F131_AnalysisDto>();
|
List<AnalysisBaseDto<decimal>> list = new List<AnalysisBaseDto<decimal>>();
|
||||||
for (int i = index; i < data.Count; i++)
|
for (int i = index; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
AFN12_F131_AnalysisDto meter = new AFN12_F131_AnalysisDto();
|
AnalysisBaseDto<decimal> meter = new AnalysisBaseDto<decimal>();
|
||||||
decimal value = 0;
|
decimal value = 0;
|
||||||
var errorCode = data[i].CheckErrorCode();
|
var errorCode = data[i].CheckErrorCode();
|
||||||
if (errorCode != null)
|
if (errorCode != null)
|
||||||
@ -91,7 +92,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
decimal.TryParse(data[i], out value);
|
decimal.TryParse(data[i], out value);
|
||||||
meter.DataValue = value;
|
meter.DataValue = value;
|
||||||
meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}";
|
meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}";
|
||||||
meter.ReadTime = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
meter.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
||||||
|
meter.FiledDesc = filedDesc;
|
||||||
|
meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
||||||
list.Add(meter);
|
list.Add(meter);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -31,8 +33,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.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);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
List<AFN12_F132_AnalysisDto> list = GenerateFinalResult(2, datas, "反向无功电能示值", (int)input.AFN_FC.AFN!, (int)input.DT.Fn!);
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
UnitDataAnalysis<List<AFN12_F132_AnalysisDto>> unitDataAnalysis = new UnitDataAnalysis<List<AFN12_F132_AnalysisDto>>
|
|
||||||
|
List<AnalysisBaseDto<decimal>> list = GenerateFinalResult(2, datas, "反向无功电能示值", dataType);
|
||||||
|
UnitDataAnalysis<List<AnalysisBaseDto<decimal>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal>>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
@ -78,12 +82,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
public List<AFN12_F132_AnalysisDto> GenerateFinalResult(int index, List<string> data, string remark = "",int afn=0,int fn=0)
|
public List<AnalysisBaseDto<decimal>> GenerateFinalResult(int index, List<string> data, string dataType, string filedDesc = "")
|
||||||
{
|
{
|
||||||
List<AFN12_F132_AnalysisDto> list = new List<AFN12_F132_AnalysisDto>();
|
List<AnalysisBaseDto<decimal>> list = new List<AnalysisBaseDto<decimal>>();
|
||||||
for (int i = index; i < data.Count; i++)
|
for (int i = index; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
AFN12_F132_AnalysisDto meter = new AFN12_F132_AnalysisDto();
|
AnalysisBaseDto<decimal> meter = new AnalysisBaseDto<decimal>();
|
||||||
decimal value = 0;
|
decimal value = 0;
|
||||||
var errorCode = data[i].CheckErrorCode();
|
var errorCode = data[i].CheckErrorCode();
|
||||||
if (errorCode != null)
|
if (errorCode != null)
|
||||||
@ -91,8 +95,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
else
|
else
|
||||||
decimal.TryParse(data[i], out value);
|
decimal.TryParse(data[i], out value);
|
||||||
meter.DataValue = value;
|
meter.DataValue = value;
|
||||||
meter.DataType = $"{afn.ToString().PadLeft(2, '0')}_{fn}_{i - index}";
|
meter.DataType = $"{dataType}_{i - index}";
|
||||||
meter.ReadTime = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
meter.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
||||||
|
meter.FiledDesc = filedDesc;
|
||||||
|
meter.FiledName = meter.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
||||||
list.Add(meter);
|
list.Add(meter);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
using JiShe.CollectBus.Protocol.T37612012.Appendix;
|
||||||
using JiShe.CollectBus.Protocol3761;
|
using JiShe.CollectBus.Protocol3761;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System.Diagnostics.Metrics;
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
||||||
{
|
{
|
||||||
@ -31,9 +33,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.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);
|
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
AFN12_F145_AnalysisDto data = GenerateFinalResult(2, datas, "当月正向有功最大需量及发生时间");
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
data.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
|
||||||
UnitDataAnalysis<AFN12_F145_AnalysisDto> unitDataAnalysis = new UnitDataAnalysis<AFN12_F145_AnalysisDto>
|
AnalysisBaseDto<decimal> data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", dataType);
|
||||||
|
UnitDataAnalysis<AnalysisBaseDto<decimal>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
@ -93,9 +96,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AFN12_F145_AnalysisDto GenerateFinalResult(int index, List<string> data, string remark = "")
|
public AnalysisBaseDto<decimal> GenerateFinalResult(List<string> data, string filedDesc = "",string dataType)
|
||||||
{
|
{
|
||||||
AFN12_F145_AnalysisDto dto = new AFN12_F145_AnalysisDto();
|
AnalysisBaseDto<decimal> dto = new AnalysisBaseDto<decimal>();
|
||||||
|
|
||||||
decimal value = 0;
|
decimal value = 0;
|
||||||
var errorCode = data[2].CheckErrorCode();
|
var errorCode = data[2].CheckErrorCode();
|
||||||
@ -105,11 +108,14 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
|
|||||||
decimal.TryParse(data[2], out value);
|
decimal.TryParse(data[2], out value);
|
||||||
|
|
||||||
dto.DataValue = value;
|
dto.DataValue = value;
|
||||||
dto.TimeSpan = $"{DateTime.Now.Year}-{data[3].Substring(0, 2)}-{data[3].Substring(2, 2)} {data[3].Substring(4, 2)}:{data[3].Substring(6, 2)}:00";//$"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)}";
|
string timeSpan = $"{DateTime.Now.Year}-{data[3].Substring(0, 2)}-{data[3].Substring(2, 2)} {data[3].Substring(4, 2)}:{data[3].Substring(6, 2)}:00";//$"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)}";
|
||||||
if (DateTime.TryParse(dto.TimeSpan, out DateTime readingDate))
|
if (DateTime.TryParse(timeSpan, out DateTime readingDate))
|
||||||
{
|
{
|
||||||
dto.ReadingDate = readingDate;
|
dto.TimeSpan = readingDate;
|
||||||
}
|
}
|
||||||
|
dto.DataType = dataType;
|
||||||
|
dto.FiledDesc = filedDesc;
|
||||||
|
dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -143,9 +143,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
{
|
{
|
||||||
dto.TimeSpan= dto.TimeSpan.Value.AddYears(-1);
|
dto.TimeSpan= dto.TimeSpan.Value.AddYears(-1);
|
||||||
}
|
}
|
||||||
|
dto.DataType = dataType;
|
||||||
dto.FiledDesc = "上月(上一结算日)正向有功最大需量及发生时间";
|
dto.FiledDesc = "上月(上一结算日)正向有功最大需量及发生时间";
|
||||||
dto.FiledName = dataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
||||||
|
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using JiShe.CollectBus.Common.Enums;
|
using JiShe.CollectBus.Common.Enums;
|
||||||
using JiShe.CollectBus.Common.Extensions;
|
using JiShe.CollectBus.Common.Extensions;
|
||||||
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Dto;
|
using JiShe.CollectBus.Protocol.Dto;
|
||||||
using JiShe.CollectBus.Protocol.Interfaces;
|
using JiShe.CollectBus.Protocol.Interfaces;
|
||||||
@ -32,9 +33,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN);
|
ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN);
|
||||||
ArgumentNullException.ThrowIfNull(input.DT.Fn);
|
ArgumentNullException.ThrowIfNull(input.DT.Fn);
|
||||||
var data = GenerateFinalResult(input.UnitData.HexMessageList);
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
data.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
AnalysisBaseDto<decimal> data = GenerateFinalResult(input.UnitData.HexMessageList, dataType);
|
||||||
UnitDataAnalysis<AFN12_F149_AnalysisDto> dto = new UnitDataAnalysis<AFN12_F149_AnalysisDto>
|
UnitDataAnalysis<AnalysisBaseDto<decimal>> dto = new UnitDataAnalysis<AnalysisBaseDto<decimal>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
@ -57,9 +58,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
}
|
}
|
||||||
return await Task.FromResult(false);
|
return await Task.FromResult(false);
|
||||||
}
|
}
|
||||||
public AFN12_F149_AnalysisDto GenerateFinalResult(List<string> hexMessageList)
|
public AnalysisBaseDto<decimal> GenerateFinalResult(List<string> hexMessageList,string dataType)
|
||||||
{
|
{
|
||||||
AFN12_F149_AnalysisDto dto = new AFN12_F149_AnalysisDto();
|
AnalysisBaseDto<decimal> dto = new AnalysisBaseDto<decimal>();
|
||||||
decimal value = 0;
|
decimal value = 0;
|
||||||
var arr = hexMessageList.GetRange(11, 4);
|
var arr = hexMessageList.GetRange(11, 4);
|
||||||
var errorCodeInfo = arr.CheckErrorCode();
|
var errorCodeInfo = arr.CheckErrorCode();
|
||||||
@ -72,7 +73,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
decimal.TryParse($"{arr[11]}{arr[12]}{arr[13]}.{arr[14]}", out value);
|
decimal.TryParse($"{arr[11]}{arr[12]}{arr[13]}.{arr[14]}", out value);
|
||||||
|
|
||||||
dto.DataValue = value;
|
dto.DataValue = value;
|
||||||
//dto.ReadTime = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
dto.DataType = dataType;
|
||||||
|
dto.FiledDesc = "水示值";
|
||||||
|
dto.FiledName = dto.DataType.GetDataFieldByGatherDataType() ?? string.Empty;
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,12 +32,12 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
List<string> remarks = new List<string>() { "当前总有功功率", "当前A相有功功率", "当前B相有功功率", "当前C相有功功率", "当前总无功功率", "当前A相无功功率", "当前B相无功功率", "当前C相无功功率", "当前总功率因数", "当前A相功率因数", "当前B相功率因数", "当前C相功率因数", "当前A相电压", "当前B相电压", "当前C相电压", "当前A相电流", "当前C相电流", "当前 C相电流", "当前零序电流", "当前总视在功率", "当前A相视在功率", "当前B相视在功率", "当前C相视在功率" };
|
List<string> remarks = new List<string>() { "当前总有功功率", "当前A相有功功率", "当前B相有功功率", "当前C相有功功率", "当前总无功功率", "当前A相无功功率", "当前B相无功功率", "当前C相无功功率", "当前总功率因数", "当前A相功率因数", "当前B相功率因数", "当前C相功率因数", "当前A相电压", "当前B相电压", "当前C相电压", "当前A相电流", "当前C相电流", "当前 C相电流", "当前零序电流", "当前总视在功率", "当前A相视在功率", "当前B相视在功率", "当前C相视在功率" };
|
||||||
List<AFN12_F25_AnalysisDto> list = new List<AFN12_F25_AnalysisDto>();
|
List<AnalysisBaseDto<decimal>> list = new List<AnalysisBaseDto<decimal>>();
|
||||||
List<string> data = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
List<string> data = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
|
||||||
|
|
||||||
for (int i = 1; i < data.Count; i++)
|
for (int i = 1; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
AFN12_F25_AnalysisDto dto = new AFN12_F25_AnalysisDto();
|
AnalysisBaseDto<decimal> dto = new AnalysisBaseDto<decimal>();
|
||||||
decimal value = 0;
|
decimal value = 0;
|
||||||
var errorCodeInfo = data[i].CheckErrorCode();
|
var errorCodeInfo = data[i].CheckErrorCode();
|
||||||
if (errorCodeInfo != null)
|
if (errorCodeInfo != null)
|
||||||
@ -50,11 +50,11 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
dto.DataValue = value;
|
dto.DataValue = value;
|
||||||
dto.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}_{DataType[i-1]}";
|
dto.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}_{DataType[i-1]}";
|
||||||
dto.FiledName = DataType[i - 1];
|
dto.FiledName = DataType[i - 1];
|
||||||
dto.ReadTime = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
dto.TimeSpan = Convert.ToDateTime($"{data[0].Substring(0, 4)}-{data[0].Substring(4, 2)}-{data[0].Substring(6, 2)} {data[0].Substring(8, 2)}:{data[0].Substring(10, 2)}:00");
|
||||||
dto.FiledDesc = remarks[i - 1];
|
dto.FiledDesc = remarks[i - 1];
|
||||||
list.Add(dto);
|
list.Add(dto);
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<List<AFN12_F25_AnalysisDto>> unitDataAnalysis = new UnitDataAnalysis<List<AFN12_F25_AnalysisDto>>
|
UnitDataAnalysis<List<AnalysisBaseDto<decimal>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal>>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
|
|||||||
@ -30,9 +30,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(input);
|
ArgumentNullException.ThrowIfNull(input);
|
||||||
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
|
||||||
var data= await GenerateFinalResultAsync(input.UnitData.HexMessageList);
|
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
||||||
data.DataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
|
|
||||||
UnitDataAnalysis<AFN12_F2_AnalysisDto> dto = new UnitDataAnalysis<AFN12_F2_AnalysisDto>
|
var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, dataType);
|
||||||
|
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
@ -56,9 +57,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
return await Task.FromResult(false);
|
return await Task.FromResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<AFN12_F2_AnalysisDto> GenerateFinalResultAsync(List<string> hexMessageList)
|
public async Task<AnalysisBaseDto<string>> GenerateFinalResultAsync(List<string> hexMessageList,string dataType)
|
||||||
{
|
{
|
||||||
AFN12_F2_AnalysisDto dto = new AFN12_F2_AnalysisDto();
|
AnalysisBaseDto<string> dto = new AnalysisBaseDto<string>();
|
||||||
var arr = hexMessageList.GetRange(4, 6);
|
var arr = hexMessageList.GetRange(4, 6);
|
||||||
var errorCodeInfo = arr.CheckErrorCode();
|
var errorCodeInfo = arr.CheckErrorCode();
|
||||||
if (errorCodeInfo != null)
|
if (errorCodeInfo != null)
|
||||||
@ -73,6 +74,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
dto.DataValue = value;
|
dto.DataValue = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
dto.DataType = dataType;
|
||||||
dto.FiledName = "TerminalTime";
|
dto.FiledName = "TerminalTime";
|
||||||
dto.FiledDesc = "召读终端时间";
|
dto.FiledDesc = "召读终端时间";
|
||||||
return await Task.FromResult(dto);
|
return await Task.FromResult(dto);
|
||||||
|
|||||||
@ -33,10 +33,10 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
|
|
||||||
List<string> data = await AnalysisDataUnitAsync(input.UnitData?.HexMessageList!);
|
List<string> data = await AnalysisDataUnitAsync(input.UnitData?.HexMessageList!);
|
||||||
List<string> remarks = new List<string>() { "Uab/Ua 相位角", "Ub 相位角", "Ucb/Uc 相位角", "Ia 相位角", "Ib 相位角", "Ic 相位角" };
|
List<string> remarks = new List<string>() { "Uab/Ua 相位角", "Ub 相位角", "Ucb/Uc 相位角", "Ia 相位角", "Ib 相位角", "Ic 相位角" };
|
||||||
List<AFN12_F49_AnalysisDto> list = new List<AFN12_F49_AnalysisDto>();
|
List<AnalysisBaseDto<decimal>> list = new List<AnalysisBaseDto<decimal>>();
|
||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
AFN12_F49_AnalysisDto dto = new AFN12_F49_AnalysisDto();
|
AnalysisBaseDto<decimal> dto = new AnalysisBaseDto<decimal>();
|
||||||
decimal value = 0;
|
decimal value = 0;
|
||||||
var errorCodeInfo = data[i].CheckErrorCode();
|
var errorCodeInfo = data[i].CheckErrorCode();
|
||||||
if (errorCodeInfo != null)
|
if (errorCodeInfo != null)
|
||||||
@ -53,7 +53,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
|
|||||||
dto.FiledDesc= remarks[i];
|
dto.FiledDesc= remarks[i];
|
||||||
list.Add(dto);
|
list.Add(dto);
|
||||||
}
|
}
|
||||||
UnitDataAnalysis<List<AFN12_F49_AnalysisDto>> unitDataAnalysis = new UnitDataAnalysis<List<AFN12_F49_AnalysisDto>>
|
UnitDataAnalysis<List<AnalysisBaseDto<decimal>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal>>>
|
||||||
{
|
{
|
||||||
Code = input.A.Code!,
|
Code = input.A.Code!,
|
||||||
AFN = input.AFN_FC.AFN,
|
AFN = input.AFN_FC.AFN,
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F129_AnalysisDto : AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
public DateTime ReadTime { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F130_AnalysisDto : AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
public DateTime ReadTime { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F131_AnalysisDto: AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
public DateTime ReadTime { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F132_AnalysisDto: AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
public DateTime ReadTime { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F145_AnalysisDto : AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 最大需量时标
|
|
||||||
/// </summary>
|
|
||||||
public string TimeSpan { get; set; }
|
|
||||||
|
|
||||||
public DateTime ReadingDate { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F149_AnalysisDto : AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 最大需量时标
|
|
||||||
/// </summary>
|
|
||||||
public string TimeSpan { get; set; }
|
|
||||||
|
|
||||||
public DateTime ReadingDate { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F188_AnalysisDto : AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F25_AnalysisDto: AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 读取时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime ReadTime { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F2_AnalysisDto: AnalysisBaseDto<string>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
using JiShe.CollectBus.Protocol.Dto;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Protocol.Contracts.Protocol.Dto
|
|
||||||
{
|
|
||||||
public class AFN12_F49_AnalysisDto: AnalysisBaseDto<decimal>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user