Compare commits

...

5 Commits

Author SHA1 Message Date
Diego
f73245e650 build: 10.5.10 2025-04-30 15:31:39 +08:00
2248356998 qq.com
484461fa05 更新依赖 2025-04-30 15:29:19 +08:00
Diego
7e0b7aff2a feat: sqldb支持数组 2025-04-28 15:52:32 +08:00
Diego
6c450dcb09 feat: sqldb支持数组类型 2025-04-28 15:52:11 +08:00
Diego
227f44283f build: 10.5.8 2025-04-28 15:30:10 +08:00
16 changed files with 64 additions and 49 deletions

View File

@@ -22,12 +22,34 @@ public static class JSRuntimeExtensions
/// 获取文化信息 /// 获取文化信息
/// </summary> /// </summary>
/// <param name="jsRuntime"></param> /// <param name="jsRuntime"></param>
public static ValueTask<string> GetCulture(this IJSRuntime jsRuntime) => jsRuntime.InvokeAsync<string>("getCultureLocalStorage"); public static async ValueTask<string> GetCulture(this IJSRuntime jsRuntime)
{
try
{
return await jsRuntime.InvokeAsync<string>("getCultureLocalStorage");
}
catch
{
return null;
}
}
/// <summary> /// <summary>
/// 设置文化信息 /// 设置文化信息
/// </summary> /// </summary>
/// <param name="jsRuntime"></param> /// <param name="jsRuntime"></param>
/// <param name="cultureName"></param> /// <param name="cultureName"></param>
public static ValueTask SetCulture(this IJSRuntime jsRuntime, string cultureName) => jsRuntime.InvokeVoidAsync("setCultureLocalStorage", cultureName); public static async ValueTask SetCulture(this IJSRuntime jsRuntime, string cultureName)
{
try
{
await jsRuntime.InvokeVoidAsync("setCultureLocalStorage", cultureName);
}
catch
{
}
}
} }

View File

@@ -1,8 +1,8 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<PluginVersion>10.5.7</PluginVersion> <PluginVersion>10.5.10</PluginVersion>
<ProPluginVersion>10.5.7</ProPluginVersion> <ProPluginVersion>10.5.10</ProPluginVersion>
<AuthenticationVersion>2.1.7</AuthenticationVersion> <AuthenticationVersion>2.1.7</AuthenticationVersion>
</PropertyGroup> </PropertyGroup>

View File

@@ -10,8 +10,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="9.0.4" /> <PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="9.0.4" />
<PackageReference Include="TouchSocket" Version="3.1.0" /> <PackageReference Include="TouchSocket" Version="3.1.1" />
<PackageReference Include="TouchSocket.SerialPorts" Version="3.1.0" /> <PackageReference Include="TouchSocket.SerialPorts" Version="3.1.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -26,7 +26,7 @@ namespace ThingsGateway.Gateway.Application;
public class DeviceRuntime : Device, IDisposable public class DeviceRuntime : Device, IDisposable
{ {
protected volatile DeviceStatusEnum _deviceStatus = DeviceStatusEnum.Default; protected volatile DeviceStatusEnum _deviceStatus = DeviceStatusEnum.Default;
private string? _lastErrorMessage; private string? _lastErrorMessage;
/// <summary> /// <summary>

View File

@@ -19,5 +19,8 @@ public class VariableMapper : IRegister
{ {
config.ForType<Variable, VariableRuntime>() config.ForType<Variable, VariableRuntime>()
.Map(dest => dest.Value, src => src.InitValue); .Map(dest => dest.Value, src => src.InitValue);
config.ForType<VariableRuntime, VariableRuntime>()
.Ignore(dest => dest.DeviceRuntime);
} }
} }

View File

@@ -8,8 +8,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" /> <PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="Rougamo.Fody" Version="5.0.0" /> <PackageReference Include="Rougamo.Fody" Version="5.0.0" />
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.0" /> <PackageReference Include="TouchSocket.Dmtp" Version="3.1.1" />
<PackageReference Include="TouchSocket.WebApi.Swagger" Version="3.1.0" /> <PackageReference Include="TouchSocket.WebApi.Swagger" Version="3.1.1" />
<PackageReference Include="ThingsGateway.Authentication" Version="$(AuthenticationVersion)" /> <PackageReference Include="ThingsGateway.Authentication" Version="$(AuthenticationVersion)" />
</ItemGroup> </ItemGroup>

