Withdraw() private méthode

撤销活动实例
private Withdraw ( int activityInstanceID, Slickflow.Engine.Common.WfAppRunner runner, IDbSession session ) : void
activityInstanceID int
runner Slickflow.Engine.Common.WfAppRunner
session IDbSession
Résultat void
        /// <summary>
        /// 撤销处理具体功能实现
        /// </summary>
        /// <param name="session"></param>
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //创建新任务节点
            var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);

            nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                base.BackwardContext.BackwardFromActivityInstance,
                BackwardTypeEnum.Withdrawed,
                backMostPreviouslyActivityInstanceID,
                base.BackwardContext.BackwardToTargetTransitionGUID,
                TransitionTypeEnum.Withdrawed,
                TransitionFlyingTypeEnum.NotFlying,
                base.ActivityResource,
                session);

            //更新撤销节点的状态(从准备状态更新为撤销状态)
            var aim = new ActivityInstanceManager();
            aim.Withdraw(base.BackwardContext.BackwardFromActivityInstance.ID,
                base.ActivityResource.AppRunner, session);

            //更新主节点状态为撤销状态(会签,加签类型)
            var hostActivityInstanceID = base.BackwardContext.BackwardFromActivityInstance.MIHostActivityInstanceID;
            if (hostActivityInstanceID != null)
            {
                aim.Withdraw(hostActivityInstanceID.Value,
                    base.ActivityResource.AppRunner,
                    session);
            }

            //构造回调函数需要的数据
            WfExecutedResult result = base.WfExecutedResult;
            result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
            result.Status = WfExecutedStatus.Success;
        }
        /// <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;
        }