From 4162544553f96aa5086af44826de5aa47d52c606 Mon Sep 17 00:00:00 2001 From: Dai Mr <1822802785@qq.com> Date: Wed, 15 Jan 2025 21:08:04 +0800 Subject: [PATCH] xxxx --- .../EnergySystem/EnergySystemAppService.cs | 64 ++++++- .../cmd3761Matching.txt | 48 ++++++ .../cmd3761TdcMatching.txt | 120 +++++++++++++ src/JiShe.CollectBus.Common/Enums/376Enums.cs | 5 +- .../CurrentPositiveActiveEnergyAnalyze.cs | 42 +++++ .../Models/F25ReadingAnalyze.cs | 108 ++++++++++++ .../Models/TerminalVersionInfoAnalyze.cs | 52 ++++++ .../Records/ConrOnlineRecord.cs | 43 +++++ .../Records/CsqRecord.cs | 40 +++++ .../Records/FocusRecord.cs | 61 +++++++ .../Abstracts/BaseProtocolPlugin.cs | 158 ++++++++++++------ .../Models/TB3761.cs | 3 +- 12 files changed, 687 insertions(+), 57 deletions(-) create mode 100644 src/JiShe.CollectBus.Common/Models/CurrentPositiveActiveEnergyAnalyze.cs create mode 100644 src/JiShe.CollectBus.Common/Models/F25ReadingAnalyze.cs create mode 100644 src/JiShe.CollectBus.Common/Models/TerminalVersionInfoAnalyze.cs create mode 100644 src/JiShe.CollectBus.Domain/Records/ConrOnlineRecord.cs create mode 100644 src/JiShe.CollectBus.Domain/Records/CsqRecord.cs create mode 100644 src/JiShe.CollectBus.Domain/Records/FocusRecord.cs diff --git a/src/JiShe.CollectBus.Application/EnergySystem/EnergySystemAppService.cs b/src/JiShe.CollectBus.Application/EnergySystem/EnergySystemAppService.cs index 4a4c6ce..df2c6e1 100644 --- a/src/JiShe.CollectBus.Application/EnergySystem/EnergySystemAppService.cs +++ b/src/JiShe.CollectBus.Application/EnergySystem/EnergySystemAppService.cs @@ -12,18 +12,28 @@ using JiShe.CollectBus.EnergySystem.Dto; using JiShe.CollectBus.FreeSql; using JiShe.CollectBus.PrepayModel; using JiShe.CollectBus.Protocol.Contracts; +using JiShe.CollectBus.Records; using MassTransit; +using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; +using Volo.Abp.Domain.Repositories; namespace JiShe.CollectBus.EnergySystem { public class EnergySystemAppService: CollectBusAppService,IEnergySystemAppService { + private readonly IRepository _focusRecordRepository; + private readonly IRepository _csqRecordRepository; + private readonly IRepository _conrOnlineRecordRepository; private readonly ICapPublisher _capBus; - public EnergySystemAppService(ICapPublisher capBus) + public EnergySystemAppService(IRepository focusRecordRepository, IRepository csqRecordRepository, + IRepository conrOnlineRecordRepository, ICapPublisher capBus) { - _capBus = capBus; + _focusRecordRepository = focusRecordRepository; + _csqRecordRepository = csqRecordRepository; + _conrOnlineRecordRepository = conrOnlineRecordRepository; + _capBus = capBus; } /// @@ -31,6 +41,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/TranspondSend_10_98")] public async Task> ValveControl(ValveControlInput input) { var result = new BaseResultDto(); @@ -77,6 +88,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/TranspondSend_10_94")] public async Task> ReadTime(ReadTimeInput input) { var result = new BaseResultDto @@ -111,6 +123,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/IssueArchives")] public async Task> AmmeterArchivesDown(AmmeterArchivesDownInput input) { var result = new BaseResultDto(); @@ -153,6 +166,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/ReadMeterAddress_10_105")] public Task AmmeterArchivesMatch(AmmeterArchivesMatchInput input) { throw new NotImplementedException(); @@ -164,6 +178,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/EquitDubg")] public async Task CommunicationParametersSet(CommunicationParametersSetInput input) { var result = new BaseResultDto(); @@ -209,6 +224,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/EquitDubg")] public async Task CallTimeTesting(CallTimeTestingInput input) { var result = new BaseResultDto(); @@ -235,6 +251,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/EquitDubg")] public async Task TimeAdjust(TimeAdjustInput input) { var result = new BaseResultDto(); @@ -261,6 +278,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/EquitDubg")] public async Task TerminalRestart(TerminalRestartInput input) { var result = new BaseResultDto(); @@ -287,6 +305,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/EquitDubg")] public async Task> ReadMeterNum(ReadMeterNumInput input) { var result = new BaseResultDto(); @@ -313,6 +332,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/IssueCmd")] public async Task> Reading(ReadingInput input) { var result = new BaseResultDto(); @@ -363,6 +383,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/IssueTranspondTimeSet_10_103")] public async Task TimeSet(TimeSetInput input) { var result = new BaseResultDto(); @@ -409,6 +430,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/SetAutoItemCode")] public Task AutoReportCollectionItemsSet(AutoReportCollectionItemsSetInput input) { throw new NotImplementedException(); @@ -420,6 +442,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/SetAutoUpSwitch")] public Task AutoReportSet(AutoReportSetInput input) { throw new NotImplementedException(); @@ -431,6 +454,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/QueryAutoUpSwitch")] public Task QueryAutoReportOpenStatus(QueryAutoReportOpenStatusInput input) { throw new NotImplementedException(); @@ -442,6 +466,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/BatchIssueVersion_09_1")] public async Task> BatchReadVersion(BatchReadVersionInput input) { var result = new BaseResultDto(); @@ -469,6 +494,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Record/QueryRecordLog")] public Task> QueryRecordLog(QueryRecordLogInput input) { throw new NotImplementedException(); @@ -480,6 +506,7 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// + [Route("Handmould/MeterTiming_10_104")] public async Task AdjustMeterTiming(AdjustMeterTimingInput input) { var result = new BaseResultDto(); @@ -514,9 +541,15 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// - public Task AddConrOnlineRecord(AddConrOnlineRecordInput input) + [Route("AfterSaleApi/AddConrOnlineRecord")] + public async Task AddConrOnlineRecord(AddConrOnlineRecordInput input) { - throw new NotImplementedException(); + var conrOnlineRecord = new ConrOnlineRecord(input.AreaCode,input.Address,input.State,input.LastTime); + await _conrOnlineRecordRepository.InsertAsync(conrOnlineRecord); + return new BaseResultDto() + { + Status = true + }; } /// @@ -525,9 +558,16 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// - public Task AddSignalStrength(AddSignalStrengthInput input) + [Route("AfterSaleApi/RssiToWebApi")] + public async Task AddSignalStrength(AddSignalStrengthInput input) { - throw new NotImplementedException(); + var csqRecord = new CsqRecord(input.Address, input.AreaCode,input.DeviceType,input.Csq); + await _csqRecordRepository.InsertAsync(csqRecord); + + return new BaseResultDto() + { + Status = true + }; } /// @@ -536,9 +576,17 @@ namespace JiShe.CollectBus.EnergySystem /// /// /// - public Task AddFocusLog(AddFocusLogInput input) + [Route("AfterSaleApi/AddFocusLog")] + public async Task AddFocusLog(AddFocusLogInput input) { - throw new NotImplementedException(); + var focusLog = new FocusRecord(input.Address, input.GatherServerId, int.Parse(input.IntervalTime), input.LogTime, + input.LogType, input.Remark); + await _focusRecordRepository.InsertAsync(focusLog); + + return new BaseResultDto() + { + Status = true + }; } } } diff --git a/src/JiShe.CollectBus.Application/cmd3761Matching.txt b/src/JiShe.CollectBus.Application/cmd3761Matching.txt index 5cab1eb..2fffd51 100644 --- a/src/JiShe.CollectBus.Application/cmd3761Matching.txt +++ b/src/JiShe.CollectBus.Application/cmd3761Matching.txt @@ -11,6 +11,7 @@ { "Id": 1, "Name": "UabUa相位角", + "Value": "", "DataType": "A05", "DataIndex": 0, "DataCount": 2, @@ -19,6 +20,7 @@ { "Id": 2, "Name": "Ub相位角", + "Value": "", "DataType": "A05", "DataIndex": 2, "DataCount": 2, @@ -27,6 +29,7 @@ { "Id": 3, "Name": "UcbUc相位角", + "Value": "", "DataType": "A05", "DataIndex": 4, "DataCount": 2, @@ -35,6 +38,7 @@ { "Id": 4, "Name": "Ia相位角", + "Value": "", "DataType": "A05", "DataIndex": 6, "DataCount": 2, @@ -43,6 +47,7 @@ { "Id": 5, "Name": "Ib相位角", + "Value": "", "DataType": "A05", "DataIndex": 8, "DataCount": 2, @@ -51,6 +56,7 @@ { "Id": 6, "Name": "Ic相位角", + "Value": "", "DataType": "A05", "DataIndex": 10, "DataCount": 2, @@ -66,6 +72,7 @@ { "Id": 1, "Name": "终端抄表时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -74,6 +81,7 @@ { "Id": 2, "Name": "费率数M", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -82,6 +90,7 @@ { "Id": 3, "Name": "正向有功总电能示值", + "Value": "", "DataType": "A14", "DataIndex": 6, "DataCount": 5, @@ -90,6 +99,7 @@ { "Id": 0, "Name": "费率{0}正向有功总电能示值", + "Value": "", "DataType": "A14", "DataIndex": 0, "DataCount": 5, @@ -107,6 +117,7 @@ { "Id": 1, "Name": "终端抄表时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -115,6 +126,7 @@ { "Id": 2, "Name": "费率数M", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -123,6 +135,7 @@ { "Id": 3, "Name": "正向有功总最大需量", + "Value": "", "DataType": "A23", "DataIndex": 6, "DataCount": 3, @@ -131,6 +144,7 @@ { "Id": 0, "Name": "正向有功费率{0}最大需量", + "Value": "", "DataType": "A23", "DataIndex": 0, "DataCount": 3, @@ -141,6 +155,7 @@ { "Id": 4, "Name": "正向有功总最大需量发生时间", + "Value": "", "DataType": "A17", "DataIndex": 0, "DataCount": 4, @@ -149,6 +164,7 @@ { "Id": 0, "Name": "正向有功费率{0}最大需量发生时间", + "Value": "", "DataType": "A23", "DataIndex": 0, "DataCount": 4, @@ -172,6 +188,7 @@ { "Id": 1, "Name": "日冻结类数据时标Td_d", + "Value": "", "DataType": "ATd_d", "DataIndex": 0, "DataCount": 3, @@ -180,6 +197,7 @@ { "Id": 2, "Name": "终端抄表时间", + "Value": "", "DataType": "A15", "DataIndex": 3, "DataCount": 5, @@ -188,6 +206,7 @@ { "Id": 3, "Name": "费率数M", + "Value": "", "DataType": "BIN", "DataIndex": 8, "DataCount": 1, @@ -196,6 +215,7 @@ { "Id": 4, "Name": "正向有功总最大需量", + "Value": "", "DataType": "A23", "DataIndex": 9, "DataCount": 3, @@ -204,6 +224,7 @@ { "Id": 0, "Name": "费率{0}正向有功最大需量", + "Value": "", "DataType": "A23", "DataIndex": 0, "DataCount": 3, @@ -214,6 +235,7 @@ { "Id": 5, "Name": "正向有功总最大需量发生时间", + "Value": "", "DataType": "A17", "DataIndex": 0, "DataCount": 4, @@ -222,6 +244,7 @@ { "Id": 0, "Name": "费率{0}正向有功最大需量发生时间", + "Value": "", "DataType": "A23", "DataIndex": 0, "DataCount": 4, @@ -232,6 +255,7 @@ { "Id": 6, "Name": "正向无功总最大需量", + "Value": "", "DataType": "A23", "DataIndex": 9, "DataCount": 3, @@ -240,6 +264,7 @@ { "Id": 0, "Name": "费率{0}正向无功最大需量", + "Value": "", "DataType": "A23", "DataIndex": 0, "DataCount": 3, @@ -250,6 +275,7 @@ { "Id": 7, "Name": "正向无功总最大需量发生时间", + "Value": "", "DataType": "A17", "DataIndex": 0, "DataCount": 4, @@ -258,6 +284,7 @@ { "Id": 0, "Name": "费率{0}正向无功最大需量发生时间", + "Value": "", "DataType": "A23", "DataIndex": 0, "DataCount": 4, @@ -275,6 +302,7 @@ { "Id": 1, "Name": "日冻结类数据时标Td_d", + "Value": "", "DataType": "ATd_d", "DataIndex": 0, "DataCount": 3, @@ -283,6 +311,7 @@ { "Id": 2, "Name": "终端抄表时间", + "Value": "", "DataType": "A15", "DataIndex": 3, "DataCount": 5, @@ -291,6 +320,7 @@ { "Id": 3, "Name": "费率数M", + "Value": "", "DataType": "BIN", "DataIndex": 8, "DataCount": 1, @@ -299,6 +329,7 @@ { "Id": 4, "Name": "正向有功总电能示值", + "Value": "", "DataType": "A14", "DataIndex": 9, "DataCount": 5, @@ -307,6 +338,7 @@ { "Id": 0, "Name": "费率{0}正向有功电能示值", + "Value": "", "DataType": "A14", "DataIndex": 0, "DataCount": 5, @@ -324,6 +356,7 @@ { "Id": 1, "Name": "日冻结类数据时标Td_d", + "Value": "", "DataType": "ATd_d", "DataIndex": 0, "DataCount": 3, @@ -332,6 +365,7 @@ { "Id": 2, "Name": "终端抄表时间", + "Value": "", "DataType": "A15", "DataIndex": 3, "DataCount": 5, @@ -340,6 +374,7 @@ { "Id": 3, "Name": "费率数M", + "Value": "", "DataType": "BIN", "DataIndex": 8, "DataCount": 1, @@ -348,6 +383,7 @@ { "Id": 4, "Name": "反向有功总电能示值", + "Value": "", "DataType": "A14", "DataIndex": 9, "DataCount": 5, @@ -356,6 +392,7 @@ { "Id": 0, "Name": "费率{0}反向有功电能示值", + "Value": "", "DataType": "A14", "DataIndex": 0, "DataCount": 5, @@ -373,6 +410,7 @@ { "Id": 1, "Name": "月冻结类数据时标Td_m", + "Value": "", "DataType": "ATd_m", "DataIndex": 0, "DataCount": 2, @@ -381,6 +419,7 @@ { "Id": 2, "Name": "终端抄表时间", + "Value": "", "DataType": "A15", "DataIndex": 2, "DataCount": 5, @@ -389,6 +428,7 @@ { "Id": 3, "Name": "费率数M", + "Value": "", "DataType": "BIN", "DataIndex": 7, "DataCount": 1, @@ -397,6 +437,7 @@ { "Id": 4, "Name": "正向有功总电能示值", + "Value": "", "DataType": "A14", "DataIndex": 8, "DataCount": 5, @@ -405,6 +446,7 @@ { "Id": 0, "Name": "费率{0}正向有功电能示值", + "Value": "", "DataType": "A14", "DataIndex": 0, "DataCount": 5, @@ -418,10 +460,12 @@ "Id": 0, "Fn": 179, "Text": "月冻结反向有功电能示值", + "Value": "", "UpList": [ { "Id": 1, "Name": "月冻结类数据时标Td_m", + "Value": "", "DataType": "ATd_m", "DataIndex": 0, "DataCount": 2, @@ -430,6 +474,7 @@ { "Id": 2, "Name": "终端抄表时间", + "Value": "", "DataType": "A15", "DataIndex": 2, "DataCount": 5, @@ -438,6 +483,7 @@ { "Id": 3, "Name": "费率数M", + "Value": "", "DataType": "BIN", "DataIndex": 7, "DataCount": 1, @@ -446,6 +492,7 @@ { "Id": 4, "Name": "反向有功总电能示值", + "Value": "", "DataType": "A14", "DataIndex": 8, "DataCount": 5, @@ -454,6 +501,7 @@ { "Id": 0, "Name": "费率{0}反向有功电能示值", + "Value": "", "DataType": "A14", "DataIndex": 0, "DataCount": 5, diff --git a/src/JiShe.CollectBus.Application/cmd3761TdcMatching.txt b/src/JiShe.CollectBus.Application/cmd3761TdcMatching.txt index a432620..f4d73d1 100644 --- a/src/JiShe.CollectBus.Application/cmd3761TdcMatching.txt +++ b/src/JiShe.CollectBus.Application/cmd3761TdcMatching.txt @@ -11,6 +11,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -19,6 +20,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -27,6 +29,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -35,6 +38,7 @@ { "Id": 0, "Name": "有功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -52,6 +56,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -60,6 +65,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -68,6 +74,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -76,6 +83,7 @@ { "Id": 0, "Name": "有功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -93,6 +101,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -101,6 +110,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -109,6 +119,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -117,6 +128,7 @@ { "Id": 0, "Name": "有功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -134,6 +146,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -142,6 +155,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -150,6 +164,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -158,6 +173,7 @@ { "Id": 0, "Name": "有功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -175,6 +191,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -183,6 +200,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -191,6 +209,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -199,6 +218,7 @@ { "Id": 0, "Name": "无功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -216,6 +236,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -224,6 +245,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -232,6 +254,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -240,6 +263,7 @@ { "Id": 0, "Name": "无功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -257,6 +281,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -265,6 +290,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -273,6 +299,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -281,6 +308,7 @@ { "Id": 0, "Name": "无功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -298,6 +326,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -306,6 +335,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -314,6 +344,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -322,6 +353,7 @@ { "Id": 0, "Name": "无功功率{0}", + "Value": "", "DataType": "A09", "DataIndex": 0, "DataCount": 3, @@ -339,6 +371,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -347,6 +380,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -355,6 +389,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -363,6 +398,7 @@ { "Id": 0, "Name": "电压数据{0}", + "Value": "", "DataType": "A07", "DataIndex": 0, "DataCount": 2, @@ -380,6 +416,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -388,6 +425,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -396,6 +434,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -404,6 +443,7 @@ { "Id": 0, "Name": "电压数据{0}", + "Value": "", "DataType": "A07", "DataIndex": 0, "DataCount": 2, @@ -421,6 +461,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -429,6 +470,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -437,6 +479,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -445,6 +488,7 @@ { "Id": 0, "Name": "电压数据{0}", + "Value": "", "DataType": "A07", "DataIndex": 0, "DataCount": 2, @@ -462,6 +506,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -470,6 +515,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -478,6 +524,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -486,6 +533,7 @@ { "Id": 0, "Name": "电流数据{0}", + "Value": "", "DataType": "A25", "DataIndex": 0, "DataCount": 3, @@ -503,6 +551,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -511,6 +560,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -519,6 +569,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -527,6 +578,7 @@ { "Id": 0, "Name": "电流数据{0}", + "Value": "", "DataType": "A25", "DataIndex": 0, "DataCount": 3, @@ -544,6 +596,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -552,6 +605,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -560,6 +614,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -568,6 +623,7 @@ { "Id": 0, "Name": "电流数据{0}", + "Value": "", "DataType": "A25", "DataIndex": 0, "DataCount": 3, @@ -585,6 +641,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -593,6 +650,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -601,6 +659,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -609,6 +668,7 @@ { "Id": 0, "Name": "有功电量{0}", + "Value": "", "DataType": "A13", "DataIndex": 0, "DataCount": 4, @@ -626,6 +686,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -634,6 +695,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -642,6 +704,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -650,6 +713,7 @@ { "Id": 0, "Name": "无功电量{0}", + "Value": "", "DataType": "A13", "DataIndex": 0, "DataCount": 4, @@ -667,6 +731,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -675,6 +740,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -683,6 +749,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -691,6 +758,7 @@ { "Id": 0, "Name": "有功电量{0}", + "Value": "", "DataType": "A13", "DataIndex": 0, "DataCount": 4, @@ -708,6 +776,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -716,6 +785,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -724,6 +794,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -732,6 +803,7 @@ { "Id": 0, "Name": "无功电量{0}", + "Value": "", "DataType": "A13", "DataIndex": 0, "DataCount": 4, @@ -749,6 +821,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -757,6 +830,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -765,6 +839,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -773,6 +848,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, @@ -790,6 +866,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -798,6 +875,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -806,6 +884,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -814,6 +893,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, @@ -831,6 +911,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -839,6 +920,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -847,6 +929,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -855,6 +938,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, @@ -872,6 +956,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -880,6 +965,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -888,6 +974,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -896,6 +983,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, @@ -913,6 +1001,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -921,6 +1010,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -929,6 +1019,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -937,6 +1028,7 @@ { "Id": 0, "Name": "功率因数{0}", + "Value": "", "DataType": "A05", "DataIndex": 0, "DataCount": 2, @@ -954,6 +1046,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -962,6 +1055,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -970,6 +1064,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -978,6 +1073,7 @@ { "Id": 0, "Name": "功率因数{0}", + "Value": "", "DataType": "A05", "DataIndex": 0, "DataCount": 2, @@ -995,6 +1091,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -1003,6 +1100,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -1011,6 +1109,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -1019,6 +1118,7 @@ { "Id": 0, "Name": "功率因数{0}", + "Value": "", "DataType": "A05", "DataIndex": 0, "DataCount": 2, @@ -1036,6 +1136,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -1044,6 +1145,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -1052,6 +1154,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -1060,6 +1163,7 @@ { "Id": 0, "Name": "功率因数{0}", + "Value": "", "DataType": "A05", "DataIndex": 0, "DataCount": 2, @@ -1077,6 +1181,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -1085,6 +1190,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -1093,6 +1199,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -1101,6 +1208,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, @@ -1118,6 +1226,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -1126,6 +1235,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -1134,6 +1244,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -1142,6 +1253,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, @@ -1159,6 +1271,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -1167,6 +1280,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -1175,6 +1289,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -1183,6 +1298,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, @@ -1200,6 +1316,7 @@ { "Id": 1, "Name": "起始时间", + "Value": "", "DataType": "A15", "DataIndex": 0, "DataCount": 5, @@ -1208,6 +1325,7 @@ { "Id": 2, "Name": "数据冻结密度m", + "Value": "", "DataType": "BIN", "DataIndex": 5, "DataCount": 1, @@ -1216,6 +1334,7 @@ { "Id": 3, "Name": "数据点数", + "Value": "", "DataType": "BIN", "DataIndex": 6, "DataCount": 1, @@ -1224,6 +1343,7 @@ { "Id": 0, "Name": "电能示值{0}", + "Value": "", "DataType": "A11", "DataIndex": 0, "DataCount": 4, diff --git a/src/JiShe.CollectBus.Common/Enums/376Enums.cs b/src/JiShe.CollectBus.Common/Enums/376Enums.cs index a64aa54..68df1da 100644 --- a/src/JiShe.CollectBus.Common/Enums/376Enums.cs +++ b/src/JiShe.CollectBus.Common/Enums/376Enums.cs @@ -362,7 +362,10 @@ namespace JiShe.CollectBus.Common.Enums DeviceNo = 4, SoftwareVersionNo =12, SoftwareReleaseDate=16, - HardwareVersionNo = 30 + CapacityInformationCode=19, + ProtocolVersionNo= 30, + HardwareVersionNo = 34, + HardwareReleaseDate=38 } } diff --git a/src/JiShe.CollectBus.Common/Models/CurrentPositiveActiveEnergyAnalyze.cs b/src/JiShe.CollectBus.Common/Models/CurrentPositiveActiveEnergyAnalyze.cs new file mode 100644 index 0000000..2b09191 --- /dev/null +++ b/src/JiShe.CollectBus.Common/Models/CurrentPositiveActiveEnergyAnalyze.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.CollectBus.Common.Models +{ + /// + /// 当前正向有功电能 + /// + public class CurrentPositiveActiveEnergyAnalyze + { + /// + /// 终端抄表时间 + /// + public DateTime ReadingTime { get; set; } + + /// + /// 费率数 + /// + public int RateNumber { get; set; } + + /// + /// 正向有功总电脑 + /// + public decimal Total { get; set; } + + /// + /// 费率{0}正向有功总电脑 + /// + public List Items { get; set; } + + } + + public class PositiveActiveEnergyItem + { + public string Name { get; set; } + + public decimal Value { get; set; } + } +} diff --git a/src/JiShe.CollectBus.Common/Models/F25ReadingAnalyze.cs b/src/JiShe.CollectBus.Common/Models/F25ReadingAnalyze.cs new file mode 100644 index 0000000..24ba3f0 --- /dev/null +++ b/src/JiShe.CollectBus.Common/Models/F25ReadingAnalyze.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.CollectBus.Common.Models +{ + public class F25ReadingAnalyze + { + /// + /// 终端抄表时间 + /// + public DateTime ReadingTime { get; set; } + /// + /// 当前总有功功率 + /// + public decimal CrntTotalActivePower { get; set; } + /// + /// 当前A相有功功率 + /// + public decimal CrntActivePowerOfA { get; set; } + /// + /// 当前B相有功功率 + /// + public decimal CrntActivePowerOfB { get; set; } + /// + /// 当前C相有功功率 + /// + public decimal CrntActivePowerOfC { get; set; } + /// + /// 当前总无功功率 + /// + public decimal CrntTotalReactivePower { get; set; } + /// + /// 当前A相无功功率 + /// + public decimal CrntReactivePowerOfA { get; set; } + /// + /// 当前B相无功功率 + /// + public decimal CrntReactivePowerOfB { get;set; } + /// + /// 当前C相无功功率 + /// + public decimal CrntReactivePowerOfC { get;set; } + /// + /// 当前总功率因数 + /// + public decimal CrntTotalPowerFactor { get; set; } + /// + /// 当前A相功率因数 + /// + public decimal CrntPowerFactorOfA { get;set; } + /// + /// 当前B相功率因数 + /// + public decimal CrntPowerFactorOfB { get; set; } + /// + /// 当前C相功率因数 + /// + public decimal CrntPowerFactorOfC { get; set; } + /// + /// 当前A相电压 + /// + public decimal CrntVoltageOfA { get; set; } + /// + /// 当前B相电压 + /// + public decimal CrntVoltageOfB { get; set; } + /// + /// 当前C相电压 + /// + public decimal CrntVoltageOfC { get; set; } + /// + /// 当前A相电流 + /// + public decimal CrntCurrentOfA { get; set; } + /// + /// 当前B相电流 + /// + public decimal CrntCurrentOfB { get; set; } + /// + /// 当前C相电流 + /// + public decimal CrntCurrentOfC { get; set; } + /// + /// 当前零序电流 + /// + public decimal CrntZeroSequenceCurrent { get; set; } + /// + /// 当前总视在功率 + /// + public decimal CrntTotalApparentPower { get; set; } + /// + /// 当前A相视在功率 + /// + public decimal CrntApparentPowerOfA { get; set; } + /// + /// 当前B相视在功率 + /// + public decimal CrntApparentPowerOfB { get; set; } + /// + /// 当前C相视在功率 + /// + public decimal CrntApparentPowerOfC { get; set; } + } +} diff --git a/src/JiShe.CollectBus.Common/Models/TerminalVersionInfoAnalyze.cs b/src/JiShe.CollectBus.Common/Models/TerminalVersionInfoAnalyze.cs new file mode 100644 index 0000000..a4ba5d1 --- /dev/null +++ b/src/JiShe.CollectBus.Common/Models/TerminalVersionInfoAnalyze.cs @@ -0,0 +1,52 @@ +using Microsoft.VisualBasic; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JiShe.CollectBus.Common.Models +{ + /// + /// 终端版本信息 + /// + public class TerminalVersionInfoAnalyze + { + /// + /// 厂商代号 + /// + public string MakerNo { get; set; } + /// + /// 设备编号 + /// + public string DeviceNo { get; set; } + /// + /// 终端软件版本号 + /// + public string SoftwareVersionNo { get; set; } + /// + /// 终端软件发布日期:年月日 + /// + public DateTime SoftwareReleaseDate { get; set; } + + /// + /// 容量信息码 + /// + public string CapacityInformationCode { get; set; } + + /// + /// 协议版本号 + /// + public string ProtocolVersionNo { get; set; } + + /// + /// 终端硬件版本号 + /// + public string HardwareVersionNo { get; set; } + + /// + /// 终端硬件发布日期:年月日 + /// + public DateTime HardwareReleaseDate { get; set; } + } +} diff --git a/src/JiShe.CollectBus.Domain/Records/ConrOnlineRecord.cs b/src/JiShe.CollectBus.Domain/Records/ConrOnlineRecord.cs new file mode 100644 index 0000000..e62525f --- /dev/null +++ b/src/JiShe.CollectBus.Domain/Records/ConrOnlineRecord.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace JiShe.CollectBus.Records +{ + /// + /// 集中器在线记录 + /// + public class ConrOnlineRecord : AggregateRoot + { + public ConrOnlineRecord(string areaCode,string address,bool state,DateTime lastTime) + { + AreaCode = areaCode; + Address = address; + State = state; + LastTime = lastTime; + } + + /// + /// 区域编号 + /// + public string AreaCode { get; set; } + + /// + /// 区域地址 + /// + public string Address { get; set; } + + /// + /// 是否在线 + /// + public bool State { get; set; } + + /// + /// 在/离线时间 + /// + public DateTime LastTime { get; set; } + } +} diff --git a/src/JiShe.CollectBus.Domain/Records/CsqRecord.cs b/src/JiShe.CollectBus.Domain/Records/CsqRecord.cs new file mode 100644 index 0000000..e99235a --- /dev/null +++ b/src/JiShe.CollectBus.Domain/Records/CsqRecord.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace JiShe.CollectBus.Records +{ + /// + /// 信号强度 + /// + public class CsqRecord : AggregateRoot + { + public CsqRecord(string areaCode,string address,int deviceType,string csq) + { + AreaCode = areaCode; + Address = address; + DeviceType = deviceType; + Csq = csq; + } + + /// + /// 区域编号 + /// + public string AreaCode { get; set; } + /// + /// 区域地址 + /// + public string Address { get; set; } + /// + /// 1电表 2水表 3集中器 + /// + public int DeviceType { get; set; } + /// + /// 信号强度 + /// + public string Csq { get; set; } + } +} diff --git a/src/JiShe.CollectBus.Domain/Records/FocusRecord.cs b/src/JiShe.CollectBus.Domain/Records/FocusRecord.cs new file mode 100644 index 0000000..6436e33 --- /dev/null +++ b/src/JiShe.CollectBus.Domain/Records/FocusRecord.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; + +namespace JiShe.CollectBus.Records +{ + /// + /// 集中器上下线、心跳记录 + /// + public class FocusRecord : AggregateRoot + { + public FocusRecord(string address,string gatherServerId,int intervalTime,DateTime logTime, + string logType,string remark) + { + + Address = address; + GatherServerId = gatherServerId; + IntervalTime = intervalTime; + LogTime = logTime; + LogType = logType; + Remark = remark; + } + + /// + /// 集中器编号 + /// + public string Address { get; set; } + /// + /// 采集主站 + /// + public string GatherServerId { get; set; } + /// + /// 间隔时间 (DateTime.Now.Minute - LogTime.Minute) + /// + public int IntervalTime { get; set; } + /// + /// 离/在线发生时间 + /// + public DateTime LogTime { get; set; } + /// + /// 终端心跳;SignIn 终端登录;SignOut 终端登出 + /// + public string LogType { get; set; } + + public string Remark { get; set; } + } + + //public enum LogType + //{ + // [Description("终端心跳")] + // HeartBeat, + // [Description("终端登录")] + // SignIn, + // [Description("终端登出")] + // SignOut + //} +} diff --git a/src/JiShe.CollectBus.Protocol.Contracts/Abstracts/BaseProtocolPlugin.cs b/src/JiShe.CollectBus.Protocol.Contracts/Abstracts/BaseProtocolPlugin.cs index 2f078ce..cc7a278 100644 --- a/src/JiShe.CollectBus.Protocol.Contracts/Abstracts/BaseProtocolPlugin.cs +++ b/src/JiShe.CollectBus.Protocol.Contracts/Abstracts/BaseProtocolPlugin.cs @@ -11,6 +11,7 @@ using System.Linq; using JiShe.CollectBus.Protocol.Contracts.Models; using Volo.Abp.Domain.Repositories; using System; +using System.Runtime.CompilerServices; using MassTransit.Internals.GraphValidation; namespace JiShe.CollectBus.Protocol.Contracts.Abstracts @@ -152,7 +153,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts /// /// /// - public virtual async Task AnalyzeAmmeterParameterReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) + public virtual List AnalyzeAmmeterParameterReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) { var hexDatas = GetHexDatas(messageReceived.MessageHexString); @@ -212,7 +213,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts Pn = pn, BaudRate = baudRate, Port = port, - ProtocolType = protocolType, + ProtocolType = (int)protocolType, Address = address, Password = password, RateNumber = rateNumber, @@ -224,6 +225,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts }); } + return meterList; } /// @@ -232,19 +234,22 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts /// 报文 /// 发送委托 /// - public virtual async Task AnalyzeActivePowerIndicationReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) + public virtual CurrentPositiveActiveEnergyAnalyze AnalyzeActivePowerIndicationReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) { var hexDatas = GetHexDatas(messageReceived.MessageHexString); - var minutes = Convert.ToInt32(hexDatas[0]); // 获取当前分钟数 - var hours = Convert.ToInt32(hexDatas[1]); // 获取当前小时数 + var minute = Convert.ToInt32(hexDatas[0]); // 获取当前分钟数 + var hour = Convert.ToInt32(hexDatas[1]); // 获取当前小时数 var day = Convert.ToInt32(hexDatas[2]); // 获取当前日期的日数 var month = Convert.ToInt32(hexDatas[3]); // 获取当前月份 var year = Convert.ToInt32(hexDatas[4]); // 获取当前日期的年份 + var dateTime = new DateTime(year, month, day, hour, minute, 0); + // 转换为本地时间 + var localDateTime = dateTime.ToLocalTime(); var rateNumber = Convert.ToInt32(hexDatas[5]); var kwhTotal = hexDatas.Skip(5).Take(5).ToList(); - var kwhList = new List(); + var kwhList = new List(); var index = 11; for (int i = 0; i < rateNumber; i++) { @@ -253,9 +258,20 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var integerStr = $"{kwhHexList.Take(0)}{kwhHexList.Take(1)}{kwhHexList.Take(2)}"; var decimalValStr = $"{kwhHexList[3]}{kwhHexList[4]}"; var val = decimal.Parse($"{integerStr}{decimalValStr}"); - kwhList.Add(val); + kwhList.Add(new PositiveActiveEnergyItem() + { + Name = $"费率{i + 1}正向有功总电能示值", + Value = val + }); index += 5; } + + return new CurrentPositiveActiveEnergyAnalyze() + { + ReadingTime = localDateTime, + RateNumber = rateNumber, + Items = kwhList + }; } /// @@ -264,7 +280,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts /// /// /// - public virtual async Task AnalyzeDailyFrozenReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) + public virtual void AnalyzeDailyFrozenReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) { var hexDatas = GetHexDatas(messageReceived.MessageHexString); //附录A.20 日月年 @@ -328,7 +344,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts /// /// /// - public virtual async Task AnalyzeF25ReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) + public virtual F25ReadingAnalyze AnalyzeF25ReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) { var hexDatas = GetHexDatas(messageReceived.MessageHexString); //A.15 分时日月年 @@ -409,6 +425,36 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var crntApparentPowerOfCHexs = hexDatas.Skip((int)F25DataItemEnum.CrntApparentPowerOfC).Take(3).ToList(); var crntApparentPowerOfC = AnalyzeDataAccordingToA09(crntApparentPowerOfCHexs[0], crntApparentPowerOfCHexs[1], crntApparentPowerOfCHexs[2]); + var f25ReadingAnalyze = new F25ReadingAnalyze() + { + ReadingTime = readingTime.ToLocalTime(), + CrntTotalActivePower = crntTotalActivePower, + CrntActivePowerOfA = crntActivePowerOfA, + CrntActivePowerOfB = crntActivePowerOfB, + CrntActivePowerOfC = crntActivePowerOfC, + CrntTotalReactivePower = crntTotalReactivePower, + CrntReactivePowerOfA = crntReactivePowerOfA, + CrntReactivePowerOfB = crntReactivePowerOfB, + CrntReactivePowerOfC = crntReactivePowerOfC, + CrntTotalPowerFactor = crntTotalPowerFactor, + CrntPowerFactorOfA = crntPowerFactorOfA, + CrntPowerFactorOfB = crntPowerFactorOfB, + CrntPowerFactorOfC = crntPowerFactorOfC, + CrntVoltageOfA = crntVoltageOfA, + CrntVoltageOfB = crntVoltageOfB, + CrntVoltageOfC = crntVoltageOfC, + CrntCurrentOfA = crntCurrentOfA, + CrntCurrentOfB = crntCurrentOfB, + CrntCurrentOfC = crntCurrentOfC, + CrntZeroSequenceCurrent = crntZeroSequenceCurrent, + CrntTotalApparentPower = crntTotalApparentPower, + CrntApparentPowerOfA = crntApparentPowerOfA, + CrntApparentPowerOfB = crntApparentPowerOfB, + CrntApparentPowerOfC = crntApparentPowerOfC + }; + + return f25ReadingAnalyze; + } /// @@ -417,7 +463,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts /// /// /// - public virtual async Task AnalyzeTerminalVersionInfoReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) + public virtual TerminalVersionInfoAnalyze AnalyzeTerminalVersionInfoReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) { var hexDatas = GetHexDatas(messageReceived.MessageHexString); @@ -426,7 +472,23 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var softwareVersionNo = string.Join("", hexDatas.Skip((int)TerminalVersionInfoEnum.SoftwareVersionNo).Take(4).Select(s => (char)s.HexToDec()));//软件版本号 var softwareReleaseDateList = hexDatas.Skip((int)TerminalVersionInfoEnum.SoftwareReleaseDate).Take(3).ToList(); var softwareReleaseDate = $"20{AnalyzeDataAccordingToA20(softwareReleaseDateList[0], softwareReleaseDateList[1], softwareReleaseDateList[2])}";//软件发布日期 + var capacityInformationCode = string.Join("", hexDatas.Skip((int)TerminalVersionInfoEnum.CapacityInformationCode).Take(11).Select(s => (char)s.HexToDec()));//容量信息码 + var protocolVersionNo = string.Join("", hexDatas.Skip((int)TerminalVersionInfoEnum.ProtocolVersionNo).Take(4).Select(s => (char)s.HexToDec()));//容量信息码 var hardwareVersionNo = string.Join("", hexDatas.Skip((int)TerminalVersionInfoEnum.HardwareVersionNo).Take(4).Select(s => (char)s.HexToDec()));//硬件版本号 + var hardwareReleaseDateList = hexDatas.Skip((int)TerminalVersionInfoEnum.HardwareReleaseDate).Take(3).ToList(); + var hardwareReleaseDate = $"20{AnalyzeDataAccordingToA20(hardwareReleaseDateList[0], hardwareReleaseDateList[1], hardwareReleaseDateList[2])}";//软件发布日期 + + return new TerminalVersionInfoAnalyze() + { + MakerNo = makerNo, + DeviceNo = deviceNo, + SoftwareVersionNo = softwareVersionNo, + SoftwareReleaseDate = DateTime.Parse(softwareReleaseDate).ToLocalTime(), + CapacityInformationCode = capacityInformationCode, + ProtocolVersionNo = protocolVersionNo, + HardwareVersionNo = hardwareVersionNo, + HardwareReleaseDate = DateTime.Parse(hardwareReleaseDate).ToLocalTime() + }; } /// @@ -464,7 +526,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts /// /// /// - public virtual async Task AnalyzeReadingDataAsync(MessageReceivedHeartbeat messageReceived, + public virtual TB3761FN AnalyzeReadingDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) { var hexStringList = messageReceived.MessageHexString.StringToPairs(); @@ -472,14 +534,13 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var fn = (int)hexStringList.GetAnalyzeValue(CommandChunkEnum.FN); var tb3761 = QGDW3761Config.CommandList.FirstOrDefault(it => it.Afn == afn); - if (tb3761 == null) return; + if (tb3761 == null) return null; var tb3761Fn = tb3761.FnList.FirstOrDefault(it => it.Fn == fn); - if (tb3761Fn == null) return; + if (tb3761Fn == null) return null; var hexDatas = (List)hexStringList.GetAnalyzeValue(CommandChunkEnum.Data); - var list = new List(); - + var m = 0; var rateNumberUpSort = -1; var rateNumberUp = tb3761Fn.UpList.FirstOrDefault(it => it.Name.Contains("费率数M")); @@ -505,7 +566,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var value = AnalyzeDataAccordingDataType(hexDatas, dataIndex, up.DataCount, up.DataType); if (value != null) { - list.Add(value); + up.Value = value.ToString(); } if (up.Tb3761UpChildlList.Count > 0) //复费率根据费率数来解析 { @@ -517,15 +578,17 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var val = AnalyzeDataAccordingDataType(hexDatas, dataIndex, upChild.DataCount, upChild.DataType); if (val != null) { - list.Add(val); + upChild.Name = string.Format(upChild.Name, j + 1); + upChild.Value = val.ToString(); } dataIndex += upChild.DataCount; - //var name = string.Format(up.Name, i+1); } } } } + + return tb3761Fn; } /// @@ -534,7 +597,7 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts /// /// /// - public virtual async Task AnalyzeReadingTdcDataAsync(MessageReceivedHeartbeat messageReceived, + public virtual TB3761FN AnalyzeReadingTdcDataAsync(MessageReceivedHeartbeat messageReceived, Action? sendAction = null) { @@ -542,22 +605,21 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var afn = (AFN)hexStringList.GetAnalyzeValue(CommandChunkEnum.AFN); var fn = (int)hexStringList.GetAnalyzeValue(CommandChunkEnum.FN); - var tb3761 = QGDW3761Config.CommandList.FirstOrDefault(it => it.Afn == afn); - if (tb3761 == null) return; + var tb3761 = QGDW3761Config.CommandTdcList.FirstOrDefault(it => it.Afn == afn); + if (tb3761 == null) return null; var tb3761Fn = tb3761.FnList.FirstOrDefault(it => it.Fn == fn); - if (tb3761Fn == null) return; + if (tb3761Fn == null) return null; var hexDatas = (List)hexStringList.GetAnalyzeValue(CommandChunkEnum.Data); - var list = new List(); foreach (var up in tb3761Fn.UpList) { var value = AnalyzeDataAccordingDataType(hexDatas, up.DataIndex, up.DataCount, up.DataType); if (value != null) { - list.Add(value); - + up.Value = value.ToString(); + if (up.Tb3761UpChildlList.Count > 0) { var dataIndex = up.DataIndex; @@ -569,35 +631,37 @@ namespace JiShe.CollectBus.Protocol.Contracts.Abstracts var val = AnalyzeDataAccordingDataType(hexDatas, dataIndex, upChild.DataCount, upChild.DataType); if (val != null) { - list.Add(val); + upChild.Value = val.ToString(); + upChild.Name = string.Format(upChild.Name, j + 1); } dataIndex += upChild.DataCount; - //var name = string.Format(up.Name, i+1); } } } } } - //var freezeDensity = (FreezeDensity)Convert.ToInt32(hexDatas.Skip(5).Take(1)); - //var addMinute = 0; - //switch (freezeDensity) - //{ - // case FreezeDensity.No:break; - // case FreezeDensity.Min15: - // addMinute = 15; - // break; - // case FreezeDensity.Min30: - // addMinute = 30; - // break; - // case FreezeDensity.Min60: - // addMinute = 60; - // break; - // case FreezeDensity.Min5: break; - // addMinute = 5; - // case FreezeDensity.Min1: - // addMinute = 1; - // break; - // } + + return tb3761Fn; + //var freezeDensity = (FreezeDensity)Convert.ToInt32(hexDatas.Skip(5).Take(1)); + //var addMinute = 0; + //switch (freezeDensity) + //{ + // case FreezeDensity.No:break; + // case FreezeDensity.Min15: + // addMinute = 15; + // break; + // case FreezeDensity.Min30: + // addMinute = 30; + // break; + // case FreezeDensity.Min60: + // addMinute = 60; + // break; + // case FreezeDensity.Min5: break; + // addMinute = 5; + // case FreezeDensity.Min1: + // addMinute = 1; + // break; + // } } private object? AnalyzeDataAccordingDataType(List hexDatas, int dataIndex,int dataCount,string dataType) diff --git a/src/JiShe.CollectBus.Protocol.Contracts/Models/TB3761.cs b/src/JiShe.CollectBus.Protocol.Contracts/Models/TB3761.cs index e5e5252..ecc1f88 100644 --- a/src/JiShe.CollectBus.Protocol.Contracts/Models/TB3761.cs +++ b/src/JiShe.CollectBus.Protocol.Contracts/Models/TB3761.cs @@ -35,6 +35,8 @@ namespace JiShe.CollectBus.Protocol.Contracts.Models public string Name { get; set; } + public string? Value { get; set; } + public string DataType { get; set; } public int DataIndex { get; set; } @@ -42,7 +44,6 @@ namespace JiShe.CollectBus.Protocol.Contracts.Models //public int DataIndex { get; set; } public int DataCount { get; set; } - //public int ParentId { get; set; }