From 2eef022042824039cb3b6e5eb749627fa09684fe Mon Sep 17 00:00:00 2001 From: besley Date: Sun, 8 Dec 2024 15:06:41 +0800 Subject: [PATCH] fixed signforward jump back feature --- .../Pattern/NodeMediatorMultiSignForward.cs | 67 ++++++++++--------- .../Core/Pattern/NodeMediatorSignForward.cs | 5 +- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorMultiSignForward.cs b/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorMultiSignForward.cs index 835ce707..7d5dbdcc 100644 --- a/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorMultiSignForward.cs +++ b/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorMultiSignForward.cs @@ -87,6 +87,13 @@ internal bool CompleteWorkItem(int? taskID, base.LinkContext.FromActivityInstance.ActivityState = (short)ActivityStateEnum.Completed; + //如果是非正常流转模式,不用判断通过率,直接跳转 + if (base.ActivityForwardContext.IsNotParsedByTransition == true) + { + canContinueForwardCurrentNode = true; + return canContinueForwardCurrentNode; + } + //多实例会签和加签处理 //先判断是否是会签和加签类型 //主节点不为空时不发起加签可以正常运行 @@ -163,44 +170,44 @@ internal bool CompleteWorkItem(int? taskID, base.WfNodeMediatedResult.Feedback = WfNodeMediatedFeedback.NotEnoughApprovalBranchesCount; } } - else - { - if (mainActivityInstance.CompleteOrder == null || mainActivityInstance.CompleteOrder > 1)//串行会签未设置通过率的判断 - mainActivityInstance.CompleteOrder = 1; + } + else + { + if (mainActivityInstance.CompleteOrder == null || mainActivityInstance.CompleteOrder > 1)//串行会签未设置通过率的判断 + mainActivityInstance.CompleteOrder = 1; - if ((base.LinkContext.FromActivityInstance.CompleteOrder * 0.01) / (maxOrder * 0.01) >= mainActivityInstance.CompleteOrder) + if ((base.LinkContext.FromActivityInstance.CompleteOrder * 0.01) / (maxOrder * 0.01) >= mainActivityInstance.CompleteOrder) + { + var passed = base.ActivityInstanceManager.GetMiApprovalThresholdStatus(base.LinkContext.FromActivityInstance, + mainActivityInstance, session); + if (passed) { - var passed = base.ActivityInstanceManager.GetMiApprovalThresholdStatus(base.LinkContext.FromActivityInstance, - mainActivityInstance, session); - if (passed) - { - //完成最后一个会签任务,会签主节点状态由挂起设置为完成状态 - mainActivityInstance.ActivityState = (short)ActivityStateEnum.Completed; - base.ActivityInstanceManager.Update(mainActivityInstance, session); - //更新未办理完成节点状态为取消状态 - base.ActivityInstanceManager.CancelUnCompletedMultipleInstance(mainActivityInstance.ID, session, runner); - } - else - { - canContinueForwardCurrentNode = false; - base.WfNodeMediatedResult.Feedback = WfNodeMediatedFeedback.NotEnoughApprovalBranchesCount; - } + //完成最后一个会签任务,会签主节点状态由挂起设置为完成状态 + mainActivityInstance.ActivityState = (short)ActivityStateEnum.Completed; + base.ActivityInstanceManager.Update(mainActivityInstance, session); + //更新未办理完成节点状态为取消状态 + base.ActivityInstanceManager.CancelUnCompletedMultipleInstance(mainActivityInstance.ID, session, runner); } else { - //设置下一个任务进入准备状态 - var nextActivityInstance = sqList[0]; //始终取第一条挂起实例 - nextActivityInstance.ActivityState = (short)ActivityStateEnum.Ready; - base.ActivityInstanceManager.Update(nextActivityInstance, session); - - //更新主节点的执行人员列表 - mainActivityInstance.NextStepPerformers = NextStepUtility.SerializeNextStepPerformers( - base.ActivityForwardContext.ActivityResource.AppRunner.NextActivityPerformers); - base.ActivityInstanceManager.Update(mainActivityInstance, session); canContinueForwardCurrentNode = false; - base.WfNodeMediatedResult.Feedback = WfNodeMediatedFeedback.ForwardToNextSequenceTask; + base.WfNodeMediatedResult.Feedback = WfNodeMediatedFeedback.NotEnoughApprovalBranchesCount; } } + else + { + //设置下一个任务进入准备状态 + var nextActivityInstance = sqList[0]; //始终取第一条挂起实例 + nextActivityInstance.ActivityState = (short)ActivityStateEnum.Ready; + base.ActivityInstanceManager.Update(nextActivityInstance, session); + + //更新主节点的执行人员列表 + mainActivityInstance.NextStepPerformers = NextStepUtility.SerializeNextStepPerformers( + base.ActivityForwardContext.ActivityResource.AppRunner.NextActivityPerformers); + base.ActivityInstanceManager.Update(mainActivityInstance, session); + canContinueForwardCurrentNode = false; + base.WfNodeMediatedResult.Feedback = WfNodeMediatedFeedback.ForwardToNextSequenceTask; + } } } else if (signforwardType == SignForwardTypeEnum.SignForwardParallel) diff --git a/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorSignForward.cs b/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorSignForward.cs index 7eb4d4d4..17314989 100644 --- a/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorSignForward.cs +++ b/source/lib/Slickflow.Engine/Core/Pattern/NodeMediatorSignForward.cs @@ -44,7 +44,10 @@ internal override void ExecuteWorkItem() else { base.ActivityForwardContext.FromActivityInstance.CompareType = (short)CompareTypeEnum.Percentage; - base.ActivityForwardContext.FromActivityInstance.CompleteOrder = 1; + if (controlParamSheet.SignForwardCompleteOrder != 0) + base.ActivityForwardContext.FromActivityInstance.CompleteOrder = controlParamSheet.SignForwardCompleteOrder; + else + base.ActivityForwardContext.FromActivityInstance.CompleteOrder = 1; } //更新当前实例节点为主节点,并且置当前节点为挂起状态