Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f73245e650 | ||
![]() |
484461fa05 | ||
![]() |
7e0b7aff2a | ||
![]() |
6c450dcb09 | ||
![]() |
227f44283f |
@@ -22,12 +22,34 @@ public static class JSRuntimeExtensions
|
||||
/// 获取文化信息
|
||||
/// </summary>
|
||||
/// <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>
|
||||
/// <param name="jsRuntime"></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
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.5.7</PluginVersion>
|
||||
<ProPluginVersion>10.5.7</ProPluginVersion>
|
||||
<PluginVersion>10.5.10</PluginVersion>
|
||||
<ProPluginVersion>10.5.10</ProPluginVersion>
|
||||
<AuthenticationVersion>2.1.7</AuthenticationVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="9.0.4" />
|
||||
<PackageReference Include="TouchSocket" Version="3.1.0" />
|
||||
<PackageReference Include="TouchSocket.SerialPorts" Version="3.1.0" />
|
||||
<PackageReference Include="TouchSocket" Version="3.1.1" />
|
||||
<PackageReference Include="TouchSocket.SerialPorts" Version="3.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -26,7 +26,7 @@ namespace ThingsGateway.Gateway.Application;
|
||||
public class DeviceRuntime : Device, IDisposable
|
||||
{
|
||||
protected volatile DeviceStatusEnum _deviceStatus = DeviceStatusEnum.Default;
|
||||
|
||||
|
||||
private string? _lastErrorMessage;
|
||||
|
||||
/// <summary>
|
||||
|
@@ -19,5 +19,8 @@ public class VariableMapper : IRegister
|
||||
{
|
||||
config.ForType<Variable, VariableRuntime>()
|
||||
.Map(dest => dest.Value, src => src.InitValue);
|
||||
|
||||
config.ForType<VariableRuntime, VariableRuntime>()
|
||||
.Ignore(dest => dest.DeviceRuntime);
|
||||
}
|
||||
}
|
||||
|
@@ -8,8 +8,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
|
||||
<PackageReference Include="Rougamo.Fody" Version="5.0.0" />
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.0" />
|
||||
<PackageReference Include="TouchSocket.WebApi.Swagger" Version="3.1.0" />
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.1" />
|
||||
<PackageReference Include="TouchSocket.WebApi.Swagger" Version="3.1.1" />
|
||||
<PackageReference Include="ThingsGateway.Authentication" Version="$(AuthenticationVersion)" />
|
||||
|
||||
</ItemGroup>
|
||||
|
@@ -212,8 +212,8 @@ public partial class VariableEditComponent
|
||||
{
|
||||
var component = new BootstrapDynamicComponent(data.VariablePropertyUIType, new Dictionary<string, object?>
|
||||
{
|
||||
[nameof(VariableEditComponent.Model)] = Model,
|
||||
[nameof(DeviceEditComponent.PluginPropertyEditorItems)] = data.EditorItems,
|
||||
[nameof(IPropertyUIBase.Model)] = Model,
|
||||
[nameof(IPropertyUIBase.PluginPropertyEditorItems)] = data.EditorItems,
|
||||
});
|
||||
VariablePropertyRenderFragments.AddOrUpdate(id, component.Render());
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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.CodeEditor" Version="9.0.1" />
|
||||
<ProjectReference Include="..\..\Admin\ThingsGateway.Admin.Razor\ThingsGateway.Admin.Razor.csproj" />
|
||||
|
@@ -19,7 +19,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
|
||||
{
|
||||
Func = 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>();
|
||||
deviceChangedTriggerNodes.Add(this);
|
||||
@@ -44,7 +44,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
|
||||
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) =>
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public class DeviceChangedTriggerNode : TextNode, ITriggerNode, IDisposable
|
||||
public void Dispose()
|
||||
{
|
||||
FuncDict.Remove(this);
|
||||
if (DeviceChangedTriggerNodeDict.TryGetValue(Text, out var list))
|
||||
if (DeviceChangedTriggerNodeDict.TryGetValue(Text ?? string.Empty, out var list))
|
||||
{
|
||||
list.Remove(this);
|
||||
}
|
||||
|
@@ -12,6 +12,8 @@ using BootstrapBlazor.Components;
|
||||
|
||||
using Mapster;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using SqlSugar;
|
||||
|
||||
using ThingsGateway.Admin.Application;
|
||||
@@ -66,7 +68,7 @@ public partial class QuestDBProducer : BusinessBaseWithCacheIntervalVariableMode
|
||||
_config.ForType<VariableRuntime, QuestDBHistoryValue>()
|
||||
//.Map(dest => dest.Id, src => CommonUtils.GetSingleId())
|
||||
.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.CreateTime, (src) => DateTime.UtcNow)
|
||||
;//注意sqlsugar插入时无时区,直接utc时间
|
||||
|
@@ -12,6 +12,8 @@ using BootstrapBlazor.Components;
|
||||
|
||||
using Mapster;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using SqlSugar;
|
||||
|
||||
using ThingsGateway.Admin.Application;
|
||||
@@ -154,11 +156,17 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariableModel<
|
||||
{
|
||||
_config = new TypeAdapterConfig();
|
||||
_config.ForType<VariableRuntime, SQLHistoryValue>()
|
||||
//.Map(dest => dest.Id, (src) =>CommonUtils.GetSingleId())
|
||||
.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.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)
|
||||
.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);
|
||||
|
||||
await base.InitChannelAsync(channel, cancellationToken).ConfigureAwait(false);
|
||||
@@ -220,7 +228,7 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariableModel<
|
||||
var groups = varList.GroupBy(a => a.Group);
|
||||
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 (!result.IsSuccess)
|
||||
@@ -231,7 +239,7 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariableModel<
|
||||
}
|
||||
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 (!result.IsSuccess)
|
||||
|
@@ -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>
|
||||
</PackageReference>
|
||||
|
||||
|
@@ -1,32 +1,11 @@
|
||||
<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 包-->
|
||||
<Target Name="IncludeAllFilesInTargetDir" AfterTargets="Build">
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="$(ProjectDir)bin\$(Configuration)\$(TargetFramework)\**\*MQTT*.dll">
|
||||
<Content Include="$(ProjectDir)bin\$(Configuration)\$(TargetFramework)\**\*Http*.dll">
|
||||
<Pack>true</Pack>
|
||||
<PackagePath>Content</PackagePath>
|
||||
</Content>
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
"ConfigurationScanDirectories": [ "Configuration", "" ], // 扫描配置文件json文件夹(自动合并该文件夹里面所有json文件)
|
||||
"IgnoreConfigurationFiles": [ "" ],
|
||||
"ExternalAssemblies": [ "" ]
|
||||
"ExternalAssemblies": [ "" ],
|
||||
"DetailedErrors": true
|
||||
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.0" />
|
||||
<PackageReference Include="TouchSocket.Dmtp" Version="3.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>10.5.7</Version>
|
||||
<Version>10.5.10</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user