/// <summary> /// 处理审批通过的方法 /// </summary> /// <param name="toDoWork"></param> /// <param name="Actioner"></param> private void DoApproval(ToDoWork toDoWork, User Actioner) { var allOfTheNextProcessNodeInstances = toDoWork.ProcessNodeInstance.NextProcessNodeInstances; //能够被指向的下个节点 var canBeActiveNextNodes = allOfTheNextProcessNodeInstances.Where( allOfTheNextNode => allOfTheNextNode.Expression.Compile().Invoke(allOfTheNextNode.BizContext)); //判断当前提交的这个节点的可被激活的下一级节点是否是会签节点,如果是会签节点,就要判断它会签的那些节点是否是审批通过状态 foreach (var canBeActiveNextNode in canBeActiveNextNodes) { //判断某一个节点是否是会签节点 if (this.IsCounterSignature(canBeActiveNextNode)) { } else { //如果非会签节点,那么就得到Linkage var linkages = canBeActiveNextNode.Linkages.Where( linkage => linkage.Expression.Compile().Invoke(canBeActiveNextNode.BizContext)); //生成待办 foreach (var linkage in linkages) { this.HibernateClass.BuildToDo(linkage); } //关闭当前待办 this.HibernateClass.CloseToDoWork(toDoWork); } } }
public object Submit(ToDoWork toDoWork, User Actioner) { //得到该流程实例下所有的流程节点实例 var processNodeInstances = this.HibernateClass.GetProcessNodeInstancesByProcessInstanceID(toDoWork.ProcessNodeInstance.ProcessInstance.ID); switch (toDoWork.Action) { case Action.Approve: this.DoApproval(toDoWork, Actioner); break; case Action.Return: this.DoReturn(toDoWork, Actioner); break; } return(new object()); }
/// <summary> /// 处理退回的方法 /// </summary> /// <param name="toDoWork"></param> /// <param name="Actioner"></param> private void DoReturn(ToDoWork toDoWork, User Actioner) { var canBeActivePreProcessNodeInstances = toDoWork.ProcessNodeInstance.PreProcessNodeInstances.Where( preProcessNodeInstance => preProcessNodeInstance.Expression.Compile().Invoke(preProcessNodeInstance.BizContext)); foreach (var canBeActivePreProcessNodeInstance in canBeActivePreProcessNodeInstances) { var linkages = canBeActivePreProcessNodeInstance.Linkages.Where(linkage => linkage.Expression.Compile().Invoke(canBeActivePreProcessNodeInstance.BizContext)); foreach (var linkage in linkages) { this.HibernateClass.BuildToDo(linkage); } this.HibernateClass.CloseToDoWork(toDoWork); } }