Compare commits
No commits in common. "4a609b6cf8f455387d7e75ac29d8d67680df2b18" and "7dd833257a42fecde50a992876ecdd8a66c7b531" have entirely different histories.
4a609b6cf8
...
7dd833257a
@ -1087,7 +1087,7 @@ namespace JiShe.CollectBus.IoTDB.Provider
|
|||||||
stringBuilder.Append(string.Join(",", tempColumInfos.Where(d => !string.IsNullOrWhiteSpace(d))));
|
stringBuilder.Append(string.Join(",", tempColumInfos.Where(d => !string.IsNullOrWhiteSpace(d))));
|
||||||
stringBuilder.Append($" ) COMMENT '{item.Name}' ");
|
stringBuilder.Append($" ) COMMENT '{item.Name}' ");
|
||||||
|
|
||||||
_logger.LogWarning($"{dynamicAccessor.EntityName} 初始化语句:{stringBuilder.ToString()}");
|
_logger.LogError($"{dynamicAccessor.EntityName} 初始化语句:{stringBuilder.ToString()}");
|
||||||
|
|
||||||
await CurrentSession.ExecuteNonQueryStatementAsync($"{stringBuilder.ToString()}");
|
await CurrentSession.ExecuteNonQueryStatementAsync($"{stringBuilder.ToString()}");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,19 +38,16 @@ namespace JiShe.CollectBus.Protocol.T1882018.SendData
|
|||||||
#region 读数据
|
#region 读数据
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取计量数据,CTR0_控制码(01H/09H)_DI1_DI0_SER
|
/// 读取计量数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Telemetry1882018PacketResponse CTR0_01_Send(Telemetry1882018PacketRequest request)
|
public static Telemetry1882018PacketResponse CTR_01_Send(Telemetry1882018PacketRequest request)
|
||||||
{
|
{
|
||||||
var itemCodeArr = request.ItemCode.Split('_');
|
var itemCodeArr = request.ItemCode.Split('_');
|
||||||
var ctr = itemCodeArr[0];//CTR0
|
var c_data = itemCodeArr[0];//01
|
||||||
var c_data = itemCodeArr[1];//01
|
var d_data = itemCodeArr[2];//91 或者 90
|
||||||
var DI1 = itemCodeArr[2];//91 或者 90
|
var dataUnit = new List<string>() { "1F", d_data, "00" };
|
||||||
var DI0 = itemCodeArr[3];//1F
|
|
||||||
var SER = itemCodeArr[4];//00
|
|
||||||
var dataUnit = new List<string>() { DI1, DI0, SER };
|
|
||||||
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
||||||
|
|
||||||
return new Telemetry1882018PacketResponse() { Data = dataList };
|
return new Telemetry1882018PacketResponse() { Data = dataList };
|
||||||
@ -59,19 +56,16 @@ namespace JiShe.CollectBus.Protocol.T1882018.SendData
|
|||||||
|
|
||||||
#region 写数据
|
#region 写数据
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 写数据,CTR3_控制码(04H/0CH)_DI1_DI0_SER
|
/// 阀控
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static Telemetry1882018PacketResponse CTR3_04_Send(Telemetry1882018PacketRequest request)
|
public static Telemetry1882018PacketResponse CTR_04_Send(Telemetry1882018PacketRequest request)
|
||||||
{
|
{
|
||||||
var itemCodeArr = request.ItemCode.Split('_');
|
var itemCodeArr = request.ItemCode.Split('_');
|
||||||
var ctr = itemCodeArr[0];//CTR3
|
var c_data = itemCodeArr[0];//01
|
||||||
var c_data = itemCodeArr[1];//04
|
var d_data = itemCodeArr[2];//55 或者 99
|
||||||
var DI1 = itemCodeArr[2];//A0
|
var dataUnit = new List<string>() { "A0", "17", "00", d_data };
|
||||||
var DI0 = itemCodeArr[3];//17
|
|
||||||
var SER = itemCodeArr[4];//55 或者 99
|
|
||||||
var dataUnit = new List<string>() { DI1, DI0, SER };
|
|
||||||
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
var dataList = Build188SendData.Build188SendCommand(request.MeterAddress, c_data, dataUnit);
|
||||||
|
|
||||||
return new Telemetry1882018PacketResponse() { Data = dataList };
|
return new Telemetry1882018PacketResponse() { Data = dataList };
|
||||||
|
|||||||
@ -93,9 +93,9 @@ namespace JiShe.CollectBus.Protocol.T1882018
|
|||||||
//数据转发场景 10H_F1
|
//数据转发场景 10H_F1
|
||||||
if (request.ItemCode == T37612012PacketItemCodeConst.AFN10HFN01H && request.SubProtocolRequest != null && string.IsNullOrWhiteSpace(request.SubProtocolRequest.ItemCode) == false)
|
if (request.ItemCode == T37612012PacketItemCodeConst.AFN10HFN01H && request.SubProtocolRequest != null && string.IsNullOrWhiteSpace(request.SubProtocolRequest.ItemCode) == false)
|
||||||
{
|
{
|
||||||
var subItemCodeArr = request.SubProtocolRequest.ItemCode.Split("_");
|
//var subItemCodeArr = request.SubProtocolRequest.ItemCode.Split("_");
|
||||||
|
|
||||||
var t188PacketHandlerName = $"{subItemCodeArr[0]}_{subItemCodeArr[1]}_Send";
|
var t188PacketHandlerName = $"{T1882018PacketItemCodeConst.BasicT1882018}_{request.SubProtocolRequest.ItemCode}_Send";
|
||||||
Telemetry1882018PacketResponse t645PacketResponse = null;
|
Telemetry1882018PacketResponse t645PacketResponse = null;
|
||||||
|
|
||||||
if (T188ControlHandlers != null && T188ControlHandlers.TryGetValue(t188PacketHandlerName
|
if (T188ControlHandlers != null && T188ControlHandlers.TryGetValue(t188PacketHandlerName
|
||||||
@ -124,7 +124,6 @@ namespace JiShe.CollectBus.Protocol.T1882018
|
|||||||
FocusAddress = request.FocusAddress,
|
FocusAddress = request.FocusAddress,
|
||||||
Fn = fn,
|
Fn = fn,
|
||||||
Pn = request.Pn,
|
Pn = request.Pn,
|
||||||
SubRequest = request.SubProtocolRequest,
|
|
||||||
DataUnit = dataUnit,
|
DataUnit = dataUnit,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,38 @@ namespace JiShe.CollectBus.Protocol.T6452007
|
|||||||
|
|
||||||
public override async Task<T> AnalyzeAsync<T>(ITcpSessionClient client, string messageReceived, Action<T>? sendAction = null)
|
public override async Task<T> AnalyzeAsync<T>(ITcpSessionClient client, string messageReceived, Action<T>? sendAction = null)
|
||||||
{
|
{
|
||||||
|
//TODO:645解析报文
|
||||||
|
//TB3761? tB3761 = Analysis3761(messageReceived);
|
||||||
|
//if (tB3761 != null)
|
||||||
|
//{
|
||||||
|
// if (tB3761.AFN_FC?.AFN == (int)AFN.链路接口检测)
|
||||||
|
// {
|
||||||
|
// if (tB3761.A == null || tB3761.A.Code.IsNullOrWhiteSpace() || tB3761.A.A3?.D1_D7 == null || tB3761.SEQ?.PSEQ == null)
|
||||||
|
// {
|
||||||
|
// _logger.LogError($"解析AFN.链路接口检测报文失败,报文:{messageReceived},TB3761:{tB3761.Serialize()}");
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// if (tB3761.DT?.Fn == (int)FN.登录)
|
||||||
|
// {
|
||||||
|
// // 登录回复
|
||||||
|
// if (tB3761.SEQ.CON == (int)CON.需要对该帧进行确认)
|
||||||
|
// await LoginAsync(client, messageReceived, tB3761.A.Code, tB3761.A.A3?.D1_D7, tB3761.SEQ?.PSEQ);
|
||||||
|
// }
|
||||||
|
// else if (tB3761.DT?.Fn == (int)FN.心跳)
|
||||||
|
// {
|
||||||
|
// // 心跳回复
|
||||||
|
// //心跳帧有两种情况:
|
||||||
|
// //1. 集中器先有登录帧,再有心跳帧
|
||||||
|
// //2. 集中器没有登录帧,只有心跳帧
|
||||||
|
// await HeartbeatAsync(client, messageReceived, tB3761.A.Code, tB3761.A.A3?.D1_D7, tB3761.SEQ?.PSEQ);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// await OnTcpNormalReceived(client, tB3761);
|
||||||
|
//}
|
||||||
|
//return (tB3761 as T)!;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,13 +17,15 @@ namespace JiShe.CollectBus.Application.Contracts
|
|||||||
/// 单个添加数据
|
/// 单个添加数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="redisHashCacheKey">主数据存储Hash缓存Key</param>
|
||||||
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
||||||
/// <param name="redisDeviceInfoHashCacheKey">hash缓存Key</param>
|
/// <param name="redisZSetScoresIndexCacheKey">ZSET索引缓存Key</param>
|
||||||
/// <param name="data">待缓存数据</param>
|
/// <param name="data">待缓存数据</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task InsertDataAsync<T>(
|
Task InsertDataAsync<T>(
|
||||||
|
string redisHashCacheKey,
|
||||||
string redisSetIndexCacheKey,
|
string redisSetIndexCacheKey,
|
||||||
string redisDeviceInfoHashCacheKey,
|
string redisZSetScoresIndexCacheKey,
|
||||||
T data) where T : DeviceCacheBasicModel;
|
T data) where T : DeviceCacheBasicModel;
|
||||||
|
|
||||||
|
|
||||||
@ -45,13 +47,15 @@ namespace JiShe.CollectBus.Application.Contracts
|
|||||||
/// 删除缓存信息
|
/// 删除缓存信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="redisHashCacheKey">主数据存储Hash缓存Key</param>
|
||||||
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
||||||
/// <param name="redisDeviceInfoHashCacheKey">hash缓存Key</param>
|
/// <param name="redisZSetScoresIndexCacheKey">ZSET索引缓存Key</param>
|
||||||
/// <param name="data">已缓存数据</param>
|
/// <param name="data">已缓存数据</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task RemoveCacheDataAsync<T>(
|
Task RemoveCacheDataAsync<T>(
|
||||||
|
string redisHashCacheKey,
|
||||||
string redisSetIndexCacheKey,
|
string redisSetIndexCacheKey,
|
||||||
string redisDeviceInfoHashCacheKey,
|
string redisZSetScoresIndexCacheKey,
|
||||||
T data) where T : DeviceCacheBasicModel;
|
T data) where T : DeviceCacheBasicModel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -95,6 +95,5 @@ public class CollectBusApplicationModule : AbpModule
|
|||||||
//默认初始化表计信息
|
//默认初始化表计信息
|
||||||
var dbContext = context.ServiceProvider.GetRequiredService<EnergySystemScheduledMeterReadingService>();
|
var dbContext = context.ServiceProvider.GetRequiredService<EnergySystemScheduledMeterReadingService>();
|
||||||
await dbContext.InitAmmeterCacheData("V4-Gather-8890");
|
await dbContext.InitAmmeterCacheData("V4-Gather-8890");
|
||||||
await dbContext.InitWatermeterCacheData("V4-Gather-8890");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17,7 +17,6 @@ using static FreeSql.Internal.GlobalFilter;
|
|||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
using static Volo.Abp.UI.Navigation.DefaultMenuNames.Application;
|
using static Volo.Abp.UI.Navigation.DefaultMenuNames.Application;
|
||||||
using JiShe.CollectBus.IotSystems.Ammeters;
|
using JiShe.CollectBus.IotSystems.Ammeters;
|
||||||
using System.IO.Pipelines;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.RedisDataCache
|
namespace JiShe.CollectBus.RedisDataCache
|
||||||
{
|
{
|
||||||
@ -48,18 +47,21 @@ namespace JiShe.CollectBus.RedisDataCache
|
|||||||
/// 单个添加数据
|
/// 单个添加数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="redisHashCacheKey">主数据存储Hash缓存Key</param>
|
||||||
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
||||||
/// <param name="redisDeviceInfoHashCacheKey">hash缓存Key</param>
|
/// <param name="redisZSetScoresIndexCacheKey">ZSET索引缓存Key</param>
|
||||||
/// <param name="data">待缓存数据</param>
|
/// <param name="data">待缓存数据</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task InsertDataAsync<T>(
|
public async Task InsertDataAsync<T>(
|
||||||
|
string redisHashCacheKey,
|
||||||
string redisSetIndexCacheKey,
|
string redisSetIndexCacheKey,
|
||||||
string redisDeviceInfoHashCacheKey,
|
string redisZSetScoresIndexCacheKey,
|
||||||
T data) where T : DeviceCacheBasicModel
|
T data) where T : DeviceCacheBasicModel
|
||||||
{
|
{
|
||||||
// 参数校验增强
|
// 参数校验增强
|
||||||
if (data == null || string.IsNullOrWhiteSpace(redisSetIndexCacheKey)
|
if (data == null || string.IsNullOrWhiteSpace(redisHashCacheKey)
|
||||||
|| string.IsNullOrWhiteSpace(redisDeviceInfoHashCacheKey))
|
|| string.IsNullOrWhiteSpace(redisSetIndexCacheKey)
|
||||||
|
|| string.IsNullOrWhiteSpace(redisZSetScoresIndexCacheKey))
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(InsertDataAsync)} 参数异常,-101");
|
_logger.LogError($"{nameof(InsertDataAsync)} 参数异常,-101");
|
||||||
return;
|
return;
|
||||||
@ -68,27 +70,14 @@ namespace JiShe.CollectBus.RedisDataCache
|
|||||||
// 使用事务保证原子性
|
// 使用事务保证原子性
|
||||||
using (var trans = Instance.Multi())
|
using (var trans = Instance.Multi())
|
||||||
{
|
{
|
||||||
// Set索引缓存
|
// 主数据存储Hash
|
||||||
trans.SAdd(redisSetIndexCacheKey, $"{data.TimeDensity.ToString().PadLeft(2, '0')}:{data.FocusAddress}");
|
trans.HSet(redisHashCacheKey, data.MemberId, data.Serialize());
|
||||||
|
|
||||||
//检查HSet是否存在对应的信息,如果存在,需要进一步检查value是否已经存在,如果存在则更新,不存在则添加
|
// 集中器号分组索引Set缓存
|
||||||
var oldValue = Instance.HGet<List<T>>(redisDeviceInfoHashCacheKey, data.FocusAddress);
|
trans.SAdd(redisSetIndexCacheKey, data.MemberId);
|
||||||
if (oldValue == null || oldValue.Count <= 0)//直接添加
|
|
||||||
{
|
|
||||||
//设备信息缓存
|
|
||||||
trans.HSet(redisDeviceInfoHashCacheKey, data.FocusAddress, data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 移除缓存中同类型旧数据
|
|
||||||
oldValue.RemoveAll(device => device.MeterType == data.MeterType);
|
|
||||||
|
|
||||||
//添加新数据
|
// 集中器与表计信息排序索引ZSET缓存Key
|
||||||
oldValue.Add(data);
|
trans.ZAdd(redisZSetScoresIndexCacheKey, data.ScoreValue, data.MemberId);
|
||||||
|
|
||||||
//设备信息缓存
|
|
||||||
trans.HSet(redisDeviceInfoHashCacheKey, data.FocusAddress, oldValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
var results = trans.Exec();
|
var results = trans.Exec();
|
||||||
|
|
||||||
@ -140,24 +129,9 @@ namespace JiShe.CollectBus.RedisDataCache
|
|||||||
// Set索引缓存
|
// Set索引缓存
|
||||||
pipe.SAdd(redisSetIndexCacheKey, $"{item.Value.First().TimeDensity.ToString().PadLeft(2, '0')}:{item.Value.First().FocusAddress}");
|
pipe.SAdd(redisSetIndexCacheKey, $"{item.Value.First().TimeDensity.ToString().PadLeft(2, '0')}:{item.Value.First().FocusAddress}");
|
||||||
|
|
||||||
//检查HSet是否存在对应的信息,如果存在,需要进一步检查value是否已经存在,如果存在则更新,不存在则添加
|
|
||||||
var oldValue = Instance.HGet<List<T>>(redisDeviceInfoHashCacheKey, item.Key);
|
|
||||||
if (oldValue == null || oldValue.Count <= 0)//直接添加
|
|
||||||
{
|
|
||||||
//设备信息缓存
|
//设备信息缓存
|
||||||
pipe.HSet(redisDeviceInfoHashCacheKey, item.Key, item.Value);
|
pipe.HSet(redisDeviceInfoHashCacheKey, item.Key, item.Value.Serialize());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 移除缓存中同类型旧数据
|
|
||||||
oldValue.RemoveAll(device => device.MeterType == item.Value[0].MeterType);
|
|
||||||
|
|
||||||
//添加新数据
|
|
||||||
oldValue.AddRange(item.Value);
|
|
||||||
|
|
||||||
//设备信息缓存
|
|
||||||
pipe.HSet(redisDeviceInfoHashCacheKey, item.Key, oldValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pipe.EndPipe();
|
pipe.EndPipe();
|
||||||
}
|
}
|
||||||
@ -172,18 +146,21 @@ namespace JiShe.CollectBus.RedisDataCache
|
|||||||
/// 删除缓存信息
|
/// 删除缓存信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="redisHashCacheKey">主数据存储Hash缓存Key</param>
|
||||||
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
/// <param name="redisSetIndexCacheKey">Set索引缓存Key</param>
|
||||||
/// <param name="redisDeviceInfoHashCacheKey">hash缓存Key</param>
|
/// <param name="redisZSetScoresIndexCacheKey">ZSET索引缓存Key</param>
|
||||||
/// <param name="data">已缓存数据</param>
|
/// <param name="data">已缓存数据</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task RemoveCacheDataAsync<T>(
|
public async Task RemoveCacheDataAsync<T>(
|
||||||
|
string redisHashCacheKey,
|
||||||
string redisSetIndexCacheKey,
|
string redisSetIndexCacheKey,
|
||||||
string redisDeviceInfoHashCacheKey,
|
string redisZSetScoresIndexCacheKey,
|
||||||
T data) where T : DeviceCacheBasicModel
|
T data) where T : DeviceCacheBasicModel
|
||||||
{
|
{
|
||||||
if (data == null
|
if (data == null
|
||||||
|| string.IsNullOrWhiteSpace(redisDeviceInfoHashCacheKey)
|
|| string.IsNullOrWhiteSpace(redisHashCacheKey)
|
||||||
|| string.IsNullOrWhiteSpace(redisSetIndexCacheKey) )
|
|| string.IsNullOrWhiteSpace(redisSetIndexCacheKey)
|
||||||
|
|| string.IsNullOrWhiteSpace(redisZSetScoresIndexCacheKey))
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(RemoveCacheDataAsync)} 参数异常,-101");
|
_logger.LogError($"{nameof(RemoveCacheDataAsync)} 参数异常,-101");
|
||||||
return;
|
return;
|
||||||
@ -192,29 +169,31 @@ namespace JiShe.CollectBus.RedisDataCache
|
|||||||
const string luaScript = @"
|
const string luaScript = @"
|
||||||
local hashCacheKey = KEYS[1]
|
local hashCacheKey = KEYS[1]
|
||||||
local setIndexCacheKey = KEYS[2]
|
local setIndexCacheKey = KEYS[2]
|
||||||
local focusAddress = ARGV[1]
|
local zsetScoresIndexCacheKey = KEYS[3]
|
||||||
local scoreValue = ARGV[2]
|
local member = ARGV[1]
|
||||||
|
|
||||||
local deleted = 0
|
local deleted = 0
|
||||||
if redis.call('HDEL', hashCacheKey, focusAddress) > 0 then
|
if redis.call('HDEL', hashCacheKey, member) > 0 then
|
||||||
deleted = 1
|
deleted = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
redis.call('SREM', setIndexCacheKey, scoreValue)
|
redis.call('SREM', setIndexCacheKey, member)
|
||||||
|
redis.call('ZREM', zsetScoresIndexCacheKey, member)
|
||||||
return deleted
|
return deleted
|
||||||
";
|
";
|
||||||
|
|
||||||
var keys = new[]
|
var keys = new[]
|
||||||
{
|
{
|
||||||
redisDeviceInfoHashCacheKey,
|
redisHashCacheKey,
|
||||||
redisSetIndexCacheKey
|
redisSetIndexCacheKey,
|
||||||
|
redisZSetScoresIndexCacheKey
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = await Instance.EvalAsync(luaScript, keys, new object[] { data.FocusAddress , data.ScoreValue});
|
var result = await Instance.EvalAsync(luaScript, keys, new[] { data.MemberId });
|
||||||
|
|
||||||
if ((int)result == 0)
|
if ((int)result == 0)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(RemoveCacheDataAsync)} 删除指定Key{redisDeviceInfoHashCacheKey}的{data.MemberId}数据失败,-102");
|
_logger.LogError($"{nameof(RemoveCacheDataAsync)} 删除指定Key{redisHashCacheKey}的{data.MemberId}数据失败,-102");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,6 @@ using JiShe.CollectBus.Common.Extensions;
|
|||||||
using JiShe.CollectBus.Common.Helpers;
|
using JiShe.CollectBus.Common.Helpers;
|
||||||
using JiShe.CollectBus.Common.Models;
|
using JiShe.CollectBus.Common.Models;
|
||||||
using JiShe.CollectBus.DataChannels;
|
using JiShe.CollectBus.DataChannels;
|
||||||
using JiShe.CollectBus.EnergySystems.Entities;
|
|
||||||
using JiShe.CollectBus.GatherItem;
|
using JiShe.CollectBus.GatherItem;
|
||||||
using JiShe.CollectBus.IoTDB.Interface;
|
using JiShe.CollectBus.IoTDB.Interface;
|
||||||
using JiShe.CollectBus.IoTDB.Model;
|
using JiShe.CollectBus.IoTDB.Model;
|
||||||
@ -29,9 +28,6 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Volo.Abp.Guids;
|
using Volo.Abp.Guids;
|
||||||
using static FreeSql.Internal.GlobalFilter;
|
|
||||||
using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata;
|
|
||||||
using static Thrift.Protocol.Utilities.TJSONProtocolConstants;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.ScheduledMeterReading
|
namespace JiShe.CollectBus.ScheduledMeterReading
|
||||||
{
|
{
|
||||||
@ -133,6 +129,11 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
var tempArryay = item.Split(":");
|
var tempArryay = item.Split(":");
|
||||||
string meteryType = tempArryay[4];//表计类别
|
string meteryType = tempArryay[4];//表计类别
|
||||||
int timeDensity = Convert.ToInt32(tempArryay[5]);//采集频率
|
int timeDensity = Convert.ToInt32(tempArryay[5]);//采集频率
|
||||||
|
if (timeDensity > 15)
|
||||||
|
{
|
||||||
|
timeDensity = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//电表定时广播校时,一天一次。
|
//电表定时广播校时,一天一次。
|
||||||
string currentTimeStr = $"{currentTime:HH:mm:00}";
|
string currentTimeStr = $"{currentTime:HH:mm:00}";
|
||||||
@ -242,12 +243,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
|
|
||||||
if (meteryType == MeterTypeEnum.Ammeter.ToString())
|
if (meteryType == MeterTypeEnum.Ammeter.ToString())
|
||||||
{
|
{
|
||||||
//电表最大采集频率为15分钟
|
|
||||||
if (timeDensity > 15)
|
|
||||||
{
|
|
||||||
timeDensity = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = CreateMeterPublishTask<DeviceInfo>(
|
_ = CreateMeterPublishTask<DeviceInfo>(
|
||||||
timeDensity: timeDensity,
|
timeDensity: timeDensity,
|
||||||
nextTaskTime: currentTaskTime,
|
nextTaskTime: currentTaskTime,
|
||||||
@ -423,10 +418,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
deviceIds.Add(ammeter.MeterId.ToString());
|
deviceIds.Add(ammeter.MeterId.ToString());
|
||||||
|
|
||||||
//处理ItemCode
|
//处理ItemCode
|
||||||
if (ammeter.ItemCodes == null && !string.IsNullOrWhiteSpace(ammeter.DataTypes))
|
if (string.IsNullOrWhiteSpace(ammeter.ItemCodes) && !string.IsNullOrWhiteSpace(ammeter.DataTypes))
|
||||||
{
|
{
|
||||||
ammeter.ItemCodes = new List<string>();
|
|
||||||
|
|
||||||
var itemArr = ammeter.DataTypes.Split(',').ToList();
|
var itemArr = ammeter.DataTypes.Split(',').ToList();
|
||||||
|
|
||||||
#region 拼接采集项
|
#region 拼接采集项
|
||||||
@ -439,7 +432,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
{
|
{
|
||||||
if (!excludeItemCode.Contains(gatherItem.ItemCode))
|
if (!excludeItemCode.Contains(gatherItem.ItemCode))
|
||||||
{
|
{
|
||||||
itemCodeList.Add(gatherItem.ItemCode.Replace("WAVE_109", "10_109"));
|
itemCodeList.Add(gatherItem.ItemCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,11 +451,16 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ammeter.ItemCodes = itemCodeList;
|
ammeter.ItemCodes = itemCodeList.Serialize();//转换成JSON字符串
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(ammeter.ItemCodes))
|
||||||
|
{
|
||||||
|
ammeter.ItemCodes = ammeter.ItemCodes.Replace("WAVE_109", "10_109");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//var tempItemCodeList = new List<string>() { "10_97" };
|
var tempItemCodeList = new List<string>() { "10_97" };
|
||||||
//ammeter.ItemCodes = tempItemCodeList.Serialize();
|
ammeter.ItemCodes = tempItemCodeList.Serialize();
|
||||||
|
|
||||||
if (!keyValuePairs.ContainsKey(ammeter.FocusAddress))
|
if (!keyValuePairs.ContainsKey(ammeter.FocusAddress))
|
||||||
{
|
{
|
||||||
@ -630,7 +628,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ammeterInfo.ItemCodes == null || ammeterInfo.ItemCodes.Count <=0)
|
if (string.IsNullOrWhiteSpace(ammeterInfo.ItemCodes))
|
||||||
{
|
{
|
||||||
//_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}数据采集指令生成失败,采集项为空,-101");
|
//_logger.LogError($"{nameof(AmmerterCreatePublishTaskAction)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}数据采集指令生成失败,采集项为空,-101");
|
||||||
return null;
|
return null;
|
||||||
@ -677,7 +675,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<string> tempCodes = ammeterInfo.ItemCodes!;
|
List<string> tempCodes = ammeterInfo.ItemCodes.Deserialize<List<string>>()!;
|
||||||
|
|
||||||
//TODO:自动上报数据只主动采集1类数据。
|
//TODO:自动上报数据只主动采集1类数据。
|
||||||
if (ammeterInfo.AutomaticReport.Equals(1))
|
if (ammeterInfo.AutomaticReport.Equals(1))
|
||||||
@ -1153,42 +1151,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
throw new NullReferenceException($"{nameof(InitAmmeterCacheData)} 初始化水表缓存数据时,采集项类型数据为空");
|
throw new NullReferenceException($"{nameof(InitAmmeterCacheData)} 初始化水表缓存数据时,采集项类型数据为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meterInfos != null && meterInfos.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (var item in meterInfos)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (item.MeterTypeName.Equals("水表") && (item.Protocol.Equals((int)MeterLinkProtocol.CJT_188_2018) || item.Protocol.Equals((int)MeterLinkProtocol.DLT_645_1997) || item.Protocol.Equals((int)MeterLinkProtocol.DLT_645_2007)))
|
|
||||||
{
|
|
||||||
if (item.BrandType.Contains("炬华有线"))
|
|
||||||
{
|
|
||||||
item.ItemCodes = new List<string>() { T37612012PacketItemCodeConst.AFN0CHFN188H };
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item.ItemCodes = new List<string>() { T37612012PacketItemCodeConst.AFN0CHFN129H };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (item.MeterTypeName.Trim().Equals("西恩超声波流量计"))
|
|
||||||
{
|
|
||||||
item.ItemCodes = new List<string>() { T37612012PacketItemCodeConst.AFN09HFN01H };
|
|
||||||
}
|
|
||||||
else if (item.MeterTypeName.Trim().Equals("江苏华海涡街流量计积算仪"))
|
|
||||||
{
|
|
||||||
item.ItemCodes = new List<string>() { T37612012PacketItemCodeConst.AFN09HFN01H };
|
|
||||||
}
|
|
||||||
else if (item.MeterTypeName.Trim().Equals("V880BR涡街流量计"))
|
|
||||||
{
|
|
||||||
item.ItemCodes = new List<string>() { T37612012PacketItemCodeConst.AFN09HFN01H };
|
|
||||||
}
|
|
||||||
else if (item.MeterTypeName.Trim().Equals("拓思特涡街流量计H880BR"))
|
|
||||||
{
|
|
||||||
item.ItemCodes = new List<string>() { T37612012PacketItemCodeConst.AFN09HFN01H };
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<string> deviceIds = new List<string>();//用于处理Kafka主题分区数据的分发和处理。
|
List<string> deviceIds = new List<string>();//用于处理Kafka主题分区数据的分发和处理。
|
||||||
|
|
||||||
//根据采集频率分组,获得采集频率分组
|
//根据采集频率分组,获得采集频率分组
|
||||||
@ -1339,40 +1301,25 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
var protocolPlugin = await _protocolService.GetProtocolServiceAsync(watermeter.BrandType);
|
var protocolPlugin = await _protocolService.GetProtocolServiceAsync(watermeter.BrandType);
|
||||||
if (protocolPlugin == null)
|
if (protocolPlugin == null)
|
||||||
{
|
{
|
||||||
_logger.LogError($"{nameof(AmmeterScheduledAutoValveControl)} 创建水表待发送的任务数据时{currentTime}没有找到对应的协议组件,-101");
|
//_logger.LogError($"{nameof(AmmeterScheduledAutoValveControl)} 定时阀控运行时间{currentTime}没有找到对应的协议组件,-105");
|
||||||
return null;
|
//return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (watermeter.ItemCodes == null || watermeter.ItemCodes.Count <=0)
|
string itemCode = T37612012PacketItemCodeConst.AFN10HFN01H;
|
||||||
{
|
string subItemCode = T1882018PacketItemCodeConst.CTR0190;
|
||||||
_logger.LogError($"{nameof(AmmeterScheduledAutoValveControl)} 创建水表待发送的任务数据时{watermeter.Name}没有相应的采集项,-102");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var item in watermeter.ItemCodes)
|
ProtocolBuildResponse builderResponse = await protocolPlugin.BuildAsync(new ProtocolBuildRequest()
|
||||||
{
|
|
||||||
var tempRequest = new ProtocolBuildRequest()
|
|
||||||
{
|
{
|
||||||
FocusAddress = watermeter.FocusAddress,
|
FocusAddress = watermeter.FocusAddress,
|
||||||
Pn = watermeter.MeteringCode,
|
Pn = watermeter.MeteringCode,
|
||||||
ItemCode = item,
|
ItemCode = itemCode,
|
||||||
};
|
SubProtocolRequest = new SubProtocolBuildRequest()
|
||||||
|
|
||||||
if (item == T37612012PacketItemCodeConst.AFN09HFN01H)
|
|
||||||
{
|
|
||||||
//var itemCodeInfo = T37612012PacketItemCodeConst.MappingItemCodeTo188SubCodeRelationship(T37612012PacketItemCodeConst.AFN10HFN99H, true);//阀控
|
|
||||||
tempRequest.SubProtocolRequest = new SubProtocolBuildRequest()
|
|
||||||
{
|
{
|
||||||
MeterAddress = watermeter.MeterAddress,
|
MeterAddress = watermeter.MeterAddress,
|
||||||
Password = watermeter.Password,
|
Password = watermeter.Password,
|
||||||
ItemCode = T1882018PacketItemCodeConst.CTR01901F00,
|
ItemCode = subItemCode,
|
||||||
MeteringPort = watermeter.MeteringPort,
|
|
||||||
Baudrate = watermeter.Baudrate,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
ProtocolBuildResponse builderResponse = await protocolPlugin.BuildAsync(tempRequest);
|
|
||||||
|
|
||||||
if (builderResponse == null || builderResponse.Data.Length <= 0)
|
if (builderResponse == null || builderResponse.Data.Length <= 0)
|
||||||
{
|
{
|
||||||
//_logger.LogWarning($"{nameof(AmmerterCreatePublishTask)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}采集项{tempItem}未能正确获取报文。");
|
//_logger.LogWarning($"{nameof(AmmerterCreatePublishTask)} 集中器{ammeterInfo.FocusAddress}的电表{ammeterInfo.Name}采集项{tempItem}未能正确获取报文。");
|
||||||
@ -1381,23 +1328,41 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
|
|
||||||
if (builderResponse == null || builderResponse.Data.Length <= 0)
|
if (builderResponse == null || builderResponse.Data.Length <= 0)
|
||||||
{
|
{
|
||||||
_logger.LogWarning($"{nameof(WatermeterCreatePublishTaskAction)} 集中器{watermeter.FocusAddress}的水表{watermeter.Name} 水表采抄读采集项{T1882018PacketItemCodeConst.CTR01901F00}未能正确获取报文。");
|
_logger.LogWarning($"{nameof(WatermeterCreatePublishTaskAction)} 集中器{watermeter.FocusAddress}的水表{watermeter.Name}采集项{itemCode}未能正确获取报文。");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var meterReadingRecords = CreateAmmeterPacketInfo(
|
|
||||||
ammeterInfo: watermeter,
|
|
||||||
timestamps: currentTime.GetDateTimeOffset().ToUnixTimeNanoseconds(),
|
|
||||||
builderResponse: builderResponse,
|
|
||||||
itemCode: T37612012PacketItemCodeConst.AFN10HFN01H,
|
|
||||||
subItemCode: T1882018PacketItemCodeConst.CTR01901F00,
|
|
||||||
pendingCopyReadTime: currentTime,
|
|
||||||
creationTime: currentTime,
|
|
||||||
packetType: TelemetryPacketTypeEnum.WatermeterAutoReadding,
|
|
||||||
_guidGenerator);
|
|
||||||
taskList.Add(meterReadingRecords);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
string taskMark = CommonHelper.GetTaskMark(builderResponse.AFn, builderResponse.Fn, watermeter.MeteringCode, builderResponse.MSA, builderResponse.Seq);
|
||||||
|
var meterReadingRecords = new MeterReadingTelemetryPacketInfo()
|
||||||
|
{
|
||||||
|
SystemName = SystemType,
|
||||||
|
ProjectId = $"{watermeter.ProjectID}",
|
||||||
|
DeviceType = $"{MeterTypeEnum.Ammeter}",
|
||||||
|
DeviceId = $"{watermeter.MeterId}",
|
||||||
|
Timestamps = DateTimeOffset.Now.ToUnixTimeNanoseconds(),
|
||||||
|
DatabaseBusiID = watermeter.DatabaseBusiID,
|
||||||
|
PacketType = (int)TelemetryPacketTypeEnum.WatermeterAutoReadding,
|
||||||
|
PendingCopyReadTime = timestamps,
|
||||||
|
CreationTime = currentTime,
|
||||||
|
MeterAddress = watermeter.MeterAddress,
|
||||||
|
AFN = builderResponse.AFn,
|
||||||
|
Fn = builderResponse.Fn,
|
||||||
|
Seq = builderResponse.Seq,
|
||||||
|
MSA = builderResponse.MSA,
|
||||||
|
ItemCode = itemCode,
|
||||||
|
SubItemCode = subItemCode,
|
||||||
|
TaskMark = taskMark,
|
||||||
|
IsSend = false,
|
||||||
|
ManualOrNot = false,
|
||||||
|
Pn = watermeter.MeteringCode,
|
||||||
|
IssuedMessageId = GuidGenerator.Create().ToString(),
|
||||||
|
IssuedMessageHexString = Convert.ToHexString(builderResponse.Data),
|
||||||
|
IsReceived = false,
|
||||||
|
ScoreValue = $"{watermeter.FocusAddress}.{taskMark}".Md5Fun(),
|
||||||
|
};
|
||||||
|
|
||||||
|
taskList.Add(meterReadingRecords);
|
||||||
|
|
||||||
return taskList;
|
return taskList;
|
||||||
|
|
||||||
|
|||||||
@ -96,73 +96,73 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
//[Route($"ammeter/list")]
|
//[Route($"ammeter/list")]
|
||||||
public override async Task<List<DeviceInfo>> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890")
|
public override async Task<List<DeviceInfo>> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890")
|
||||||
{
|
{
|
||||||
#if DEBUG
|
//#if DEBUG
|
||||||
var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo";
|
// var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo";
|
||||||
|
|
||||||
List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);//542400504
|
// List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);//542400504
|
||||||
|
|
||||||
if (ammeterInfos == null || ammeterInfos.Count <= 0)
|
// if (ammeterInfos == null || ammeterInfos.Count <= 0)
|
||||||
{
|
|
||||||
ammeterInfos = new List<DeviceInfo>();
|
|
||||||
//ammeterInfos.Add(new DeviceInfo()
|
|
||||||
// {
|
// {
|
||||||
// Baudrate = 2400,
|
// ammeterInfos = new List<DeviceInfo>();
|
||||||
// FocusAddress = "442400040",
|
// //ammeterInfos.Add(new DeviceInfo()
|
||||||
// Name = "保利单箱电表1",
|
// //{
|
||||||
// FocusId = 95780,
|
// // Baudrate = 2400,
|
||||||
// DatabaseBusiID = 1,
|
// // FocusAddress = "442400040",
|
||||||
// MeteringCode = 0,
|
// // Name = "保利单箱电表1",
|
||||||
// MeterAddress = "442405000040",
|
// // FocusId = 95780,
|
||||||
// MeterId = 127035,
|
// // DatabaseBusiID = 1,
|
||||||
// TypeName = 1,
|
// // MeteringCode = 0,
|
||||||
// DataTypes = "581,589,592,597,601",
|
// // MeterAddress = "442405000040",
|
||||||
// TimeDensity = 15,
|
// // MeterId = 127035,
|
||||||
// BrandType = "DTS1980",
|
// // TypeName = 1,
|
||||||
// MeterType = MeterTypeEnum.Ammeter,
|
// // DataTypes = "581,589,592,597,601",
|
||||||
// ProjectID = 1,
|
// // TimeDensity = 15,
|
||||||
// MeteringPort = MeteringPortConst.MeteringPortTwo,
|
// // BrandType = "DTS1980",
|
||||||
// Password = "000000",
|
// // MeterType = MeterTypeEnum.Ammeter,
|
||||||
//});
|
// // ProjectID = 1,
|
||||||
|
// // MeteringPort = MeteringPortConst.MeteringPortTwo,
|
||||||
|
// // Password = "000000",
|
||||||
|
// //});
|
||||||
|
|
||||||
//ammeterInfos.Add(new DeviceInfo()
|
// //ammeterInfos.Add(new DeviceInfo()
|
||||||
//{
|
// //{
|
||||||
// Baudrate = 2400,
|
// // Baudrate = 2400,
|
||||||
// FocusAddress = "442400039",
|
// // FocusAddress = "442400039",
|
||||||
// Name = "保利单箱电表2",
|
// // Name = "保利单箱电表2",
|
||||||
// FocusId = 69280,
|
// // FocusId = 69280,
|
||||||
// DatabaseBusiID = 1,
|
// // DatabaseBusiID = 1,
|
||||||
// MeteringCode = 0,
|
// // MeteringCode = 0,
|
||||||
// MeterAddress = "442405000039",
|
// // MeterAddress = "442405000039",
|
||||||
// MeterId = 95594,
|
// // MeterId = 95594,
|
||||||
// TypeName = 1,
|
// // TypeName = 1,
|
||||||
// DataTypes = "581,589,592,597,601",
|
// // DataTypes = "581,589,592,597,601",
|
||||||
// TimeDensity = 15,
|
// // TimeDensity = 15,
|
||||||
// BrandType = "DTS1980",
|
// // BrandType = "DTS1980",
|
||||||
// MeterType = MeterTypeEnum.Ammeter,
|
// // MeterType = MeterTypeEnum.Ammeter,
|
||||||
// ProjectID = 1,
|
// // ProjectID = 1,
|
||||||
// MeteringPort = MeteringPortConst.MeteringPortTwo,
|
// // MeteringPort = MeteringPortConst.MeteringPortTwo,
|
||||||
// Password = "000000",
|
// // Password = "000000",
|
||||||
//});
|
// //});
|
||||||
|
|
||||||
//ammeterInfos.Add(new DeviceInfo()
|
// //ammeterInfos.Add(new DeviceInfo()
|
||||||
//{
|
// //{
|
||||||
// Baudrate = 2400,
|
// // Baudrate = 2400,
|
||||||
// FocusAddress = "402440506",
|
// // FocusAddress = "402440506",
|
||||||
// Name = "中环半导体9#冷却泵-220KW(三相电表)",
|
// // Name = "中环半导体9#冷却泵-220KW(三相电表)",
|
||||||
// FocusId = 106857,
|
// // FocusId = 106857,
|
||||||
// DatabaseBusiID = 1,
|
// // DatabaseBusiID = 1,
|
||||||
// MeteringCode = 0,
|
// // MeteringCode = 0,
|
||||||
// MeterAddress = "402410040506",
|
// // MeterAddress = "402410040506",
|
||||||
// MeterId = 139059,
|
// // MeterId = 139059,
|
||||||
// TypeName = 3,
|
// // TypeName = 3,
|
||||||
// DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679",
|
// // DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679",
|
||||||
// TimeDensity = 15,
|
// // TimeDensity = 15,
|
||||||
// BrandType = "DTS1980",
|
// // BrandType = "DTS1980",
|
||||||
// Password = "000000",
|
// // Password = "000000",
|
||||||
// ProjectID = 1,
|
// // ProjectID = 1,
|
||||||
// MeterType = MeterTypeEnum.Ammeter,
|
// // MeterType = MeterTypeEnum.Ammeter,
|
||||||
// MeteringPort = MeteringPortConst.MeteringPortTwo,
|
// // MeteringPort = MeteringPortConst.MeteringPortTwo,
|
||||||
//});
|
// //});
|
||||||
|
|
||||||
|
|
||||||
// ammeterInfos.Add(new DeviceInfo()
|
// ammeterInfos.Add(new DeviceInfo()
|
||||||
@ -206,34 +206,15 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
// MeteringPort = MeteringPortConst.MeteringPortTwo,
|
// MeteringPort = MeteringPortConst.MeteringPortTwo,
|
||||||
// });
|
// });
|
||||||
|
|
||||||
ammeterInfos.Add(new DeviceInfo()
|
|
||||||
{
|
|
||||||
Baudrate = 2400,
|
|
||||||
FocusAddress = "322011149",
|
|
||||||
Name = "DDS1980-T4(5-60) ML307A 长稳 322011149",
|
|
||||||
FocusId = 57685,
|
|
||||||
DatabaseBusiID = 1,
|
|
||||||
MeteringCode = 0,
|
|
||||||
MeterAddress = "31240010270",
|
|
||||||
MeterId = 78973,
|
|
||||||
TypeName = 3,
|
|
||||||
DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679",
|
|
||||||
TimeDensity = 15,
|
|
||||||
BrandType = "DTS1980",
|
|
||||||
Password = "000000",
|
|
||||||
ProjectID = 1,
|
|
||||||
MeterType = MeterTypeEnum.Ammeter,
|
|
||||||
MeteringPort = MeteringPortConst.MeteringPortTwo,
|
|
||||||
});
|
|
||||||
|
|
||||||
FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp, ammeterInfos);
|
// FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp, ammeterInfos);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return ammeterInfos;
|
// return ammeterInfos;
|
||||||
#else
|
//#else
|
||||||
|
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -275,8 +256,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
|
|
||||||
|
|
||||||
#if DEBUG
|
#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')";
|
//sql = $@"{sql} and c.Address in('402410040506')";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(gatherCode))
|
if (!string.IsNullOrWhiteSpace(gatherCode))
|
||||||
@ -580,7 +561,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus119:DeviceInfo";
|
var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo";
|
||||||
|
|
||||||
List<DeviceInfo> deviceInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);
|
List<DeviceInfo> deviceInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);
|
||||||
|
|
||||||
@ -607,8 +588,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
LinkType = "RS-485",
|
LinkType = "RS-485",
|
||||||
TimesRate = 1.0000m,
|
TimesRate = 1.0000m,
|
||||||
});
|
});
|
||||||
|
|
||||||
FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp, deviceInfos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return deviceInfos;
|
return deviceInfos;
|
||||||
|
|||||||
@ -113,8 +113,7 @@ namespace JiShe.CollectBus.IotSystems.Devices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 该电表方案下采集项,JSON格式,如:["0D_80","0D_80"]
|
/// 该电表方案下采集项,JSON格式,如:["0D_80","0D_80"]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Column(IsIgnore = true)]
|
public string ItemCodes { get; set; }
|
||||||
public List<string> ItemCodes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// State表状态:
|
/// State表状态:
|
||||||
|
|||||||
@ -14,14 +14,9 @@ namespace JiShe.CollectBus.Common.Consts
|
|||||||
#region 下行报文编码
|
#region 下行报文编码
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 基路径,表示主站发起读数据
|
/// 基路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string BasicT1882018Read = "CTR0";
|
public const string BasicT1882018 = "CTR";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 基路径,表示主站发起读数据
|
|
||||||
/// </summary>
|
|
||||||
public const string BasicT1882018Write = "CTR3";
|
|
||||||
|
|
||||||
#region 读数据
|
#region 读数据
|
||||||
|
|
||||||
@ -29,12 +24,12 @@ namespace JiShe.CollectBus.Common.Consts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取计量数据1
|
/// 读取计量数据1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string CTR01901F00 = $"{BasicT1882018Read}_01_90_1F_00";
|
public const string CTR0190 = $"01_90";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取计量数据2
|
/// 读取计量数据2
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string CTR01911F00 = $"{BasicT1882018Read}_01_91_1F_00";
|
public const string CTR0191 = $"01_91";
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -43,12 +38,12 @@ namespace JiShe.CollectBus.Common.Consts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关阀
|
/// 关阀
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string CTR304A01755 = $"{BasicT1882018Write}_04_A0_17_55";
|
public const string CTR30455 = $"_04_55";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开阀
|
/// 开阀
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string CTR304A01799 = $"{BasicT1882018Write}_04_A0_17_99";
|
public const string CTR30499 = $"_04_99";
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -35,21 +35,6 @@ namespace JiShe.CollectBus.Common.Consts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string AFN09HFN09H = $"09_9";
|
public const string AFN09HFN09H = $"09_9";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 水表阀控
|
|
||||||
/// </summary>
|
|
||||||
public const string AFN10HFN99H = $"10_99";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 炬华有线水表抄读
|
|
||||||
/// </summary>
|
|
||||||
public const string AFN0CHFN188H = $"0C_188";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 标准188协议水表抄读
|
|
||||||
/// </summary>
|
|
||||||
public const string AFN0CHFN129H = $"0C_129";
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 写数据
|
#region 写数据
|
||||||
@ -216,7 +201,7 @@ namespace JiShe.CollectBus.Common.Consts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 特殊645编码关系映射
|
/// 特殊645编码关系映射
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="itemCode">特殊3761编码</param>
|
/// <param name="itemCode"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static (string,string) MappingItemCodeTo645SubCodeRelationship(string itemCode)
|
public static (string,string) MappingItemCodeTo645SubCodeRelationship(string itemCode)
|
||||||
{
|
{
|
||||||
@ -226,20 +211,5 @@ namespace JiShe.CollectBus.Common.Consts
|
|||||||
_=> (itemCode,""),
|
_=> (itemCode,""),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 特殊188编码关系映射
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="itemCode">特殊3761编码</param>
|
|
||||||
/// <param name="tripState">TripState (0 合闸-开阀, 1 关阀);开阀关阀</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static (string, string) MappingItemCodeTo188SubCodeRelationship(string itemCode,bool tripState)
|
|
||||||
{
|
|
||||||
return itemCode switch
|
|
||||||
{
|
|
||||||
AFN10HFN99H => (AFN10HFN01H, tripState == true ?T1882018PacketItemCodeConst.CTR304A01799: T1882018PacketItemCodeConst.CTR304A01755),
|
|
||||||
_ => (itemCode, ""),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user