当前位置: 首页>>代码示例>>C#>>正文


C# WorkflowService.GetNextActivityTree方法代码示例

本文整理汇总了C#中Slickflow.Engine.Service.WorkflowService.GetNextActivityTree方法的典型用法代码示例。如果您正苦于以下问题:C# WorkflowService.GetNextActivityTree方法的具体用法?C# WorkflowService.GetNextActivityTree怎么用?C# WorkflowService.GetNextActivityTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Slickflow.Engine.Service.WorkflowService的用法示例。


在下文中一共展示了WorkflowService.GetNextActivityTree方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnMade_Click

        /// <summary>
        /// 生产节点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMade_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["limu"];
            appRunner.UserName = "limu";

            var wfService = new WorkflowService();
            var nextSteps = wfService.GetNextActivityTree(appRunner);

            if (nextSteps != null)
            {
                //构造下一步办理人的信息
                appRunner.NextActivityPerformers = CreateNextActivityPerformers(nextSteps);

                var r2 = wfService.RunProcessApp(appRunner);
                var msg2 = string.Format("执行【生产】:{0}, {1}\r\n", r2.Status, r2.Message);

                WriteText(msg2);

                if (r2.Status == WfExecutedStatus.Success)
                {
                    WriteText(string.Format("任务已经发送到下一节点:{0}\r\n\r\n", nextSteps[0].ActivityName));
                }
            }
            else
            {
                WriteText("您当前没有办理任务!\r\n");
            }
        }
开发者ID:zengfanlin,项目名称:Slickflow,代码行数:37,代码来源:MOrderUserCaseForm.cs

示例2: btnPrintOrder_Click

        /// <summary>
        /// 打单节点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrintOrder_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["yiran"];
            appRunner.UserName = "yiran";

            //先启动流程
            var wfService = new WorkflowService();
            var r1 = wfService.StartProcess(appRunner);

            var msg = string.Format("生产订单流程开始:{0}, {1}\r\n", r1.Status, r1.Message);
            WriteText(msg);

            if (r1.Status == WfExecutedStatus.Success)
            {
                //打单环节加入条件,运行流程
                var cond = new Dictionary<string, string>();

                cond["CanUseStock"] = chkStock.Checked.ToString().ToLower();
                cond["IsHavingWeight"] = chkWeight.Checked.ToString().ToLower();

                appRunner.Conditions = cond;

                string message = string.Empty;
                var nextSteps = wfService.GetNextActivityTree(appRunner, cond);
                if (nextSteps != null)
                {
                    appRunner.NextActivityPerformers = CreateNextActivityPerformers(nextSteps);

                    var r2 = wfService.RunProcessApp(appRunner);
                    message = r2.Message;
                    WriteText(string.Format("执行【打单】: {0}, {1}\r\n", r2.Status, r2.Message));

                    if (r2.Status == WfExecutedStatus.Success)
                    {
                        WriteText(string.Format("任务已经发送到下一节点:{0}\r\n\r\n", nextSteps[0].ActivityName));
                    }
                }
                else
                {
                    message = "下一步节点不匹配!";
                    WriteText(string.Format("{0}\r\n", message));
                }
            }
        }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:53,代码来源:MOrderUserCaseForm.cs

示例3: QueryNextStep

 public ResponseResult<List<NodeView>> QueryNextStep(WfAppRunner runner)
 {
     var result = ResponseResult<List<NodeView>>.Default();
     try
     {
         var wfservice = new WorkflowService();
         var nodeViewList = wfservice.GetNextActivityTree(runner).ToList<NodeView>();
         result = ResponseResult<List<NodeView>>.Success(nodeViewList, "获取流程下一步信息成功!");
     }
     catch(System.Exception ex)
     {
         result = ResponseResult<List<NodeView>>.Error(string.Format(
             " 请确认角色身份是否切换?! {0}", 
             ex.Message));
     }
     return result;
 }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:17,代码来源:WfController.cs

