using PropertyGridLib.Attributes; using PropertyGridLib.Controls; using System; using System.Collections.Generic; using System.ComponentModel; using TeamAAS.FlowEditor.Models; using TeamAAS.FlowEditor.Plugins; using TeamAAS.FlowEngine.FormulaData; namespace Plugins.Standard.Models { [Serializable] public class GroupPluginModel : BasePluginModel { [Category("I.参数")] [DisplayName("1.输入参数")] [Description("输入参数设置 —— 映射主流程前序节点的运行结果到组合模块内部,内部节点用 &{输入.变量名} 引用")] public List ModuleInputs { get; set; } = new List(); [Category("I.参数")] [DisplayName("2.输出参数")] [Description("输出参数设置")] public List ModuleOutputs { get; set; } = new List(); private int _loopCount = 1; [Category("II.循环设置")] [DisplayName("1.循环次数")] [Description("循环次数。-1=无限循环, 0=跳过不执行, 其他=按次数执行")] public int LoopCount { get => _loopCount; set => _loopCount = value; } [Browsable(false)] public FlowGraph SubGraph { get; set; } [Browsable(false)] public bool IsBreakRequested { get; set; } = false; public void EnsureSubGraph() { if (SubGraph == null) { SubGraph = new FlowGraph { GraphName = ToolName ?? "组合模块", GraphId = NodeId }; } } } [Serializable] public class InputModels { public InputModels() { SourceValue = new FormulaBound(); } [Category("输入参数")] [DisplayName("变量名")] [Description("自定义变量名,内部节点通过 &{输入.变量名} 引用")] public string InputName { get; set; } = "Var1"; [Category("输入参数")] [DisplayName("来源值")] [Description("从主流程前序节点的输出结果中选择(运行时自动读取最新值)")] [FormulaEditor(typeof(InputSourceDataProvider))] public FormulaBound SourceValue { get; set; } public override string ToString() => InputName; } [Serializable] public class OutPutModels { public OutPutModels() { OutVale = new FormulaBound(); } private string _OutName = string.Empty; [Category("输出参数")] [DisplayName("参数名")] [Description("设置输出参数的名称")] public string OutName { get => _OutName; set => _OutName = value; } [Category("输出参数")] [DisplayName("参数值")] [Description("设置输出参数的值")] [FormulaEditor(typeof(PluginDataProvider))] public FormulaBound OutVale { get; set; } = new FormulaBound(); private bool _IsEndResult = true; [Category("参数拓展")] [DisplayName("是否是末参")] [Description("如果为false OutVale会累计输出结果 并返回的是 List数组")] public bool IsEndResult { get => _IsEndResult; set => _IsEndResult = value; } private int _MaxResultNumber = 50; [Category("参数拓展")] [DisplayName("最大结果数量")] [Description("如果返回的是列表结果 列表的最大数量限制是")] public int MaxResultNumber { get => _MaxResultNumber; set => _MaxResultNumber = value; } [NonSerialized] private List _ResultList = new List(); /// /// 缓存 /// [Browsable(false)] internal List ResultList { get => _ResultList; set => _ResultList = value; } /// /// 缓存类型 /// [Browsable(false)] [NonSerialized] internal Type ResultType = typeof(object); public override string ToString() { return OutName.ToString(); } } }