虚拟模式下 跳过联锁(Interlock)检查,因为虚拟模式没有真实安全门信

This commit is contained in:
zhengxuan.zhang
2026-05-21 17:15:27 +08:00
parent 43d0e7fa89
commit de4a7121db
5 changed files with 27 additions and 12 deletions
@@ -65,6 +65,8 @@ namespace XP.Hardware.RaySource.Implementations
public override XRayResult ConnectVariables()
{
_isConnected = true;
_eventAggregator.GetEvent<VariablesConnectedEvent>().Publish(true);
_eventAggregator.GetEvent<RaySourceStatusChangedEvent>().Publish(RaySourceStatus.Closed);
_logger.Info("[Simulated] PVI 变量连接成功");
return XRayResult.Ok();
}
@@ -70,11 +70,14 @@ namespace XP.Hardware.RaySource.ViewModels
{
get
{
var isSimulated = _config.SourceType.Equals("Simulated", System.StringComparison.OrdinalIgnoreCase);
var suffix = isSimulated ? "\n(虚拟模式)" : "";
return RaySourceStatus switch
{
RaySourceStatus.Unavailable => $"{_localizationService.GetString("RaySource_StatusUnavailable")}",
RaySourceStatus.Closed => _localizationService.GetString("RaySource_StatusClosed"),
RaySourceStatus.Opened => _localizationService.GetString("RaySource_StatusOpened"),
RaySourceStatus.Closed => (_localizationService.GetString("RaySource_StatusClosed") ?? "已关闭") + suffix,
RaySourceStatus.Opened => (_localizationService.GetString("RaySource_StatusOpened") ?? "已开启") + suffix,
_ => _localizationService.GetString("RaySource_StatusUnavailable")
};
}
@@ -477,11 +480,14 @@ namespace XP.Hardware.RaySource.ViewModels
}
/// <summary>
/// 开启命令是否可执行(仅关闭状态且连锁激活时可执行| Can execute turn on command (only when closed and interlock active)
/// 开启命令是否可执行(仅关闭状态且连锁激活时可执行,虚拟模式跳过联锁检查)
/// Can execute turn on command (only when closed and interlock active; simulated mode skips interlock check)
/// </summary>
private bool CanExecuteTurnOn()
{
return !_isOperating && _isVariablesConnected && IsInterlockActive && RaySourceStatus == RaySourceStatus.Closed && _raySourceService.IsInitialized;
var isSimulated = _config.SourceType.Equals("Simulated", System.StringComparison.OrdinalIgnoreCase);
var interlockOk = isSimulated || IsInterlockActive;
return !_isOperating && _isVariablesConnected && interlockOk && RaySourceStatus == RaySourceStatus.Closed && _raySourceService.IsInitialized;
}
/// <summary>