コード例 #1
0
        /// <summary>
        /// 退回操作的处理逻辑
        /// </summary>
        /// <param name="session">会话</param>
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);
            var aim = new ActivityInstanceManager();
            var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();

            //上一步节点是普通节点的退回处理
            nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                                                                              base.BackwardContext.BackwardFromActivityInstance,
                                                                              BackwardTypeEnum.Sendback,
                                                                              backMostPreviouslyActivityInstanceID,
                                                                              base.BackwardContext.BackwardToTargetTransitionGUID,
                                                                              TransitionTypeEnum.Sendback,
                                                                              TransitionFlyingTypeEnum.NotFlying,
                                                                              base.ActivityResource,
                                                                              session);

            //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
            aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                         base.ActivityResource.AppRunner,
                         session);

            //构造回调函数需要的数据
            WfExecutedResult result = base.WfExecutedResult;

            result.BackwardTaskReceiver = base.BackwardContext.BackwardTaskReceiver;
            result.ReturnDataContext    = nodeMediatorBackward.ReturnDataContext;
            result.Status = WfExecutedStatus.Success;
        }
コード例 #2
0
        /// <summary>
        /// 跳转执行方法
        /// </summary>
        /// <param name="session">会话</param>
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            WfExecutedResult result = base.WfExecutedResult;

            //创建新任务节点
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);

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

            //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
            var aim = new ActivityInstanceManager();

            aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                         base.ActivityResource.AppRunner,
                         session);

            //构造回调函数需要的数据
            result.BackwardTaskReceiver = base.BackwardContext.BackwardTaskReceiver;
            result.Status = WfExecutedStatus.Success;
        }
コード例 #3
0
        /// <summary>
        /// 跳转执行方法
        /// </summary>
        /// <param name="session">会话</param>
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            WfExecutedResult result = base.WfExecutedResult;

            //回跳类型的处理
            if (base.IsBackward == true)
            {
                //创建新任务节点
                var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);
                nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                                                                                  base.BackwardContext.BackwardFromActivityInstance,
                                                                                  BackwardTypeEnum.Sendback,
                                                                                  base.BackwardContext.BackwardToTargetTransitionGUID,
                                                                                  TransitionTypeEnum.Sendback,
                                                                                  TransitionFlyingTypeEnum.NotFlying,
                                                                                  base.ActivityResource,
                                                                                  session);

                //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
                var aim = new ActivityInstanceManager();
                aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                             base.ActivityResource.AppRunner,
                             session);

                //构造回调函数需要的数据
                result.BackwardTaskReceiver = base.BackwardContext.BackwardTaskReceiver;
                result.Status = WfExecutedStatus.Success;
            }
            else
            {
                var jumpActivityGUID            = base.AppRunner.NextActivityPerformers.First().Key;
                var jumpforwardActivity         = base.ProcessModel.GetActivity(jumpActivityGUID);
                var processInstance             = (new ProcessInstanceManager()).GetById(base.RunningActivityInstance.ProcessInstanceID);
                var jumpforwardExecutionContext = ActivityForwardContext.CreateJumpforwardContext(jumpforwardActivity,
                                                                                                  base.ProcessModel, processInstance, base.ActivityResource);

                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(jumpforwardExecutionContext, session);
                mediator.Linker.FromActivityInstance = base.RunningActivityInstance;
                mediator.Linker.ToActivity           = jumpforwardActivity;

                if (mediator is NodeMediatorEnd)
                {
                    //结束节点的连线转移
                    mediator.CreateActivityTaskTransitionInstance(jumpforwardActivity,
                                                                  processInstance,
                                                                  base.RunningActivityInstance,
                                                                  WfDefine.WF_XPDL_JUMP_BYPASS_GUID,
                                                                  TransitionTypeEnum.Forward,
                                                                  TransitionFlyingTypeEnum.ForwardFlying,
                                                                  base.ActivityResource,
                                                                  session);
                }
                mediator.ExecuteWorkItem();

                result.Status  = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
        }
コード例 #4
0
        /// <summary>
        /// 更新当前运行节点状态为退回状态
        /// </summary>
        /// <param name="session">会话</param>
        private void SetRunningNodeSendBack(IDbSession session)
        {
            //更新当前任务记录为退回状态
            var tm = new TaskManager();

            tm.SendBack(base.TaskView.TaskID, base.SendBackOperation.ActivityResource.AppRunner, session);

            //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
            var aim = new ActivityInstanceManager();

            aim.SendBack(base.SendBackOperation.BackwardFromActivityInstance.ID,
                         base.SendBackOperation.ActivityResource.AppRunner,
                         session);
        }
