/// <summary> /// 多实例情况下(会签和加签)撤销处理 /// </summary> /// <param name="session"></param> internal override void ExecuteInstanceImp(IDbSession session) { var runningNode = BackwardContext.BackwardFromActivityInstance; //创建撤销到上一步的节点记录 var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session); nodeMediatorBackward.CreateBackwardActivityTaskOfInnerMultipleInstance( base.BackwardContext.ProcessInstance, base.BackwardContext.BackwardToTaskActivityInstance, BackwardTypeEnum.WithdrawedOfMI, base.BackwardContext.BackwardFromActivityInstance.ID, base.ActivityResource, session); //置当前节点为撤销状态 var aim = new ActivityInstanceManager(); aim.Withdraw(runningNode.ID, base.ActivityResource.AppRunner, session); //创建新的一条待办状态的记录,用于下次执行 var newSuspendNode = aim.CreateActivityInstanceObject(runningNode); newSuspendNode.ActivityState = (short)ActivityStateEnum.Suspended; newSuspendNode.MIHostActivityInstanceID = runningNode.MIHostActivityInstanceID; newSuspendNode.CompleteOrder = runningNode.CompleteOrder; newSuspendNode.ComplexType = runningNode.ComplexType; newSuspendNode.SignForwardType = runningNode.SignForwardType; newSuspendNode.AssignedToUserIDs = runningNode.AssignedToUserIDs; newSuspendNode.AssignedToUserNames = runningNode.AssignedToUserNames; aim.Insert(newSuspendNode, session); //同时为此活动实例,创建新的任务 var tm = new TaskManager(); tm.Renew(base.BackwardContext.BackwardFromActivityInstance, newSuspendNode, base.AppRunner, session); //构造回调函数需要的数据 WfExecutedResult result = base.WfExecutedResult; result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever; result.Status = WfExecutedStatus.Success; }
/// <summary> /// 创建节点对象 /// </summary> /// <param name="processInstance">流程实例</param> protected ActivityInstanceEntity CreateActivityInstanceObject(ActivityEntity activity, ProcessInstanceEntity processInstance, WfAppRunner runner) { ActivityInstanceManager aim = new ActivityInstanceManager(); this.GatewayActivityInstance = aim.CreateActivityInstanceObject(processInstance.AppName, processInstance.AppInstanceID, processInstance.ID, activity, runner); return this.GatewayActivityInstance; }