| 1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections.Generic;
- using System.Threading;
- using TeamAAS.FlowEditor.Models;
- using TeamAAS.FlowEditor.Plugins;
- using Plugins.Standard.Models;
- namespace Plugins.Standard
- {
- /// <summary>
- /// 异常分支插件 - 前驱节点 Failed 时由 FlowExecutor 显式触发执行;
- /// 无可编辑属性,双击不弹窗。多前驱异常时串行排队执行。
- /// 默认 PluginRun 返回 Success;具体异常处理逻辑由派生类重写。
- /// </summary>
- [Plugin("异常分支", PluginCategory.逻辑判断, /*modelType*/ null,
- "AlertOutline",
- NodeShape = NodeCategory.ExceptionBranch,
- Description = "前置节点异常时执行的分支节点,多前驱异常时串行排队执行")]
- [System.Serializable]
- public class ExceptionBranchPlugin : BasePlugin<ExceptionBranchModel>
- {
- public override List<OutputField> DeclareOutputs() => new List<OutputField>
- {
- new OutputField("状态", typeof(string)),
- new OutputField("异常源", typeof(string))
- };
- public override NodeRunStatus PluginRun(CancellationToken token, out Dictionary<string, object> results)
- {
- results = new Dictionary<string, object>
- {
- ["状态"] = "异常分支已执行",
- ["异常源"] = Model?.NodeName ?? ""
- };
- Log(2, $"异常分支已执行,异常源: {Model?.NodeName ?? "(未知)"}", TeamAAS.LogLevel.Warning);
- return NodeRunStatus.Success;
- }
- }
- }
|