合并代码

This commit is contained in:
ChenYi 2025-05-14 11:34:18 +08:00
commit 9df3f652f9
86 changed files with 1115 additions and 889 deletions

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -38,15 +39,15 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H
ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询电表信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId= ammeterInfo.FocusId; data.FocusId= deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>> UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
{ {

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -35,15 +36,15 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询电表信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>> UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
{ {

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
DataValue = "Login", DataValue = "Login",
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>> UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
{ {

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
DataValue = "LogOut", DataValue = "LogOut",
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>> UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
{ {

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -36,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
DataValue = "Heartbeat", DataValue = "Heartbeat",
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>> UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
{ {

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -32,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
var version = AnalysisDataUnit(input.UnitData.HexMessageList); var version = AnalysisDataUnit(input.UnitData.HexMessageList);
version.AreaCode = input.A.Code?.Substring(0, 4); version.AreaCode = input.A.Code?.Substring(0, 4);
@ -42,16 +44,16 @@ namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_09H
DataValue = version, DataValue = version,
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>> UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN9_F1_AnalysisDto?>>
{ {

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -29,6 +30,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
var data = new AnalysisBaseDto<string?>() var data = new AnalysisBaseDto<string?>()
{ {
@ -36,16 +38,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_09H
DataValue = Encoding.ASCII.GetString(string.Join("", input.UnitData.HexMessageList.Skip(30).Take(20).ToList()).HexToByte()).Replace("\0", ""), DataValue = Encoding.ASCII.GetString(string.Join("", input.UnitData.HexMessageList.Skip(30).Take(20).ToList()).HexToByte()).Replace("\0", ""),
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>> UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
{ {

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -28,6 +29,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
Tuple<int, List<AFN10F10Entity>> tuple = AFN10F10EntityAnalysis(input.UnitData.HexMessageList); Tuple<int, List<AFN10F10Entity>> tuple = AFN10F10EntityAnalysis(input.UnitData.HexMessageList);
@ -41,16 +43,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
}, },
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>> UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F10_AnalysisDto?>>
{ {
@ -90,22 +92,25 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
SerialNum = $"{sArray[1]}{sArray[0]}".HexToDec(), SerialNum = $"{sArray[1]}{sArray[0]}".HexToDec(),
Point = $"{sArray[3]}{sArray[2]}".HexToDec(), Point = $"{sArray[3]}{sArray[2]}".HexToDec(),
RuleType= GetProtocol(sArray[5]), RuleType= GetProtocol(sArray[5]),
ComAddress= $"{sArray[11]}{sArray[10]}{sArray[9]}{sArray[8]}{sArray[7]}{sArray[6]}", //ComAddress= $"{sArray[11]}{sArray[10]}{sArray[9]}{sArray[8]}{sArray[7]}{sArray[6]}"
ComPwd= $"{sArray[17]}{sArray[16]}{sArray[15]}{sArray[14]}{sArray[13]}{sArray[12]}".Substring(6, 6), //ComPwd= $"{sArray[17]}{sArray[16]}{sArray[15]}{sArray[14]}{sArray[13]}{sArray[12]}".Substring(6, 6),
ElectricityRatesNum= sArray[18].HexToBin().Substring(2, 6).BinToDec(), //ElectricityRatesNum= sArray[18].HexToBin().Substring(2, 6).BinToDec(),
CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}", //CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}",
}; };
aFN10F10Entity.ComAddress = $"{sArray[11]}{sArray[10]}{sArray[9]}{sArray[8]}{sArray[7]}{sArray[6]}";
string baudPort = sArray[4].HexToBin().PadLeft(8, '0'); //波特率和端口号放在一个字节内 aFN10F10Entity.ComPwd = $"{sArray[17]}{sArray[16]}{sArray[15]}{sArray[14]}{sArray[13]}{sArray[12]}".Substring(6, 6);
aFN10F10Entity.ElectricityRatesNum = sArray[18].HexTo4BinZero().Substring(2, 6).BinToDec();
aFN10F10Entity.CollectorAddress = $"{sArray[25]}{sArray[24]}{sArray[23]}{sArray[22]}{sArray[21]}{sArray[20]}";
string baudPort = sArray[4].HexTo4BinZero().PadLeft(8, '0'); //波特率和端口号放在一个字节内
aFN10F10Entity.BaudRate = GetBaudrate(baudPort.Substring(0, 3)); aFN10F10Entity.BaudRate = GetBaudrate(baudPort.Substring(0, 3));
aFN10F10Entity.Port = baudPort.Substring(3, 5).BinToDec(); aFN10F10Entity.Port = baudPort.Substring(3, 5).BinToDec();
string dataDigit = sArray[19].HexToBin().PadLeft(8, '0'); //有功电能示值整数位及小数位个数 string dataDigit = sArray[19].HexTo4BinZero().PadLeft(8, '0'); //有功电能示值整数位及小数位个数
aFN10F10Entity.IntegerBitsNum = dataDigit.Substring(4, 2).BinToDec() + 4; aFN10F10Entity.IntegerBitsNum = dataDigit.Substring(4, 2).BinToDec() + 4;
aFN10F10Entity.DecimalPlacesNum = dataDigit.Substring(6, 2).BinToDec() + 1; aFN10F10Entity.DecimalPlacesNum = dataDigit.Substring(6, 2).BinToDec() + 1;
string classNo = sArray[26].HexToBin().PadLeft(8, '0');//用户大类号及用户小类号 string classNo = sArray[26].HexTo4BinZero().PadLeft(8, '0');//用户大类号及用户小类号
aFN10F10Entity.UserCategoryNum = classNo.Substring(0, 4).BinToDec() + 1; aFN10F10Entity.UserCategoryNum = classNo.Substring(0, 4).BinToDec() + 1;
aFN10F10Entity.UserCategoryNum = classNo.Substring(4, 4).BinToDec() + 1; aFN10F10Entity.UserCategoryNum = classNo.Substring(4, 4).BinToDec() + 1;
aFN10F10Entitys.Add(aFN10F10Entity); aFN10F10Entitys.Add(aFN10F10Entity);

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -32,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
var data = new AnalysisBaseDto<AFN10_F66_AnalysisDto?>() var data = new AnalysisBaseDto<AFN10_F66_AnalysisDto?>()
@ -40,16 +42,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
DataValue = await GenerateFinalResult(input.UnitData.HexMessageList), DataValue = await GenerateFinalResult(input.UnitData.HexMessageList),
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>> UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>> dto = new UnitDataAnalysis<AnalysisBaseDto<AFN10_F66_AnalysisDto?>>
{ {
@ -80,7 +82,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
public async Task<AFN10_F66_AnalysisDto> GenerateFinalResult(List<string> hexMessageList) public async Task<AFN10_F66_AnalysisDto> GenerateFinalResult(List<string> hexMessageList)
{ {
AFN10_F66_AnalysisDto entity = new AFN10_F66_AnalysisDto(); AFN10_F66_AnalysisDto entity = new AFN10_F66_AnalysisDto();
var cycleBin = hexMessageList[4].HexToBin().PadLeft(8, '0'); var cycleBin = hexMessageList[4].HexTo4BinZero().PadLeft(8, '0');
var cycleUnitBin = cycleBin.Substring(0, 2); var cycleUnitBin = cycleBin.Substring(0, 2);
var cycleValueBin = cycleBin.Substring(2, 6); var cycleValueBin = cycleBin.Substring(2, 6);

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -28,6 +29,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
var data = new AnalysisBaseDto<bool?>() var data = new AnalysisBaseDto<bool?>()
{ {
@ -35,16 +37,16 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0AH
DataValue = input.UnitData.HexMessageList[4].Equals("55"), DataValue = input.UnitData.HexMessageList[4].Equals("55"),
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(MeterTypeEnum.Focus.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.FocusId; data.DeviceId = deviceInfo.FocusId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.Address; data.DeviceAddress = deviceInfo.FocusAddress;
data.DeviceType = MeterTypeEnum.Focus; data.DeviceType = MeterTypeEnum.Focus;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>> UnitDataAnalysis<AnalysisBaseDto<bool?>> dto = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
{ {

View File

@ -4,6 +4,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IoTDB.Interface; using JiShe.CollectBus.IoTDB.Interface;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -34,6 +35,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
ArgumentNullException.ThrowIfNull(input.A.A3?.D1_D7); ArgumentNullException.ThrowIfNull(input.A.A3?.D1_D7);
UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>> UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>> unitDataAnalysis = new UnitDataAnalysis<List<AnalysisBaseDto<decimal?>>>
@ -55,17 +57,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向有功电能示值", input.AFN_FC.AFN, input.DT.Fn);
if (list.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code,input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
list.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -33,22 +34,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向无功电能示值", input.AFN_FC.AFN, input.DT.Fn); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "正向无功电能示值", input.AFN_FC.AFN, input.DT.Fn);
if (list.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
list.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -34,22 +35,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向有功总电能示值", input.AFN_FC.AFN, input.DT.Fn); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向有功总电能示值", input.AFN_FC.AFN, input.DT.Fn);
if (list.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
list.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -35,23 +36,24 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向无功电能示值", dataType); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(2, datas, "反向无功电能示值", dataType);
if (list.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
list.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -36,20 +37,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", itemType); AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "当月正向有功最大需量及发生时间", itemType);
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>> UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -36,21 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnit(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnit(input.UnitData.HexMessageList);
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, itemType,"上月(上一结算日)正向有功最大需量及发生时间"); AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, itemType,"上月(上一结算日)正向有功最大需量及发生时间");
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID=ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress= ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>> UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
{ {
Code = input.A.Code!, Code = input.A.Code!,

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -36,21 +37,23 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN); ArgumentNullException.ThrowIfNull(input.AFN_FC.AFN);
ArgumentNullException.ThrowIfNull(input.DT.Fn); ArgumentNullException.ThrowIfNull(input.DT.Fn);
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
AnalysisBaseDto<decimal?> data = GenerateFinalResult(input.UnitData.HexMessageList, itemType); AnalysisBaseDto<decimal?> data = GenerateFinalResult(input.UnitData.HexMessageList, itemType);
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<decimal?>> dto = new UnitDataAnalysis<AnalysisBaseDto<decimal?>> UnitDataAnalysis<AnalysisBaseDto<decimal?>> dto = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
{ {
Code = input.A.Code!, Code = input.A.Code!,

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -37,6 +38,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> remarks = new List<string>() { "当前总有功功率", "当前A相有功功率", "当前B相有功功率", "当前C相有功功率", "当前总无功功率", "当前A相无功功率", "当前B相无功功率", "当前C相无功功率", "当前总功率因数", "当前A相功率因数", "当前B相功率因数", "当前C相功率因数", "当前A相电压", "当前B相电压", "当前C相电压", "当前A相电流", "当前C相电流", "当前 C相电流", "当前零序电流", "当前总视在功率", "当前A相视在功率", "当前B相视在功率", "当前C相视在功率" }; List<string> remarks = new List<string>() { "当前总有功功率", "当前A相有功功率", "当前B相有功功率", "当前C相有功功率", "当前总无功功率", "当前A相无功功率", "当前B相无功功率", "当前C相无功功率", "当前总功率因数", "当前A相功率因数", "当前B相功率因数", "当前C相功率因数", "当前A相电压", "当前B相电压", "当前C相电压", "当前A相电流", "当前C相电流", "当前 C相电流", "当前零序电流", "当前总视在功率", "当前A相视在功率", "当前B相视在功率", "当前C相视在功率" };
List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>(); List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
@ -68,17 +70,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
} }
if (list.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].ItemType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
list.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }

View File

@ -12,6 +12,7 @@ using JiShe.CollectBus.Protocol.T37612012.AnalysisData;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using static FreeSql.Internal.GlobalFilter; using static FreeSql.Internal.GlobalFilter;
using JiShe.CollectBus.IotSystems.Devices;
namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
{ {
@ -36,19 +37,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, itemType); var data = await GenerateFinalResultAsync(input.UnitData.HexMessageList, itemType);
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>> UnitDataAnalysis<AnalysisBaseDto<string>> dto = new UnitDataAnalysis<AnalysisBaseDto<string>>
{ {

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -35,6 +36,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
int rationgCount = input.UnitData.HexMessageList!.GetRatingCount(23, 1); int rationgCount = input.UnitData.HexMessageList!.GetRatingCount(23, 1);
@ -46,15 +48,15 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
DataValue = await AnalysisDataUnit(input.UnitData.HexMessageList, rationgCount), DataValue = await AnalysisDataUnit(input.UnitData.HexMessageList, rationgCount),
ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType= $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>> UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<AFN12_F33_AnalysisDto?>>
{ {

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -36,7 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
List<string> data = await AnalysisDataUnitAsync(input.UnitData?.HexMessageList!); List<string> data = await AnalysisDataUnitAsync(input.UnitData?.HexMessageList!);
List<string> remarks = new List<string>() { "Uab/Ua 相位角", "Ub 相位角", "Ucb/Uc 相位角", "Ia 相位角", "Ib 相位角", "Ic 相位角" }; List<string> remarks = new List<string>() { "Uab/Ua 相位角", "Ub 相位角", "Ucb/Uc 相位角", "Ia 相位角", "Ib 相位角", "Ic 相位角" };
List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>(); List<AnalysisBaseDto<decimal?>> list = new List<AnalysisBaseDto<decimal?>>();
@ -64,17 +65,17 @@ namespace JiShe.CollectBus.Protocol.T37612012.AFN_0CH
} }
if (list.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(list[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
list.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -33,27 +35,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能量"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能量");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -66,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
@ -38,21 +41,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,6 +34,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
@ -39,21 +42,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string itemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, itemType, "反向有功总电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, itemType, "反向有功总电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "反向无功总电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "功率因数"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "功率因数");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相功率因数"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相功率因数");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相功率因数"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相功率因数");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度,注意这里会兼容存储做判断 TimeDensity = density,//密度,注意这里会兼容存储做判断

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相功率因数"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相功率因数");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using YamlDotNet.Core.Tokens; using YamlDotNet.Core.Tokens;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
@ -33,25 +35,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas,3, dataType, "抄表日冻结电能表正向有功最大需量及发生时间"); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas,3, dataType, "抄表日冻结电能表正向有功最大需量及发生时间");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "一象限无功电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "一象限无功电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -39,20 +41,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "四象限无功电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "四象限无功电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "二象限无功电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "二象限无功电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,27 +34,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "三象限无功电能示值"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "三象限无功电能示值");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,27 +33,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType,timeSpan, "正向有功总电能示值").IsValidData(new List<string>() { "0D_161", "0D_161_1", "0D_161_2", "0D_161_3", "0D_161_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType,timeSpan, "正向有功总电能示值").IsValidData(new List<string>() { "0D_161", "0D_161_1", "0D_161_2", "0D_161_3", "0D_161_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "正向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_162", "0D_162_1", "0D_162_2", "0D_162_3", "0D_162_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "正向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_162", "0D_162_1", "0D_162_2", "0D_162_3", "0D_162_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,26 +33,28 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_163", "0D_163_1", "0D_163_2", "0D_163_3", "0D_163_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_163", "0D_163_1", "0D_163_2", "0D_163_3", "0D_163_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结反向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_164", "0D_164_1", "0D_164_2", "0D_164_3", "0D_164_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结反向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_164", "0D_164_1", "0D_164_2", "0D_164_3", "0D_164_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结一象限无功电能示值").IsValidData(new List<string>() { "0D_165", "0D_165_1", "0D_165_2", "0D_165_3", "0D_165_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结一象限无功电能示值").IsValidData(new List<string>() { "0D_165", "0D_165_1", "0D_165_2", "0D_165_3", "0D_165_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结二象限无功电能示值").IsValidData(new List<string>() { "0D_166", "0D_166_1", "0D_166_2", "0D_166_3", "0D_166_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结二象限无功电能示值").IsValidData(new List<string>() { "0D_166", "0D_166_1", "0D_166_2", "0D_166_3", "0D_166_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结三象限无功电能示值").IsValidData(new List<string>() { "0D_167", "0D_167_1", "0D_167_2", "0D_167_3", "0D_167_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结三象限无功电能示值").IsValidData(new List<string>() { "0D_167", "0D_167_1", "0D_167_2", "0D_167_3", "0D_167_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,26 +33,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结四象限无功电能示值").IsValidData(new List<string>() { "0D_168", "0D_168_1", "0D_168_2", "0D_168_3", "0D_168_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "日冻结四象限无功电能示值").IsValidData(new List<string>() { "0D_168", "0D_168_1", "0D_168_2", "0D_168_3", "0D_168_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向有功电能示值").IsValidData(new List<string>() { "0D_177", "0D_177_1", "0D_177_2", "0D_177_3", "0D_177_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向有功电能示值").IsValidData(new List<string>() { "0D_177", "0D_177_1", "0D_177_2", "0D_177_3", "0D_177_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_178", "0D_178_1", "0D_178_2", "0D_178_3", "0D_178_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结正向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_178", "0D_178_1", "0D_178_2", "0D_178_3", "0D_178_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_179", "0D_179_1", "0D_179_2", "0D_179_3", "0D_179_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "反向有功总电能示值").IsValidData(new List<string>() { "0D_179", "0D_179_1", "0D_179_2", "0D_179_3", "0D_179_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结反向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_180", "0D_180_1", "0D_180_2", "0D_180_3", "0D_180_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结反向无功(组合无功 1电能示值").IsValidData(new List<string>() { "0D_180", "0D_180_1", "0D_180_2", "0D_180_3", "0D_180_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结一象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_181", "0D_181_1", "0D_181_2", "0D_181_3", "0D_181_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结一象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_181", "0D_181_1", "0D_181_2", "0D_181_3", "0D_181_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结二象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_182", "0D_182_1", "0D_182_2", "0D_182_3", "0D_182_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结二象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_182", "0D_182_1", "0D_182_2", "0D_182_3", "0D_182_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -2,12 +2,14 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -31,25 +33,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结三象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_183", "0D_183_1", "0D_183_2", "0D_183_3", "0D_183_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结三象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_183", "0D_183_1", "0D_183_2", "0D_183_3", "0D_183_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -61,7 +64,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,25 +34,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-01 00:00:00";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结四象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_184", "0D_184_1", "0D_184_2", "0D_184_3", "0D_184_4" }); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_m(3, dataType, timeSpan, "月冻结四象限无功电能示值(总、费率 1M").IsValidData(new List<string>() { "0D_184", "0D_184_1", "0D_184_2", "0D_184_3", "0D_184_4" });
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -62,7 +65,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -9,6 +9,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -32,26 +34,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; string timeSpan = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "抄表日冻结正向有功最大需量及发生时间"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_d(3, dataType, timeSpan, "抄表日冻结正向有功最大需量及发生时间");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -63,7 +66,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -3,6 +3,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -33,21 +34,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "抄表日冻结正向无功最大需量及发生时间", dataType); AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "抄表日冻结正向无功最大需量及发生时间", dataType);
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>> UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
{ {

View File

@ -11,6 +11,7 @@ using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using static FreeSql.Internal.GlobalFilter; using static FreeSql.Internal.GlobalFilter;
using JiShe.CollectBus.IotSystems.Devices;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,21 +35,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结正向有功最大需量及发生时间", dataType); AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结正向有功最大需量及发生时间", dataType);
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>> UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
{ {

View File

@ -11,6 +11,7 @@ using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using static FreeSql.Internal.GlobalFilter; using static FreeSql.Internal.GlobalFilter;
using JiShe.CollectBus.IotSystems.Devices;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,21 +35,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结反向有功最大需量及发生时间", dataType); AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas, "月冻结反向有功最大需量及发生时间", dataType);
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>> UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
{ {

View File

@ -12,6 +12,8 @@ using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using YamlDotNet.Core.Tokens; using YamlDotNet.Core.Tokens;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -35,24 +37,25 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas, dataType, "月冻结电能表正向有功最大需量及发生时间"); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas, dataType, "月冻结电能表正向有功最大需量及发生时间");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -12,6 +12,8 @@ using Volo.Abp.Domain.Entities;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -35,6 +37,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
@ -42,20 +45,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
//冻结数据时标 //冻结数据时标
var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas,dataType, "日冻结正向有/无功最大需量及发生时间"); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas,dataType, "日冻结正向有/无功最大需量及发生时间");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -67,7 +70,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -11,6 +11,8 @@ using AutoMapper.Internal.Mappers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,6 +36,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
@ -41,20 +44,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
//冻结数据时标 //冻结数据时标
var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00"; var time = $"{datas[0].Substring(0, 4)}-{datas[0].Substring(4, 2)}-{datas[0].Substring(6, 2)} 00:00:00";
List<AnalysisBaseDto<decimal?>> data = GenerateFinalResult(datas, dataType, "日冻结反向有/无功最大需量及发生时间"); List<AnalysisBaseDto<decimal?>> list = GenerateFinalResult(datas, dataType, "日冻结反向有/无功最大需量及发生时间");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -66,7 +69,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = 1,//密度-间隔, TimeDensity = 1,//密度-间隔,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "有功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "有功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相有功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相有功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相有功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相有功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相有功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相有功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "无功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "无功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相无功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相无功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相无功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相无功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相无功功率曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相无功功率曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电压曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电压曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电压曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电压曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -3,12 +3,14 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.Appendix; using JiShe.CollectBus.Protocol.T37612012.Appendix;
using JiShe.CollectBus.Protocol3761; using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -33,26 +35,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电压曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电压曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -64,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电流曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "A相电流曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电流曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "B相电流曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电流曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "C相电流曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "测量点零序电流曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "测量点零序电流曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能量曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向有功总电能量曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能量曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "正向无功总电能量曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -10,6 +10,8 @@ using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.IotSystems.Devices;
using System.Collections.Generic;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
{ {
@ -34,26 +36,27 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums))); int density = Convert.ToInt32(Convert.ToInt32(datas[1]).GetEnumDescription(typeof(DensityEnums)));
string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"; string dataType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}";
List<AnalysisBaseDto<decimal?>> data = datas.GenerateFinalResultTd_c(3, density, dataType, "反向有功总电能量曲线"); List<AnalysisBaseDto<decimal?>> list = datas.GenerateFinalResultTd_c(3, density, dataType, "反向有功总电能量曲线");
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.MeterId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.AmmerterAddress; item.DeviceAddress = deviceInfo.MeterAddress;
item.FocusId = ammeterInfo.FocusId; item.FocusId = deviceInfo.FocusId;
}); });
} }
} }
@ -65,7 +68,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0DH
Pn = input.DA.Pn, Pn = input.DA.Pn,
MSA = input.A.A3!.D1_D7!, MSA = input.A.A3!.D1_D7!,
PSEQ = input.SEQ.PSEQ, PSEQ = input.SEQ.PSEQ,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
TimeDensity = density,//密度-间隔分钟数, TimeDensity = density,//密度-间隔分钟数,

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -31,8 +32,9 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
{ {
try try
{ {
ArgumentNullException.ThrowIfNull(nameof(input)); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(nameof(input.UnitData.HexMessageList)); ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
int erc = input.UnitData.HexMessageList![8].HexToDec(); int erc = input.UnitData.HexMessageList![8].HexToDec();
bool isOnOffPower = erc.Equals(14) ? true : false; bool isOnOffPower = erc.Equals(14) ? true : false;
if (!isOnOffPower) if (!isOnOffPower)
@ -42,21 +44,20 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
return await Task.FromResult(true); return await Task.FromResult(true);
} }
List<AnalysisBaseDto<string>> data = AnalysisDataUnit(input.UnitData.HexMessageList); List<AnalysisBaseDto<string>> list = AnalysisDataUnit(input.UnitData.HexMessageList);
if (data.Count > 0) if (list.Count > 0)
{ {
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data[0].DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ForEach(item => list.ForEach(item =>
{ {
item.ProjectId = ammeterInfo.ProjectID; item.ProjectId = deviceInfo.ProjectID;
item.DeviceId = ammeterInfo.FocusId; item.DeviceId = deviceInfo.MeterId;
item.DatabaseBusiID = ammeterInfo.DatabaseBusiID; item.DatabaseBusiID = deviceInfo.DatabaseBusiID;
item.DeviceAddress = ammeterInfo.Address; item.DeviceAddress = deviceInfo.MeterAddress;
item.DeviceType = MeterTypeEnum.Focus; item.FocusId = deviceInfo.FocusId;
item.FocusId = ammeterInfo.FocusId;
}); });
} }
} }
@ -66,7 +67,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_0EH
AFN = input.AFN_FC.AFN, AFN = input.AFN_FC.AFN,
Fn = input.DT.Fn, Fn = input.DT.Fn,
Pn = input.DA.Pn, Pn = input.DA.Pn,
Data = data, Data = list,
ReceivedHexMessage = input.BaseHexMessage.HexMessageString, ReceivedHexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId, MessageId = input.MessageId,
ReceivedTime = input.ReceivedTime, ReceivedTime = input.ReceivedTime,

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -30,6 +31,7 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
var data = new AnalysisBaseDto<string?>() var data = new AnalysisBaseDto<string?>()
{ {
@ -37,15 +39,15 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
DataValue = AnalysisDataUnit(input.UnitData.HexMessageList), DataValue = AnalysisDataUnit(input.UnitData.HexMessageList),
ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}" ItemType = $"{input.AFN_FC.AFN.HexToDecStr().PadLeft(2, '0')}_{input.DT.Fn}"
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>> UnitDataAnalysis<AnalysisBaseDto<string?>> dto = new UnitDataAnalysis<AnalysisBaseDto<string?>>
{ {

View File

@ -33,6 +33,7 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.BaseHexMessage.HexMessageList); ArgumentNullException.ThrowIfNull(input.BaseHexMessage.HexMessageList);
ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageString); ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageString);
// TODO: 待定,等确认如何匹配规则 // TODO: 待定,等确认如何匹配规则

View File

@ -4,6 +4,7 @@ using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces; using JiShe.CollectBus.Protocol.Interfaces;
@ -38,20 +39,21 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList); List<string> datas = await AnalysisDataUnitAsync(input.UnitData.HexMessageList);
AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas); AnalysisBaseDto<decimal?> data = GenerateFinalResult(datas);
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>> UnitDataAnalysis<AnalysisBaseDto<decimal?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<decimal?>>
{ {

View File

@ -2,6 +2,7 @@
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.Protocol; using JiShe.CollectBus.Protocol;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
@ -33,6 +34,7 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
try try
{ {
ArgumentNullException.ThrowIfNull(input); ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList); ArgumentNullException.ThrowIfNull(input.UnitData?.HexMessageList);
List<string> datas = AnalysisDataUnit(input.UnitData.HexMessageList); List<string> datas = AnalysisDataUnit(input.UnitData.HexMessageList);
@ -44,15 +46,15 @@ namespace GatherService.WattMeter.AnalysisData.AFN_10H
ItemType= "10_98", ItemType= "10_98",
}; };
// 查询电表信息 // 查询设备信息
AmmeterInfo ammeterInfo = await _dataStorage.GetMeterInfoAsync(data.DeviceType.ToString(), "15"); DeviceInfo? deviceInfo = await _dataStorage.GetDeviceInfoAsync(input.A.Code, input.DA.Pn);
if (ammeterInfo != null) if (deviceInfo != null)
{ {
data.ProjectId = ammeterInfo.ProjectID; data.ProjectId = deviceInfo.ProjectID;
data.DeviceId = ammeterInfo.MeterId; data.DeviceId = deviceInfo.MeterId;
data.DatabaseBusiID = ammeterInfo.DatabaseBusiID; data.DatabaseBusiID = deviceInfo.DatabaseBusiID;
data.DeviceAddress = ammeterInfo.AmmerterAddress; data.DeviceAddress = deviceInfo.MeterAddress;
data.FocusId = ammeterInfo.FocusId; data.FocusId = deviceInfo.FocusId;
} }
UnitDataAnalysis<AnalysisBaseDto<bool?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<bool?>> UnitDataAnalysis<AnalysisBaseDto<bool?>> unitDataAnalysis = new UnitDataAnalysis<AnalysisBaseDto<bool?>>
{ {

View File

@ -1,26 +1,33 @@
using JiShe.CollectBus.Common; using FreeRedis;
using JiShe.CollectBus.Common;
using JiShe.CollectBus.Common.Consts; using JiShe.CollectBus.Common.Consts;
using JiShe.CollectBus.Common.Encrypt; using JiShe.CollectBus.Common.Encrypt;
using JiShe.CollectBus.Common.Enums; using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Common.Extensions; using JiShe.CollectBus.Common.Extensions;
using JiShe.CollectBus.Common.Helpers; using JiShe.CollectBus.Common.Helpers;
using JiShe.CollectBus.FreeRedis;
using JiShe.CollectBus.IoTDB.Context; using JiShe.CollectBus.IoTDB.Context;
using JiShe.CollectBus.IoTDB.Interface; using JiShe.CollectBus.IoTDB.Interface;
using JiShe.CollectBus.IoTDB.Model; using JiShe.CollectBus.IoTDB.Model;
using JiShe.CollectBus.IoTDB.Options; using JiShe.CollectBus.IoTDB.Options;
using JiShe.CollectBus.IoTDB.Provider; using JiShe.CollectBus.IoTDB.Provider;
using JiShe.CollectBus.IotSystems.Ammeters; using JiShe.CollectBus.IotSystems.Ammeters;
using JiShe.CollectBus.IotSystems.Devices;
using JiShe.CollectBus.IotSystems.LogRecord; using JiShe.CollectBus.IotSystems.LogRecord;
using JiShe.CollectBus.IotSystems.MeterReadingRecords; using JiShe.CollectBus.IotSystems.MeterReadingRecords;
using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto; using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
using JiShe.CollectBus.Protocol.Dto; using JiShe.CollectBus.Protocol.Dto;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.Metrics; using System.Diagnostics.Metrics;
using System.Threading.Channels; using System.Threading.Channels;
using TouchSocket.Core;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids; using Volo.Abp.Guids;
using YamlDotNet.Core.Tokens;
using static FreeSql.Internal.GlobalFilter; using static FreeSql.Internal.GlobalFilter;
using static JiShe.CollectBus.Common.Consts.T37612012PacketItemCodeConst; using static JiShe.CollectBus.Common.Consts.T37612012PacketItemCodeConst;
@ -33,19 +40,22 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
private readonly ServerApplicationOptions _applicationOptions; private readonly ServerApplicationOptions _applicationOptions;
private readonly IoTDBRuntimeContext _runtimeContext; private readonly IoTDBRuntimeContext _runtimeContext;
private readonly ILogger<DataStorage> _logger; private readonly ILogger<DataStorage> _logger;
private readonly IMemoryCache _imemoryCache;
private readonly IFreeRedisProvider _freeRedisProvider;
private RedisClient Instance { get; set; }
public DataStorage(IIoTDbProvider dbProvider, IOptions<ServerApplicationOptions> applicationOptions, public DataStorage(IIoTDbProvider dbProvider, IOptions<ServerApplicationOptions> applicationOptions,
IGuidGenerator guidGenerator, IoTDBRuntimeContext runtimeContext, ILogger<DataStorage> logger) IGuidGenerator guidGenerator, IoTDBRuntimeContext runtimeContext, ILogger<DataStorage> logger, IMemoryCache memoryCache, IFreeRedisProvider freeRedisProvider)
{ {
_dbProvider= dbProvider; _dbProvider= dbProvider;
_applicationOptions = applicationOptions.Value; _applicationOptions = applicationOptions.Value;
_guidGenerator= guidGenerator; _guidGenerator= guidGenerator;
_runtimeContext= runtimeContext; _runtimeContext= runtimeContext;
_logger= logger; _logger= logger;
_imemoryCache = memoryCache;
_freeRedisProvider = freeRedisProvider;
Instance = _freeRedisProvider.Instance;
} }
/// <summary> /// <summary>
/// 日志保存通道写入 /// 日志保存通道写入
/// </summary> /// </summary>
@ -64,20 +74,26 @@ namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
await channelWriter.WriteAsync(dataItems); await channelWriter.WriteAsync(dataItems);
} }
/// <summary> /// <summary>
/// 获取缓存电表信息 /// 获取缓存设备信息
/// </summary> /// </summary>
/// <param name="meterType"></param> /// <param name="meterType"></param>
/// <param name="timeDensity"></param> /// <param name="timeDensity"></param>
/// <returns></returns> /// <returns></returns>
public async Task<AmmeterInfo> GetMeterInfoAsync(string meterType,string timeDensity="15") public async Task<DeviceInfo?> GetDeviceInfoAsync(string code,int pn=1)
{ {
var redisCacheMeterInfoHashKeyTemp = $"{string.Format(RedisConst.CacheDeviceInfoHashKey, _applicationOptions.SystemType, _applicationOptions.ServerTagName, meterType, timeDensity)}"; string redisCacheDeviceInfoHashKey = $"{string.Format(RedisConst.CacheDeviceInfoHashKey, _applicationOptions.SystemType, _applicationOptions.ServerTagName)}";
// TODO临时写死等确认后如何取再调整 string deviceKey= $"{code}:{pn}";
return await Task.FromResult(new AmmeterInfo() { return await _imemoryCache.GetOrCreateAsync(deviceKey, async entry =>
ProjectID = 10000, {
MeterId=11111, List<DeviceInfo> devices= await Instance.HGetAsync<List<DeviceInfo>>(redisCacheDeviceInfoHashKey, code);
FocusId=22222 var data = devices.Where(s => s.MeteringCode == pn).FirstOrDefault();
if (data != null)
entry.SetSlidingExpiration(TimeSpan.FromMinutes(5));
else
entry.SetSlidingExpiration(TimeSpan.FromSeconds(5));
return data ?? default;
}); });
} }

View File

@ -14,7 +14,7 @@ namespace JiShe.CollectBus.Protocol.T37612012
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
context.Services.AddKeyedSingleton<IProtocolPlugin, T37612012ProtocolPlugin>(nameof(T37612012ProtocolPlugin)); context.Services.AddKeyedSingleton<IProtocolPlugin, T37612012ProtocolPlugin>(nameof(T37612012ProtocolPlugin));
context.Services.AddMemoryCache();
// TODO:先用之前的策略注册方式后续验证后采用LoadAnalysisStrategy // TODO:先用之前的策略注册方式后续验证后采用LoadAnalysisStrategy
RegisterProtocolAnalysis(context.Services); RegisterProtocolAnalysis(context.Services);
//LoadAnalysisStrategy(context.Services); //LoadAnalysisStrategy(context.Services);

View File

@ -261,10 +261,10 @@ namespace JiShe.CollectBus.Host
HealthStatus.Unhealthy) HealthStatus.Unhealthy)
.AddKafka(new Confluent.Kafka.ProducerConfig .AddKafka(new Confluent.Kafka.ProducerConfig
{ {
BootstrapServers = configuration.GetConnectionString("Kafka") BootstrapServers = configuration.GetValue<string>("Kafka:BootstrapServers")
}, "Kafka", failureStatus: HealthStatus.Unhealthy) }, "Kafka", failureStatus: HealthStatus.Unhealthy)
.AddCheck<CassandraHealthCheck>("Cassandra") //.AddCheck<CassandraHealthCheck>("Cassandra")
.AddCheck<IoTdbHealthCheck>("IoTDB"); .AddCheck<IoTdbHealthCheck>("IoTDB");
context.Services context.Services

View File

@ -1,18 +1,17 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "mongodb://mongo_PmEeF3:lixiao1980@121.42.175.177:17270/JiSheCollectBus?authSource=admin&maxPoolSize=400&minPoolSize=10&waitQueueTimeoutMS=5000", "Default": "mongodb://admin:4mFmPTTB8tn6aI@47.110.62.104:27017,47.110.53.196:27017,47.110.60.222:27017/JiSheCollectBus?authSource=admin&maxPoolSize=400&minPoolSize=10&waitQueueTimeoutMS=5000",
"Kafka": "121.42.175.177:16392,121.42.175.177:16393,121.42.175.177:16394",
"PrepayDB": "server=118.190.144.92;database=jishe.sysdb;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False", "PrepayDB": "server=118.190.144.92;database=jishe.sysdb;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False",
"EnergyDB": "server=118.190.144.92;database=db_energy;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False" "EnergyDB": "server=118.190.144.92;database=db_energy;uid=sa;pwd=admin@2023;Encrypt=False;Trust Server Certificate=False"
}, },
"Redis": { "Redis": {
"Configuration": "121.42.175.177:16380,password=1q2w3e!@#,syncTimeout=30000,abortConnect=false,connectTimeout=30000,allowAdmin=true", "Configuration": "47.110.60.222:6379,password=3JBGfyhTaD46nS,syncTimeout=30000,abortConnect=false,connectTimeout=30000,allowAdmin=true",
"MaxPoolSize": "50", "MaxPoolSize": "50",
"DefaultDB": "14", "DefaultDB": "14",
"HangfireDB": "13" "HangfireDB": "13"
}, },
"Kafka": { "Kafka": {
"BootstrapServers": "121.42.175.177:16392,121.42.175.177:16393,121.42.175.177:16394", "BootstrapServers": "47.110.62.104:9092,47.110.53.196:9092,47.110.60.222:9092",
"EnableFilter": true, "EnableFilter": true,
"EnableAuthorization": false, "EnableAuthorization": false,
"SecurityProtocol": "SaslPlaintext", "SecurityProtocol": "SaslPlaintext",
@ -26,8 +25,8 @@
}, },
"IoTDBOptions": { "IoTDBOptions": {
"UserName": "root", "UserName": "root",
"Password": "root", "Password": "Yp2eU6MVdIjXCL",
"ClusterList": [ "121.42.175.177:16667" ], "ClusterList": [ "47.110.53.196:6667", "47.110.60.222:6667", "47.110.62.104:6667" ],
"PoolSize": 2, "PoolSize": 2,
"DataBaseName": "energy", "DataBaseName": "energy",
"OpenDebugMode": true, "OpenDebugMode": true,

View File

@ -141,7 +141,7 @@
} }
}, },
"ServerApplicationOptions": { "ServerApplicationOptions": {
"ServerTagName": "JiSheCollectBus999", "ServerTagName": "JiSheCollectBus99",
"SystemType": "Energy", "SystemType": "Energy",
"FirstCollectionTime": "2025-04-28 15:07:00", "FirstCollectionTime": "2025-04-28 15:07:00",
"AutomaticVerificationTime": "16:07:00", "AutomaticVerificationTime": "16:07:00",
@ -153,6 +153,6 @@
}, },
"PlugInFolder": "", "PlugInFolder": "",
"TCP": { "TCP": {
"ClientPort": 10502 "ClientPort": 10500
} }
} }