示例4: WfAppRunner

        private void btn仓库签字_Click(object sender, EventArgs e)
        {
            WfAppRunner appRunner = new WfAppRunner();
            appRunner.ProcessGUID = process_guid;
            appRunner.AppInstanceID = application_instance_id;
            //第一步任务承担者,登录后要找到自己的任务
            appRunner.AppName = "officeIn";
            appRunner.UserID = "1";
            appRunner.UserName = "user1";
            IWorkflowService wfService = new WorkflowService();

            //外部变量条件
            Dictionary<string, string> dictCondition = new Dictionary<string, string>();
            dictCondition.Add("surplus", cBoxSurplus.Text);
            appRunner.Conditions = dictCondition;
            //动态获取下一跳转后的节点
            var nodeViewList = wfService.GetNextActivityTree(appRunner,dictCondition);
            //指定对象执行者
            PerformerList list3 = new PerformerList();
            list3.Add(new Performer("3", "user3"));

            PerformerList list4 = new PerformerList();
            list4.Add(new Performer("4", "user4"));

            Dictionary<String, PerformerList> dictPerformer = new Dictionary<String, PerformerList>();
            int i = 3;
            foreach (NodeView nv in nodeViewList)
            {   
                if (i==3)
                    dictPerformer.Add(nv.ActivityGUID, list3);
                else
                    dictPerformer.Add(nv.ActivityGUID, list4);

                i ++;
            }
            appRunner.NextActivityPerformers = dictPerformer;

            var result = wfService.RunProcessApp(appRunner);
            var msg = string.Format("流程运行结果:{0}\r\n{1}\r\n", result.Status, result.Message);
            tBoxResult.Text += msg;
        }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:41,代码来源:FormOfficeInXorSplitXorJoin.cs

示例5: RunProcess

        /// <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;
        }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:30,代码来源:WfAppInteropService.cs

示例6: StartProcess

        public ResponseResult StartProcess(WfAppRunner starter)
        {
            IWorkflowService wfService = new WorkflowService();
            IDbConnection conn = SessionFactory.CreateConnection();

            IDbTransaction trans = null;
            try
            {
                trans = conn.BeginTransaction();
                WfExecutedResult result = wfService.StartProcess(conn, starter, trans);
                trans.Commit();

                int newProcessInstanceID = result.ProcessInstanceIDStarted;
                IList<NodeView> nextSteps = wfService.GetNextActivityTree(starter);

                if (result.Status == WfExecutedStatus.Success)
                {
                    return ResponseResult.Success();
                }
                else
                {
                    return ResponseResult.Error(result.Message);
                }
            }
            catch (WorkflowException w)
            {
                trans.Rollback();
                return ResponseResult.Error(w.Message);
            }
            finally
            {
                trans.Dispose();
                if (conn.State == ConnectionState.Open)
                    conn.Close();
            }
        }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:36,代码来源:WfTaskMISubProcessController.cs

示例7: GetNextStepsContainer

        public ResponseResult<IList<NodeView>> GetNextStepsContainer(WfAppRunner runner)
        {
            IWorkflowService wfService = new WorkflowService();
            var nodeList = wfService.GetNextActivityTree(runner, null);

            return ResponseResult<IList<NodeView>>.Success(nodeList);
        }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:7,代码来源:Wf2GoController.cs

示例8: GetTaskNextSteps

        public ResponseResult<IList<NodeView>> GetTaskNextSteps(int id)
        {
            IWorkflowService wfService = new WorkflowService();
            var nodeList = wfService.GetNextActivityTree(id);

            return ResponseResult<IList<NodeView>>.Success(nodeList);
        }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:7,代码来源:Wf2GoController.cs

示例9: btnSkip_Click

        /// <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 = "andun";

            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;
                }
            }
        }
开发者ID:zengfanlin,项目名称:Slickflow,代码行数:35,代码来源:FlowForm.cs

