Merge #950: AdminUI /alerts scripted-alarm ack/shelve report the engine verdict (ExecuteAck.alarm_verdict / DPS replies collected per request, Applied/Refused/Outcome unknown)
# Conflicts: # docs/ScriptedAlarms.md # src/Core/ZB.MOM.WW.OtOpcUa.Commons/OpcUa/AlarmCommand.cs
This commit is contained in:
@@ -809,12 +809,18 @@ public sealed class ScriptedAlarmHostActor : ReceiveActor
|
||||
/// <param name="cmd">The inbound alarm command.</param>
|
||||
private async Task OnAlarmCommand(AlarmCommand cmd)
|
||||
{
|
||||
// #950: central's AdminUI path publishes with its verdict collector as the sender and asks every host to answer —
|
||||
// non-owners included, so the collector can stop waiting once each driver node has spoken. Any other publisher
|
||||
// (the OPC UA broadcast, a pre-#950 central) gets no reply, exactly as before.
|
||||
var replyTo = cmd.VerdictRequested && !Sender.IsNobody() ? Sender : null;
|
||||
|
||||
// #937: the broadcast copy of a command this host already took through ExecuteAlarmCommand (or the other way
|
||||
// round) is applied once.
|
||||
if (cmd.CommandId is { } id && _recentCommands.ContainsKey(id))
|
||||
if (cmd.CommandId is { } id && _recentCommands.TryGetValue(id, out var known))
|
||||
{
|
||||
_log.Debug("ScriptedAlarmHost: skipping duplicate AlarmCommand {Op} for {AlarmId} (command {CommandId})",
|
||||
cmd.Operation, cmd.AlarmId, id);
|
||||
replyTo?.Tell(known);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -824,10 +830,14 @@ public sealed class ScriptedAlarmHostActor : ReceiveActor
|
||||
{
|
||||
_log.Debug("ScriptedAlarmHost: ignoring AlarmCommand {Op} for unowned alarm {AlarmId}",
|
||||
cmd.Operation, cmd.AlarmId);
|
||||
replyTo?.Tell(new AlarmCommandOutcome(cmd.AlarmId, cmd.Operation, AlarmCommandVerdict.NotApplied,
|
||||
NotLoadedRefusal, NotOwned: true));
|
||||
return;
|
||||
}
|
||||
|
||||
Remember(cmd, await ApplyCommandAsync(cmd));
|
||||
var outcome = await ApplyCommandAsync(cmd);
|
||||
Remember(cmd, outcome);
|
||||
replyTo?.Tell(outcome);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -861,7 +871,7 @@ public sealed class ScriptedAlarmHostActor : ReceiveActor
|
||||
var outcome = Owns(cmd.AlarmId)
|
||||
? await ApplyCommandAsync(cmd)
|
||||
: new AlarmCommandOutcome(cmd.AlarmId, cmd.Operation, AlarmCommandVerdict.NotApplied,
|
||||
_readiness?.Refusal() ?? NotLoadedRefusal);
|
||||
_readiness?.Refusal() ?? NotLoadedRefusal, NotOwned: true);
|
||||
|
||||
// #952: a command the engine never started is a refusal only while its asker is still waiting (it then neither
|
||||
// broadcasts it nor keeps the node change). Once the asker's deadline has passed it already answered
|
||||
|
||||
Reference in New Issue
Block a user