mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-19 16:06:33 +08:00
修改了无法添加基础节点的bug,增加WebSocket JSON ID字段,远程环境交互使用消息ID作为响应key。
This commit is contained in:
@@ -4,20 +4,38 @@ using Serein.Library.Api;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 组合条件节点(用于条件区域)
|
||||
/// </summary>
|
||||
public class CompositeConditionNode : NodeModelBase
|
||||
[NodeProperty(ValuePath = NodeValuePath.Node)]
|
||||
public partial class CompositeConditionNode : NodeModelBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件节点集合
|
||||
/// </summary>
|
||||
[PropertyInfo]
|
||||
private List<SingleConditionNode> _conditionNodes;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 组合条件节点(用于条件区域)
|
||||
/// </summary>
|
||||
public partial class CompositeConditionNode : NodeModelBase
|
||||
{
|
||||
public CompositeConditionNode(IFlowEnvironment environment):base(environment)
|
||||
{
|
||||
|
||||
}
|
||||
public List<SingleConditionNode> ConditionNodes { get; } = [];
|
||||
|
||||
|
||||
public void AddNode(SingleConditionNode node)
|
||||
{
|
||||
if(ConditionNodes is null)
|
||||
{
|
||||
ConditionNodes = new List<SingleConditionNode>();
|
||||
}
|
||||
ConditionNodes.Add(node);
|
||||
MethodDetails ??= node.MethodDetails;
|
||||
}
|
||||
@@ -93,6 +111,7 @@ namespace Serein.NodeFlow.Model
|
||||
ParameterData = parameterData.ToArray(),
|
||||
ErrorNodes = errorNodes.ToArray(),
|
||||
ChildNodeGuids = ConditionNodes.Select(node => node.Guid).ToArray(),
|
||||
Position = Position,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +1,51 @@
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Utils.SereinExpression;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件节点(用于条件控件)
|
||||
/// </summary>
|
||||
public class SingleConditionNode : NodeModelBase
|
||||
[NodeProperty(ValuePath = NodeValuePath.Node)]
|
||||
public partial class SingleConditionNode : NodeModelBase
|
||||
{
|
||||
public SingleConditionNode(IFlowEnvironment environment):base(environment)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否为自定义参数
|
||||
/// </summary>
|
||||
public bool IsCustomData { get; set; }
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
private bool _isCustomData;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义参数值
|
||||
/// </summary>
|
||||
public object? CustomData { get; set; }
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
|
||||
private object? _customData;
|
||||
/// <summary>
|
||||
/// 条件表达式
|
||||
/// </summary>
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
private string _expression;
|
||||
|
||||
public string Expression { get; set; }
|
||||
}
|
||||
|
||||
public partial class SingleConditionNode : NodeModelBase
|
||||
{
|
||||
public SingleConditionNode(IFlowEnvironment environment):base(environment)
|
||||
{
|
||||
this.IsCustomData = false;
|
||||
this.CustomData = null;
|
||||
this.Expression = "PASS";
|
||||
}
|
||||
|
||||
//public override object? Executing(IDynamicContext context)
|
||||
/// <summary>
|
||||
/// 重写节点的方法执行
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override Task<object?> ExecutingAsync(IDynamicContext context)
|
||||
{
|
||||
// 接收上一节点参数or自定义参数内容
|
||||
@@ -94,46 +110,20 @@ namespace Serein.NodeFlow.Model
|
||||
public override NodeModelBase LoadInfo(NodeInfo nodeInfo)
|
||||
{
|
||||
var node = this;
|
||||
if (node != null)
|
||||
node.Guid = nodeInfo.Guid;
|
||||
this.Position = nodeInfo.Position;// 加载位置信息
|
||||
for (int i = 0; i < nodeInfo.ParameterData.Length; i++)
|
||||
{
|
||||
node.Guid = nodeInfo.Guid;
|
||||
for (int i = 0; i < nodeInfo.ParameterData.Length; i++)
|
||||
{
|
||||
Parameterdata? pd = nodeInfo.ParameterData[i];
|
||||
node.IsCustomData = pd.State;
|
||||
node.CustomData = pd.Value;
|
||||
node.Expression = pd.Expression;
|
||||
Parameterdata? pd = nodeInfo.ParameterData[i];
|
||||
node.IsCustomData = pd.State;
|
||||
node.CustomData = pd.Value;
|
||||
node.Expression = pd.Expression;
|
||||
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
//public override void Execute(DynamicContext context)
|
||||
//{
|
||||
// CurrentState = Judge(context, base.MethodDetails);
|
||||
//}
|
||||
|
||||
//private bool Judge(DynamicContext context, MethodDetails md)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// if (DelegateCache.GlobalDicDelegates.TryGetValue(md.MethodName, out Delegate del))
|
||||
// {
|
||||
// object[] parameters = GetParameters(context, md);
|
||||
// var temp = del.DynamicInvoke(parameters);
|
||||
// //context.GetData(GetDyPreviousKey());
|
||||
// return (bool)temp;
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Debug.Write(ex.Message);
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +1,32 @@
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Utils.SereinExpression;
|
||||
using System.Reactive;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Expression Operation - 表达式操作
|
||||
/// </summary>
|
||||
public class SingleExpOpNode : NodeModelBase
|
||||
[NodeProperty(ValuePath = NodeValuePath.Node)]
|
||||
public partial class SingleExpOpNode : NodeModelBase
|
||||
{
|
||||
public SingleExpOpNode(IFlowEnvironment environment) : base(environment)
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 表达式
|
||||
/// </summary>
|
||||
public string Expression { get; set; }
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
private string _expression;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public partial class SingleExpOpNode : NodeModelBase
|
||||
{
|
||||
public SingleExpOpNode(IFlowEnvironment environment) : base(environment)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//public override async Task<object?> Executing(IDynamicContext context)
|
||||
public override Task<object?> ExecutingAsync(IDynamicContext context)
|
||||
@@ -31,7 +40,7 @@ namespace Serein.NodeFlow.Model
|
||||
object? result = null;
|
||||
if (isChange)
|
||||
{
|
||||
result = newData;
|
||||
result = newData;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,7 +61,7 @@ namespace Serein.NodeFlow.Model
|
||||
|
||||
public override Parameterdata[] GetParameterdatas()
|
||||
{
|
||||
return [new Parameterdata{ Expression = Expression}];
|
||||
return [new Parameterdata { Expression = Expression }];
|
||||
}
|
||||
|
||||
|
||||
@@ -60,13 +69,11 @@ namespace Serein.NodeFlow.Model
|
||||
public override NodeModelBase LoadInfo(NodeInfo nodeInfo)
|
||||
{
|
||||
var node = this;
|
||||
if (node != null)
|
||||
this.Position = nodeInfo.Position;// 加载位置信息
|
||||
node.Guid = nodeInfo.Guid;
|
||||
for (int i = 0; i < nodeInfo.ParameterData.Length; i++)
|
||||
{
|
||||
node.Guid = nodeInfo.Guid;
|
||||
for (int i = 0; i < nodeInfo.ParameterData.Length; i++)
|
||||
{
|
||||
node.Expression = nodeInfo.ParameterData[i].Expression;
|
||||
}
|
||||
node.Expression = nodeInfo.ParameterData[i].Expression;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user