public JumpProcess ( IDbConnection conn, Slickflow.Engine.Common.WfAppRunner runner, IDbTransaction trans ) : |
||
conn | IDbConnection | 连接 |
runner | Slickflow.Engine.Common.WfAppRunner | 执行操作人 |
trans | IDbTransaction | 事务 |
Résultat |
/// <summary> /// 退回流程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBackward_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; appRunner.AppName = "WallwaOrder"; appRunner.UserID = "1"; appRunner.UserName = "******"; //下一步执行人 PerformerList list = new PerformerList(); Performer p = new Performer("13", "andun");//下一步人ID,Name list.Add(p); Dictionary<String, PerformerList> dict = new Dictionary<String, PerformerList>(); dict.Add("fc8c71c5-8786-450e-af27-9f6a9de8560f", list); //print activity:"fc8c71c5-8786-450e-af27-9f6a9de8560f"下一步节点的标识ID appRunner.NextActivityPerformers = dict; IWorkflowService wfService = new WorkflowService(); var result = wfService.JumpProcess(appRunner); var msg = string.Format("流程跳转回退结果:{0}\r\n", result.Status); textBox1.Text += msg; }
/// <summary> /// 工作流运行 /// </summary> /// <param name="session"></param> /// <param name="runner"></param> /// <returns></returns> public WfExecutedResult RunProcess(IDbSession session, WfAppRunner runner, IDictionary<string, string> conditions = null) { var result = new WfExecutedResult(); var wfService = new WorkflowService(); var nodeViewList = wfService.GetNextActivityTree(runner, conditions).ToList<NodeView>(); foreach (var node in nodeViewList) { var performerList = wfService.GetPerformerList(node); //根据节点角色定义,读取执行者列表 Dictionary<string, PerformerList> dict = new Dictionary<string, PerformerList>(); dict.Add(node.ActivityGUID, performerList); runner.NextActivityPerformers = dict; if (node.IsSkipTo == true) { result = wfService.JumpProcess(session.Connection, runner, session.Transaction); } else { result = wfService.RunProcessApp(session.Connection, runner, session.Transaction); } } return result; }
/// <summary> /// XML节点预定义跳转 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSkip_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; appRunner.AppName = "WallwaOrder"; appRunner.UserID = "13"; appRunner.UserName = "******"; IWorkflowService wfService = new WorkflowService(); var nodeViewList = wfService.GetNextActivityTree(appRunner); if (nodeViewList != null && nodeViewList.Count() == 1) { var nodeView = nodeViewList[0]; if (nodeView.IsSkipTo == true) { //下一步执行人 PerformerList list = new PerformerList(); Performer p = new Performer("1", "admin");//下一步人ID,Name list.Add(p); Dictionary<String, PerformerList> dict = new Dictionary<String, PerformerList>(); dict.Add(nodeView.ActivityGUID, list); //nodeView.ID 下一步节点的标识ID appRunner.NextActivityPerformers = dict; var result = wfService.JumpProcess(appRunner); var msg = string.Format("流程跳转结果:{0}\r\n", result.Status); textBox1.Text += msg; } } }
/// <summary> /// 输出节点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOutput_Click(object sender, EventArgs e) { WfAppRunner appRunner = new WfAppRunner(); appRunner.ProcessGUID = process_guid; appRunner.AppInstanceID = application_instance_id; appRunner.AppName = application_name; appRunner.UserID = per_dict["andun"]; appRunner.UserName = "******"; var wfService = new WorkflowService(); var nextSteps = wfService.GetNextActivityTree(appRunner); if (nextSteps != null) { //构造下一步办理人的信息 string msg2 = string.Empty; foreach (NodeView nodeView in nextSteps) { //当前用例只有一个节点能够向下流转 appRunner.NextActivityPerformers = CreateNextActivityPerformers(nodeView); if (nodeView.IsSkipTo == true) { var j2 = wfService.JumpProcess(appRunner); msg2 = string.Format("执行【输出】并跳转:{0}, {1}\r\n", j2.Status, j2.Message); WriteText(msg2); if (j2.Status == WfExecutedStatus.Success) { WriteText(string.Format("任务已经发送到下一节点:{0}\r\n\r\n", nodeView.ActivityName)); } } else { var r2 = wfService.RunProcessApp(appRunner); msg2 = string.Format("执行【输出】:{0}\r\n", r2.Message); WriteText(msg2); if (r2.Status == WfExecutedStatus.Success) { WriteText(string.Format("任务已经发送到下一节点:{0}\r\n", nodeView.ActivityName)); } } } } else { WriteText("您当前没有办理任务!\r\n"); } }