mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-22 11:33:07 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7314c8901d | ||
![]() |
4e9f02b48c | ||
![]() |
9ae7602cb4 | ||
![]() |
aa8aa36aef | ||
![]() |
0174f7c6f2 | ||
![]() |
df9e7d6ff1 |
@@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
|
||||
<Version>$(SourceGeneratorVersion)</Version>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace BlazorSetParametersAsyncGenerator;
|
||||
namespace Microsoft.AspNetCore.Components;
|
||||
|
||||
[Generator]
|
||||
public partial class SetParametersAsyncGenerator : ISourceGenerator
|
||||
@@ -11,7 +11,7 @@ public partial class SetParametersAsyncGenerator : ISourceGenerator
|
||||
private string m_DoNotGenerateSetParametersAsyncAttribute = """
|
||||
|
||||
using System;
|
||||
namespace BlazorSetParametersAsyncGenerator
|
||||
namespace Microsoft.AspNetCore.Components
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class DoNotGenerateSetParametersAsyncAttribute : Attribute
|
||||
@@ -25,7 +25,7 @@ public partial class SetParametersAsyncGenerator : ISourceGenerator
|
||||
private string m_GenerateSetParametersAsyncAttribute = """
|
||||
|
||||
using System;
|
||||
namespace BlazorSetParametersAsyncGenerator
|
||||
namespace Microsoft.AspNetCore.Components
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
||||
internal sealed class GenerateSetParametersAsyncAttribute : Attribute
|
||||
@@ -40,7 +40,7 @@ public partial class SetParametersAsyncGenerator : ISourceGenerator
|
||||
private string m_GlobalGenerateSetParametersAsyncAttribute = """
|
||||
|
||||
using System;
|
||||
namespace BlazorSetParametersAsyncGenerator
|
||||
namespace Microsoft.AspNetCore.Components
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
internal sealed class GlobalGenerateSetParametersAsyncAttribute : Attribute
|
||||
@@ -445,8 +445,8 @@ namespace {namespaceName}
|
||||
private static IEnumerable<INamedTypeSymbol> GetCandidateClasses(SyntaxReceiver receiver, GeneratorExecutionContext context)
|
||||
{
|
||||
var compilation = context.Compilation;
|
||||
var positiveAttributeSymbol = compilation.GetTypeByMetadataName("BlazorSetParametersAsyncGenerator.GenerateSetParametersAsyncAttribute");
|
||||
var negativeAttributeSymbol = compilation.GetTypeByMetadataName("BlazorSetParametersAsyncGenerator.DoNotGenerateSetParametersAsyncAttribute");
|
||||
var positiveAttributeSymbol = compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Components.GenerateSetParametersAsyncAttribute");
|
||||
var negativeAttributeSymbol = compilation.GetTypeByMetadataName("Microsoft.AspNetCore.Components.DoNotGenerateSetParametersAsyncAttribute");
|
||||
|
||||
// loop over the candidate methods, and keep the ones that are actually annotated
|
||||
|
||||
@@ -454,7 +454,7 @@ namespace {namespaceName}
|
||||
var assemblyAttributes = compilation.Assembly.GetAttributes();
|
||||
|
||||
var enableAttr = assemblyAttributes.FirstOrDefault(attr =>
|
||||
attr.AttributeClass?.ToDisplayString() == "BlazorSetParametersAsyncGenerator.GlobalGenerateSetParametersAsyncAttribute");
|
||||
attr.AttributeClass?.ToDisplayString() == "Microsoft.AspNetCore.Components.GlobalGenerateSetParametersAsyncAttribute");
|
||||
|
||||
var globalEnable = false;
|
||||
if (enableAttr != null)
|
||||
|
@@ -3,7 +3,7 @@ using Microsoft.CodeAnalysis.Text;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace BlazorSetParametersAsyncGenerator
|
||||
namespace Microsoft.AspNetCore.Components
|
||||
{
|
||||
internal static class SourceGeneratorContextExtension
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
|
||||
namespace BlazorSetParametersAsyncGenerator
|
||||
namespace Microsoft.AspNetCore.Components
|
||||
{
|
||||
internal static class StringExtension
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace BlazorSetParametersAsyncGenerator
|
||||
namespace Microsoft.AspNetCore.Components
|
||||
{
|
||||
public static class TypeSymbolExtension
|
||||
{
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
@@ -18,7 +18,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Rougamo.Fody" Version="5.0.0" />
|
||||
<PackageReference Include="Rougamo.Fody" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
|
||||
@@ -41,12 +41,20 @@
|
||||
<ItemGroup>
|
||||
<None Include="..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="..\README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ThingsGateway.DB\ThingsGateway.DB.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<!--<Target Name="Mapster" AfterTargets="AfterBuild">
|
||||
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet tool restore" />
|
||||
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster extension -o MapsterGenerator -a "$(TargetDir)$(ProjectName).dll"" />
|
||||
<Exec WorkingDirectory="$(ProjectDir)" Command="dotnet mapster mapper -o MapsterGenerator -a "$(TargetDir)$(ProjectName).dll"" />
|
||||
</Target>-->
|
||||
|
||||
|
||||
</Project>
|
||||
|
@@ -19,4 +19,4 @@ global using System.Diagnostics.CodeAnalysis;
|
||||
global using ThingsGateway.Razor;
|
||||
|
||||
[assembly: SuppressMessage("Reliability", "CA2007", Justification = "<挂起>", Scope = "module")]
|
||||
[assembly: BlazorSetParametersAsyncGenerator.GlobalGenerateSetParametersAsync(true)]
|
||||
[assembly: GlobalGenerateSetParametersAsync(true)]
|
@@ -39,6 +39,7 @@ public partial class SysUserEdit
|
||||
var items = await SysPositionService.SelectorAsync(new PositionSelectorInput() { });
|
||||
Items = PositionUtil.BuildCascaderItemList(items);
|
||||
ModuleSelectedItems = ResourceUtil.BuildModuleSelectList((await SysResourceService.GetAllAsync())).ToList();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ThingsGateway.Admin.Application\ThingsGateway.Admin.Application.csproj" />
|
||||
@@ -30,8 +30,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="..\README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
@@ -11,14 +11,14 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.2.5" />
|
||||
<PackageReference Include="BootstrapBlazor.TableExport" Version="9.2.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="..\README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -15,6 +15,7 @@ using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
using ThingsGateway.NewLife.Caching;
|
||||
using ThingsGateway.NewLife.Log;
|
||||
|
||||
namespace ThingsGateway.Logging;
|
||||
|
||||
@@ -33,7 +34,7 @@ public sealed class DatabaseLoggerProvider : ILoggerProvider, ISupportExternalSc
|
||||
/// <summary>
|
||||
/// 日志消息队列(线程安全)
|
||||
/// </summary>
|
||||
private readonly BlockingCollection<LogMessage> _logMessageQueue = new(12000);
|
||||
private readonly BlockingCollection<LogMessage> _logMessageQueue = new(20000);
|
||||
|
||||
/// <summary>
|
||||
/// 日志作用域提供器
|
||||
@@ -135,7 +136,10 @@ public sealed class DatabaseLoggerProvider : ILoggerProvider, ISupportExternalSc
|
||||
{
|
||||
try
|
||||
{
|
||||
_logMessageQueue.Add(logMsg);
|
||||
if (!_logMessageQueue.TryAdd(logMsg, 5000))
|
||||
{
|
||||
XTrace.Log.Warn($"{nameof(DatabaseLoggerProvider)} queue add fail");
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (InvalidOperationException) { }
|
||||
|
@@ -14,6 +14,7 @@ using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
using ThingsGateway.NewLife.Caching;
|
||||
using ThingsGateway.NewLife.Log;
|
||||
|
||||
namespace ThingsGateway.Logging;
|
||||
|
||||
@@ -32,7 +33,7 @@ public sealed class FileLoggerProvider : ILoggerProvider, ISupportExternalScope
|
||||
/// <summary>
|
||||
/// 日志消息队列(线程安全)
|
||||
/// </summary>
|
||||
private readonly BlockingCollection<LogMessage> _logMessageQueue = new(12000);
|
||||
private readonly BlockingCollection<LogMessage> _logMessageQueue = new(20000);
|
||||
|
||||
/// <summary>
|
||||
/// 日志作用域提供器
|
||||
@@ -170,8 +171,10 @@ public sealed class FileLoggerProvider : ILoggerProvider, ISupportExternalScope
|
||||
{
|
||||
try
|
||||
{
|
||||
_logMessageQueue.Add(logMsg);
|
||||
return;
|
||||
if (!_logMessageQueue.TryAdd(logMsg, 5000))
|
||||
{
|
||||
XTrace.Log.Warn($"{nameof(DatabaseLoggerProvider)} queue add fail");
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException) { }
|
||||
catch { }
|
||||
|
@@ -46,6 +46,8 @@ public static class ObjectMapperServiceCollectionExtensions
|
||||
// 获取全局映射配置
|
||||
var config = TypeAdapterConfig.GlobalSettings;
|
||||
|
||||
//config.Compiler = exp => exp.CompileFast();
|
||||
|
||||
// 扫描所有继承 IRegister 接口的对象映射配置
|
||||
if (assemblies?.Length > 0) config.Scan(assemblies);
|
||||
|
||||
|
@@ -76,7 +76,7 @@ internal sealed partial class SchedulerFactory : ISchedulerFactory
|
||||
/// <summary>
|
||||
/// 作业持久化记录消息队列(线程安全)
|
||||
/// </summary>
|
||||
private readonly BlockingCollection<PersistenceContext> _persistenceMessageQueue = new(12000);
|
||||
private readonly BlockingCollection<PersistenceContext> _persistenceMessageQueue = new(20000);
|
||||
|
||||
/// <summary>
|
||||
/// 不受控的作业 Id 集合
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
|
||||
<!--<PackageReference Include="FastExpressionCompiler" Version="5.3.0" />-->
|
||||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.5.4" />
|
||||
@@ -61,8 +62,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net462;netstandard2.0;net6.0;net6.0-windows;net8.0;net8.0-windows;</TargetFrameworks>
|
||||
@@ -16,8 +16,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net462' or '$(TargetFramework)'=='net5.0-windows' or '$(TargetFramework)'=='net6.0-windows' or '$(TargetFramework)'=='net7.0-windows' or '$(TargetFramework)'=='net8.0-windows'">
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
|
||||
|
@@ -13,7 +13,7 @@ namespace ThingsGateway.Razor;
|
||||
/// <summary>
|
||||
/// 母版页基类
|
||||
/// </summary>
|
||||
[BlazorSetParametersAsyncGenerator.DoNotGenerateSetParametersAsync]
|
||||
[DoNotGenerateSetParametersAsync]
|
||||
public partial class BaseLayout
|
||||
{
|
||||
}
|
||||
|
@@ -18,8 +18,6 @@ namespace ThingsGateway.Extension.Generic;
|
||||
[ThingsGateway.DependencyInjection.SuppressSniffer]
|
||||
public static class GenericExtensions
|
||||
{
|
||||
private static MemoryCache Instance { get; set; } = new MemoryCache();
|
||||
|
||||
/// <summary>
|
||||
/// 把已修改的属性赋值到列表中,并返回字典
|
||||
/// </summary>
|
||||
|
@@ -21,4 +21,4 @@ global using System.Globalization;
|
||||
|
||||
|
||||
[assembly: SuppressMessage("Reliability", "CA2007", Justification = "<挂起>", Scope = "module")]
|
||||
[assembly: BlazorSetParametersAsyncGenerator.GlobalGenerateSetParametersAsync(true)]
|
||||
[assembly: GlobalGenerateSetParametersAsync(true)]
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
@@ -20,8 +20,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="..\README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
@@ -13,8 +13,8 @@
|
||||
<ItemGroup>
|
||||
<None Include="..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="..\README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.md" Pack="false" PackagePath="\" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" Pack="false" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -1,12 +1,13 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.8.14</PluginVersion>
|
||||
<ProPluginVersion>10.8.14</ProPluginVersion>
|
||||
<AuthenticationVersion>2.8.0</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.8.2</SourceGeneratorVersion>
|
||||
<PluginVersion>10.8.21</PluginVersion>
|
||||
<ProPluginVersion>10.8.21</ProPluginVersion>
|
||||
<AuthenticationVersion>2.8.4</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.8.6</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.17</NET8Version>
|
||||
<NET9Version>9.0.6</NET9Version>
|
||||
<SatelliteResourceLanguages>zh-Hans;en-US</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -41,7 +42,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(SolutionDir)Directory.Build.props" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)Directory.Build.props" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@@ -4,6 +4,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(SolutionDir)Foundation.props" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)Foundation.props" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
|
||||
|
@@ -19,4 +19,4 @@ global using ThingsGateway.Razor;
|
||||
|
||||
[assembly: SuppressMessage("Reliability", "CA2007", Justification = "<挂起>", Scope = "module")]
|
||||
|
||||
[assembly: BlazorSetParametersAsyncGenerator.GlobalGenerateSetParametersAsync(true)]
|
||||
[assembly: GlobalGenerateSetParametersAsync(true)]
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
<!--<UseRazorSourceGenerator>false</UseRazorSourceGenerator>-->
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
|
||||
|
@@ -85,6 +85,7 @@ public static class ChannelOptionsExtensions
|
||||
channelOptions.ThrowIfNull(nameof(IChannelOptions));
|
||||
var channelType = channelOptions.ChannelType;
|
||||
channelType.ThrowIfNull(nameof(ChannelTypeEnum));
|
||||
config.SetMaxCount(channelOptions.MaxClientCount);
|
||||
switch (channelType)
|
||||
{
|
||||
case ChannelTypeEnum.TcpClient:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)Foundation.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\Foundation.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>工业设备通讯协议-基础类库</Description>
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="$(NET9Version)" />
|
||||
<PackageReference Include="TouchSocket" Version="3.1.8" />
|
||||
<PackageReference Include="TouchSocket.SerialPorts" Version="3.1.8" />
|
||||
<PackageReference Include="TouchSocket" Version="3.1.10" />
|
||||
<PackageReference Include="TouchSocket.SerialPorts" Version="3.1.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<None Remove="$(SolutionDir)..\README.md" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" />
|
||||
<None Remove="..\..\..\README.md" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" />
|
||||
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
|
@@ -11,4 +11,4 @@
|
||||
|
||||
global using Microsoft.AspNetCore.Components;
|
||||
|
||||
[assembly: BlazorSetParametersAsyncGenerator.GlobalGenerateSetParametersAsync(true)]
|
||||
[assembly: GlobalGenerateSetParametersAsync(true)]
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<None Remove="$(SolutionDir)..\README.md" />
|
||||
<None Remove="$(SolutionDir)..\README.zh-CN.md" />
|
||||
<None Remove="..\..\..\README.md" />
|
||||
<None Remove="..\..\..\README.zh-CN.md" />
|
||||
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
|
@@ -435,8 +435,10 @@ public abstract class BusinessBaseWithCacheVariableModel<VarModel> : BusinessBas
|
||||
|
||||
try
|
||||
{
|
||||
if (_memoryVarModelsQueue.TryDequeue(out var cacheDBItem))
|
||||
while (_memoryVarModelsQueue.TryDequeue(out var cacheDBItem))
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
break;
|
||||
var list = cacheDBItem.Value;
|
||||
var data = list.ChunkBetter(_businessPropertyWithCache.SplitSize);
|
||||
foreach (var item in data)
|
||||
|
@@ -344,6 +344,8 @@ public abstract class CollectBase : DriverBase, IRpcDriver
|
||||
|
||||
var readErrorCount = 0;
|
||||
|
||||
await ReadWriteLock.ReaderLockAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
//if (LogMessage?.LogLevel <= TouchSocket.Core.LogLevel.Trace)
|
||||
// LogMessage?.Trace(string.Format("{0} - Collecting [{1} - {2}]", DeviceName, variableSourceRead?.RegisterAddress, variableSourceRead?.Length));
|
||||
var readResult = await ReadSourceAsync(variableSourceRead, cancellationToken).ConfigureAwait(false);
|
||||
@@ -460,7 +462,40 @@ public abstract class CollectBase : DriverBase, IRpcDriver
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
protected async Task Check(Dictionary<VariableRuntime, JToken> writeInfoLists, ConcurrentDictionary<string, OperResult> operResults, CancellationToken cancellationToken)
|
||||
{
|
||||
if (VariableSourceReadsEnable)
|
||||
{
|
||||
// 如果成功,每个变量都读取一次最新值,再次比较写入值
|
||||
var successfulWriteNames = operResults.Where(a => a.Value.IsSuccess).Select(a => a.Key).ToHashSet();
|
||||
|
||||
var groups = writeInfoLists.Select(a => a.Key).Where(a => a.RpcWriteCheck && a.ProtectType != ProtectTypeEnum.WriteOnly && successfulWriteNames.Contains(a.Name) && a.VariableSource != null).GroupBy(a => a.VariableSource as VariableSourceRead).Where(a => a.Key != null).ToList();
|
||||
|
||||
await groups.ParallelForEachAsync(async (varRead, token) =>
|
||||
{
|
||||
var result = await ReadSourceAsync(varRead.Key, token).ConfigureAwait(false);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
foreach (var item in varRead)
|
||||
{
|
||||
if (!item.Value.Equals(writeInfoLists[item].ToObject(item.Value?.GetType())))
|
||||
{
|
||||
// 如果写入值与读取值不同,则更新操作结果为失败
|
||||
operResults[item.Name] = new OperResult($"The write value is inconsistent with the read value, Write value: {writeInfoLists[item].ToObject(item.Value?.GetType())}, read value: {item.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in varRead)
|
||||
{
|
||||
// 如果写入值与读取值不同,则更新操作结果为失败
|
||||
operResults[item.Name] = new OperResult($"Reading and rechecking resulted in an error: {result.ErrorMessage}", result.Exception);
|
||||
}
|
||||
}
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
#region 写入方法
|
||||
|
||||
|
@@ -133,7 +133,6 @@ public abstract class CollectFoundationBase : CollectBase
|
||||
{
|
||||
try
|
||||
{
|
||||
await ReadWriteLock.ReaderLockAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return new(new OperationCanceledException());
|
||||
@@ -202,6 +201,8 @@ public abstract class CollectFoundationBase : CollectBase
|
||||
}
|
||||
}, CollectProperties.MaxConcurrentCount, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await Check(writeInfoLists, operResults, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// 返回包含操作结果的字典
|
||||
return new Dictionary<string, OperResult>(operResults);
|
||||
}
|
||||
@@ -210,4 +211,5 @@ public abstract class CollectFoundationBase : CollectBase
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -30,9 +30,6 @@ namespace ThingsGateway.Gateway.Application;
|
||||
[SugarIndex("unique_deviceid_variable_name", nameof(Variable.Name), OrderByType.Asc, nameof(Variable.DeviceId), OrderByType.Asc, true)]
|
||||
public class Variable : BaseDataEntity, IValidatableObject
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导入验证专用
|
||||
/// </summary>
|
||||
@@ -68,6 +65,8 @@ public class Variable : BaseDataEntity, IValidatableObject
|
||||
private bool lLAlarmEnable;
|
||||
private bool lAlarmEnable;
|
||||
private bool customAlarmEnable;
|
||||
private bool businessGroupUpdateTrigger = true;
|
||||
private bool rpcWriteCheck;
|
||||
|
||||
private object _value;
|
||||
private string name;
|
||||
@@ -143,6 +142,20 @@ public class Variable : BaseDataEntity, IValidatableObject
|
||||
[AutoGenerateColumn(Visible = true, Filterable = true, Sortable = true, Order = 1)]
|
||||
public virtual string BusinessGroup { get => businessGroup; set => businessGroup = value; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组上传触发变量
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "分组上传触发变量", IsNullable = true)]
|
||||
[AutoGenerateColumn(Visible = true, Filterable = true, Sortable = true, Order = 1)]
|
||||
public virtual bool BusinessGroupUpdateTrigger { get => businessGroupUpdateTrigger; set => businessGroupUpdateTrigger = value; }
|
||||
|
||||
/// <summary>
|
||||
/// 写入后再次读取检查值是否一致
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "写入后再次读取检查值是否一致", IsNullable = true)]
|
||||
[AutoGenerateColumn(Visible = true, Filterable = true, Sortable = true, Order = 1)]
|
||||
public virtual bool RpcWriteCheck { get => rpcWriteCheck; set => rpcWriteCheck = value; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
|
@@ -52,17 +52,7 @@
|
||||
"RulesId": "Name"
|
||||
},
|
||||
|
||||
"ThingsGateway.Management.Authentication": {
|
||||
"AuthName": "AuthName",
|
||||
"Authorized": "Authorized",
|
||||
"ExpireTime": "ExpireTime {0}",
|
||||
"Password": "Password",
|
||||
"Register": "Register",
|
||||
"RegisterStatus": "RegisterStatus",
|
||||
"Unauthorized": "Unauthorized",
|
||||
"Unregister": "Unregister",
|
||||
"UUID": "UUID"
|
||||
},
|
||||
|
||||
"ThingsGateway.Management.AutoUpdateController": {
|
||||
"AutoUpdateController": "AutoUpdate",
|
||||
"Update": "Update"
|
||||
@@ -448,6 +438,8 @@
|
||||
"BoolOpenAlarmText": "BoolOpenAlarmText",
|
||||
"BoolOpenRestrainExpressions": "BoolOpenRestrainExpressions",
|
||||
"BusinessGroup": "BusinessGroup",
|
||||
"BusinessGroupUpdateTrigger": "BusinessGroupUpdateTrigger",
|
||||
"RpcWriteCheck": "RpcWriteCheck",
|
||||
"ClearVariable": "Clear Variable",
|
||||
"CollectGroup": "CollectGroup",
|
||||
"CopyVariable": "Copy Variable",
|
||||
@@ -456,7 +448,7 @@
|
||||
"CustomAlarmText": "CustomAlarmText",
|
||||
"CustomRestrainExpressions": "CustomRestrainExpressions",
|
||||
"DataType": "DataType",
|
||||
"DeleteVariable": "Copy Variable",
|
||||
"DeleteVariable": "Delete Variable",
|
||||
"Description": "Description",
|
||||
"DeviceId": "CollectionDevice",
|
||||
"DeviceId.MinValue": "{0} cannot be empty",
|
||||
|
@@ -50,17 +50,7 @@
|
||||
"LogConsole": "日志",
|
||||
"RulesId": "名称"
|
||||
},
|
||||
"ThingsGateway.Management.Authentication": {
|
||||
"AuthName": "公司名称",
|
||||
"Authorized": "已授权",
|
||||
"ExpireTime": "过期时间 {0}",
|
||||
"Password": "注册码",
|
||||
"Register": "注册",
|
||||
"RegisterStatus": "注册状态",
|
||||
"Unauthorized": "未授权",
|
||||
"Unregister": "取消注册",
|
||||
"UUID": "唯一编码"
|
||||
},
|
||||
|
||||
"ThingsGateway.Management.AutoUpdateController": {
|
||||
"AutoUpdateController": "程序更新",
|
||||
"Update": "更新"
|
||||
@@ -449,6 +439,8 @@
|
||||
"BoolOpenAlarmText": "布尔开报警文本",
|
||||
"BoolOpenRestrainExpressions": "布尔开报警约束",
|
||||
"BusinessGroup": "业务组",
|
||||
"BusinessGroupUpdateTrigger": "分组上传触发",
|
||||
"RpcWriteCheck": "写入后再次读取检查值是否一致",
|
||||
"ClearVariable": "清空变量",
|
||||
"CollectGroup": "采集组",
|
||||
"CopyVariable": "复制变量",
|
||||
|
@@ -101,6 +101,9 @@ public class VariableBasicData
|
||||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string BusinessGroup => VariableRuntime.BusinessGroup;
|
||||
|
||||
/// <inheritdoc cref="Variable.BusinessGroupUpdateTrigger"/>
|
||||
public bool BusinessGroupUpdateTrigger => VariableRuntime.BusinessGroupUpdateTrigger;
|
||||
|
||||
/// <inheritdoc cref="VariableRuntime.DeviceName"/>
|
||||
public string DeviceName => VariableRuntime.DeviceName;
|
||||
|
||||
|
@@ -414,6 +414,12 @@ internal sealed class DeviceThreadManage : IAsyncDisposable, IDeviceThreadManage
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (DriverTasks.TryRemove(deviceId, out var task))
|
||||
{
|
||||
task.Stop();
|
||||
}
|
||||
|
||||
// 取消驱动程序的操作
|
||||
if (CancellationTokenSources.TryRemove(deviceId, out var token))
|
||||
{
|
||||
@@ -424,10 +430,6 @@ internal sealed class DeviceThreadManage : IAsyncDisposable, IDeviceThreadManage
|
||||
}
|
||||
}
|
||||
|
||||
if (DriverTasks.TryRemove(deviceId, out var task))
|
||||
{
|
||||
task.Stop();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@@ -104,12 +104,21 @@ public class ExecuteScriptNode : TextNode, IActuatorNode, IExexcuteExpressionsBa
|
||||
}
|
||||
}
|
||||
|
||||
Task<NodeOutput> IActuatorNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
Task<OperResult<NodeOutput>> IActuatorNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
{
|
||||
Logger?.Trace($"Execute script");
|
||||
var exexcuteExpressions = CSharpScriptEngineExtension.Do<IExexcuteExpressions>(Text);
|
||||
exexcuteExpressions.Logger = Logger;
|
||||
return exexcuteExpressions.ExecuteAsync(input, cancellationToken);
|
||||
try
|
||||
{
|
||||
Logger?.Trace($"Execute script");
|
||||
var exexcuteExpressions = CSharpScriptEngineExtension.Do<IExexcuteExpressions>(Text);
|
||||
exexcuteExpressions.Logger = Logger;
|
||||
return exexcuteExpressions.ExecuteAsync(input, cancellationToken);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogWarning(ex);
|
||||
return Task.FromResult(new OperResult<NodeOutput>(ex));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -12,22 +12,32 @@ public class VariableRpcNode : VariableNode, IActuatorNode
|
||||
public VariableRpcNode(string id, Point? position = null) : base(id, position)
|
||||
{ Title = "VariableRpcNode"; }
|
||||
|
||||
async Task<NodeOutput> IActuatorNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
async Task<OperResult<NodeOutput>> IActuatorNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
{
|
||||
if ((!DeviceText.IsNullOrWhiteSpace()) && GlobalData.ReadOnlyDevices.TryGetValue(DeviceText, out var device))
|
||||
try
|
||||
{
|
||||
if (device.ReadOnlyVariableRuntimes.TryGetValue(Text, out var value))
|
||||
|
||||
if ((!DeviceText.IsNullOrWhiteSpace()) && GlobalData.ReadOnlyDevices.TryGetValue(DeviceText, out var device))
|
||||
{
|
||||
var data = await value.RpcAsync(input.JToken.ToString(), $"RulesEngine: {RulesEngineName}", cancellationToken).ConfigureAwait(false);
|
||||
if (data.IsSuccess)
|
||||
Logger?.Trace($" VariableRpcNode - VariableName {Text} : execute success");
|
||||
else
|
||||
Logger?.Warning($" VariableRpcNode - VariableName {Text} : {data.ErrorMessage}");
|
||||
return new NodeOutput() { Value = data };
|
||||
if (device.ReadOnlyVariableRuntimes.TryGetValue(Text, out var value))
|
||||
{
|
||||
var data = await value.RpcAsync(input.JToken.ToString(), $"RulesEngine: {RulesEngineName}", cancellationToken).ConfigureAwait(false);
|
||||
if (data.IsSuccess)
|
||||
Logger?.Trace($" VariableRpcNode - VariableName {Text} : execute success");
|
||||
else
|
||||
Logger?.Warning($" VariableRpcNode - VariableName {Text} : {data.ErrorMessage}");
|
||||
return new OperResult<NodeOutput>() { Content = new NodeOutput() { Value = data } };
|
||||
}
|
||||
}
|
||||
Logger?.Warning($" VariableRpcNode - VariableName {Text} : not found");
|
||||
|
||||
return new OperResult<NodeOutput>() { Content = new NodeOutput() { } };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogWarning(ex);
|
||||
return new OperResult<NodeOutput>(ex);
|
||||
}
|
||||
Logger?.Warning($" VariableRpcNode - VariableName {Text} : not found");
|
||||
return new NodeOutput() { };
|
||||
}
|
||||
|
||||
|
||||
|
@@ -16,12 +16,21 @@ public class DataNode : TextNode, IExpressionNode
|
||||
|
||||
}
|
||||
|
||||
Task<NodeOutput> IExpressionNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
Task<OperResult<NodeOutput>> IExpressionNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
{
|
||||
var value = Text.GetExpressionsResult(input.Value, Logger);
|
||||
NodeOutput nodeOutput = new();
|
||||
nodeOutput.Value = value;
|
||||
Logger?.Trace($"Data result: {nodeOutput.JToken?.ToString(Newtonsoft.Json.Formatting.Indented)}");
|
||||
return Task.FromResult(nodeOutput);
|
||||
try
|
||||
{
|
||||
var value = Text.GetExpressionsResult(input.Value, Logger);
|
||||
NodeOutput nodeOutput = new();
|
||||
nodeOutput.Value = value;
|
||||
Logger?.Trace($"Data result: {nodeOutput.JToken?.ToString(Newtonsoft.Json.Formatting.Indented)}");
|
||||
return Task.FromResult(new OperResult<NodeOutput>() { Content = nodeOutput });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogWarning(ex);
|
||||
return Task.FromResult(new OperResult<NodeOutput>(ex));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -10,11 +10,20 @@ public class DelayNode : NumberNode, IExpressionNode
|
||||
{
|
||||
public DelayNode(string id, Point? position = null) : base(id, position) { Title = "DelayNode"; Placeholder = "DelayNode.Placeholder"; }
|
||||
|
||||
async Task<NodeOutput> IExpressionNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
async Task<OperResult<NodeOutput>> IExpressionNode.ExecuteAsync(NodeInput input, CancellationToken cancellationToken)
|
||||
{
|
||||
Logger?.Trace($"Delay {Number} ms");
|
||||
await Task.Delay(Number ?? 0, cancellationToken).ConfigureAwait(false);
|
||||
return new NodeOutput();
|
||||
try
|
||||
{
|
||||
Logger?.Trace($"Delay {Number} ms");
|
||||
await Task.Delay(Number ?? 0, cancellationToken).ConfigureAwait(false);
|
||||
return new OperResult<NodeOutput>() { Content = new NodeOutput() };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogWarning(ex);
|
||||
return new OperResult<NodeOutput>(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -13,11 +13,11 @@ public interface IConditionNode : INode
|
||||
|
||||
public interface IExpressionNode : INode
|
||||
{
|
||||
public Task<NodeOutput> ExecuteAsync(NodeInput input, CancellationToken cancellationToken);
|
||||
public Task<OperResult<NodeOutput>> ExecuteAsync(NodeInput input, CancellationToken cancellationToken);
|
||||
}
|
||||
public interface IActuatorNode : INode
|
||||
{
|
||||
public Task<NodeOutput> ExecuteAsync(NodeInput input, CancellationToken cancellationToken);
|
||||
public Task<OperResult<NodeOutput>> ExecuteAsync(NodeInput input, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface ITriggerNode : INode
|
||||
@@ -30,6 +30,6 @@ public interface IExexcuteExpressionsBase
|
||||
public interface IExexcuteExpressions : IExexcuteExpressionsBase
|
||||
{
|
||||
public TouchSocket.Core.ILog Logger { get; set; }
|
||||
Task<NodeOutput> ExecuteAsync(NodeInput input, CancellationToken cancellationToken);
|
||||
Task<OperResult<NodeOutput>> ExecuteAsync(NodeInput input, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ internal sealed class RulesEngineHostedService : BackgroundService, IRulesEngine
|
||||
if (rules.Status)
|
||||
{
|
||||
var data = Init(rules);
|
||||
await Start(data.rulesLog, data.blazorDiagram, TokenSource.Token).ConfigureAwait(false);
|
||||
Start(data.rulesLog, data.blazorDiagram, TokenSource.Token);
|
||||
dispatchService.Dispatch(null);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ internal sealed class RulesEngineHostedService : BackgroundService, IRulesEngine
|
||||
|
||||
return result;
|
||||
}
|
||||
private static Task Start(RulesLog rulesLog, DefaultDiagram item, CancellationToken cancellationToken)
|
||||
private static void Start(RulesLog rulesLog, DefaultDiagram item, CancellationToken cancellationToken)
|
||||
{
|
||||
rulesLog.Log.Trace("Start");
|
||||
var startNodes = item.Nodes.Where(a => a is IStartNode);
|
||||
@@ -123,7 +123,6 @@ internal sealed class RulesEngineHostedService : BackgroundService, IRulesEngine
|
||||
{
|
||||
_ = Analysis((link.Target.Model as PortModel)?.Parent, new NodeInput(), rulesLog, cancellationToken);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private static async Task Analysis(NodeModel targetNode, NodeInput input, RulesLog rulesLog, CancellationToken cancellationToken)
|
||||
@@ -152,17 +151,24 @@ internal sealed class RulesEngineHostedService : BackgroundService, IRulesEngine
|
||||
else if (targetNode is IExpressionNode expressionNode)
|
||||
{
|
||||
var nodeOutput = await expressionNode.ExecuteAsync(input, cancellationToken).ConfigureAwait(false);
|
||||
foreach (var link in targetNode.PortLinks.Where(a => ((a.Target.Model as PortModel)?.Parent) != targetNode))
|
||||
if (nodeOutput.IsSuccess)
|
||||
{
|
||||
await Analysis((link.Target.Model as PortModel)?.Parent, new NodeInput() { Value = nodeOutput.Value, }, rulesLog, cancellationToken).ConfigureAwait(false);
|
||||
foreach (var link in targetNode.PortLinks.Where(a => ((a.Target.Model as PortModel)?.Parent) != targetNode))
|
||||
{
|
||||
await Analysis((link.Target.Model as PortModel)?.Parent, new NodeInput() { Value = nodeOutput.Content.Value, }, rulesLog, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (targetNode is IActuatorNode actuatorNode)
|
||||
{
|
||||
var nodeOutput = await actuatorNode.ExecuteAsync(input, cancellationToken).ConfigureAwait(false);
|
||||
foreach (var link in targetNode.PortLinks.Where(a => ((a.Target.Model as PortModel)?.Parent) != targetNode))
|
||||
if (nodeOutput.IsSuccess)
|
||||
{
|
||||
await Analysis((link.Target.Model as PortModel)?.Parent, new NodeInput() { Value = nodeOutput.Value }, rulesLog, cancellationToken).ConfigureAwait(false);
|
||||
foreach (var link in targetNode.PortLinks.Where(a => ((a.Target.Model as PortModel)?.Parent) != targetNode))
|
||||
{
|
||||
await Analysis((link.Target.Model as PortModel)?.Parent, new NodeInput() { Value = nodeOutput.Content.Value }, rulesLog, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (targetNode is ITriggerNode triggerNode)
|
||||
@@ -200,11 +206,10 @@ internal sealed class RulesEngineHostedService : BackgroundService, IRulesEngine
|
||||
foreach (var rules in Rules.Where(a => a.Status))
|
||||
{
|
||||
var item = Init(rules);
|
||||
await Start(item.rulesLog, item.blazorDiagram, cancellationToken).ConfigureAwait(false);
|
||||
Start(item.rulesLog, item.blazorDiagram, cancellationToken);
|
||||
}
|
||||
dispatchService.Dispatch(null);
|
||||
|
||||
|
||||
_ = Task.Factory.StartNew(async (state) =>
|
||||
{
|
||||
if (state is not Dictionary<RulesLog, Diagram> diagrams)
|
||||
|
@@ -176,20 +176,20 @@ public class VariableRuntimeService : IVariableRuntimeService
|
||||
var datas = await GlobalData.VariableService.InsertTestDataAsync(testVariableCount, testDeviceCount, slaveUrl, businessEnable).ConfigureAwait(false);
|
||||
|
||||
{
|
||||
var newChannelRuntimes = (datas.Item1).Adapt<List<ChannelRuntime>>();
|
||||
var newChannelRuntimes = datas.Item1.Adapt<List<ChannelRuntime>>();
|
||||
|
||||
//批量修改之后,需要重新加载通道
|
||||
RuntimeServiceHelper.Init(newChannelRuntimes);
|
||||
|
||||
{
|
||||
|
||||
var newDeviceRuntimes = (datas.Item2).Adapt<List<DeviceRuntime>>();
|
||||
var newDeviceRuntimes = datas.Item2.Adapt<List<DeviceRuntime>>();
|
||||
|
||||
RuntimeServiceHelper.Init(newDeviceRuntimes);
|
||||
|
||||
}
|
||||
{
|
||||
var newVariableRuntimes = (datas.Item3).Adapt<List<VariableRuntime>>();
|
||||
var newVariableRuntimes = datas.Item3.Adapt<List<VariableRuntime>>();
|
||||
RuntimeServiceHelper.Init(newVariableRuntimes);
|
||||
|
||||
}
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
|
||||
<PackageReference Include="Rougamo.Fody" Version="5.0.0" />
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.8" />
|
||||
<PackageReference Include="TouchSocket.WebApi.Swagger" Version="3.1.8" />
|
||||
<PackageReference Include="Rougamo.Fody" Version="5.0.1" />
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.10" />
|
||||
<PackageReference Include="TouchSocket.WebApi.Swagger" Version="3.1.10" />
|
||||
<PackageReference Include="ThingsGateway.Authentication" Version="$(AuthenticationVersion)" />
|
||||
<!--<ProjectReference Include="..\..\PluginPro\ThingsGateway.Authentication\ThingsGateway.Authentication.csproj" />-->
|
||||
|
||||
|
@@ -20,4 +20,4 @@ global using ThingsGateway.Razor;
|
||||
|
||||
[assembly: SuppressMessage("Reliability", "CA2007", Justification = "<挂起>", Scope = "module")]
|
||||
|
||||
[assembly: BlazorSetParametersAsyncGenerator.GlobalGenerateSetParametersAsync(true)]
|
||||
[assembly: GlobalGenerateSetParametersAsync(true)]
|
@@ -1,4 +1,16 @@
|
||||
{
|
||||
"ThingsGateway.Management.Authentication": {
|
||||
"AuthName": "AuthName",
|
||||
"Authorized": "Authorized",
|
||||
"ExpireTime": "ExpireTime",
|
||||
"Password": "Password",
|
||||
"Register": "Register",
|
||||
"RegisterStatus": "RegisterStatus",
|
||||
"Unauthorized": "Unauthorized",
|
||||
"Unregister": "Unregister",
|
||||
"UUID": "UUID"
|
||||
},
|
||||
|
||||
"ThingsGateway.Gateway.Razor._Imports": {
|
||||
|
||||
"Actuator": "Actuator",
|
||||
|
@@ -1,4 +1,16 @@
|
||||
{
|
||||
"ThingsGateway.Management.Authentication": {
|
||||
"AuthName": "公司名称",
|
||||
"Authorized": "已授权",
|
||||
"ExpireTime": "过期时间",
|
||||
"Password": "注册码",
|
||||
"Register": "注册",
|
||||
"RegisterStatus": "注册状态",
|
||||
"Unauthorized": "未授权",
|
||||
"Unregister": "取消注册",
|
||||
"UUID": "唯一编码"
|
||||
},
|
||||
|
||||
"ThingsGateway.Gateway.Razor._Imports": {
|
||||
|
||||
"Actuator": "执行",
|
||||
|
@@ -28,225 +28,227 @@
|
||||
RenderFragment renderFragment =>
|
||||
@<Tab>
|
||||
|
||||
<TabItem Text=@GatewayLocalizer["VariableInformation"]>
|
||||
<TabItem Text=@GatewayLocalizer["VariableInformation"]>
|
||||
|
||||
<EditorForm class="p-2" AutoGenerateAllItem="false" RowType=RowType.Inline ItemsPerRow=2 LabelWidth=200 Model="Model">
|
||||
<EditorForm class="p-2" AutoGenerateAllItem="false" RowType=RowType.Inline ItemsPerRow=2 LabelWidth=200 Model="Model">
|
||||
|
||||
<FieldItems>
|
||||
<EditorItem TValue="string" TModel="Variable" @bind-Field="@context.Name">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<h6>@GatewayLocalizer["BasicInformation"]</h6>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<FieldItems>
|
||||
<EditorItem TValue="string" TModel="Variable" @bind-Field="@context.Name">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<h6>@GatewayLocalizer["BasicInformation"]</h6>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
|
||||
<EditorItem @bind-Field="@context.Name" Readonly=BatchEditEnable />
|
||||
<EditorItem @bind-Field="@context.Name" Readonly=BatchEditEnable />
|
||||
|
||||
<EditorItem @bind-Field="@context.Description" />
|
||||
<EditorItem @bind-Field="@context.CollectGroup" />
|
||||
<EditorItem @bind-Field="@context.BusinessGroup" />
|
||||
<EditorItem @bind-Field="@context.Description" />
|
||||
<EditorItem @bind-Field="@context.CollectGroup" />
|
||||
<EditorItem @bind-Field="@context.BusinessGroup" />
|
||||
<EditorItem @bind-Field="@context.BusinessGroupUpdateTrigger" />
|
||||
<EditorItem @bind-Field="@context.RpcWriteCheck" />
|
||||
|
||||
<EditorItem @bind-Field="@context.Unit" />
|
||||
<EditorItem @bind-Field="@context.ProtectType" />
|
||||
<EditorItem @bind-Field="@context.Enable" />
|
||||
<EditorItem @bind-Field="@context.RpcWriteEnable" />
|
||||
<EditorItem @bind-Field="@context.Unit" />
|
||||
<EditorItem @bind-Field="@context.ProtectType" />
|
||||
<EditorItem @bind-Field="@context.Enable" />
|
||||
<EditorItem @bind-Field="@context.RpcWriteEnable" />
|
||||
|
||||
<EditorItem @bind-Field="@context.InitValue">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12 col-md-6 ">
|
||||
<BootstrapInput @bind-Value="@value.InitValue" DisplayText="@(context.Description(a=>a.InitValue))" ShowLabel="true" Formatter=@(JsonFormatter) />
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem @bind-Field="@context.InitValue">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12 col-md-6 ">
|
||||
<BootstrapInput @bind-Value="@value.InitValue" DisplayText="@(context.Description(a => a.InitValue))" ShowLabel="true" Formatter=@(JsonFormatter) />
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
|
||||
<EditorItem @bind-Field="@context.SaveValue" />
|
||||
<EditorItem @bind-Field="@context.SaveValue" />
|
||||
|
||||
<EditorItem TValue="string" TModel="Variable" @bind-Field="@context.Name">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<h6>@GatewayLocalizer["Connection"]</h6>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem TValue="string" TModel="Variable" @bind-Field="@context.Name">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<h6>@GatewayLocalizer["Connection"]</h6>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
|
||||
<EditorItem @bind-Field="@context.DeviceId">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12 col-md-6 ">
|
||||
<BootstrapInputGroup>
|
||||
<Select IsVirtualize @bind-Value="@value.DeviceId" DefaultVirtualizeItemText=@(GlobalData.ReadOnlyIdDevices.TryGetValue(value.DeviceId,out var deviceRuntime)?deviceRuntime.Name:string.Empty) IsDisabled=BatchEditEnable Items="@CollectDeviceItems" OnSelectedItemChanged=OnDeviceChanged ShowSearch="true" ShowLabel="true" />
|
||||
<Button class="text-end" Icon="fa-solid fa-plus" OnClick="AddDevice" IsDisabled=BatchEditEnable></Button>
|
||||
</BootstrapInputGroup>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem @bind-Field="@context.DeviceId">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12 col-md-6 ">
|
||||
<BootstrapInputGroup>
|
||||
<Select IsVirtualize @bind-Value="@value.DeviceId" DefaultVirtualizeItemText=@(GlobalData.ReadOnlyIdDevices.TryGetValue(value.DeviceId, out var deviceRuntime) ? deviceRuntime.Name : string.Empty) IsDisabled=BatchEditEnable Items="@CollectDeviceItems" OnSelectedItemChanged=OnDeviceChanged ShowSearch="true" ShowLabel="true" />
|
||||
<Button class="text-end" Icon="fa-solid fa-plus" OnClick="AddDevice" IsDisabled=BatchEditEnable></Button>
|
||||
</BootstrapInputGroup>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
|
||||
<EditorItem @bind-Field="@context.DataType" />
|
||||
<EditorItem @bind-Field="@context.IntervalTime" />
|
||||
<EditorItem @bind-Field="@context.DataType" />
|
||||
<EditorItem @bind-Field="@context.IntervalTime" />
|
||||
|
||||
<EditorItem @bind-Field="@context.OtherMethod">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12 col-md-6">
|
||||
<Select IsVirtualize DefaultVirtualizeItemText=@(OtherMethods.TryGetValue(value.OtherMethod??string.Empty,out var desc)?desc:value.OtherMethod) @bind-Value="@value.OtherMethod" Items="@OtherMethodSelectedItems" ShowSearch="true" />
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem @bind-Field="@context.OtherMethod">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12 col-md-6">
|
||||
<Select IsVirtualize DefaultVirtualizeItemText=@(OtherMethods.TryGetValue(value.OtherMethod ?? string.Empty, out var desc) ? desc : value.OtherMethod) @bind-Value="@value.OtherMethod" Items="@OtherMethodSelectedItems" ShowSearch="true" />
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
|
||||
<EditorItem @bind-Field="@context.RegisterAddress">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<BootstrapInputGroup>
|
||||
@if(GlobalData.ReadOnlyIdDevices.TryGetValue(value.DeviceId,out var device)&&device.Driver is CollectBase collectBase)
|
||||
{
|
||||
<Textarea rows="1" title=@collectBase.GetAddressDescription() @bind-Value="value.RegisterAddress" ShowLabel="true"></Textarea>
|
||||
}
|
||||
else
|
||||
<EditorItem @bind-Field="@context.RegisterAddress">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<BootstrapInputGroup>
|
||||
@if(GlobalData.ReadOnlyIdDevices.TryGetValue(value.DeviceId,out var device)&&device.Driver is CollectBase collectBase)
|
||||
{
|
||||
<Textarea rows="1" title=@collectBase.GetAddressDescription() @bind-Value="value.RegisterAddress" ShowLabel="true"></Textarea>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Textarea rows="1" @bind-Value="value.RegisterAddress" ShowLabel="true"></Textarea>
|
||||
}
|
||||
<Button IsDisabled=@(AddressUIType==null) Icon="fa-solid fa-bars" OnClick="ShowAddressUI"></Button>
|
||||
</BootstrapInputGroup>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem @bind-Field="@context.ArrayLength" />
|
||||
<Button IsDisabled=@(AddressUIType == null) Icon="fa-solid fa-bars" OnClick="ShowAddressUI"></Button>
|
||||
</BootstrapInputGroup>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem @bind-Field="@context.ArrayLength" />
|
||||
|
||||
<EditorItem @bind-Field="@context.ReadExpressions" Rows="1" />
|
||||
<EditorItem @bind-Field="@context.WriteExpressions" Rows="1" />
|
||||
<EditorItem @bind-Field="@context.ReadExpressions" Rows="1" />
|
||||
<EditorItem @bind-Field="@context.WriteExpressions" Rows="1" />
|
||||
|
||||
|
||||
<EditorItem TValue="string" TModel="Variable" @bind-Field="@context.Description">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<h6>@GatewayLocalizer["Remark"]</h6>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem @bind-Field="@context.Remark1" />
|
||||
<EditorItem @bind-Field="@context.Remark2" />
|
||||
<EditorItem @bind-Field="@context.Remark3" />
|
||||
<EditorItem @bind-Field="@context.Remark4" />
|
||||
<EditorItem @bind-Field="@context.Remark5" />
|
||||
<EditorItem TValue="string" TModel="Variable" @bind-Field="@context.Description">
|
||||
<EditTemplate Context="value">
|
||||
<div class="col-12">
|
||||
<h6>@GatewayLocalizer["Remark"]</h6>
|
||||
</div>
|
||||
</EditTemplate>
|
||||
</EditorItem>
|
||||
<EditorItem @bind-Field="@context.Remark1" />
|
||||
<EditorItem @bind-Field="@context.Remark2" />
|
||||
<EditorItem @bind-Field="@context.Remark3" />
|
||||
<EditorItem @bind-Field="@context.Remark4" />
|
||||
<EditorItem @bind-Field="@context.Remark5" />
|
||||
|
||||
</FieldItems>
|
||||
</FieldItems>
|
||||
|
||||
</EditorForm>
|
||||
</TabItem>
|
||||
</EditorForm>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Text=@GatewayLocalizer["AlarmInformation"]>
|
||||
<EditorForm class="p-2" AutoGenerateAllItem="false" RowType=RowType.Inline ItemsPerRow=2 LabelWidth=250 Model="Model">
|
||||
<FieldItems>
|
||||
<TabItem Text=@GatewayLocalizer["AlarmInformation"]>
|
||||
<EditorForm class="p-2" AutoGenerateAllItem="false" RowType=RowType.Inline ItemsPerRow=2 LabelWidth=250 Model="Model">
|
||||
<FieldItems>
|
||||
|
||||
<EditorItem @bind-Field="@context.BoolCloseAlarmText" />
|
||||
<EditorItem @bind-Field="@context.BoolCloseRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.BoolCloseAlarmEnable" Rows="1" />
|
||||
<EditorItem @bind-Field="@context.BoolOpenAlarmText" />
|
||||
<EditorItem @bind-Field="@context.BoolOpenRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.BoolOpenAlarmEnable" Rows="1" />
|
||||
<EditorItem @bind-Field="@context.HHAlarmText" />
|
||||
<EditorItem @bind-Field="@context.HHAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.HHRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.HHAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.HAlarmText" />
|
||||
<EditorItem @bind-Field="@context.HAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.HRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.HAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.LAlarmText" />
|
||||
<EditorItem @bind-Field="@context.LAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.LRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.LAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.LLAlarmText" />
|
||||
<EditorItem @bind-Field="@context.LLAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.LLRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.LLAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.CustomAlarmText" />
|
||||
<EditorItem @bind-Field="@context.CustomAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.CustomRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.CustomAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.AlarmDelay" />
|
||||
</FieldItems>
|
||||
</EditorForm>
|
||||
</TabItem>
|
||||
@if(!BatchEditEnable)
|
||||
{
|
||||
<EditorItem @bind-Field="@context.BoolCloseAlarmText" />
|
||||
<EditorItem @bind-Field="@context.BoolCloseRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.BoolCloseAlarmEnable" Rows="1" />
|
||||
<EditorItem @bind-Field="@context.BoolOpenAlarmText" />
|
||||
<EditorItem @bind-Field="@context.BoolOpenRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.BoolOpenAlarmEnable" Rows="1" />
|
||||
<EditorItem @bind-Field="@context.HHAlarmText" />
|
||||
<EditorItem @bind-Field="@context.HHAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.HHRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.HHAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.HAlarmText" />
|
||||
<EditorItem @bind-Field="@context.HAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.HRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.HAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.LAlarmText" />
|
||||
<EditorItem @bind-Field="@context.LAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.LRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.LAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.LLAlarmText" />
|
||||
<EditorItem @bind-Field="@context.LLAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.LLRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.LLAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.CustomAlarmText" />
|
||||
<EditorItem @bind-Field="@context.CustomAlarmCode" />
|
||||
<EditorItem @bind-Field="@context.CustomRestrainExpressions" />
|
||||
<EditorItem @bind-Field="@context.CustomAlarmEnable" />
|
||||
<EditorItem @bind-Field="@context.AlarmDelay" />
|
||||
</FieldItems>
|
||||
</EditorForm>
|
||||
</TabItem>
|
||||
@if (!BatchEditEnable)
|
||||
{
|
||||
<TabItem Text=@GatewayLocalizer["PluginInformation"]>
|
||||
<div class="min-height-500 px-4">
|
||||
<div class="row g-2 mx-1 form-inline">
|
||||
|
||||
<div class="col-12 col-md-8">
|
||||
<Select SkipValidate IsVirtualize DefaultVirtualizeItemText=@(GlobalData.ReadOnlyIdDevices.TryGetValue(ChoiceBusinessDeviceId,out var deviceRuntime)?deviceRuntime.Name:string.Empty) @bind-Value="@ChoiceBusinessDeviceId" Items="@BusinessDeviceItems" ShowSearch="true" ShowLabel="true" />
|
||||
<Select SkipValidate IsVirtualize DefaultVirtualizeItemText=@(GlobalData.ReadOnlyIdDevices.TryGetValue(ChoiceBusinessDeviceId, out var deviceRuntime) ? deviceRuntime.Name : string.Empty) @bind-Value="@ChoiceBusinessDeviceId" Items="@BusinessDeviceItems" ShowSearch="true" ShowLabel="true" />
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
<Button OnClick="async() =>{
|
||||
|
||||
await RefreshBusinessPropertyClickAsync(ChoiceBusinessDeviceId);
|
||||
foreach (var item in Model.VariablePropertyModels)
|
||||
{
|
||||
if(item.Value!=null)
|
||||
{
|
||||
item.Value.ValidateForm=null;
|
||||
}
|
||||
}
|
||||
}">
|
||||
@GatewayLocalizer["RefreshBusinessProperty"]
|
||||
</Button>
|
||||
</div>
|
||||
await RefreshBusinessPropertyClickAsync(ChoiceBusinessDeviceId);
|
||||
foreach (var item in Model.VariablePropertyModels)
|
||||
{
|
||||
if (item.Value != null)
|
||||
{
|
||||
item.Value.ValidateForm = null;
|
||||
}
|
||||
}
|
||||
}">
|
||||
@GatewayLocalizer["RefreshBusinessProperty"]
|
||||
</Button>
|
||||
</div>
|
||||
@if (Model.VariablePropertyModels != null)
|
||||
</div>
|
||||
@if (Model.VariablePropertyModels != null)
|
||||
{
|
||||
@foreach (var a in Model.VariablePropertyModels)
|
||||
{
|
||||
{
|
||||
|
||||
var item = a;
|
||||
var item = a;
|
||||
|
||||
var custom = VariablePropertyRenderFragments.TryGetValue(item.Key, out var renderFragment);
|
||||
var custom = VariablePropertyRenderFragments.TryGetValue(item.Key, out var renderFragment);
|
||||
|
||||
if (!custom)
|
||||
{
|
||||
var has = VariablePropertyEditors.TryGetValue(item.Key, out var items);
|
||||
if (has)
|
||||
{
|
||||
if (!custom)
|
||||
{
|
||||
var has = VariablePropertyEditors.TryGetValue(item.Key, out var items);
|
||||
if (has)
|
||||
{
|
||||
|
||||
|
||||
<Card IsShadow=true class="m-2 flex-fill" Color="Color.Primary">
|
||||
<HeaderTemplate>
|
||||
@{
|
||||
GlobalData.ReadOnlyIdDevices.TryGetValue(item.Key, out var items);
|
||||
<Card IsShadow=true class="m-2 flex-fill" Color="Color.Primary">
|
||||
<HeaderTemplate>
|
||||
@{
|
||||
GlobalData.ReadOnlyIdDevices.TryGetValue(item.Key, out var items);
|
||||
}
|
||||
<div class="flex-fill">
|
||||
@($"{items.Name} - {PluginServiceUtil.GetFileNameAndTypeName(items?.PluginName).TypeName}")
|
||||
</div>
|
||||
|
||||
<Button OnClick=@((a)=>
|
||||
{
|
||||
Model.VariablePropertyModels.TryRemove(item.Key, out _);
|
||||
}) class="mx-2" Color="Color.None" style="color: var(--bs-card-titlecolor);" Icon=@("fas fa-delete-left") />
|
||||
|
||||
</HeaderTemplate>
|
||||
|
||||
<BodyTemplate>
|
||||
|
||||
<ValidateForm Model="item.Value.Value" @ref=item.Value.ValidateForm
|
||||
@key=@($"VariableEditValidateForm{item.Key}{Model.Id}{item.Value.Value.GetType().TypeHandle.Value}")
|
||||
Id=@($"VariableEditValidateForm{item.Key}{Model.Id}{item.Value.Value.GetType().TypeHandle.Value}")>
|
||||
|
||||
<EditorFormObject class="p-2" Items=items AutoGenerateAllItem="false" RowType=RowType.Inline ItemsPerRow=2 ShowLabelTooltip=true LabelWidth=150 Model="item.Value.Value" @key=@($"VariableEditEditorFormObject{item.Key}{Model.Id}{item.Value.Value.GetType().TypeHandle.Value}")>
|
||||
|
||||
</EditorFormObject>
|
||||
</ValidateForm>
|
||||
</BodyTemplate>
|
||||
</Card>
|
||||
}
|
||||
<div class="flex-fill">
|
||||
@($"{items.Name} - {PluginServiceUtil.GetFileNameAndTypeName(items?.PluginName).TypeName}")
|
||||
</div>
|
||||
|
||||
<Button OnClick=@((a)=>
|
||||
{
|
||||
Model.VariablePropertyModels.TryRemove(item.Key,out _);
|
||||
}) class="mx-2" Color="Color.None" style="color: var(--bs-card-titlecolor);" Icon=@("fas fa-delete-left") />
|
||||
|
||||
</HeaderTemplate>
|
||||
|
||||
<BodyTemplate>
|
||||
|
||||
<ValidateForm Model="item.Value.Value" @ref=item.Value.ValidateForm
|
||||
@key=@($"VariableEditValidateForm{item.Key}{Model.Id}{item.Value.Value.GetType().TypeHandle.Value}")
|
||||
Id=@($"VariableEditValidateForm{item.Key}{Model.Id}{item.Value.Value.GetType().TypeHandle.Value}")>
|
||||
|
||||
<EditorFormObject class="p-2" Items=items AutoGenerateAllItem="false" RowType=RowType.Inline ItemsPerRow=2 ShowLabelTooltip=true LabelWidth=150 Model="item.Value.Value" @key=@($"VariableEditEditorFormObject{item.Key}{Model.Id}{item.Value.Value.GetType().TypeHandle.Value}")>
|
||||
|
||||
</EditorFormObject>
|
||||
</ValidateForm>
|
||||
</BodyTemplate>
|
||||
</Card>
|
||||
}
|
||||
else
|
||||
{
|
||||
@renderFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@renderFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</TabItem>
|
||||
</TabItem>
|
||||
}
|
||||
</Tab>;
|
||||
</Tab>;
|
||||
}
|
@@ -35,6 +35,8 @@
|
||||
<TableColumn @bind-Field="@context.Name" ShowTips=true Filterable=true Sortable=true Visible=true />
|
||||
<TableColumn @bind-Field="@context.Description" ShowTips=true Filterable=true Sortable=true Visible=true />
|
||||
<TableColumn @bind-Field="@context.BusinessGroup" ShowTips=true Filterable=true Sortable=true Visible=true />
|
||||
<TableColumn @bind-Field="@context.BusinessGroupUpdateTrigger" ShowTips=true Filterable=true Sortable=true Visible=false />
|
||||
<TableColumn @bind-Field="@context.RpcWriteCheck" ShowTips=true Filterable=true Sortable=true Visible=false />
|
||||
|
||||
<TableColumn @bind-Field="@context.Enable" Filterable=true Sortable=true Visible="false" />
|
||||
<TableColumn Field="@context.ChangeTime" ShowTips=true FieldExpression=@(()=>context.ChangeTime) Filterable=true Sortable=true Visible=false />
|
||||
|
@@ -44,9 +44,17 @@ namespace ThingsGateway.Gateway.Razor
|
||||
if(Node is IConditionNode conditionNode)
|
||||
return (await conditionNode.ExecuteAsync(new NodeInput(){Value=a==null?a:JToken.Parse(a??string.Empty) },default).ConfigureAwait(false)).ToString();
|
||||
if(Node is IExpressionNode expressionNode)
|
||||
return (await expressionNode.ExecuteAsync(new NodeInput(){Value=a==null?a:JToken.Parse(a??string.Empty) },default).ConfigureAwait(false)).JToken?.ToString();
|
||||
{
|
||||
var data=await expressionNode.ExecuteAsync(new NodeInput(){Value=a==null?a:JToken.Parse(a??string.Empty) },default).ConfigureAwait(false);
|
||||
|
||||
return data.IsSuccess? data.Content.JToken?.ToString()??string.Empty: data.ToString();
|
||||
}
|
||||
if(Node is IActuatorNode actuatorNode)
|
||||
return (await actuatorNode.ExecuteAsync(new NodeInput(){Value=a==null?a:JToken.Parse(a??string.Empty) },default).ConfigureAwait(false)).JToken?.ToString();
|
||||
{
|
||||
var data=await actuatorNode.ExecuteAsync(new NodeInput(){Value=a==null?a:JToken.Parse(a??string.Empty) },default).ConfigureAwait(false);
|
||||
|
||||
return data.IsSuccess? data.Content.JToken?.ToString()??string.Empty: data.ToString();
|
||||
}
|
||||
return string.Empty;
|
||||
}) },
|
||||
{nameof(ScriptEdit.Script),Node.Text },
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<PackageOutputPath>$(SolutionDir)..\..\nupkgs</PackageOutputPath>
|
||||
<PackageOutputPath>$(MSBuildThisFileDirectory)..\..\nupkgs</PackageOutputPath>
|
||||
<PackageVersion>$(Version)</PackageVersion>
|
||||
<PackageTags>ThingsGateway;Diego;Blazor;IOT;设备采集;边缘网关;物联网</PackageTags>
|
||||
<PackageProjectUrl>https://gitee.com/diego2098/ThingsGateway</PackageProjectUrl>
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(SolutionDir)PackNuget.props" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)PackNuget.props" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(SolutionDir)..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="$(SolutionDir)..\README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Include="$(SolutionDir)..\LICENSE" Pack="true" PackagePath="\" />
|
||||
<None Include="$(SolutionDir)..\icon.png" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\README.md" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\README.zh-CN.md" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\icon.png" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
|
@@ -12,4 +12,4 @@ global using Microsoft.AspNetCore.Components;
|
||||
|
||||
global using ThingsGateway.Razor;
|
||||
|
||||
[assembly: BlazorSetParametersAsyncGenerator.GlobalGenerateSetParametersAsync(true)]
|
||||
[assembly: GlobalGenerateSetParametersAsync(true)]
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
<!--<UseRazorSourceGenerator>false</UseRazorSourceGenerator>-->
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Foundation.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\Foundation.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<Description>工业设备通讯协议-Dlt645协议</Description>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Foundation.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\Foundation.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<Description>工业设备通讯协议-Modbus协议</Description>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net462;netstandard2.0;net6.0;</TargetFrameworks>
|
||||
<Description>工业设备通讯协议-OpcDa协议</Description>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;netstandard2.1;net6.0;</TargetFrameworks>
|
||||
<Description>工业设备通讯协议-OpcUa协议</Description>
|
||||
|
@@ -139,27 +139,36 @@ public partial class SiemensS7Master : DeviceBase
|
||||
{
|
||||
int num = 0;
|
||||
var addressLen = sAddress.Length == 0 ? 1 : sAddress.Length;
|
||||
while (num < addressLen)
|
||||
var start = sAddress.AddressStart;
|
||||
try
|
||||
{
|
||||
//pdu长度,重复生成报文,直至全部生成
|
||||
int len = Math.Min(addressLen - num, PduLength);
|
||||
sAddress.Length = len;
|
||||
|
||||
var result = await SendThenReturnAsync(new S7Send([sAddress], true), cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
if (!result.IsSuccess) return result;
|
||||
|
||||
byteBlock.Write(result.Content);
|
||||
num += len;
|
||||
|
||||
if (sAddress.DataCode == S7Area.TM || sAddress.DataCode == S7Area.CT)
|
||||
while (num < addressLen)
|
||||
{
|
||||
sAddress.AddressStart += len / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sAddress.AddressStart += len * 8;
|
||||
//pdu长度,重复生成报文,直至全部生成
|
||||
int len = Math.Min(addressLen - num, PduLength);
|
||||
sAddress.Length = len;
|
||||
var result = await SendThenReturnAsync(new S7Send([sAddress], true), cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
if (!result.IsSuccess) return result;
|
||||
|
||||
byteBlock.Write(result.Content);
|
||||
num += len;
|
||||
|
||||
if (sAddress.DataCode == S7Area.TM || sAddress.DataCode == S7Area.CT)
|
||||
{
|
||||
sAddress.AddressStart += len / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
sAddress.AddressStart += len * 8;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
sAddress.AddressStart = start;
|
||||
}
|
||||
}
|
||||
|
||||
return new OperResult<byte[]>() { Content = byteBlock.ToArray() };
|
||||
@@ -361,6 +370,7 @@ public partial class SiemensS7Master : DeviceBase
|
||||
{
|
||||
try
|
||||
{
|
||||
SetDataAdapter(channel);
|
||||
AutoConnect = false;
|
||||
var ISO_CR = SiemensHelper.ISO_CR;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="$(SolutionDir)Foundation.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\Foundation.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<Description>工业设备通讯协议-SiemensS7协议</Description>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
|
@@ -75,7 +75,7 @@ public partial class QuestDBProducer : BusinessBaseWithCacheIntervalVariableMode
|
||||
|
||||
private void UpdateVariable(VariableRuntime variableRuntime, VariableBasicData variable)
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
{
|
||||
|
||||
AddQueueVarModel(new CacheDBItem<List<VariableBasicData>>(variableRuntimeGroup.Adapt<List<VariableBasicData>>(_config)));
|
||||
|
@@ -82,7 +82,7 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariableModel<
|
||||
{
|
||||
if (_driverPropertys.IsHistoryDB)
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
{
|
||||
|
||||
AddQueueVarModel(new CacheDBItem<List<VariableBasicData>>(variableRuntimeGroup.Adapt<List<VariableBasicData>>(_config)));
|
||||
|
@@ -77,7 +77,7 @@ public partial class TDengineDBProducer : BusinessBaseWithCacheIntervalVariableM
|
||||
|
||||
private void UpdateVariable(VariableRuntime variableRuntime, VariableBasicData variable)
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
{
|
||||
|
||||
AddQueueVarModel(new CacheDBItem<List<VariableBasicData>>(variableRuntimeGroup.Adapt<List<VariableBasicData>>(_config)));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -1,13 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Foundation\ThingsGateway.Foundation.Razor\ThingsGateway.Foundation.Razor.csproj">
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Razor\ThingsGateway.Gateway.Razor.csproj">
|
||||
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj">
|
||||
</ProjectReference>
|
||||
|
||||
|
||||
|
@@ -118,7 +118,7 @@ public partial class Webhook : BusinessBaseWithCacheIntervalScript<VariableBasic
|
||||
{
|
||||
if (!_businessPropertyWithCacheIntervalScript.VariableTopic.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
{
|
||||
|
||||
AddQueueVarModel(new CacheDBItem<List<VariableBasicData>>(variableRuntimeGroup.Adapt<List<VariableBasicData>>()));
|
||||
|
@@ -112,7 +112,7 @@ public partial class KafkaProducer : BusinessBaseWithCacheIntervalScript<Variabl
|
||||
{
|
||||
if (!_businessPropertyWithCacheIntervalScript.VariableTopic.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
{
|
||||
|
||||
AddQueueVarModel(new CacheDBItem<List<VariableBasicData>>(variableRuntimeGroup.Adapt<List<VariableBasicData>>()));
|
||||
|
@@ -1,13 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Foundation\ThingsGateway.Foundation.Razor\ThingsGateway.Foundation.Razor.csproj">
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Razor\ThingsGateway.Gateway.Razor.csproj">
|
||||
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj">
|
||||
</ProjectReference>
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.10.1" GeneratePathProperty="true">
|
||||
<PrivateAssets>contentFiles;compile;build;buildMultitargeting;buildTransitive;analyzers;</PrivateAssets>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -170,7 +170,7 @@ public partial class MqttClient : BusinessBaseWithCacheIntervalScript<VariableBa
|
||||
{
|
||||
if (!_businessPropertyWithCacheIntervalScript.VariableTopic.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
{
|
||||
//获取组内全部变量
|
||||
AddQueueVarModel(new CacheDBItem<List<VariableBasicData>>(variableRuntimeGroup.Adapt<List<VariableBasicData>>()));
|
||||
|
@@ -126,7 +126,7 @@ public partial class MqttServer : BusinessBaseWithCacheIntervalScript<VariableBa
|
||||
{
|
||||
if (!_businessPropertyWithCacheIntervalScript.VariableTopic.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
{
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -10,6 +10,8 @@
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
using ThingsGateway.Foundation.OpcDa;
|
||||
using ThingsGateway.Foundation.OpcDa.Da;
|
||||
using ThingsGateway.Gateway.Application;
|
||||
@@ -159,7 +161,7 @@ public class OpcDaMaster : CollectBase
|
||||
try
|
||||
{
|
||||
var result = _plc.WriteItem(writeInfoLists.ToDictionary(a => a.Key.RegisterAddress!, a => a.Value.GetObjectFromJToken()!));
|
||||
return result.ToDictionary<KeyValuePair<string, Tuple<bool, string>>, string, OperResult>(a =>
|
||||
var results = new ConcurrentDictionary<string, OperResult>(result.ToDictionary<KeyValuePair<string, Tuple<bool, string>>, string, OperResult>(a =>
|
||||
{
|
||||
return writeInfoLists.Keys.FirstOrDefault(b => b.RegisterAddress == a.Key).Name;
|
||||
}, a =>
|
||||
@@ -169,7 +171,11 @@ public class OpcDaMaster : CollectBase
|
||||
else
|
||||
return OperResult.Success;
|
||||
}
|
||||
);
|
||||
));
|
||||
|
||||
await Check(writeInfoLists, results, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return new(results);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -13,6 +13,8 @@ using Newtonsoft.Json.Linq;
|
||||
using Opc.Ua;
|
||||
using Opc.Ua.Client;
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
using ThingsGateway.Foundation.Extension.Generic;
|
||||
using ThingsGateway.Foundation.OpcUa;
|
||||
using ThingsGateway.Gateway.Application;
|
||||
@@ -281,7 +283,7 @@ public class OpcUaMaster : CollectBase
|
||||
try
|
||||
{
|
||||
var result = await _plc.WriteNodeAsync(writeInfoLists.ToDictionary(a => a.Key.RegisterAddress!, a => a.Value), cancellationToken).ConfigureAwait(false);
|
||||
return result.ToDictionary<KeyValuePair<string, Tuple<bool, string>>, string, OperResult>(a =>
|
||||
var results = new ConcurrentDictionary<string, OperResult>(result.ToDictionary<KeyValuePair<string, Tuple<bool, string>>, string, OperResult>(a =>
|
||||
{
|
||||
return writeInfoLists.Keys.FirstOrDefault(b => b.RegisterAddress == a.Key)?.Name!;
|
||||
}
|
||||
@@ -291,7 +293,12 @@ public class OpcUaMaster : CollectBase
|
||||
return new OperResult(a.Value.Item2);
|
||||
else
|
||||
return OperResult.Success;
|
||||
})!;
|
||||
}));
|
||||
|
||||
await Check(writeInfoLists, results, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return new(results);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -113,7 +113,7 @@ public partial class RabbitMQProducer : BusinessBaseWithCacheIntervalScript<Vari
|
||||
{
|
||||
if (!_businessPropertyWithCacheIntervalScript.VariableTopic.IsNullOrWhiteSpace())
|
||||
{
|
||||
if (_driverPropertys.GroupUpdate && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
if (_driverPropertys.GroupUpdate && variable.BusinessGroupUpdateTrigger && !variable.BusinessGroup.IsNullOrEmpty() && VariableRuntimeGroups.TryGetValue(variable.BusinessGroup, out var variableRuntimeGroup))
|
||||
|
||||
{
|
||||
//获取组内全部变量
|
||||
|
@@ -1,13 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Foundation\ThingsGateway.Foundation.Razor\ThingsGateway.Foundation.Razor.csproj">
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Razor\ThingsGateway.Gateway.Razor.csproj">
|
||||
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj">
|
||||
</ProjectReference>
|
||||
|
||||
</ItemGroup>
|
||||
|
@@ -179,6 +179,7 @@ public class SiemensS7Master : CollectFoundationBase
|
||||
}
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
await Check(writeInfoLists, operResults, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// 返回包含操作结果的字典
|
||||
return new Dictionary<string, OperResult>(operResults);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0;</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
@@ -92,7 +92,7 @@ public class Program
|
||||
|
||||
|
||||
})
|
||||
.Configure(app=>
|
||||
.Configure(app =>
|
||||
{
|
||||
ReflectionInoHelper.RemoveAllCache();
|
||||
InstanceFactory.RemoveCache();
|
||||
|
@@ -4,7 +4,7 @@
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Production"
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://*:5000"
|
||||
|
@@ -15,7 +15,6 @@ using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption;
|
||||
using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\Version.props" />
|
||||
|
||||
|
||||
<ItemGroup Condition=" '$(SolutionName)' != 'ThingsGatewayRelease' ">
|
||||
@@ -55,6 +55,7 @@
|
||||
<!--动态适用GC-->
|
||||
<GarbageCollectionAdaptationMode>1</GarbageCollectionAdaptationMode>
|
||||
|
||||
<CETCompat>false</CETCompat>
|
||||
<!--<TieredCompilation>false</TieredCompilation>-->
|
||||
|
||||
<!--使用自托管线程池-->
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\Version.props" />
|
||||
|
||||
|
||||
<ItemGroup Condition=" '$(SolutionName)' != 'ThingsGatewayRelease' ">
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\Version.props" />
|
||||
|
||||
|
||||
<ItemGroup Condition=" '$(SolutionName)' != 'ThingsGatewayRelease'">
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="$(SolutionDir)PackNuget.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
<Import Project="..\..\PackNuget.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net8.0</TargetFrameworks>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.8" />
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.10" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<Import Project="$(SolutionDir)Version.props" />
|
||||
<Import Project="..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net9.0;</TargetFrameworks>
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>10.8.14</Version>
|
||||
<Version>10.8.21</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(SolutionDir)Version.props" Pack="true" PackagePath="\" />
|
||||
<None Include="$(MSBuildThisFileDirectory)Version.props" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Reference in New Issue
Block a user