mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-21 03:01:28 +08:00
更新nuget包
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<ItemGroup>
|
||||
|
||||
<PackageReference Include="Masa.Blazor" Version="1.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.10" />
|
||||
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -12,10 +12,10 @@
|
||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.8.8.40" />
|
||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.8.8.40" />
|
||||
<PackageReference Include="Furion.Pure" Version="4.8.8.40" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.94" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.95" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
<PackageReference Include="MiniExcel" Version="1.31.0" />
|
||||
<PackageReference Include="MiniExcel" Version="1.31.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@@ -66,7 +66,7 @@ public class AlarmWorker : BackgroundService
|
||||
/// </summary>
|
||||
public OperResult StatuString { get; set; } = new OperResult("初始化");
|
||||
private ConcurrentQueue<DeviceVariableRunTime> DeviceVariables { get; set; } = new();
|
||||
private ConcurrentQueue<DeviceVariableRunTime> HisAlarmDeviceVariables { get; set; } = new();
|
||||
private ConcurrentQueue<HistoryAlarm> HisAlarmDeviceVariables { get; set; } = new();
|
||||
/// <summary>
|
||||
/// 获取数据库链接
|
||||
/// </summary>
|
||||
@@ -465,7 +465,7 @@ public class AlarmWorker : BackgroundService
|
||||
OnAlarmChanged?.Invoke(item.Adapt<DeviceVariableRunTime>());
|
||||
if (!IsExited)
|
||||
{
|
||||
HisAlarmDeviceVariables.Enqueue(item);
|
||||
HisAlarmDeviceVariables.Enqueue(item.Adapt<HistoryAlarm>());
|
||||
}
|
||||
|
||||
if (eventEnum == EventEnum.Alarm)
|
||||
@@ -586,18 +586,20 @@ public class AlarmWorker : BackgroundService
|
||||
|
||||
//缓存值
|
||||
var cacheData = await CacheDb.GetCacheData();
|
||||
var data = cacheData.SelectMany(a => a.CacheStr.FromJson<List<HistoryAlarm>>()).ToList();
|
||||
try
|
||||
if (cacheData.Count > 0)
|
||||
{
|
||||
var count = await sqlSugarClient.Insertable(data).ExecuteCommandAsync(stoppingToken.Token);
|
||||
await CacheDb.DeleteCacheData(cacheData.Select(a => a.Id).ToArray());
|
||||
var data = cacheData.SelectMany(a => a.CacheStr.FromJson<List<HistoryAlarm>>()).ToList();
|
||||
try
|
||||
{
|
||||
var count = await sqlSugarClient.Insertable(data).ExecuteCommandAsync(stoppingToken.Token);
|
||||
await CacheDb.DeleteCacheData(cacheData.Select(a => a.Id).ToArray());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (isSuccess)
|
||||
_logger.LogWarning(ex, "写入历史报警失败");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (isSuccess)
|
||||
_logger.LogWarning(ex, "写入历史报警失败");
|
||||
}
|
||||
|
||||
if (stoppingToken.Token.IsCancellationRequested)
|
||||
break;
|
||||
|
||||
@@ -605,16 +607,15 @@ public class AlarmWorker : BackgroundService
|
||||
var list = HisAlarmDeviceVariables.ToListWithDequeue();
|
||||
if (list.Count != 0)
|
||||
{
|
||||
var hisalarm = list.Adapt<List<HistoryAlarm>>();
|
||||
////Sql保存
|
||||
hisalarm.ForEach(it =>
|
||||
list.ForEach(it =>
|
||||
{
|
||||
it.Id = YitIdHelper.NextId();
|
||||
});
|
||||
//插入
|
||||
try
|
||||
{
|
||||
await sqlSugarClient.Insertable(hisalarm).ExecuteCommandAsync(stoppingToken.Token);
|
||||
await sqlSugarClient.Insertable(list).ExecuteCommandAsync(stoppingToken.Token);
|
||||
isSuccess = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -622,7 +623,7 @@ public class AlarmWorker : BackgroundService
|
||||
if (isSuccess)
|
||||
_logger.LogWarning(ex, "写入历史报警失败");
|
||||
|
||||
var cacheDatas = hisalarm.ChunkTrivialBetter(500);
|
||||
var cacheDatas = list.ChunkTrivialBetter(500);
|
||||
foreach (var a in cacheDatas)
|
||||
{
|
||||
await CacheDb.AddCacheData("", a.ToJson(), 50000);
|
||||
|
@@ -29,6 +29,7 @@ using System.Runtime.InteropServices;
|
||||
using ThingsGateway.Foundation;
|
||||
|
||||
using TouchSocket.Resources;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace ThingsGateway.Foundation;
|
||||
|
||||
@@ -159,7 +160,7 @@ public class TcpClientBaseEx : BaseSocket, ITcpClient
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.PluginsManager.Raise(nameof(ITcpDisconnectedPlguin.OnTcpDisconnected), this, e);
|
||||
this.PluginsManager.Raise(nameof(ITcpDisconnectedPlugin.OnTcpDisconnected), this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -13,6 +13,7 @@
|
||||
using System.IO.Ports;
|
||||
|
||||
using TouchSocket.Resources;
|
||||
using TouchSocket.Sockets;
|
||||
|
||||
namespace ThingsGateway.Foundation.Serial;
|
||||
|
||||
@@ -172,7 +173,7 @@ public class SerialClientBase : BaseSerial, ISerialClient
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.PluginsManager.Raise(nameof(ITcpDisconnectedPlguin.OnTcpDisconnected), this, e);
|
||||
this.PluginsManager.Raise(nameof(ITcpDisconnectedPlugin.OnTcpDisconnected), this, e);
|
||||
}
|
||||
private void PrivateOnDisconnecting(DisconnectEventArgs e)
|
||||
{
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="TouchSocket" Version="2.0.0-beta.120" />
|
||||
<PackageReference Include="TouchSocket" Version="2.0.0-beta.134" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetFramework)'!='net45'">
|
||||
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
|
||||
|
Reference in New Issue
Block a user