/// <summary> /// 创建运行时实例对象 /// </summary> /// <param name="runner">执行者</param> /// <param name="result">结果对象</param> /// <returns>运行时实例对象</returns> public static WfRuntimeManager CreateRuntimeInstanceAppRunning( WfAppRunner runner, ref WfExecutedResult result) { //检查传人参数是否有效 var rmins = new WfRuntimeManagerAppRunning(); rmins.WfExecutedResult = result = new WfExecutedResult(); if (string.IsNullOrEmpty(runner.AppName) || String.IsNullOrEmpty(runner.AppInstanceID) || runner.ProcessGUID == null) { result.Status = WfExecutedStatus.Exception; result.ExceptionType = WfExceptionType.RunApp_ErrorArguments; result.Message = "方法参数错误,无法运行流程!"; return(rmins); } //传递runner变量 rmins.AppRunner = runner; var aim = new ActivityInstanceManager(); TaskViewEntity taskView = null; var runningNode = aim.GetRunningNode(runner, out taskView); //判断是否是当前登录用户的任务 if (runningNode.AssignedToUserIDs.Contains(runner.UserID.ToString()) == false) { result.Status = WfExecutedStatus.Exception; result.ExceptionType = WfExceptionType.RunApp_HasNoTask; result.Message = "当前没有登录用户要办理的任务,无法运行流程!"; return(rmins); } var processModel = ProcessModelFactory.Create(taskView.ProcessGUID, taskView.Version); var activityResource = new ActivityResource(runner, runner.NextActivityPerformers, runner.Conditions, runner.DynamicVariables); var tm = new TaskManager(); rmins.TaskView = taskView; rmins.RunningActivityInstance = runningNode; rmins.ProcessModel = processModel; rmins.ActivityResource = activityResource; return(rmins); }
/// <summary> /// 创建运行时实例对象 /// </summary> /// <param name="runner">执行者</param> /// <param name="session">数据库会话</param> /// <param name="result">结果对象</param> /// <returns>运行时实例对象</returns> public static WfRuntimeManager CreateRuntimeInstanceAppRunning(WfAppRunner runner, IDbSession session, ref WfExecutedResult result) { //检查传人参数是否有效 var rmins = new WfRuntimeManagerAppRunning(); rmins.WfExecutedResult = result = new WfExecutedResult(); if (string.IsNullOrEmpty(runner.AppName) || String.IsNullOrEmpty(runner.AppInstanceID) || runner.ProcessGUID == null) { result.Status = WfExecutedStatus.Exception; result.ExceptionType = WfExceptionType.RunApp_ErrorArguments; result.Message = LocalizeHelper.GetEngineMessage("wfruntimemanagerfactory.CreateRuntimeInstanceAppRunning.missing.error"); return(rmins); } //传递runner变量 rmins.AppRunner = runner; var aim = new ActivityInstanceManager(); TaskViewEntity taskView = null; var runningNode = aim.GetRunningNode(runner, session, out taskView); //判断是否是当前登录用户的任务 if (runningNode.AssignedToUserIDs.Contains(runner.UserID.ToString()) == false) { result.Status = WfExecutedStatus.Exception; result.ExceptionType = WfExceptionType.RunApp_HasNoTask; result.Message = LocalizeHelper.GetEngineMessage("wfruntimemanagerfactory.CreateRuntimeInstanceAppRunning.nonetask.error"); return(rmins); } //用于流程注册事件时的流程实例ID提供 rmins.ProcessInstanceID = runningNode.ProcessInstanceID; var processModel = ProcessModelFactory.Create(taskView.ProcessGUID, taskView.Version); var activityResource = new ActivityResource(runner, runner.NextActivityPerformers, runner.Conditions); rmins.TaskView = taskView; rmins.RunningActivityInstance = runningNode; rmins.ProcessModel = processModel; rmins.ActivityResource = activityResource; return(rmins); }