示例10: InitStepMember

        /// <summary>
        /// 
        /// </summary>
        protected void InitStepMember()
        {
            string strNodes = string.Empty;

            //流程定义的GUID
            string flowGuid = Request.QueryString["ProcessGUID"] == null ? "" : Request.QueryString["ProcessGUID"].ToString();
            string Step = Request.QueryString["Step"] == null ? "" : Request.QueryString["Step"].ToString();
            if (string.IsNullOrEmpty(flowGuid) || string.IsNullOrEmpty(Step))
            {
                base.RegisterStartupScript("", "<script>alert('流程GUID为空');</script>");
            }
            else
            {
                List<ZTreeEntity> zTreeEntityList = new List<ZTreeEntity>();

                String processGUID = flowGuid;
                IWorkflowService service = new WorkflowService();
                switch (Step)
                {
                    case "start"://流程第一步选择
                        ActivityEntity firstActivity = service.GetFirstActivity(processGUID, string.Empty);
                        String firstActivityGUID = firstActivity.ActivityGUID;
                        string conditions = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();
                        IList<NodeView> nextNodes = service.GetNextActivity(processGUID, string.Empty, firstActivityGUID, GetCondition(conditions));
                        if (nextNodes != null)
                        {
                            if (nextNodes != null)
                            {
                                ZTreeEntity zTreeEntity = null;
                                foreach (NodeView item in nextNodes)
                                {
                                    zTreeEntity = new ZTreeEntity();
                                    zTreeEntity.id = string.Format("step[{0}]", item.ActivityGUID);
                                    zTreeEntity.pId = "0";
                                    zTreeEntity.name = item.ActivityName;
                                    zTreeEntity.nocheck = false;
                                    zTreeEntityList.Add(zTreeEntity);


                                    DataTable dt = GetUsers(item.Roles);
                                    foreach (DataRow dr in dt.Rows)
                                    {
                                        zTreeEntity = new ZTreeEntity();
                                        zTreeEntity.id = string.Format("step[{0}]member[{1}]", item.ActivityGUID, dr["ID"].ToString());
                                        zTreeEntity.pId = string.Format("step[{0}]", item.ActivityGUID);
                                        zTreeEntity.name = dr["UserName"].ToString();
                                        zTreeEntity.nocheck = false;
                                        zTreeEntityList.Add(zTreeEntity);
                                    }

                                }
                            }
                        }
                        else
                        {
                            LiteralMSG.Text = "当前没有需要您办理的步骤";
                        }
                        break;
                    case "task":
                        try
                        {
                            if (LoginUserID > 0)
                            {
                                string condition = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();
                                string instanceId = Request.QueryString["instanceId"] == null ? string.Empty : Request.QueryString["instanceId"].ToString();
                                WfAppRunner runner = new WfAppRunner();
                                runner.AppInstanceID = instanceId;
                                runner.ProcessGUID = processGUID;
                                runner.UserID = this.LoginUserID.ToString();
                                hiddenIsSelectMember.Value = "true";
                                IList<NodeView> NodeViewList = service.GetNextActivityTree(runner, GetCondition(condition));


                                if (NodeViewList != null)
                                {
                                    ZTreeEntity zTreeEntity = null;
                                    foreach (NodeView item in NodeViewList)
                                    {
                                        zTreeEntity = new ZTreeEntity();
                                        zTreeEntity.id = string.Format("step[{0}]", item.ActivityGUID);
                                        zTreeEntity.pId = "0";
                                        zTreeEntity.name = item.ActivityName;
                                        zTreeEntityList.Add(zTreeEntity);

                                        DataTable dt = GetUsers(item.Roles);
                                        foreach (DataRow dr in dt.Rows)
                                        {
                                            zTreeEntity = new ZTreeEntity();
                                            zTreeEntity.id = string.Format("step[{0}]member[{1}]", item.ActivityGUID, dr["ID"].ToString());
                                            zTreeEntity.pId = string.Format("step[{0}]", item.ActivityGUID);
                                            zTreeEntity.name = dr["UserName"].ToString();
                                            zTreeEntity.nocheck = false;
                                            zTreeEntityList.Add(zTreeEntity);
                                        }
                                    }
                                }
                                else
//.........这里部分代码省略.........
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:101,代码来源:FlowStepSelect.aspx.cs

示例11: InitStepMember

        /// <summary>
        /// 
        /// </summary>
        protected void InitStepMember()
        {
            //流程定义的GUID
            string flowGuid = Request.QueryString["ProcessGUID"] == null ? "" : Request.QueryString["ProcessGUID"].ToString();
            string Step = Request.QueryString["Step"] == null ? "" : Request.QueryString["Step"].ToString();
            if (string.IsNullOrEmpty(flowGuid) || string.IsNullOrEmpty(Step))
            {
                base.RegisterStartupScript("", "<script>alert('流程GUID为空');</script>");
            }
            else
            {
                String processGUID = flowGuid;
                IWorkflowService service = new WorkflowService();
                switch (Step)
                {
                    case "start"://流程第一步选择
                        ActivityEntity firstActivity = service.GetFirstActivity(processGUID);
                        String firstActivityGUID = firstActivity.ActivityGUID;

                        string conditions = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();

                        IList<NodeView> nextNodes = service.GetNextActivity(processGUID, firstActivityGUID, GetCondition(conditions));
                        if (nextNodes != null)
                        {
                            Repeater1.DataSource = nextNodes;
                            Repeater1.DataBind();
                        }
                        else
                        {
                            LiteralMSG.Text = "当前没有需要您办理的步骤";
                        }
                        break;
                    case "task":
                        try
                        {
                            if (LoginUserID > 0)
                            {
                                string condition = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();
                                string instanceId = Request.QueryString["instanceId"] == null ? string.Empty : Request.QueryString["instanceId"].ToString();
                                WfAppRunner runner = new WfAppRunner();
                                runner.AppInstanceID = instanceId;
                                runner.ProcessGUID = processGUID;
                                runner.UserID = this.LoginUserID.ToString();
                                hiddenIsSelectMember.Value = "true";
                                IList<NodeView> NodeViewList = service.GetNextActivityTree(runner, GetCondition(condition));
                                if (NodeViewList != null)
                                {
                                    Repeater1.DataSource = NodeViewList;
                                    Repeater1.DataBind();
                                    if (NodeViewList.Count == 1)
                                    {
                                        string nextActivityGuid = NodeViewList[0].ActivityGUID;
                                        /*
                                        ActivityEntity activityEntity = service.GetActivityInstance(processGUID, nextActivityGuid);
                                        if (activityEntity.ActivityType == ActivityTypeEnum.EndNode)
                                        {
                                            hiddenIsSelectMember.Value = "false";
                                        }*/
                                    }
                                }
                                else
                                {
                                    LiteralMSG.Text = "当前没有需要您办理的步骤";
                                }
                            }
                        }
                        catch (Exception ex)
                        { }
                        break;
                }
            }
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:75,代码来源:FlowStepSelect.aspx.cs

示例12: btnOutput_Click

         /// <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 = "andun";

            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");
            }
        }
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:59,代码来源:MOrderUserCaseForm.cs

示例13: Approval

        public async Task<ActionResult> Approval(string type = "agree", string processGUID = "", int instanceId = 0, double days = 0)
        {
            var resolveRequest = HttpContext.Request;
            resolveRequest.InputStream.Seek(0, System.IO.SeekOrigin.Begin);
            string jsonString = new System.IO.StreamReader(resolveRequest.InputStream).ReadToEnd();
            try
            {
                IWorkflowService service = new WorkflowService();
                WfAppRunner runner = new WfAppRunner();
                runner.AppInstanceID = instanceId.ToString();
                runner.ProcessGUID = processGUID;
                runner.UserID = User.Identity.GetUserId();
                IList<NodeView> NodeViewList = service.GetNextActivityTree(runner, GetCondition("days-" + days));
                var leave = JsonConvert.DeserializeObject<LeaveEntity>(jsonString);
                leave.ID = instanceId;
                //调用流程
                WfAppRunner initiator = new WfAppRunner();
                initiator.AppName = "请假流程";
                initiator.AppInstanceID = instanceId.ToString();
                initiator.ProcessGUID = processGUID;
                initiator.UserID = User.Identity.GetUserId();
                initiator.UserName = User.Identity.GetUserName();
                initiator.Conditions = GetCondition(string.Format("days-{0}", days)); //后续节点不用传入条件表达式

                //获取下一步审批人信息
                //下一步角色ID审批者
                PerformerList pList = new PerformerList();
                if (NodeViewList[0].Roles.Count > 0)
                {
                    string outerId = NodeViewList[0].Roles[0].ID.ToString();
                    //这里只取第一个审批者,WebDemo 是弹窗形式选择
                    //审批用户id
                    IEnumerable<int> userId = RoleManager.FindById(Convert.ToInt32(outerId)).Users.Select(t => t.UserId);
                    ApplicationUser user = await UserManager.FindByIdAsync(Convert.ToInt32(userId.ToList()[0]));
                    //送往下一步
                    
                    pList.Add(new Performer(user.Id.ToString(), user.RealName));
                }

                initiator.NextActivityPerformers = new Dictionary<String, PerformerList>();
                initiator.NextActivityPerformers.Add(NodeViewList[0].ActivityGUID, pList);
                WfExecutedResult runAppResult = service.RunProcessApp(initiator);
                if (runAppResult.Status != WfExecutedStatus.Success)
                {
                }
                ProcessEntity processEntity = service.GetProcessById(processGUID);
                if (processEntity != null)
                {
                    ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(instanceId);
                    if (activityInstanceEntity != null)
                    {
                        //CurrentActivityText = activityInstanceEntity.ActivityName;
                    }
                }
                new WorkFlowManager().UpdateHrsLeave(leave);
            }
            catch (Exception ex)
            {
                return Json(new
                {
                    success = false,
                    message = ex.Message
                });
            }
            return Json(new
            {
                success = true,
                message = "执行成功"
            });
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:70,代码来源:LeaveController.cs


注:本文中的Slickflow.Engine.Service.WorkflowService.GetNextActivityTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。