版本更改

This commit is contained in:
2026-03-26 17:47:56 +08:00
parent 6876872145
commit d7dfe27ad5
6 changed files with 29 additions and 6 deletions

View File

@@ -136,7 +136,7 @@ namespace CapMachine.Wpf
containerRegistry.RegisterSingleton<MachineRtDataService>(); containerRegistry.RegisterSingleton<MachineRtDataService>();
containerRegistry.RegisterSingleton<DataRecordService>(); containerRegistry.RegisterSingleton<DataRecordService>();
containerRegistry.RegisterSingleton<HighSpeedDataService>(); containerRegistry.RegisterSingleton<HighSpeedDataService>();
//containerRegistry.RegisterSingleton<PPCService>(); containerRegistry.RegisterSingleton<PPCService>();
containerRegistry.RegisterSingleton<SysRunService>(); containerRegistry.RegisterSingleton<SysRunService>();
containerRegistry.RegisterSingleton<ComActionService>(); containerRegistry.RegisterSingleton<ComActionService>();

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>

View File

@@ -24,6 +24,7 @@ namespace CapMachine.Wpf.Services
/// 计算扫描 Task /// 计算扫描 Task
/// </summary> /// </summary>
private static Task CalcTask { get; set; } private static Task CalcTask { get; set; }
private static int _scanLoopStarted;
public ConfigService ConfigService { get; } public ConfigService ConfigService { get; }
private IEventAggregator _EventAggregator { get; set; } private IEventAggregator _EventAggregator { get; set; }
@@ -266,6 +267,11 @@ namespace CapMachine.Wpf.Services
/// </summary> /// </summary>
private void RtScanDeviceStart() private void RtScanDeviceStart()
{ {
if (System.Threading.Interlocked.CompareExchange(ref _scanLoopStarted, 1, 0) != 0)
{
return;
}
CalcTask = Task.Run(async () => CalcTask = Task.Run(async () =>
{ {
while (RtCalcEnable) while (RtCalcEnable)
@@ -332,7 +338,7 @@ namespace CapMachine.Wpf.Services
} }
else if (_superheatSubcoolCalculator.TryCalculateSuperheatK(InhPressTag.EngPvValue, InhTempTag.EngPvValue, out var superheatValue, out var superheatErr)) else if (_superheatSubcoolCalculator.TryCalculateSuperheatK(InhPressTag.EngPvValue, InhTempTag.EngPvValue, out var superheatValue, out var superheatErr))
{ {
Superheat.EngPvValue = superheatValue; Superheat.EngPvValue =Math.Abs(superheatValue) ;
updated = true; updated = true;
} }
else else
@@ -348,7 +354,7 @@ namespace CapMachine.Wpf.Services
} }
else if (_superheatSubcoolCalculator.TryCalculateSubcoolK(TxvFrPressTag.EngPvValue, TxvFrTempTag.EngPvValue, out var subcoolValue, out var subcoolErr)) else if (_superheatSubcoolCalculator.TryCalculateSubcoolK(TxvFrPressTag.EngPvValue, TxvFrTempTag.EngPvValue, out var subcoolValue, out var subcoolErr))
{ {
Subcool.EngPvValue = subcoolValue; Subcool.EngPvValue = Math.Abs(subcoolValue);
updated = true; updated = true;
} }
else else

View File

@@ -239,7 +239,7 @@ namespace CapMachine.Wpf.Services
/// </remarks> /// </remarks>
private sealed class LocalCalculationSupport : IPPCCalculationSupport private sealed class LocalCalculationSupport : IPPCCalculationSupport
{ {
private static readonly object _refpropLock = new object(); private static readonly object _refpropLock = RefpropGlobalSync.SyncRoot;
private static volatile bool _rpInitialized; private static volatile bool _rpInitialized;
public bool EnsureRefpropInitialized(out string error) public bool EnsureRefpropInitialized(out string error)

View File

@@ -1064,7 +1064,7 @@ namespace CapMachine.Wpf.Services
/// </remarks> /// </remarks>
private sealed class LocalCalculationSupport : IPPCCalculationSupport private sealed class LocalCalculationSupport : IPPCCalculationSupport
{ {
private static readonly object _refpropLock = new object(); private static readonly object _refpropLock = RefpropGlobalSync.SyncRoot;
private static volatile bool _rpInitialized; private static volatile bool _rpInitialized;
public bool EnsureRefpropInitialized(out string error) public bool EnsureRefpropInitialized(out string error)

View File

@@ -0,0 +1,17 @@
namespace CapMachine.Wpf.Services
{
/// <summary>
/// REFPROP 全局同步对象。
/// </summary>
/// <remarks>
/// REFPROP 不是线程安全组件,所有底层 DLL 调用必须串行进入。
/// 该类提供进程内统一锁,供不同计算器共享,避免并发调用导致的瞬时异常结果。
/// </remarks>
internal static class RefpropGlobalSync
{
/// <summary>
/// REFPROP 全局互斥锁。
/// </summary>
internal static readonly object SyncRoot = new object();
}
}