解决了流程接口节点执行后,后续调用的节点无法正确获取入参的问题

This commit is contained in:
fengjiayi
2025-05-30 10:53:33 +08:00
parent a112d0287f
commit 423fc0d8fc
6 changed files with 103 additions and 9 deletions

View File

@@ -56,6 +56,11 @@ namespace Serein.Library
/// </summary>
private readonly ConcurrentDictionary<NodeModelBase, NodeModelBase> dictPreviousNodes = new ConcurrentDictionary<NodeModelBase, NodeModelBase>();
/// <summary>
/// 记录忽略处理的流程
/// </summary>
private readonly ConcurrentDictionary<NodeModelBase, bool> dictIgnoreNodeFlow = new ConcurrentDictionary<NodeModelBase, bool>();
/// <summary>
/// 设置运行时上一节点
/// </summary>
@@ -66,6 +71,35 @@ namespace Serein.Library
dictPreviousNodes.AddOrUpdate(currentNodeModel, (_) => PreviousNode, (o, n) => PreviousNode);
}
/// <summary>
/// 忽略处理该节点流程
/// </summary>
/// <param name="node"></param>
public void IgnoreFlowHandle(NodeModelBase node)
{
dictIgnoreNodeFlow.AddOrUpdate(node, (o) => true, (o, n) => true);
}
/// <summary>
/// 获取此次流程处理状态
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
public bool GetIgnodeFlowStateUpload(NodeModelBase node)
{
return dictIgnoreNodeFlow.TryGetValue(node, out var state) ? state : false;
}
/// <summary>
/// 恢复流程处理状态
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
public void RecoverIgnodeFlowStateUpload(NodeModelBase node)
{
dictIgnoreNodeFlow.AddOrUpdate(node, (o) => false, (o, n) => false);
}
/// <summary>
/// 获取当前节点的运行时上一节点
/// </summary>

View File

@@ -3,6 +3,7 @@ using Serein.Library.Utils;
using Serein.Library.Utils.SereinExpression;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading;
@@ -254,10 +255,23 @@ namespace Serein.Library
}
else
{
if(!env.TryGetNodeModel(ArgDataSourceNodeGuid, out var argSourceNodeModel))
{
throw new Exception($"[arg{Index}][{Name}][{DataType}]需要节点[{ArgDataSourceNodeGuid}]的参数,但节点不存在");
}
// 如果是公开的节点,需要判断上下文调用中是否存在流程接口节点
if (argSourceNodeModel.IsPublic)
{
var pn = context.GetPreviousNode(NodeModel);
if(pn.ControlType == NodeControlType.FlowCall)
{
argSourceNodeModel = pn;
}
}
if (ArgDataSourceType == ConnectionArgSourceType.GetOtherNodeData)
{
var flowData = context.GetFlowData(argSourceNodeModel);