mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
修改了很多
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 组合动作节点(用于动作区域)
|
||||
/// </summary>
|
||||
public class CompositeActionNode : NodeModelBase
|
||||
{
|
||||
public List<SingleActionNode> ActionNodes;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 组合动作节点(用于动作区域)
|
||||
/// </summary>
|
||||
public CompositeActionNode(IFlowEnvironment environment, List<SingleActionNode> actionNodes):base(environment)
|
||||
{
|
||||
ActionNodes = actionNodes;
|
||||
}
|
||||
|
||||
//public override async Task<object?> Executing(IDynamicContext context)
|
||||
public override Task<object?> ExecutingAsync(IDynamicContext context)
|
||||
{
|
||||
throw new NotImplementedException("动作区域暂未实现");
|
||||
}
|
||||
|
||||
public override Parameterdata[] GetParameterdatas()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public override NodeInfo? ToInfo()
|
||||
{
|
||||
if (MethodDetails is null) return null;
|
||||
|
||||
var trueNodes = SuccessorNodes[ConnectionInvokeType.IsSucceed].Select(item => item.Guid); // 真分支
|
||||
var falseNodes = SuccessorNodes[ConnectionInvokeType.IsFail].Select(item => item.Guid);// 假分支
|
||||
var errorNodes = SuccessorNodes[ConnectionInvokeType.IsError].Select(item => item.Guid);// 异常分支
|
||||
var upstreamNodes = SuccessorNodes[ConnectionInvokeType.Upstream].Select(item => item.Guid);// 上游分支
|
||||
// 生成参数列表
|
||||
Parameterdata[] parameterData = GetParameterdatas();
|
||||
|
||||
return new NodeInfo
|
||||
{
|
||||
Guid = Guid,
|
||||
MethodName = MethodDetails?.MethodName,
|
||||
Label = DisplayName ?? "",
|
||||
Type = this.GetType().ToString(),
|
||||
TrueNodes = trueNodes.ToArray(),
|
||||
FalseNodes = falseNodes.ToArray(),
|
||||
UpstreamNodes = upstreamNodes.ToArray(),
|
||||
ParameterData = parameterData.ToArray(),
|
||||
ErrorNodes = errorNodes.ToArray(),
|
||||
ChildNodeGuids = ActionNodes.Select(node => node.Guid).ToArray(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,7 +58,8 @@ namespace Serein.NodeFlow.Model
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Task.FromResult( PreviousNode?.GetFlowData()); // 条件区域透传上一节点的数据
|
||||
|
||||
return Task.FromResult(context.GetFlowData(PreviousNode.Guid)); // 条件区域透传上一节点的数据
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +79,7 @@ namespace Serein.NodeFlow.Model
|
||||
}
|
||||
}
|
||||
|
||||
public override Parameterdata[] GetParameterdatas()
|
||||
public override ParameterData[] GetParameterdatas()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -97,7 +98,7 @@ namespace Serein.NodeFlow.Model
|
||||
var upstreamNodes = SuccessorNodes[ConnectionInvokeType.Upstream].Select(item => item.Guid);// 上游分支
|
||||
|
||||
// 生成参数列表
|
||||
Parameterdata[] parameterData = GetParameterdatas();
|
||||
ParameterData[] parameterData = GetParameterdatas();
|
||||
|
||||
return new NodeInfo
|
||||
{
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Serein.NodeFlow.Model
|
||||
{
|
||||
//public class CompositeLoopNode : NodeBase
|
||||
//{
|
||||
//}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
{
|
||||
@@ -12,13 +13,15 @@ namespace Serein.NodeFlow.Model
|
||||
{
|
||||
|
||||
}
|
||||
public override Parameterdata[] GetParameterdatas()
|
||||
public override ParameterData[] GetParameterdatas()
|
||||
{
|
||||
if (base.MethodDetails.ParameterDetailss.Length > 0)
|
||||
{
|
||||
return MethodDetails.ParameterDetailss
|
||||
.Select(it => new Parameterdata
|
||||
.Select(it => new ParameterData
|
||||
{
|
||||
SourceNodeGuid = it.ArgDataSourceNodeGuid,
|
||||
SourceType = it.ArgDataSourceType.ToString(),
|
||||
State = it.IsExplicitData,
|
||||
Value = it.DataValue,
|
||||
})
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Serein.NodeFlow.Model
|
||||
{
|
||||
// 接收上一节点参数or自定义参数内容
|
||||
object? parameter;
|
||||
object? result = PreviousNode?.GetFlowData(); // 条件节点透传上一节点的数据
|
||||
object? result = context.GetFlowData(PreviousNode.Guid); // 条件节点透传上一节点的数据
|
||||
if (IsCustomData) // 是否使用自定义参数
|
||||
{
|
||||
// 表达式获取上一节点数据
|
||||
@@ -88,7 +88,7 @@ namespace Serein.NodeFlow.Model
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
public override Parameterdata[] GetParameterdatas()
|
||||
public override ParameterData[] GetParameterdatas()
|
||||
{
|
||||
var value = CustomData switch
|
||||
{
|
||||
@@ -99,7 +99,7 @@ namespace Serein.NodeFlow.Model
|
||||
Type when CustomData.GetType() == typeof(bool) => ((bool)CustomData).ToString(),
|
||||
_ => CustomData?.ToString()!,
|
||||
};
|
||||
return [new Parameterdata
|
||||
return [new ParameterData
|
||||
{
|
||||
State = IsCustomData,
|
||||
Expression = Expression,
|
||||
@@ -114,11 +114,10 @@ namespace Serein.NodeFlow.Model
|
||||
this.Position = nodeInfo.Position;// 加载位置信息
|
||||
for (int i = 0; i < nodeInfo.ParameterData.Length; i++)
|
||||
{
|
||||
Parameterdata? pd = nodeInfo.ParameterData[i];
|
||||
ParameterData? pd = nodeInfo.ParameterData[i];
|
||||
node.IsCustomData = pd.State;
|
||||
node.CustomData = pd.Value;
|
||||
node.Expression = pd.Expression;
|
||||
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Serein.NodeFlow.Model
|
||||
//public override async Task<object?> Executing(IDynamicContext context)
|
||||
public override Task<object?> ExecutingAsync(IDynamicContext context)
|
||||
{
|
||||
var data = PreviousNode?.GetFlowData(); // 表达式节点使用上一节点数据
|
||||
var data = context.GetFlowData(PreviousNode.Guid); // 表达式节点使用上一节点数据
|
||||
|
||||
try
|
||||
{
|
||||
@@ -59,9 +59,9 @@ namespace Serein.NodeFlow.Model
|
||||
|
||||
}
|
||||
|
||||
public override Parameterdata[] GetParameterdatas()
|
||||
public override ParameterData[] GetParameterdatas()
|
||||
{
|
||||
return [new Parameterdata { Expression = Expression }];
|
||||
return [new ParameterData { Expression = Expression }];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Serein.NodeFlow.Model
|
||||
public override async Task<object?> ExecutingAsync(IDynamicContext context)
|
||||
{
|
||||
#region 执行前中断
|
||||
if (DebugSetting.InterruptClass != InterruptClass.None) // 执行触发前
|
||||
if (DebugSetting.IsInterrupt) // 执行触发前
|
||||
{
|
||||
string guid = this.Guid.ToString();
|
||||
var cancelType = await this.DebugSetting.GetInterruptTask();
|
||||
@@ -82,13 +82,15 @@ namespace Serein.NodeFlow.Model
|
||||
/// 获取触发器参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Parameterdata[] GetParameterdatas()
|
||||
public override ParameterData[] GetParameterdatas()
|
||||
{
|
||||
if (base.MethodDetails.ParameterDetailss.Length > 0)
|
||||
{
|
||||
return MethodDetails.ParameterDetailss
|
||||
.Select(it => new Parameterdata
|
||||
.Select(it => new ParameterData
|
||||
{
|
||||
SourceNodeGuid = it.ArgDataSourceNodeGuid,
|
||||
SourceType = it.ArgDataSourceType.ToString(),
|
||||
State = it.IsExplicitData,
|
||||
Value = it.DataValue
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user