/// <summary> /// 从消息视图中封装运行者对象 /// </summary> /// <param name="msgRunnerView">消息视图</param> /// <returns>运行者对象</returns> private WfAppRunner GetRunnerFromMessagExchange(MessageRunnerView msgRunnerView) { var runner = new WfAppRunner(); runner.ProcessGUID = msgRunnerView.ProcessEntity.ProcessGUID; runner.Version = msgRunnerView.ProcessEntity.Version; runner.ProcessCode = msgRunnerView.ProcessEntity.ProcessCode; runner.AppName = msgRunnerView.WfAppRunner.AppName; runner.AppInstanceID = msgRunnerView.WfAppRunner.AppInstanceID; runner.AppInstanceCode = msgRunnerView.WfAppRunner.AppInstanceCode; runner.UserID = msgRunnerView.WfAppRunner.UserID; runner.UserName = msgRunnerView.WfAppRunner.UserName; var query = new TaskQuery { ProcessGUID = runner.ProcessGUID, AppInstanceID = runner.AppInstanceID }; var wfService = new WorkflowService(); var activityInstanceList = wfService.GetRunningActivityInstance(query); if (activityInstanceList.Count == 1) { var activityInstance = activityInstanceList[0]; runner.NextActivityPerformers = NextStepUtility.DeserializeNextStepPerformers(activityInstance.NextStepPerformers); } return(runner); }
/// <summary> /// 获取预选步骤人员列表 /// </summary> /// <param name="runner">当前运行用户</param> /// <returns>步骤预选人员列表</returns> private IDictionary <string, PerformerList> GetNextActivityPerformersPriliminary(WfAppRunner runner) { IDictionary <string, PerformerList> nextSteps = null; var tm = new TaskManager(); TaskViewEntity taskView = tm.GetTaskOfMine(runner); //读取活动实例中记录的步骤预选数据 var aim = new ActivityInstanceManager(); if (taskView.MIHostActivityInstanceID != null) { var mainActivityInstanceID = taskView.MIHostActivityInstanceID.Value; var mainActivityInstance = aim.GetById(mainActivityInstanceID); if (mainActivityInstance != null) { nextSteps = NextStepUtility.DeserializeNextStepPerformers(mainActivityInstance.NextStepPerformers); } } IProcessModel processModel = ProcessModelFactory.Create(runner.ProcessGUID, runner.Version); var nextActivity = processModel.GetNextActivity(taskView.ActivityGUID); if (nextActivity != null) { if (nextActivity.ActivityType == ActivityTypeEnum.GatewayNode) { //获取网关节点信息 var gatewayActivityInstance = aim.GetActivityInstanceLatest(taskView.ProcessInstanceID, nextActivity.ActivityGUID); if (gatewayActivityInstance != null && !string.IsNullOrEmpty(gatewayActivityInstance.NextStepPerformers)) { nextSteps = NextStepUtility.DeserializeNextStepPerformers(gatewayActivityInstance.NextStepPerformers); } } else if (XPDLHelper.IsInterTimerEventComponentNode(nextActivity) == true) { //中间Timer事件节点 var timerActivityInstance = aim.GetActivityInstanceLatest(taskView.ProcessInstanceID, nextActivity.ActivityGUID); if (timerActivityInstance != null && !string.IsNullOrEmpty(timerActivityInstance.NextStepPerformers)) { nextSteps = NextStepUtility.DeserializeNextStepPerformers(timerActivityInstance.NextStepPerformers); } } } return(nextSteps); }
/// <summary> /// 获取预选步骤人员列表 /// </summary> /// <param name="nextActivityTree">下一步活动节点树</param> /// <param name="runner">当前运行用户</param> /// <returns>步骤预选人员列表</returns> private IDictionary <string, PerformerList> GetNextActivityPerformers(IList <NodeView> nextActivityTree, WfAppRunner runner) { IDictionary <string, PerformerList> nextSteps = null; var tm = new TaskManager(); TaskViewEntity taskView = tm.GetTaskOfMine(runner); //读取活动实例中记录的步骤预选数据 var aim = new ActivityInstanceManager(); if (taskView.MIHostActivityInstanceID != null) { var mainActivityInstanceID = taskView.MIHostActivityInstanceID.Value; var mainActivityInstance = aim.GetById(mainActivityInstanceID); if (mainActivityInstance != null) { nextSteps = NextStepUtility.DeserializeNextStepPerformers(mainActivityInstance.NextStepPerformers); } } //获取网关节点信息 IProcessModel processModel = ProcessModelFactory.Create(runner.ProcessGUID, runner.Version); var nextActivity = processModel.GetNextActivity(taskView.ActivityGUID); if (nextActivity.ActivityType == ActivityTypeEnum.GatewayNode) { var gatewayActivityInstance = aim.GetActivityInstanceLatest(taskView.ProcessInstanceID, nextActivity.ActivityGUID); if (gatewayActivityInstance != null && !string.IsNullOrEmpty(gatewayActivityInstance.NextStepPerformers)) { nextSteps = NextStepUtility.DeserializeNextStepPerformers(gatewayActivityInstance.NextStepPerformers); } } return(nextSteps); }