From f8997ea930bedf5721611e7f9368b95dce252d90 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Sat, 9 Oct 2021 15:41:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=8E=B7=E5=8F=96=E4=B8=8B?= =?UTF-8?q?=E4=B8=80=E8=8A=82=E7=82=B9=20=20GetNextNodes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Workflow.Engine/NWFEngine.cs | 197 ++++++++++++------ 1 file changed, 139 insertions(+), 58 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Workflow/Learun.Workflow.Engine/NWFEngine.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Workflow/Learun.Workflow.Engine/NWFEngine.cs index 69a05d15d..0dee5db3d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Workflow/Learun.Workflow.Engine/NWFEngine.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Workflow/Learun.Workflow.Engine/NWFEngine.cs @@ -283,6 +283,7 @@ namespace Learun.Workflow.Engine } } + /// /// 获取下一节点 /// @@ -292,89 +293,169 @@ namespace Learun.Workflow.Engine public List GetNextNodes(string nodeId, string code, List lineList, bool overFW = false) { - List nextNodes = new List(); - // 找到与当前节点相连的线条 - NWFLineInfo line = null; //如果lastNode 不为空,直接执行最后一条线的绑定方法 并终止任务 + List lineList1 = new List(); if (overFW) { - line = wfScheme.lines.Last(); + lineList1.Add(wfScheme.lines.Last()); } else { - List listLine = new List(); - listLine = wfScheme.lines.Where(a => a.from == nodeId).ToList(); - if (listLine.Count > 1) - { - line = wfScheme.lines.FirstOrDefault(a => a.from == nodeId && a.agreeList == code); - } - else - { - line = listLine.FirstOrDefault(); - } - } - + lineList1 = wfScheme.lines; - bool isOk = false; - if (string.IsNullOrEmpty(line.strategy) || line.strategy == "1") - { - isOk = true; } - else + + // 找到与当前节点相连的线条 + foreach (var line in lineList1) { - var codeList = line.agreeList.Split(','); - foreach (string _code in codeList) + if (line.from == nodeId) { - if (_code == code) + bool isOk = false; + if (string.IsNullOrEmpty(line.strategy) || line.strategy == "1") { isOk = true; - break; - } - } - } - if (isOk) - { - if (nodesMap.ContainsKey(line.to)) - { - //如果lastNode 不为空,直接执行最后一条线的绑定方法 并终止任务 - if (overFW) - { - nextNodes.Add(endNode); } else { - nextNodes.Add(nodesMap[line.to]); - } - - switch (line.operationType) - {// 绑定的操作类型 - case "sql": // sql 语句 - if (!string.IsNullOrEmpty(line.dbId) && !string.IsNullOrEmpty(line.strSql)) - { - lineList.Add(line); - } - break; - case "interface": // interface 接口 - if (!string.IsNullOrEmpty(line.strInterface)) - { - lineList.Add(line); - } - break; - case "ioc": // 依赖注入 - if (!string.IsNullOrEmpty(line.iocName)) + var codeList = line.agreeList.Split(','); + foreach (string _code in codeList) + { + if (_code == code) { - lineList.Add(line); + isOk = true; + break; } - break; + } } + if (isOk) + { + if (nodesMap.ContainsKey(line.to)) + { + nextNodes.Add(nodesMap[line.to]); + + switch (line.operationType) + {// 绑定的操作类型 + case "sql": // sql 语句 + if (!string.IsNullOrEmpty(line.dbId) && !string.IsNullOrEmpty(line.strSql)) + { + lineList.Add(line); + } + break; + case "interface": // interface 接口 + if (!string.IsNullOrEmpty(line.strInterface)) + { + lineList.Add(line); + } + break; + case "ioc": // 依赖注入 + if (!string.IsNullOrEmpty(line.iocName)) + { + lineList.Add(line); + } + break; + } + } + } } } - return nextNodes; } + + ///// + ///// 获取下一节点 + ///// + ///// 当前节点Id + ///// 节点操作码 agree 同意 disagree 不同意 lrtimeout 超时 + ///// 节点信息列表 + //public List GetNextNodes(string nodeId, string code, List lineList, bool overFW = false) + //{ + + + // List nextNodes = new List(); + // // 找到与当前节点相连的线条 + // NWFLineInfo line = null; + // //如果lastNode 不为空,直接执行最后一条线的绑定方法 并终止任务 + // if (overFW) + // { + // line = wfScheme.lines.Last(); + // } + // else + // { + // List listLine = new List(); + // listLine = wfScheme.lines.Where(a => a.from == nodeId).ToList(); + // if (listLine.Count > 1) + // { + // line = wfScheme.lines.FirstOrDefault(a => a.from == nodeId && a.agreeList == code); + // } + // else + // { + // line = listLine.FirstOrDefault(); + // } + // } + + + // bool isOk = false; + // if (string.IsNullOrEmpty(line.strategy) || line.strategy == "1") + // { + // isOk = true; + // } + // else + // { + // var codeList = line.agreeList.Split(','); + // foreach (string _code in codeList) + // { + // if (_code == code) + // { + // isOk = true; + // break; + // } + // } + // } + // if (isOk) + // { + // if (nodesMap.ContainsKey(line.to)) + // { + // //如果lastNode 不为空,直接执行最后一条线的绑定方法 并终止任务 + // if (overFW) + // { + // nextNodes.Add(endNode); + // } + // else + // { + // nextNodes.Add(nodesMap[line.to]); + // } + + // switch (line.operationType) + // {// 绑定的操作类型 + // case "sql": // sql 语句 + // if (!string.IsNullOrEmpty(line.dbId) && !string.IsNullOrEmpty(line.strSql)) + // { + // lineList.Add(line); + // } + // break; + // case "interface": // interface 接口 + // if (!string.IsNullOrEmpty(line.strInterface)) + // { + // lineList.Add(line); + // } + // break; + // case "ioc": // 依赖注入 + // if (!string.IsNullOrEmpty(line.iocName)) + // { + // lineList.Add(line); + // } + // break; + // } + + // } + // } + + // return nextNodes; + + //} /// /// 获取上一节点列表 ///