From 496ae0c7970cfd1eda688ec930e374a216215fae Mon Sep 17 00:00:00 2001 From: cli <377476583@qq.com> Date: Sun, 27 Apr 2025 14:09:58 +0800 Subject: [PATCH 001/115] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=89=93=E5=8C=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=92=8Cdockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 29 +++-------------------------- PackageAndPublish.bat | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index d4999c8..b9674e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,3 @@ -# FROM mcr.microsoft.com/dotnet/aspnet:8.0 - -# # 创建目录 -# RUN mkdir /app - -# COPY publish /app - - - -# # 设置工作目录 -# WORKDIR /app - -# # 暴露80端口 -# EXPOSE 80 -# # 设置时区 .net6 才有这个问题 -# ENV TZ=Asia/Shanghai - -# # 设置环境变量 -# ENV ASPNETCORE_ENVIRONMENT=Production - -# ENTRYPOINT ["dotnet", "JiShe.IOT.HttpApi.Host.dll"] - - - FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app EXPOSE 80 @@ -30,7 +6,7 @@ ENV TZ=Asia/Shanghai ENV ASPNETCORE_ENVIRONMENT=Production FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build -WORKDIR /src +# WORKDIR /src COPY ["JiShe.CollectBus.sln", "."] COPY ["common.props", "."] COPY ["NuGet.Config", "."] @@ -44,7 +20,7 @@ COPY ["protocols/", "protocols/"] RUN dotnet restore "JiShe.CollectBus.sln" # 构建项目 -WORKDIR "/src/web/JiShe.CollectBus.Host" +WORKDIR "/web/JiShe.CollectBus.Host" RUN dotnet build "JiShe.CollectBus.Host.csproj" -c Release -o /app/build # 发布项目 @@ -53,6 +29,7 @@ RUN dotnet publish "JiShe.CollectBus.Host.csproj" -c Release -o /app/publish /p: # 创建最终镜像 FROM base AS final + WORKDIR /app # 创建Plugins目录 diff --git a/PackageAndPublish.bat b/PackageAndPublish.bat index 0bb73cd..24ce317 100644 --- a/PackageAndPublish.bat +++ b/PackageAndPublish.bat @@ -5,6 +5,7 @@ set VERSION=1.0.0 set CONFIGURATION=Release set OUTPUT_DIR=%~dp0\nupkgs set API_KEY=your-nuget-api-key +set SOURCE=https://api.nuget.org/v3/index.json REM 创建输出目录 if not exist "%OUTPUT_DIR%" mkdir "%OUTPUT_DIR%" @@ -22,11 +23,10 @@ echo 开始打包项目... REM 打包 Protocol 项目 echo 打包 Protocol 项目... -call :PackProject protocols\JiShe.CollectBus.Protocol\JiShe.CollectBus.Protocol.csproj +call : + protocols\JiShe.CollectBus.Protocol\JiShe.CollectBus.Protocol.csproj call :PackProject protocols\JiShe.CollectBus.Protocol.Contracts\JiShe.CollectBus.Protocol.Contracts.csproj -call :PackProject protocols\JiShe.CollectBus.Protocol.T1882018\JiShe.CollectBus.Protocol.T1882018.csproj call :PackProject protocols\JiShe.CollectBus.Protocol.T37612012\JiShe.CollectBus.Protocol.T37612012.csproj -call :PackProject protocols\JiShe.CollectBus.Protocol.T6452007\JiShe.CollectBus.Protocol.T6452007.csproj REM 打包 Modules 项目 echo 打包 Modules 项目... @@ -36,7 +36,6 @@ call :PackProject modules\JiShe.CollectBus.IoTDB\JiShe.CollectBus.IoTDB.csproj call :PackProject modules\JiShe.CollectBus.MongoDB\JiShe.CollectBus.MongoDB.csproj call :PackProject modules\JiShe.CollectBus.FreeSql\JiShe.CollectBus.FreeSql.csproj call :PackProject modules\JiShe.CollectBus.Cassandra\JiShe.CollectBus.Cassandra.csproj -call :PackProject modules\JiShe.CollectBusMultiProcessing\JiShe.CollectBusMultiProcessing.csproj REM 打包 Shared 项目 echo 打包 Shared 项目... @@ -44,11 +43,11 @@ call :PackProject shared\JiShe.CollectBus.Common\JiShe.CollectBus.Common.csproj call :PackProject shared\JiShe.CollectBus.Domain.Shared\JiShe.CollectBus.Domain.Shared.csproj REM 打包 Services 项目 -echo 打包 Services 项目... -call :PackProject services\JiShe.CollectBus.Domain\JiShe.CollectBus.Domain.csproj -call :PackProject services\JiShe.CollectBus.Application.Contracts\JiShe.CollectBus.Application.Contracts.csproj -call :PackProject services\JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj -call :PackProject services\JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj +@REM echo 打包 Services 项目... +@REM call :PackProject services\JiShe.CollectBus.Domain\JiShe.CollectBus.Domain.csproj +@REM call :PackProject services\JiShe.CollectBus.Application.Contracts\JiShe.CollectBus.Application.Contracts.csproj +@REM call :PackProject services\JiShe.CollectBus.Application\JiShe.CollectBus.Application.csproj +@REM call :PackProject services\JiShe.CollectBus.EntityFrameworkCore\JiShe.CollectBus.EntityFrameworkCore.csproj echo. echo 是否要发布包到 NuGet? (Y/N) @@ -58,7 +57,7 @@ if /i "%PUBLISH_CHOICE%"=="Y" ( echo 开始发布包... for %%f in ("%OUTPUT_DIR%\*.nupkg") do ( echo 发布: %%f - dotnet nuget push "%%f" --api-key %API_KEY% --source https://api.nuget.org/v3/index.json --skip-duplicate + dotnet nuget push "%%f" --api-key %API_KEY% --source %SOURCE% --skip-duplicate ) echo 所有包已发布完成! ) else ( @@ -70,7 +69,7 @@ goto :eof :PackProject if exist "%~1" ( echo 打包: %~1 - dotnet pack "%~1" -c %CONFIGURATION% --no-build --include-symbols -p:SymbolPackageFormat=snupkg -p:PackageVersion=%VERSION% -o "%OUTPUT_DIR%" + dotnet pack "%~1" -c %CONFIGURATION% --include-symbols -p:SymbolPackageFormat=snupkg -p:PackageVersion=%VERSION% -o "%OUTPUT_DIR%" ) else ( echo 警告: 项目不存在 - %~1 ) From b34b71e0c54f97dfb54654571ac564859b7ac0a0 Mon Sep 17 00:00:00 2001 From: cli <377476583@qq.com> Date: Sun, 27 Apr 2025 14:15:08 +0800 Subject: [PATCH 002/115] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8B=AC=E7=AB=8Bsln?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JiShe.CollectBus.External.sln | 25 +++++++++++++++++++++++++ JiShe.CollectBus.sln | 11 +---------- 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 JiShe.CollectBus.External.sln diff --git a/JiShe.CollectBus.External.sln b/JiShe.CollectBus.External.sln new file mode 100644 index 0000000..a1344ff --- /dev/null +++ b/JiShe.CollectBus.External.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.PluginFileWatcher", "external\JiShe.CollectBus.PluginFileWatcher\JiShe.CollectBus.PluginFileWatcher.csproj", "{0F67A493-A4DF-550E-AB4D-95F55144C706}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0F67A493-A4DF-550E-AB4D-95F55144C706}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F67A493-A4DF-550E-AB4D-95F55144C706}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F67A493-A4DF-550E-AB4D-95F55144C706}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F67A493-A4DF-550E-AB4D-95F55144C706}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} + EndGlobalSection +EndGlobal diff --git a/JiShe.CollectBus.sln b/JiShe.CollectBus.sln index 03bd207..1ecb18c 100644 --- a/JiShe.CollectBus.sln +++ b/JiShe.CollectBus.sln @@ -37,7 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.Web", "1.Web", "{A02F7D8A EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4.Modules", "4.Modules", "{2E0FE301-34C3-4561-9CAE-C7A9E65AEE59}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "6.Protocols", "6.Protocols", "{3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "5.Protocols", "5.Protocols", "{3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.Services", "2.Services", "{BA4DA3E7-9AD0-47AD-A0E6-A0BB6700DA23}" EndProject @@ -45,8 +45,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.Shared", "3.Shared", "{EB EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Kafka.Test", "modules\JiShe.CollectBus.Kafka.Test\JiShe.CollectBus.Kafka.Test.csproj", "{6D6A2A58-7406-9C8C-7B23-3E442CCE3E6B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "5.External", "5.External", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Protocol.T1882018", "protocols\JiShe.CollectBus.Protocol.T1882018\JiShe.CollectBus.Protocol.T1882018.csproj", "{430D298B-377E-49B8-83AA-ADC7C0EBDB0F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Protocol.T37612012", "protocols\JiShe.CollectBus.Protocol.T37612012\JiShe.CollectBus.Protocol.T37612012.csproj", "{8A61DF78-069B-40B5-8811-614E2960443E}" @@ -55,8 +53,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Protocol", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.Protocol.T6452007", "protocols\JiShe.CollectBus.Protocol.T6452007\JiShe.CollectBus.Protocol.T6452007.csproj", "{75B7D419-C261-577D-58D6-AA3ACED9129F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiShe.CollectBus.PluginFileWatcher", "external\JiShe.CollectBus.PluginFileWatcher\JiShe.CollectBus.PluginFileWatcher.csproj", "{0F67A493-A4DF-550E-AB4D-95F55144C706}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0.Docs", "0.Docs", "{D8346C4C-55B8-43E8-A6B8-E59D56FE6D92}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore @@ -152,10 +148,6 @@ Global {75B7D419-C261-577D-58D6-AA3ACED9129F}.Debug|Any CPU.Build.0 = Debug|Any CPU {75B7D419-C261-577D-58D6-AA3ACED9129F}.Release|Any CPU.ActiveCfg = Release|Any CPU {75B7D419-C261-577D-58D6-AA3ACED9129F}.Release|Any CPU.Build.0 = Release|Any CPU - {0F67A493-A4DF-550E-AB4D-95F55144C706}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F67A493-A4DF-550E-AB4D-95F55144C706}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F67A493-A4DF-550E-AB4D-95F55144C706}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F67A493-A4DF-550E-AB4D-95F55144C706}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -181,7 +173,6 @@ Global {8A61DF78-069B-40B5-8811-614E2960443E} = {3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC} {E27377CC-E2D3-4237-060F-96EA214D3129} = {3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC} {75B7D419-C261-577D-58D6-AA3ACED9129F} = {3C3F9DB2-EC97-4464-B49F-BF1A0C2B46DC} - {0F67A493-A4DF-550E-AB4D-95F55144C706} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} From 13d16903b72bdb624193f4b4242efafe7cd79cf5 Mon Sep 17 00:00:00 2001 From: cli <377476583@qq.com> Date: Sun, 27 Apr 2025 14:24:06 +0800 Subject: [PATCH 003/115] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/JiShe.CollectBus.Host/appsettings.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/web/JiShe.CollectBus.Host/appsettings.json b/web/JiShe.CollectBus.Host/appsettings.json index 5abdef7..ffe9b03 100644 --- a/web/JiShe.CollectBus.Host/appsettings.json +++ b/web/JiShe.CollectBus.Host/appsettings.json @@ -141,7 +141,6 @@ "DefaultIdempotence": true } }, - "PlugInFolder": "C:\\Users\\Dai Zan\\Desktop\\Plugins", "ServerApplicationOptions": { "ServerTagName": "JiSheCollectBus100", "SystemType": null, @@ -149,6 +148,6 @@ "AutomaticVerificationTime": "16:07:00", "AutomaticGetTerminalVersionTime": "17:07:00", "AutomaticGetTelematicsModuleTime": "17:30:00" - } + }, "PlugInFolder": "" } \ No newline at end of file From b1ccb874a7c204801ceded242c758a8ca88d724b Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Sun, 27 Apr 2025 15:30:45 +0800 Subject: [PATCH 004/115] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../T37612012ProtocolPlugin.cs | 2 + .../JiShe.CollectBus.Protocol.csproj | 3 +- .../Services/ProtocolService.cs | 2 +- .../JiShe.CollectBus.Application.csproj | 4 +- .../Plugins/ServerMonitor.cs | 4 +- .../Plugins/TcpMonitor.cs | 9 ++- ...nergySystemScheduledMeterReadingService.cs | 65 ++++++++++--------- .../Consts/RedisConst.cs | 7 ++ .../Pages/Monitor.cshtml | 2 +- web/JiShe.CollectBus.Host/appsettings.json | 4 +- 10 files changed, 55 insertions(+), 47 deletions(-) diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/T37612012ProtocolPlugin.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/T37612012ProtocolPlugin.cs index 1fc8d2a..5b82aa6 100644 --- a/protocols/JiShe.CollectBus.Protocol.T37612012/T37612012ProtocolPlugin.cs +++ b/protocols/JiShe.CollectBus.Protocol.T37612012/T37612012ProtocolPlugin.cs @@ -64,11 +64,13 @@ namespace JiShe.CollectBus.Protocol.T37612012 if (tB3761.DT?.Fn == (int)FN.登录) { // 登录回复 + //todo 更新Redis数据缓存 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.心跳) { + //todo 更新Redis数据缓存,主要是TCP连接,当前服务器连接配置数量满了以后,如何解决监控策略,通知新采购服务器 // 心跳回复 //心跳帧有两种情况: //1. 集中器先有登录帧,再有心跳帧 diff --git a/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj b/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj index f75b5dd..6495b24 100644 --- a/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj +++ b/protocols/JiShe.CollectBus.Protocol/JiShe.CollectBus.Protocol.csproj @@ -19,8 +19,7 @@ - - + diff --git a/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs b/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs index 0368151..e391fcd 100644 --- a/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs +++ b/protocols/JiShe.CollectBus.Protocol/Services/ProtocolService.cs @@ -36,7 +36,7 @@ namespace JiShe.CollectBus.Protocol.Services var keyValuePair = protocols.FirstOrDefault(a => ContainsExactPartRegex(deviceCode, a.Value.RegularExpression)); if (!keyValuePair.Key.IsNullOrWhiteSpace() || keyValuePair.Value != null) return keyValuePair.Value; 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); return protocolInfo; } diff --git a/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj b/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj index 3ab9831..aefe5e4 100644 --- a/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj +++ b/services/JiShe.CollectBus.Application/JiShe.CollectBus.Application.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/services/JiShe.CollectBus.Application/Plugins/ServerMonitor.cs b/services/JiShe.CollectBus.Application/Plugins/ServerMonitor.cs index 2b3c15a..b90b372 100644 --- a/services/JiShe.CollectBus.Application/Plugins/ServerMonitor.cs +++ b/services/JiShe.CollectBus.Application/Plugins/ServerMonitor.cs @@ -5,7 +5,7 @@ using TouchSocket.Sockets; namespace JiShe.CollectBus.Plugins { - public partial class ServerMonitor(ILogger logger) : PluginBase, IServerStartedPlugin, IServerStopedPlugin + public partial class ServerMonitor(ILogger logger) : PluginBase, IServerStartedPlugin, IServerStoppedPlugin { public Task OnServerStarted(IServiceBase sender, ServiceStateEventArgs e) { @@ -31,7 +31,7 @@ namespace JiShe.CollectBus.Plugins return e.InvokeNext(); } - public Task OnServerStoped(IServiceBase sender,ServiceStateEventArgs e) + public Task OnServerStopped(IServiceBase sender,ServiceStateEventArgs e) { logger.LogInformation("服务已停止"); return e.InvokeNext(); diff --git a/services/JiShe.CollectBus.Application/Plugins/TcpMonitor.cs b/services/JiShe.CollectBus.Application/Plugins/TcpMonitor.cs index 6eadb0a..ab813fc 100644 --- a/services/JiShe.CollectBus.Application/Plugins/TcpMonitor.cs +++ b/services/JiShe.CollectBus.Application/Plugins/TcpMonitor.cs @@ -55,6 +55,7 @@ namespace JiShe.CollectBus.Plugins _logger.LogError("协议不存在!"); } var tcpSessionClient = (ITcpSessionClient)client; + TB3761? tB3761 = await protocolPlugin!.AnalyzeAsync(tcpSessionClient, messageHexString); if (tB3761 == null) { @@ -64,16 +65,15 @@ namespace JiShe.CollectBus.Plugins await e.InvokeNext(); } - //[GeneratorPlugin(typeof(ITcpConnectingPlugin))] + public async Task OnTcpConnecting(ITcpSession client, ConnectingEventArgs e) { var tcpSessionClient = (ITcpSessionClient)client; - + _logger.LogInformation($"[TCP] ID:{tcpSessionClient.Id} IP:{client.GetIPPort()}正在连接中..."); await e.InvokeNext(); } - //[GeneratorPlugin(typeof(ITcpConnectedPlugin))] public async Task OnTcpConnected(ITcpSession client, ConnectedEventArgs e) { var tcpSessionClient = (ITcpSessionClient)client; @@ -83,10 +83,9 @@ namespace JiShe.CollectBus.Plugins await e.InvokeNext(); } - //[GeneratorPlugin(typeof(ITcpClosedPlugin))]//ITcpSessionClient public async Task OnTcpClosed(ITcpSession client, ClosedEventArgs e) { - + //todo: 删除Redis缓存 var tcpSessionClient = (ITcpSessionClient)client; var entity = await _deviceRepository.FindAsync(a => a.ClientId == tcpSessionClient.Id); if (entity != null) diff --git a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs index 9dc2fc3..184452f 100644 --- a/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs +++ b/services/JiShe.CollectBus.Application/ScheduledMeterReading/EnergySystemScheduledMeterReadingService.cs @@ -97,39 +97,40 @@ namespace JiShe.CollectBus.ScheduledMeterReading public override async Task> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890") { - //List ammeterInfos = new List(); - //ammeterInfos.Add(new AmmeterInfo() - //{ - // Baudrate = 2400, - // FocusAddress = "402440506", - // Name = "张家祠工务(三相电表)", - // FocusId = 95780, - // DatabaseBusiID = 1, - // MeteringCode = 1, - // AmmerterAddress = "402410040506", - // MeterId = 127035, - // 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 = "", - //}); - //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 = "", - //}); + List ammeterInfos = new List(); + ammeterInfos.Add(new AmmeterInfo() + { + Baudrate = 2400, + FocusAddress = "402440506", + Name = "张家祠工务(三相电表)", + FocusId = 95780, + DatabaseBusiID = 1, + MeteringCode = 1, + AmmerterAddress = "402410040506", + MeterId = 127035, + 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 = "DDS1980", + }); - //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 FROM TB_GatherInfo(NOLOCK) AS A diff --git a/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs b/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs index 53ad4f6..60340bc 100644 --- a/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs +++ b/shared/JiShe.CollectBus.Common/Consts/RedisConst.cs @@ -28,7 +28,14 @@ namespace JiShe.CollectBus.Common.Consts /// public const string FifteenMinuteAcquisitionTimeInterval = "Fifteen"; + /// + /// 集中器连接信息缓存数据,{0}=>系统类型,{1}=>应用服务部署标记 + /// + public const string ConcentratorCacheHashKey = $"{CacheBasicDirectoryKey}{"{0}:{1}"}:Concentrator"; + + public const string MeterInfo = "MeterInfo"; + /// /// 缓存表计信息,{0}=>系统类型,{1}=>应用服务部署标记,{2}=>表计类别,{3}=>采集频率 /// diff --git a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml index 3a7fbc7..7cf09e0 100644 --- a/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml +++ b/web/JiShe.CollectBus.Host/Pages/Monitor.cshtml @@ -17,7 +17,7 @@ 后端服务 - +