View File

@@ -212,8 +212,8 @@ public partial class VariableEditComponent
{ {
var component = new BootstrapDynamicComponent(data.VariablePropertyUIType, new Dictionary<string, object?> var component = new BootstrapDynamicComponent(data.VariablePropertyUIType, new Dictionary<string, object?>
{ {
[nameof(VariableEditComponent.Model)] = Model, [nameof(IPropertyUIBase.Model)] = Model,
[nameof(DeviceEditComponent.PluginPropertyEditorItems)] = data.EditorItems, [nameof(IPropertyUIBase.PluginPropertyEditorItems)] = data.EditorItems,
}); });
VariablePropertyRenderFragments.AddOrUpdate(id, component.Render()); VariablePropertyRenderFragments.AddOrUpdate(id, component.Render());
} }

View File

@@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj" /> <ProjectReference Include="..\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj" />
<PackageReference Include="BootstrapBlazor.UniverSheet" Version="9.0.3" /> <PackageReference Include="BootstrapBlazor.UniverSheet" Version="9.0.4" />
<PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.7" /> <PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.7" />
<PackageReference Include="BootstrapBlazor.CodeEditor" Version="9.0.1" /> <PackageReference Include="BootstrapBlazor.CodeEditor" Version="9.0.1" />
<ProjectReference Include="..\..\Admin\ThingsGateway.Admin.Razor\ThingsGateway.Admin.Razor.csproj" /> <ProjectReference Include="..\..\Admin\ThingsGateway.Admin.Razor\ThingsGateway.Admin.Razor.csproj" />

View File

