GroupPluginModel.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using PropertyGridLib.Attributes;
  2. using PropertyGridLib.Controls;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using TeamAAS.FlowEditor.Models;
  7. using TeamAAS.FlowEditor.Plugins;
  8. using TeamAAS.FlowEngine.FormulaData;
  9. namespace Plugins.Standard.Models
  10. {
  11. [Serializable]
  12. public class GroupPluginModel : BasePluginModel
  13. {
  14. [Category("I.参数")]
  15. [DisplayName("1.输入参数")]
  16. [Description("输入参数设置 —— 映射主流程前序节点的运行结果到组合模块内部,内部节点用 &{输入.变量名} 引用")]
  17. public List<InputModels> ModuleInputs { get; set; } = new List<InputModels>();
  18. [Category("I.参数")]
  19. [DisplayName("2.输出参数")]
  20. [Description("输出参数设置")]
  21. public List<OutPutModels> ModuleOutputs { get; set; } = new List<OutPutModels>();
  22. private int _loopCount = 1;
  23. [Category("II.循环设置")]
  24. [DisplayName("1.循环次数")]
  25. [Description("循环次数。-1=无限循环, 0=跳过不执行, 其他=按次数执行")]
  26. public int LoopCount
  27. {
  28. get => _loopCount;
  29. set => _loopCount = value;
  30. }
  31. [Browsable(false)]
  32. public FlowGraph SubGraph { get; set; }
  33. [Browsable(false)]
  34. public bool IsBreakRequested { get; set; } = false;
  35. public void EnsureSubGraph()
  36. {
  37. if (SubGraph == null)
  38. {
  39. SubGraph = new FlowGraph { GraphName = ToolName ?? "组合模块", GraphId = NodeId };
  40. }
  41. }
  42. }
  43. [Serializable]
  44. public class InputModels
  45. {
  46. public InputModels()
  47. {
  48. SourceValue = new FormulaBound<object>();
  49. }
  50. [Category("输入参数")]
  51. [DisplayName("变量名")]
  52. [Description("自定义变量名,内部节点通过 &{输入.变量名} 引用")]
  53. public string InputName { get; set; } = "Var1";
  54. [Category("输入参数")]
  55. [DisplayName("来源值")]
  56. [Description("从主流程前序节点的输出结果中选择(运行时自动读取最新值)")]
  57. [FormulaEditor(typeof(InputSourceDataProvider))]
  58. public FormulaBound<object> SourceValue { get; set; }
  59. public override string ToString() => InputName;
  60. }
  61. [Serializable]
  62. public class OutPutModels
  63. {
  64. public OutPutModels()
  65. {
  66. OutVale = new FormulaBound<object>();
  67. }
  68. private string _OutName = string.Empty;
  69. [Category("输出参数")]
  70. [DisplayName("参数名")]
  71. [Description("设置输出参数的名称")]
  72. public string OutName
  73. {
  74. get => _OutName;
  75. set => _OutName = value;
  76. }
  77. [Category("输出参数")]
  78. [DisplayName("参数值")]
  79. [Description("设置输出参数的值")]
  80. [FormulaEditor(typeof(PluginDataProvider))]
  81. public FormulaBound<object> OutVale
  82. {
  83. get;
  84. set;
  85. } = new FormulaBound<object>();
  86. private bool _IsEndResult = true;
  87. [Category("参数拓展")]
  88. [DisplayName("是否是末参")]
  89. [Description("如果为false OutVale会累计输出结果 并返回的是 List<T>数组")]
  90. public bool IsEndResult
  91. {
  92. get => _IsEndResult;
  93. set => _IsEndResult = value;
  94. }
  95. private int _MaxResultNumber = 50;
  96. [Category("参数拓展")]
  97. [DisplayName("最大结果数量")]
  98. [Description("如果返回的是列表结果 列表的最大数量限制是")]
  99. public int MaxResultNumber
  100. {
  101. get => _MaxResultNumber;
  102. set => _MaxResultNumber = value;
  103. }
  104. [NonSerialized]
  105. private List<object> _ResultList = new List<object>();
  106. /// <summary>
  107. /// 缓存
  108. /// </summary>
  109. [Browsable(false)]
  110. internal List<object> ResultList
  111. {
  112. get => _ResultList;
  113. set => _ResultList = value;
  114. }
  115. /// <summary>
  116. /// 缓存类型
  117. /// </summary>
  118. [Browsable(false)]
  119. [NonSerialized]
  120. internal Type ResultType = typeof(object);
  121. public override string ToString()
  122. {
  123. return OutName.ToString();
  124. }
  125. }
  126. }