Exemplo n.º 1
0
        /// <summary>
        /// 返签执行方法
        /// </summary>
        /// <param name="session">会话</param>
        internal override void ExecuteInstanceImp(IDbSession session)
        {
            //修改流程实例为返签状态
            var pim = new ProcessInstanceManager();

            pim.Reverse(base.BackwardContext.ProcessInstance.ID,
                        base.ActivityResource.AppRunner,
                        session);

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

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

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

            result.BackwardTaskReceiver = base.BackwardContext.BackwardTaskReceiver;
            result.Status = WfExecutedStatus.Success;
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
        /// <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);

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

            result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
            result.Status = WfExecutedStatus.Success;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 返签执行方法
        /// </summary>
        /// <param name="session">会话</param>
        internal override void ExecuteInstanceImp()
        {
            //修改流程实例为返签状态
            var pim = new ProcessInstanceManager(_serviceProvider);

            pim.Reverse(base.BackwardContext.ProcessInstance.Fid);

            //创建新任务节点
            var backMostPreviouslyActivityInstanceID = GetBackwardMostPreviouslyActivityInstanceID();
            var nodeMediatorBackward = new NodeMediatorBackward(base.BackwardContext, AppRunner, _dataAccessor, _loggerFactory);

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

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

            result.BackwardTaskReciever = base.BackwardContext.BackwardTaskReciever;
            result.Status = WfExecutedStatus.Success;
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
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();
            }
        }
Exemplo n.º 7
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();
            }
        }
        /// <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;
        }