From 6d95430b63ba9e257fc1fd826a49c2b518b4a3ef Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Thu, 15 May 2025 23:59:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIoTDB=E9=A9=B1=E5=8A=A8decima?= =?UTF-8?q?l=E7=B1=BB=E5=9E=8B=E8=A7=A3=E6=9E=90=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Context/IoTDBRuntimeContext.cs | 2 +- .../Interface/IIoTDBProvider.cs | 2 + .../Provider/IoTDBProvider.cs | 27 ++++-- .../SendData/Telemetry6452007PacketBuilder.cs | 25 +++++- .../Samples/SampleAppService.cs | 40 +++++---- .../BasicScheduledMeterReadingService.cs | 80 +++++++++-------- ...nergySystemScheduledMeterReadingService.cs | 90 +++++++++---------- .../Consts/T37612012PacketItemCodeConst.cs | 20 +++++ .../Consts/T6452007PacketItemCodeConst.cs | 10 +++ .../Pages/Monitor.cshtml | 2 +- web/JiShe.CollectBus.Host/appsettings.json | 2 +- 11 files changed, 190 insertions(+), 110 deletions(-) diff --git a/modules/JiShe.CollectBus.IoTDB/Context/IoTDBRuntimeContext.cs b/modules/JiShe.CollectBus.IoTDB/Context/IoTDBRuntimeContext.cs index ef68325..7384716 100644 --- a/modules/JiShe.CollectBus.IoTDB/Context/IoTDBRuntimeContext.cs +++ b/modules/JiShe.CollectBus.IoTDB/Context/IoTDBRuntimeContext.cs @@ -7,7 +7,7 @@ namespace JiShe.CollectBus.IoTDB.Context /// /// IoTDB SessionPool 运行时上下文 /// - public class IoTDBRuntimeContext: IScopedDependency + public class IoTDBRuntimeContext: IScopedDependency//ITransientDependency { private readonly bool _defaultValue; diff --git a/modules/JiShe.CollectBus.IoTDB/Interface/IIoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Interface/IIoTDBProvider.cs index 82a0d47..a5d885d 100644 --- a/modules/JiShe.CollectBus.IoTDB/Interface/IIoTDBProvider.cs +++ b/modules/JiShe.CollectBus.IoTDB/Interface/IIoTDBProvider.cs @@ -16,6 +16,8 @@ namespace JiShe.CollectBus.IoTDB.Interface ///// 是否使用表模型 //void SwitchSessionPool(bool useTableSession); + IIoTDbProvider GetSessionPool(bool sessionpolType); + /// /// 插入数据 /// diff --git a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs index a1a69a8..7d7e366 100644 --- a/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs +++ b/modules/JiShe.CollectBus.IoTDB/Provider/IoTDBProvider.cs @@ -42,6 +42,16 @@ namespace JiShe.CollectBus.IoTDB.Provider private IIoTDbSessionPool CurrentSession => _sessionFactory.GetSessionPool(_runtimeContext.UseTableSessionPool); + + //private IIoTDbSessionPool CurrentSession { get; set; } + + public IIoTDbProvider GetSessionPool(bool sessionpolType) + { + //CurrentSession = _sessionFactory.GetSessionPool(sessionpolType); + return this; + } + + /// /// IoTDbProvider /// @@ -96,6 +106,11 @@ namespace JiShe.CollectBus.IoTDB.Provider { try { + if (entities == null || entities.Count() <= 0) + { + _logger.LogError($"{nameof(BatchInsertAsync)} 参数异常,-101"); + return; + } var metadata = await GetMetadata(); var batchSize = 1000; @@ -320,10 +335,7 @@ namespace JiShe.CollectBus.IoTDB.Provider { return null; } - - //var accessor = SourceEntityAccessorFactory.GetAccessor(); - - //var memberCache = BuildMemberCache(accessor); + if (metadata.EntityType == null) { @@ -795,7 +807,8 @@ namespace JiShe.CollectBus.IoTDB.Provider { return declaredTypeName switch { - "DATETIME" => value => value != null ? ((DateTime)value).GetDateTimeOffset().ToUnixTimeNanoseconds() : null, + "DATETIME" => value => value != null ? Convert.ToDateTime(value).GetDateTimeOffset().ToUnixTimeNanoseconds() : null, + "DECIMAL" => value => value != null ? Convert.ToDouble( value) : null, _ => value => value }; } @@ -897,7 +910,7 @@ namespace JiShe.CollectBus.IoTDB.Provider ["DATETIME"] = TSDataType.TIMESTAMP, ["DATE"] = TSDataType.DATE, ["BLOB"] = TSDataType.BLOB, - ["DECIMAL"] = TSDataType.STRING, + ["DECIMAL"] = TSDataType.DOUBLE, ["STRING"] = TSDataType.STRING }; @@ -933,7 +946,7 @@ namespace JiShe.CollectBus.IoTDB.Provider TSDataType.BOOLEAN => Convert.ToBoolean(value), TSDataType.INT32 => Convert.ToInt32(value), TSDataType.INT64 => Convert.ToInt64(value), - TSDataType.FLOAT => Convert.ToDouble(value), + TSDataType.FLOAT => Convert.ToSingle(value), TSDataType.DOUBLE => Convert.ToDouble(value), TSDataType.TEXT => Convert.ToString(value), TSDataType.NONE => null, diff --git a/protocols/JiShe.CollectBus.Protocol.T6452007/SendData/Telemetry6452007PacketBuilder.cs b/protocols/JiShe.CollectBus.Protocol.T6452007/SendData/Telemetry6452007PacketBuilder.cs index 05def67..61dfbaa 100644 --- a/protocols/JiShe.CollectBus.Protocol.T6452007/SendData/Telemetry6452007PacketBuilder.cs +++ b/protocols/JiShe.CollectBus.Protocol.T6452007/SendData/Telemetry6452007PacketBuilder.cs @@ -98,6 +98,29 @@ namespace JiShe.CollectBus.Protocol.T6452007.SendData var dataList = Build645SendData.Build645SendCommand(request.MeterAddress, c_data, dataUnit); return new Telemetry6452007PacketResponse() { Data = dataList }; } - #endregion + #endregion + + #region 读数据 + + /// + /// 变量数据标识编码处理 + /// + /// + /// + public static Telemetry6452007PacketResponse C11_02_Send(Telemetry6452007PacketRequest request) + { + var itemCodeArr = request.ItemCode.Split('_');//11_02_80_00_02 + var c_data = itemCodeArr[0]; + var DI3 = itemCodeArr[1]; + var DI2 = itemCodeArr[2]; + var DI1 = itemCodeArr[3]; + var DI0 = itemCodeArr[4]; + + var dataUnit = new List() { DI3, DI2, DI1, DI0 }; + + var dataList = Build645SendData.Build645SendCommand(request.MeterAddress, c_data, dataUnit); + return new Telemetry6452007PacketResponse() { Data = dataList }; + } + #endregion } } diff --git a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs index 30ae8ba..c52df0c 100644 --- a/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs +++ b/services/JiShe.CollectBus.Application/Samples/SampleAppService.cs @@ -55,8 +55,8 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS _dbContext = dbContext; _logger = logger; _redisDataCacheService = redisDataCacheService; - _producerService =producerService; - _tcpService=tcpService; + _producerService = producerService; + _tcpService = tcpService; } /// @@ -91,7 +91,8 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS //TableModelSingleMeasuringEntityExtension //TableModelSingleMeasuringEntityAccessor.GetSystemName(meter); //ElectricityMeterAccessor - await _iotDBProvider.InsertAsync(meter); + await _iotDBProvider.GetSessionPool(true).InsertAsync(meter); + await _iotDBProvider.InsertAsync(meter); } /// @@ -101,7 +102,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS [HttpGet] public async Task UseTableSessionPool(DateTime time) { - var testTime = time; + var testTime = time; ElectricityMeterTreeModel meter2 = new ElectricityMeterTreeModel() { SystemName = "energy", @@ -177,7 +178,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS await _iotDBProvider.InsertAsync(meter2); _dbContext.UseTableSessionPool = true; - + ElectricityMeter meter3 = new ElectricityMeter() { @@ -211,14 +212,15 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS time = DateTime.Now; //System.Reflection.PropertyInfo; //System.Reflection.FieldInfo - var meter = new TreeModelSingleMeasuringEntity() + //TreeModelSingleMeasuringEntityAccessor + var meter = new TreeModelSingleMeasuringEntity() { SystemName = "energy", DeviceId = "402440506", DeviceType = "1", ProjectId = "10059", Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(), - SingleMeasuring = (measuring, time) + SingleMeasuring = (measuring, 34.534m) }; await _iotDBProvider.InsertAsync(meter); } @@ -264,7 +266,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS Timestamps = time.GetDateTimeOffset().ToUnixTimeMilliseconds(), SingleMeasuring = ("measuring", true) }; - + QueryCondition conditions = new QueryCondition() { Field = "DeviceId", @@ -273,13 +275,13 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS }; - var query = new IoTDBQueryOptions() + var query = new IoTDBQueryOptions() { TableNameOrTreePath = meter.DevicePath, PageIndex = 1, PageSize = 1, - Conditions = new List() { conditions }, - }; + Conditions = new List() { conditions }, + }; var pageResult = await _iotDBProvider.QueryAsync(query); @@ -391,7 +393,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS //} //DeviceGroupBalanceControl.InitializeCache(focusAddressDataLista); - + //// 打印分布统计 //DeviceGroupBalanceControl.PrintDistributionStats(); @@ -405,13 +407,13 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS /// [HttpGet] public async Task TestGetDeviceGroupBalanceControl(string deviceAddress) - { + { var groupId = DeviceGroupBalanceControl.GetDeviceGroupId(deviceAddress); Console.WriteLine(groupId); await Task.CompletedTask; } - + /// /// 测试Redis批量读取10万条数据性能 @@ -474,7 +476,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS { DateTime nextTaskTime = Convert.ToDateTime(time); - return await Task.FromResult(nextTaskTime.CalculateNextCollectionTime(timeDensity)); + return await Task.FromResult(nextTaskTime.CalculateNextCollectionTime(timeDensity)); } @@ -510,7 +512,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS [AllowAnonymous] public bool GetTestProtocol() { - var aa = LazyServiceProvider.GetKeyedService("TestProtocolPlugin"); + var aa = LazyServiceProvider.GetKeyedService("TestProtocolPlugin"); return aa == null; } @@ -519,7 +521,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS public async Task KafkaSubscribeAsync(object obj) { _logger.LogWarning($"收到订阅消息: {obj}"); - return SubscribeAck.Success(); + return SubscribeAck.Success(); } /// @@ -530,7 +532,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS [AllowAnonymous] public async Task KafkaSendAsync(KafkaSendDto input) { - ArgumentException.ThrowIfNullOrWhiteSpace(input.Address); + ArgumentException.ThrowIfNullOrWhiteSpace(input.Address); ArgumentException.ThrowIfNullOrWhiteSpace(input.Frame); input.Frame = input.Frame.Replace(" ", ""); await _producerService.ProduceAsync(ProtocolConst.TESTSENDTOPIC, input); @@ -557,7 +559,7 @@ public class SampleAppService : CollectBusAppService, ISampleAppService, IKafkaS { _logger.LogWarning($"{dto.Address}集中器未上线: {dto.Serialize()}"); } - // 测试不管是否上线都ACK + // 测试不管是否上线都ACK return SubscribeAck.Success(); } diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs index 552f04f..9795624 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/BasicScheduledMeterReadingService.cs @@ -45,7 +45,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading private readonly DataMigrationOptions _dataMigrationOptions; private readonly KafkaOptionConfig _kafkaOptions; private readonly ServerApplicationOptions _applicationOptions; - private readonly IGuidGenerator _guidGenerator; + private readonly IGuidGenerator _guidGenerator; int pageSize = 10000; @@ -328,7 +328,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading /// public virtual async Task InitAmmeterCacheData(string gatherCode = "") { - //return; + //return; try { @@ -337,34 +337,34 @@ namespace JiShe.CollectBus.ScheduledMeterReading _ = _dataChannelManage.ScheduledMeterTaskReadingAsync(DataChannelManage.TaskDataChannel.Reader); -// //此处代码不要删除 -//#if DEBUG -// var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus2:DeviceInfo"; + // //此处代码不要删除 + //#if DEBUG + // var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus2:DeviceInfo"; -// var timer1 = Stopwatch.StartNew(); -// Dictionary> keyValuePairsTemps = FreeRedisProvider.Instance.HGetAll>(redisCacheDeviceInfoHashKeyTemp); -// List meterInfos = new List(); -// List focusAddressDataLista = new List(); -// foreach (var item in keyValuePairsTemps) -// { -// foreach (var subItem in item.Value) -// { -// if (subItem.MeterType == MeterTypeEnum.Ammeter && subItem.TimeDensity == 15) -// { -// meterInfos.Add(subItem); -// focusAddressDataLista.Add(subItem.MeterId.ToString()); -// } -// } -// } + // var timer1 = Stopwatch.StartNew(); + // Dictionary> keyValuePairsTemps = FreeRedisProvider.Instance.HGetAll>(redisCacheDeviceInfoHashKeyTemp); + // List meterInfos = new List(); + // List focusAddressDataLista = new List(); + // foreach (var item in keyValuePairsTemps) + // { + // foreach (var subItem in item.Value) + // { + // if (subItem.MeterType == MeterTypeEnum.Ammeter && subItem.TimeDensity == 15) + // { + // meterInfos.Add(subItem); + // focusAddressDataLista.Add(subItem.MeterId.ToString()); + // } + // } + // } -// timer1.Stop(); -// _logger.LogError($"电表初始化读取数据总共花费时间{timer1.ElapsedMilliseconds}毫秒"); -// DeviceGroupBalanceControl.InitializeCache(focusAddressDataLista, _kafkaOptions.NumPartitions); -// return; -//#else -// var meterInfos = await GetAmmeterInfoList(gatherCode); -//#endif + // timer1.Stop(); + // _logger.LogError($"电表初始化读取数据总共花费时间{timer1.ElapsedMilliseconds}毫秒"); + // DeviceGroupBalanceControl.InitializeCache(focusAddressDataLista, _kafkaOptions.NumPartitions); + // return; + //#else + // var meterInfos = await GetAmmeterInfoList(gatherCode); + //#endif var meterInfos = await GetAmmeterInfoList(gatherCode); if (meterInfos == null || meterInfos.Count <= 0) { @@ -728,17 +728,27 @@ namespace JiShe.CollectBus.ScheduledMeterReading //var aFN = (AFN)aFNStr.HexToDec(); //var fn = int.Parse(itemCodeArr[1]); + var itemCodeInfo = T37612012PacketItemCodeConst.MappingItemCodeTo645SubCodeRelationship(tempItem); + //TODO:特殊表 ProtocolBuildResponse builderResponse = await protocolPlugin.BuildAsync(new ProtocolBuildRequest() { FocusAddress = ammeterInfo.FocusAddress, Pn = ammeterInfo.MeteringCode, - ItemCode = tempItem, + ItemCode = itemCodeInfo.Item1, DataTimeMark = new Protocol.DataTimeMark() { Density = ammeterInfo.TimeDensity.GetFocusDensity(),//转换成协议的值 Point = 1, DataTime = timestamps, + }, + SubProtocolRequest = new SubProtocolBuildRequest() + { + MeterAddress = ammeterInfo.MeterAddress, + Password = ammeterInfo.Password, + MeteringPort = ammeterInfo.MeteringPort, + Baudrate = ammeterInfo.Baudrate, + ItemCode = itemCodeInfo.Item2, //10_97 => 11_02_80_00_02 } }); if (builderResponse == null || builderResponse.Data.Length <= 0) @@ -816,7 +826,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading _logger.LogError($"{nameof(AmmeterScheduledAutoValveControl)} 定时阀控运行时间{currentTime}没有找到对应的协议组件,-105"); return null; } - + ProtocolBuildResponse builderResponse = await protocolPlugin.BuildAsync(new ProtocolBuildRequest() { FocusAddress = ammeterInfo.FocusAddress, @@ -1106,7 +1116,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading List deviceIds = new List();//用于处理Kafka主题分区数据的分发和处理。 //根据采集频率分组,获得采集频率分组 - var meterInfoGroupByTimeDensity = meterInfos.Select(d=>d.TimeDensity).GroupBy(d => d); + var meterInfoGroupByTimeDensity = meterInfos.Select(d => d.TimeDensity).GroupBy(d => d); var currentTime = DateTime.Now; if (_applicationOptions.FirstCollectionTime.HasValue == false) { @@ -1153,7 +1163,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading - await _redisDataCacheService.BatchInsertDataAsync( + await _redisDataCacheService.BatchInsertDataAsync( redisCacheDeviceGroupSetIndexKey, redisCacheDeviceInfoHashKey, keyValuePairs); @@ -1546,7 +1556,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading //} Dictionary> keyValuePairs = FreeRedisProvider.Instance.HGetAll>(redisCacheDeviceInfoHashKey); - + timer.Stop(); _logger.LogError($"{nameof(CreateMeterPublishTask)} 构建采集待下发任务,缓存获取信息共花费{timer.ElapsedMilliseconds}毫秒"); @@ -1557,7 +1567,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading { foreach (var subItem in item.Value) { - if (subItem.MeterType == meterType && subItem.TimeDensity == timeDensity) + if (subItem.MeterType == meterType && subItem.TimeDensity == timeDensity) { meterInfos.Add(subItem); } @@ -1691,10 +1701,10 @@ namespace JiShe.CollectBus.ScheduledMeterReading }; } catch (Exception ex) - { + { throw ex; } - } + } #endregion } diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs index 26811a3..e41f7af 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs @@ -222,7 +222,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading #if DEBUG - sql = $@"{sql} and c.Address in('542410000504','442405000040','442405000039','402410040506')"; + // sql = $@"{sql} and c.Address in('542410000504','442405000040','442405000039','402410040506')"; + sql = $@"{sql} and c.Address in('402410040506')"; #endif if (!string.IsNullOrWhiteSpace(gatherCode)) @@ -294,35 +295,49 @@ namespace JiShe.CollectBus.ScheduledMeterReading if (settingInfos == null || settingInfos.Count <= 0) { settingInfos = new List(); - settingInfos.Add(new AmmeterAutoValveControlSetting() - { - MeterType = MeterTypeEnum.Ammeter, - AmmerterAddress = "442405000040", - FocusAddress = "442400040", - FocusId = 57683, - ProjectID = 1, - TripType = "on", - TripTime = $"{DateTime.Now:HH:mm}", - MeterId = 78971, - LoopType = "EachDay", - EachDayWithout = "周六,周日", - TimeDensity = 15, - }); - settingInfos.Add(new AmmeterAutoValveControlSetting() - { - MeterType = MeterTypeEnum.Ammeter, - AmmerterAddress = "442405000039", - FocusAddress = "442400039", - FocusId = 57684, - ProjectID = 1, - TripType = "on", - TripTime = $"{DateTime.Now:HH:mm}", - MeterId = 78972, - LoopType = "EachDay", - EachDayWithout = "周六,周日", - TimeDensity = 15, - }); - + //settingInfos.Add(new AmmeterAutoValveControlSetting() + //{ + // MeterType = MeterTypeEnum.Ammeter, + // AmmerterAddress = "442405000040", + // FocusAddress = "442400040", + // FocusId = 57683, + // ProjectID = 1, + // TripType = "on", + // TripTime = $"{DateTime.Now:HH:mm}", + // MeterId = 78971, + // LoopType = "EachDay", + // EachDayWithout = "周六,周日", + // TimeDensity = 15, + //}); + //settingInfos.Add(new AmmeterAutoValveControlSetting() + //{ + // MeterType = MeterTypeEnum.Ammeter, + // AmmerterAddress = "442405000039", + // FocusAddress = "442400039", + // FocusId = 57684, + // ProjectID = 1, + // TripType = "on", + // TripTime = $"{DateTime.Now:HH:mm}", + // MeterId = 78972, + // LoopType = "EachDay", + // EachDayWithout = "周六,周日", + // TimeDensity = 15, + //}); + + //settingInfos.Add(new AmmeterAutoValveControlSetting() + //{ + // MeterType = MeterTypeEnum.Ammeter, + // AmmerterAddress = "542410000504", + // FocusAddress = "542400504", + // FocusId = 57686, + // ProjectID = 1, + // TripType = "on", + // TripTime = $"{DateTime.Now:HH:mm}", + // MeterId = 78974, + // LoopType = "EachDay", + // EachDayWithout = "周六,周日", + // TimeDensity = 15, + //}); settingInfos.Add(new AmmeterAutoValveControlSetting() { @@ -339,21 +354,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading TimeDensity = 15, }); - settingInfos.Add(new AmmeterAutoValveControlSetting() - { - MeterType = MeterTypeEnum.Ammeter, - AmmerterAddress = "542410000504", - FocusAddress = "542400504", - FocusId = 57686, - ProjectID = 1, - TripType = "on", - TripTime = $"{DateTime.Now:HH:mm}", - MeterId = 78974, - LoopType = "EachDay", - EachDayWithout = "周六,周日", - TimeDensity = 15, - }); - FreeRedisProvider.Instance.Set(redisCacheDeviceSettingInfoHashKey, settingInfos); } diff --git a/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs b/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs index 2f16084..47f053d 100644 --- a/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs +++ b/shared/JiShe.CollectBus.Common/Consts/T37612012PacketItemCodeConst.cs @@ -19,6 +19,12 @@ namespace JiShe.CollectBus.Common.Consts /// public const string AFN10HFN01H = $"10_01"; + + /// + /// 电网频率 + /// + public const string AFN10HFN97H = $"10_97"; + /// /// 读取终端信息 /// @@ -181,5 +187,19 @@ namespace JiShe.CollectBus.Common.Consts } #endregion + + /// + /// 特殊645编码关系映射 + /// + /// + /// + public static (string,string) MappingItemCodeTo645SubCodeRelationship(string itemCode) + { + return itemCode switch + { + AFN10HFN97H => (AFN10HFN01H,T6452007PacketItemCodeConst.C1102800002), + _=> (itemCode,""), + }; + } } } diff --git a/shared/JiShe.CollectBus.Common/Consts/T6452007PacketItemCodeConst.cs b/shared/JiShe.CollectBus.Common/Consts/T6452007PacketItemCodeConst.cs index 75bbf76..734bc7a 100644 --- a/shared/JiShe.CollectBus.Common/Consts/T6452007PacketItemCodeConst.cs +++ b/shared/JiShe.CollectBus.Common/Consts/T6452007PacketItemCodeConst.cs @@ -56,6 +56,16 @@ namespace JiShe.CollectBus.Common.Consts /// public const string C08 = "08"; #endregion + + #region 读数据 + + + /// + /// 电网频率 + /// + public const string C1102800002 = "11_02_80_00_02"; + #endregion + #endregion } } diff --git a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml index ae74593..4e13d71 100644 --- a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml +++ b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml @@ -6,7 +6,7 @@ @{ Layout = null; } - + diff --git a/web/JiShe.CollectBus.Host/appsettings.json b/web/JiShe.CollectBus.Host/appsettings.json index d5129e3..d7ebf50 100644 --- a/web/JiShe.CollectBus.Host/appsettings.json +++ b/web/JiShe.CollectBus.Host/appsettings.json @@ -141,7 +141,7 @@ } }, "ServerApplicationOptions": { - "ServerTagName": "JiSheCollectBus99", + "ServerTagName": "JiSheCollectBus8", "SystemType": "Energy", "FirstCollectionTime": "2025-04-28 15:07:00", "AutomaticVerificationTime": "16:07:00",