升级依赖

This commit is contained in:
ChenYi 2025-04-27 15:30:45 +08:00
parent 63acc1c263
commit b1ccb874a7
10 changed files with 55 additions and 47 deletions

View File

@ -64,11 +64,13 @@ namespace JiShe.CollectBus.Protocol.T37612012
if (tB3761.DT?.Fn == (int)FN.) if (tB3761.DT?.Fn == (int)FN.)
{ {
// 登录回复 // 登录回复
//todo 更新Redis数据缓存
if (tB3761.SEQ.CON == (int)CON.) if (tB3761.SEQ.CON == (int)CON.)
await LoginAsync(client, messageReceived, tB3761.A.Code, tB3761.A.A3?.D1_D7, tB3761.SEQ?.PSEQ); await LoginAsync(client, messageReceived, tB3761.A.Code, tB3761.A.A3?.D1_D7, tB3761.SEQ?.PSEQ);
} }
else if (tB3761.DT?.Fn == (int)FN.) else if (tB3761.DT?.Fn == (int)FN.)
{ {
//todo 更新Redis数据缓存主要是TCP连接当前服务器连接配置数量满了以后如何解决监控策略通知新采购服务器
// 心跳回复 // 心跳回复
//心跳帧有两种情况: //心跳帧有两种情况:
//1. 集中器先有登录帧,再有心跳帧 //1. 集中器先有登录帧,再有心跳帧

View File

@ -19,8 +19,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageReference Include="TouchSocket" Version="2.1.9" /> <PackageReference Include="TouchSocket" Version="3.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -36,7 +36,7 @@ namespace JiShe.CollectBus.Protocol.Services
var keyValuePair = protocols.FirstOrDefault(a => ContainsExactPartRegex(deviceCode, a.Value.RegularExpression)); var keyValuePair = protocols.FirstOrDefault(a => ContainsExactPartRegex(deviceCode, a.Value.RegularExpression));
if (!keyValuePair.Key.IsNullOrWhiteSpace() || keyValuePair.Value != null) return keyValuePair.Value; if (!keyValuePair.Key.IsNullOrWhiteSpace() || keyValuePair.Value != null) return keyValuePair.Value;
if (isSpecial) throw new UserFriendlyException("The device protocol plugin does not exist!", ExceptionCode.NotFound); if (isSpecial) throw new UserFriendlyException("The device protocol plugin does not exist!", ExceptionCode.NotFound);
var hasStandardProtocolPlugin = protocols.TryGetValue("StandardProtocolPlugin", out var protocolInfo); var hasStandardProtocolPlugin = protocols.TryGetValue("T37612012ProtocolPlugin", out var protocolInfo);
if (!hasStandardProtocolPlugin) throw new UserFriendlyException("Standard protocol plugin does not exist!", ExceptionCode.NotFound); if (!hasStandardProtocolPlugin) throw new UserFriendlyException("Standard protocol plugin does not exist!", ExceptionCode.NotFound);
return protocolInfo; return protocolInfo;
} }

View File

@ -19,8 +19,8 @@
<PackageReference Include="Volo.Abp.AutoMapper" Version="8.3.3" /> <PackageReference Include="Volo.Abp.AutoMapper" Version="8.3.3" />
<PackageReference Include="Volo.Abp.BackgroundWorkers.Hangfire" Version="8.3.3" /> <PackageReference Include="Volo.Abp.BackgroundWorkers.Hangfire" Version="8.3.3" />
<PackageReference Include="Volo.Abp.Ddd.Application" Version="8.3.3" /> <PackageReference Include="Volo.Abp.Ddd.Application" Version="8.3.3" />
<PackageReference Include="TouchSocket" Version="3.0.19" /> <PackageReference Include="TouchSocket" Version="3.1.0" />
<PackageReference Include="TouchSocket.Hosting" Version="3.0.19" /> <PackageReference Include="TouchSocket.Hosting" Version="3.1.0" />
<PackageReference Include="Volo.Abp.EventBus.Kafka" Version="8.3.3" /> <PackageReference Include="Volo.Abp.EventBus.Kafka" Version="8.3.3" />
<ProjectReference Include="..\..\protocols\JiShe.CollectBus.Protocol\JiShe.CollectBus.Protocol.csproj" /> <ProjectReference Include="..\..\protocols\JiShe.CollectBus.Protocol\JiShe.CollectBus.Protocol.csproj" />

View File