@@ -19,7 +19,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
{ {
Func = func; Func = func;
FuncDict.Add(this, func); FuncDict.Add(this, func);
if (!DeviceChangedTriggerNodeDict.TryGetValue(Text, out var list)) if (!DeviceChangedTriggerNodeDict.TryGetValue(Text ?? string.Empty, out var list))
{ {
var deviceChangedTriggerNodes = new ConcurrentList<DeviceChangedTriggerNode>(); var deviceChangedTriggerNodes = new ConcurrentList<DeviceChangedTriggerNode>();
deviceChangedTriggerNodes.Add(this); deviceChangedTriggerNodes.Add(this);
@@ -44,7 +44,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
private static void GlobalData_DeviceStatusChangeEvent(DeviceRuntime deviceRunTime, DeviceBasicData deviceData) private static void GlobalData_DeviceStatusChangeEvent(DeviceRuntime deviceRunTime, DeviceBasicData deviceData)
{ {
if (DeviceChangedTriggerNodeDict.TryGetValue(deviceData.Name, out var deviceChangedTriggerNodes) && deviceChangedTriggerNodes?.Count > 0) if (DeviceChangedTriggerNodeDict.TryGetValue(deviceData.Name ?? string.Empty, out var deviceChangedTriggerNodes) && deviceChangedTriggerNodes?.Count > 0)
{ {
if (!DeviceDatas.IsAddingCompleted) if (!DeviceDatas.IsAddingCompleted)
{ {
@@ -63,7 +63,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
return DeviceDatas.GetConsumingEnumerable().ParallelForEachAsync((async (deviceDatas, token) => return DeviceDatas.GetConsumingEnumerable().ParallelForEachAsync((async (deviceDatas, token) =>
{ {
if (DeviceChangedTriggerNodeDict.TryGetValue(deviceDatas.Name, out var valueChangedTriggerNodes)) if (DeviceChangedTriggerNodeDict.TryGetValue(deviceDatas.Name ?? string.Empty, out var valueChangedTriggerNodes))
{ {
await valueChangedTriggerNodes.ParallelForEachAsync(async (item, token) => await valueChangedTriggerNodes.ParallelForEachAsync(async (item, token) =>
{ {
@@ -89,7 +89,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
public void Dispose() public void Dispose()
{ {
FuncDict.Remove(this); FuncDict.Remove(this);
if (DeviceChangedTriggerNodeDict.TryGetValue(Text, out var list)) if (DeviceChangedTriggerNodeDict.TryGetValue(Text ?? string.Empty, out var list))
{ {
list.Remove(this); list.Remove(this);
} }

View File

@@ -12,6 +12,8 @@ using BootstrapBlazor.Components;
using Mapster; using Mapster;
using Newtonsoft.Json.Linq;
using SqlSugar; using SqlSugar;
using ThingsGateway.Admin.Application; using ThingsGateway.Admin.Application;
@@ -66,7 +68,7 @@ public partial class QuestDBProducer : BusinessBaseWithCacheIntervalVariableMode
_config.ForType<VariableRuntime, QuestDBHistoryValue>() _config.ForType<VariableRuntime, QuestDBHistoryValue>()
//.Map(dest => dest.Id, src => CommonUtils.GetSingleId()) //.Map(dest => dest.Id, src => CommonUtils.GetSingleId())
.Map(dest => dest.Id, src => src.Id)//Id更改为变量Id .Map(dest => dest.Id, src => src.Id)//Id更改为变量Id
.Map(dest => dest.Value, src => src.Value == null ? string.Empty : src.Value.ToString() ?? string.Empty) .Map(dest => dest.Value, src => src.Value != null ? src.Value.GetType() == typeof(string) ? src.Value.ToString() : JToken.FromObject(src.Value).ToString() : string.Empty)
.Map(dest => dest.CollectTime, (src) => src.CollectTime < DateTime.MinValue ? utcTime : src.CollectTime!.Value.ToUniversalTime())//注意sqlsugar插入时无时区直接utc时间 .Map(dest => dest.CollectTime, (src) => src.CollectTime < DateTime.MinValue ? utcTime : src.CollectTime!.Value.ToUniversalTime())//注意sqlsugar插入时无时区直接utc时间
.Map(dest => dest.CreateTime, (src) => DateTime.UtcNow) .Map(dest => dest.CreateTime, (src) => DateTime.UtcNow)
;//注意sqlsugar插入时无时区直接utc时间 ;//注意sqlsugar插入时无时区直接utc时间

View File

@@ -12,6 +12,8 @@ using BootstrapBlazor.Components;
using Mapster; using Mapster;
using Newtonsoft.Json.Linq;
using SqlSugar; using SqlSugar;
using ThingsGateway.Admin.Application; using ThingsGateway.Admin.Application;
@@ -154,11 +156,17 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariableModel<
{ {
_config = new TypeAdapterConfig(); _config = new TypeAdapterConfig();
_config.ForType<VariableRuntime, SQLHistoryValue>() _config.ForType<VariableRuntime, SQLHistoryValue>()
//.Map(dest => dest.Id, (src) =>CommonUtils.GetSingleId()) .Map(dest => dest.Id, (src) => CommonUtils.GetSingleId())
.Map(dest => dest.Id, src => src.Id)//Id更改为变量Id //.Map(dest => dest.Id, src => src.Id)//Id更改为变量Id
.Map(dest => dest.Value, src => src.Value == null ? string.Empty : src.Value.ToString() ?? string.Empty) .Map(dest => dest.Value, src => src.Value != null ? src.Value.GetType() == typeof(string) ? src.Value.ToString() : JToken.FromObject(src.Value).ToString() : string.Empty)
.Map(dest => dest.CreateTime, (src) => DateTime.Now); .Map(dest => dest.CreateTime, (src) => DateTime.Now);
_config.ForType<VariableRuntime, SQLRealValue>()
//.Map(dest => dest.Id, (src) =>CommonUtils.GetSingleId())
.Map(dest => dest.Id, src => src.Id)//Id更改为变量Id
.Map(dest => dest.Value, src => src.Value != null ? src.Value.GetType() == typeof(string) ? src.Value.ToString() : JToken.FromObject(src.Value).ToString() : string.Empty);
_exRealTimerTick = new(_driverPropertys.RealTableBusinessInterval); _exRealTimerTick = new(_driverPropertys.RealTableBusinessInterval);
await base.InitChannelAsync(channel, cancellationToken).ConfigureAwait(false); await base.InitChannelAsync(channel, cancellationToken).ConfigureAwait(false);
@@ -220,7 +228,7 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariableModel<
var groups = varList.GroupBy(a => a.Group); var groups = varList.GroupBy(a => a.Group);
foreach (var item in groups) foreach (var item in groups)
{ {
var result = await UpdateAsync(item.Adapt<List<SQLRealValue>>(), cancellationToken).ConfigureAwait(false); var result = await UpdateAsync(item.Adapt<List<SQLRealValue>>(_config), cancellationToken).ConfigureAwait(false);
if (success != result.IsSuccess) if (success != result.IsSuccess)
{ {
if (!result.IsSuccess) if (!result.IsSuccess)
@@ -231,7 +239,7 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariableModel<
} }
else else
{ {
var result = await UpdateAsync(varList.Adapt<List<SQLRealValue>>(), cancellationToken).ConfigureAwait(false); var result = await UpdateAsync(varList.Adapt<List<SQLRealValue>>(_config), cancellationToken).ConfigureAwait(false);
if (success != result.IsSuccess) if (success != result.IsSuccess)
{ {
if (!result.IsSuccess) if (!result.IsSuccess)

View File

@@ -19,7 +19,7 @@
<PackageReference Include="SqlSugar.TDengineCore" Version="4.18.8" GeneratePathProperty="true"> <PackageReference Include="SqlSugar.TDengineCore" Version="4.18.10" GeneratePathProperty="true">
<PrivateAssets>contentFiles;compile;build;buildMultitargeting;buildTransitive;analyzers;</PrivateAssets> <PrivateAssets>contentFiles;compile;build;buildMultitargeting;buildTransitive;analyzers;</PrivateAssets>
</PackageReference> </PackageReference>

View File

@@ -1,32 +1,11 @@
<Project> <Project>
<Target Name="CopyNugetPackages" AfterTargets="Build">
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<!-- setting up the variable for convenience -->
<ApplicationPackageFiles Include="$(PkgMQTTnet_AspNetCore)\lib\net6.0\*.*" />
<MQTTnetApplicationPackageFiles Include="$(PkgMQTTnet)\lib\net6.0\*.*" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<!-- setting up the variable for convenience -->
<ApplicationPackageFiles Include="$(PkgMQTTnet_AspNetCore)\lib\net8.0\*.*" />
<MQTTnet_ServerApplicationPackageFiles Include="$(PkgMQTTnet_Server)\lib\net8.0\*.*" />
<MQTTnetApplicationPackageFiles Include="$(PkgMQTTnet)\lib\net8.0\*.*" />
</ItemGroup>
<PropertyGroup>
<ApplicationFolder>$(TargetDir)</ApplicationFolder>
</PropertyGroup>
<Copy SourceFiles="@(ApplicationPackageFiles)" DestinationFolder="$(ApplicationFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(MQTTnet_ServerApplicationPackageFiles)" DestinationFolder="$(ApplicationFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(MQTTnetApplicationPackageFiles)" DestinationFolder="$(ApplicationFolder)%(RecursiveDir)" />
</Target>
<!--在构建后触发的。它通过在 Nuget 包的 Content 文件夹中包含目标目录中的所有文件和子文件夹来创建 nuget 包--> <!--在构建后触发的。它通过在 Nuget 包的 Content 文件夹中包含目标目录中的所有文件和子文件夹来创建 nuget 包-->
<Target Name="IncludeAllFilesInTargetDir" AfterTargets="Build"> <Target Name="IncludeAllFilesInTargetDir" AfterTargets="Build">
<ItemGroup> <ItemGroup>
<Content Include="$(ProjectDir)bin\$(Configuration)\$(TargetFramework)\**\*MQTT*.dll"> <Content Include="$(ProjectDir)bin\$(Configuration)\$(TargetFramework)\**\*Http*.dll">
<Pack>true</Pack> <Pack>true</Pack>
<PackagePath>Content</PackagePath> <PackagePath>Content</PackagePath>
</Content> </Content>

View File

@@ -3,6 +3,7 @@
"ConfigurationScanDirectories": [ "Configuration", "" ], // 扫描配置文件json文件夹自动合并该文件夹里面所有json文件 "ConfigurationScanDirectories": [ "Configuration", "" ], // 扫描配置文件json文件夹自动合并该文件夹里面所有json文件
"IgnoreConfigurationFiles": [ "" ], "IgnoreConfigurationFiles": [ "" ],
"ExternalAssemblies": [ "" ] "ExternalAssemblies": [ "" ],
"DetailedErrors": true
} }

View File

@@ -16,7 +16,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.0" /> <PackageReference Include="TouchSocket.Dmtp" Version="3.1.1" />
</ItemGroup> </ItemGroup>

View File

@@ -1,6 +1,6 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<Version>10.5.7</Version> <Version>10.5.10</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>