コード例 #5
0
        /// <summary>
        /// 跳转执行方法
        /// </summary>
        /// <param name="session">会话</param>
        internal override void ExecuteInstanceImp()
        {
            WfExecutedResult result = base.WfExecutedResult;

            //回跳类型的处理
            if (base.IsBackward == true)
            {
                //创建新任务节点
                var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
                var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, AppRunner, _dataAccessor, _loggerFactory);

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

                //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
                var aim = new ActivityInstanceManager(_dataAccessor, _loggerFactory);
                aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.Fid,
                             AppRunner);

                //构造回调函数需要的数据
                result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
                result.Status = WfExecutedStatus.Success;
            }
            else
            {
                var jumpActivityGUID            = base.AppRunner.NextActivity.ActivityID;
                var jumpforwardActivity         = base.ProcessModel.GetActivity(jumpActivityGUID);
                var proecessInstance            = (new ProcessInstanceManager(_dataAccessor, _loggerFactory)).GetByFid(base.RunningActivityInstance.ProcessInsUid);
                var jumpforwardExecutionContext = ActivityForwardContext.CreateJumpforwardContext(jumpforwardActivity,
                                                                                                  base.ProcessModel, proecessInstance);

                NodeMediator mediator = NodeMediatorFactory.CreateNodeMediator(jumpforwardExecutionContext, AppRunner, _dataAccessor, _loggerFactory);
                mediator.Linker.FromActivityInstance = base.RunningActivityInstance;
                mediator.Linker.ToActivity           = jumpforwardActivity;
                mediator.ExecuteWorkItem();

                result.Status  = WfExecutedStatus.Success;
                result.Message = mediator.GetNodeMediatedMessage();
            }
        }
コード例 #6
0
        /// <summary>
        /// 多实例节点(会签,加签)情况下的退回处理
        /// </summary>
        /// <param name="session"></param>
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //创建撤销到上一步的节点记录
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);

            nodeMediatorBackward.CreateBackwardActivityTaskOfInnerMultipleInstance(
                base.BackwardContext.ProcessInstance,
                base.BackwardContext.BackwardToTaskActivityInstance,
                BackwardTypeEnum.SendbackOfMI,
                base.BackwardContext.BackwardFromActivityInstance.ID,
                base.ActivityResource,
                session);

            //置当前节点为退回状态
            var aim         = new ActivityInstanceManager();
            var runningNode = BackwardContext.BackwardFromActivityInstance;

            aim.SendBack(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="session"></param>
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, session);
            var aim = new ActivityInstanceManager();
            var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
            var previousActvityInstance = aim.GetById(backMostPreviouslyActivityInstanceID);

            if (previousActvityInstance.MIHostActivityInstanceID != null)
            {
                //上一步节点是会签节点的退回处理
                var mainPrevousActivityInstance = aim.GetById(previousActvityInstance.MIHostActivityInstanceID.Value);
                if (mainPrevousActivityInstance.ComplexType.Value == (short)ComplexTypeEnum.SignTogether)
                {
                    //如果是会签节点,则需要重新实例化会签节点上的所有办理人的任务
                    nodeMediatorBackward.CreateBackwardActivityTaskRepeatedSignTogetherMultipleInstance(
                        base.BackwardContext.ProcessInstance,
                        base.BackwardContext.BackwardToTaskActivity,
                        base.BackwardContext.BackwardFromActivityInstance,
                        BackwardTypeEnum.Sendback,
                        mainPrevousActivityInstance,
                        base.BackwardContext.BackwardToTargetTransitionGUID,
                        TransitionTypeEnum.Sendback,
                        TransitionFlyingTypeEnum.NotFlying,
                        base.ActivityResource,
                        session);

                    //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
                    aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                                 base.ActivityResource.AppRunner,
                                 session);
                }
                else if (mainPrevousActivityInstance.ComplexType.Value == (short)ComplexTypeEnum.SignForward)
                {
                    //上一步节点是加签节点的退回处理
                    nodeMediatorBackward.CreateBackwardActivityTaskRepateSignForwardMainNodeOnly(base.BackwardContext.ProcessInstance,
                                                                                                 base.BackwardContext.BackwardToTaskActivity,
                                                                                                 base.BackwardContext.BackwardFromActivityInstance,
                                                                                                 BackwardTypeEnum.Sendback,
                                                                                                 mainPrevousActivityInstance,
                                                                                                 base.BackwardContext.BackwardToTargetTransitionGUID,
                                                                                                 TransitionTypeEnum.Sendback,
                                                                                                 TransitionFlyingTypeEnum.NotFlying,
                                                                                                 base.ActivityResource,
                                                                                                 session);

                    //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
                    aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                                 base.ActivityResource.AppRunner,
                                 session);
                }
            }
            else
            {
                //上一步节点是普通节点的退回处理
                nodeMediatorBackward.CreateBackwardActivityTaskTransitionInstance(base.BackwardContext.ProcessInstance,
                                                                                  base.BackwardContext.BackwardFromActivityInstance,
                                                                                  BackwardTypeEnum.Sendback,
                                                                                  backMostPreviouslyActivityInstanceID,
                                                                                  base.BackwardContext.BackwardToTargetTransitionGUID,
                                                                                  TransitionTypeEnum.Sendback,
                                                                                  TransitionFlyingTypeEnum.NotFlying,
                                                                                  base.ActivityResource,
                                                                                  session);

                //更新当前办理节点的状态(从准备或运行状态更新为退回状态)
                aim.SendBack(base.BackwardContext.BackwardFromActivityInstance.ID,
                             base.ActivityResource.AppRunner,
                             session);
            }

            //构造回调函数需要的数据
            WfExecutedResult result = base.WfExecutedResult;

            result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
            result.Status = WfExecutedStatus.Success;
        }