@ -5,7 +5,7 @@ using TouchSocket.Sockets;
namespace JiShe.CollectBus.Plugins namespace JiShe.CollectBus.Plugins
{ {
public partial class ServerMonitor(ILogger<ServerMonitor> logger) : PluginBase, IServerStartedPlugin, IServerStopedPlugin public partial class ServerMonitor(ILogger<ServerMonitor> logger) : PluginBase, IServerStartedPlugin, IServerStoppedPlugin
{ {
public Task OnServerStarted(IServiceBase sender, ServiceStateEventArgs e) public Task OnServerStarted(IServiceBase sender, ServiceStateEventArgs e)
{ {
@ -31,7 +31,7 @@ namespace JiShe.CollectBus.Plugins
return e.InvokeNext(); return e.InvokeNext();
} }
public Task OnServerStoped(IServiceBase sender,ServiceStateEventArgs e) public Task OnServerStopped(IServiceBase sender,ServiceStateEventArgs e)
{ {
logger.LogInformation("服务已停止"); logger.LogInformation("服务已停止");
return e.InvokeNext(); return e.InvokeNext();

View File

@ -55,6 +55,7 @@ namespace JiShe.CollectBus.Plugins
_logger.LogError("协议不存在!"); _logger.LogError("协议不存在!");
} }
var tcpSessionClient = (ITcpSessionClient)client; var tcpSessionClient = (ITcpSessionClient)client;
TB3761? tB3761 = await protocolPlugin!.AnalyzeAsync<TB3761>(tcpSessionClient, messageHexString); TB3761? tB3761 = await protocolPlugin!.AnalyzeAsync<TB3761>(tcpSessionClient, messageHexString);
if (tB3761 == null) if (tB3761 == null)
{ {
@ -64,7 +65,7 @@ namespace JiShe.CollectBus.Plugins
await e.InvokeNext(); await e.InvokeNext();
} }
//[GeneratorPlugin(typeof(ITcpConnectingPlugin))]
public async Task OnTcpConnecting(ITcpSession client, ConnectingEventArgs e) public async Task OnTcpConnecting(ITcpSession client, ConnectingEventArgs e)
{ {
var tcpSessionClient = (ITcpSessionClient)client; var tcpSessionClient = (ITcpSessionClient)client;
@ -73,7 +74,6 @@ namespace JiShe.CollectBus.Plugins
await e.InvokeNext(); await e.InvokeNext();
} }
//[GeneratorPlugin(typeof(ITcpConnectedPlugin))]
public async Task OnTcpConnected(ITcpSession client, ConnectedEventArgs e) public async Task OnTcpConnected(ITcpSession client, ConnectedEventArgs e)
{ {
var tcpSessionClient = (ITcpSessionClient)client; var tcpSessionClient = (ITcpSessionClient)client;
@ -83,10 +83,9 @@ namespace JiShe.CollectBus.Plugins
await e.InvokeNext(); await e.InvokeNext();
} }
//[GeneratorPlugin(typeof(ITcpClosedPlugin))]//ITcpSessionClient
public async Task OnTcpClosed(ITcpSession client, ClosedEventArgs e) public async Task OnTcpClosed(ITcpSession client, ClosedEventArgs e)
{ {
//todo: 删除Redis缓存
var tcpSessionClient = (ITcpSessionClient)client; var tcpSessionClient = (ITcpSessionClient)client;
var entity = await _deviceRepository.FindAsync(a => a.ClientId == tcpSessionClient.Id); var entity = await _deviceRepository.FindAsync(a => a.ClientId == tcpSessionClient.Id);
if (entity != null) if (entity != null)

View File

@ -97,39 +97,40 @@ namespace JiShe.CollectBus.ScheduledMeterReading
public override async Task<List<AmmeterInfo>> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890") public override async Task<List<AmmeterInfo>> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890")
{ {
//List<AmmeterInfo> ammeterInfos = new List<AmmeterInfo>(); List<AmmeterInfo> ammeterInfos = new List<AmmeterInfo>();
//ammeterInfos.Add(new AmmeterInfo() ammeterInfos.Add(new AmmeterInfo()
//{ {
// Baudrate = 2400, Baudrate = 2400,
// FocusAddress = "402440506", FocusAddress = "402440506",
// Name = "张家祠工务(三相电表)", Name = "张家祠工务(三相电表)",
// FocusId = 95780, FocusId = 95780,
// DatabaseBusiID = 1, DatabaseBusiID = 1,
// MeteringCode = 1, MeteringCode = 1,
// AmmerterAddress = "402410040506", AmmerterAddress = "402410040506",
// MeterId = 127035, MeterId = 127035,
// 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 = "", BrandType = "DDS1980",
//}); });
//ammeterInfos.Add(new AmmeterInfo()
//{
// Baudrate = 2400,
// FocusAddress = "542400504",
// Name = "五号配(长芦二所四排)(单相电表)",
// FocusId = 69280,
// DatabaseBusiID = 1,
// MeteringCode = 2,
// AmmerterAddress = "542410000504",
// MeterId = 95594,
// TypeName = 1,
// DataTypes = "581,589,592,597,601",
// TimeDensity = 15,
// BrandType = "",
//});
//return ammeterInfos; ammeterInfos.Add(new AmmeterInfo()
{
Baudrate = 2400,
FocusAddress = "542400504",
Name = "五号配(长芦二所四排)(单相电表)",
FocusId = 69280,
DatabaseBusiID = 1,
MeteringCode = 2,
AmmerterAddress = "542410000504",
MeterId = 95594,
TypeName = 1,
DataTypes = "581,589,592,597,601",
TimeDensity = 15,
BrandType = "DDS1980",
});
return ammeterInfos;
string sql = $@"SELECT C.ID as MeterId,C.Name,C.FocusID as FocusId,C.SingleRate,C.MeteringCode,C.Code AS BrandType,C.Baudrate,C.Password,C.MeteringPort,C.[Address] AS AmmerterAddress,C.TypeName,C.Protocol,C.TripState,C.[State],B.[Address],B.AreaCode,B.AutomaticReport,D.DataTypes,B.TimeDensity,A.GatherCode,C.Special,C.[ProjectID],B.AbnormalState,B.LastTime,CONCAT(B.AreaCode, B.[Address]) AS FocusAddress,(select top 1 DatabaseBusiID from TB_Project where ID = B.ProjectID) AS DatabaseBusiID string sql = $@"SELECT C.ID as MeterId,C.Name,C.FocusID as FocusId,C.SingleRate,C.MeteringCode,C.Code AS BrandType,C.Baudrate,C.Password,C.MeteringPort,C.[Address] AS AmmerterAddress,C.TypeName,C.Protocol,C.TripState,C.[State],B.[Address],B.AreaCode,B.AutomaticReport,D.DataTypes,B.TimeDensity,A.GatherCode,C.Special,C.[ProjectID],B.AbnormalState,B.LastTime,CONCAT(B.AreaCode, B.[Address]) AS FocusAddress,(select top 1 DatabaseBusiID from TB_Project where ID = B.ProjectID) AS DatabaseBusiID
FROM TB_GatherInfo(NOLOCK) AS A FROM TB_GatherInfo(NOLOCK) AS A

View File

@ -28,7 +28,14 @@ namespace JiShe.CollectBus.Common.Consts
/// </summary> /// </summary>
public const string FifteenMinuteAcquisitionTimeInterval = "Fifteen"; public const string FifteenMinuteAcquisitionTimeInterval = "Fifteen";
/// <summary>
/// 集中器连接信息缓存数据,{0}=>系统类型,{1}=>应用服务部署标记
/// </summary>
public const string ConcentratorCacheHashKey = $"{CacheBasicDirectoryKey}{"{0}:{1}"}:Concentrator";
public const string MeterInfo = "MeterInfo"; public const string MeterInfo = "MeterInfo";
/// <summary> /// <summary>
/// 缓存表计信息,{0}=>系统类型,{1}=>应用服务部署标记,{2}=>表计类别,{3}=>采集频率 /// 缓存表计信息,{0}=>系统类型,{1}=>应用服务部署标记,{2}=>表计类别,{3}=>采集频率
/// </summary> /// </summary>

View File

@ -80,7 +80,7 @@
"SaslPassword": "lixiao1980", "SaslPassword": "lixiao1980",
"KafkaReplicationFactor": 3, "KafkaReplicationFactor": 3,
"NumPartitions": 30, "NumPartitions": 30,
"ServerTagName": "JiSheCollectBus100", "ServerTagName": "JiSheCollectBus5",
"FirstCollectionTime": "2025-04-22 16:07:00" "FirstCollectionTime": "2025-04-22 16:07:00"
}, },
"IoTDBOptions": { "IoTDBOptions": {
@ -141,7 +141,7 @@
"DefaultIdempotence": true "DefaultIdempotence": true
} }
}, },
"PlugInFolder": "C:\\Users\\Dai Zan\\Desktop\\Plugins", "PlugInFolder": "",
"ServerApplicationOptions": { "ServerApplicationOptions": {
"ServerTagName": "JiSheCollectBus100", "ServerTagName": "JiSheCollectBus100",
"SystemType": null, "SystemType": null,