驰骋开源的.net工作流,工作流程管理系统
驰骋工作流,好用看的见http://ccflow.org. 简单来自背后的力量.
posts - 40,comments - 10,trackbacks - 0

递归在算法在工作流程引擎中的应用

递归做为一种算法在程序设计语言中广泛应用.是指函数/过程/子程序在运行过程中直接或间接调用自身而产生的重入现象.递归是计算机科学的一个重要概念,递归的方法是程序设计中有效的方法,采用递归编写程序能使程序变得简洁和清晰.

递归在工作流程引擎中有广泛的应用,以以下事例来说明:

应用一:退回到指定的节点,要把当前节电与退回节点之间的节点数据清空。

/// <summary>

        /// ÌY¨¦¦?y¢??¨²Ì???Ì?ºyY

        /// </summary>

        /// <param name="nds">Ì?ä?Ì?¨²Ì?¡¥?</param>

        publicvoid DeleteToNodesData(Nodes nds)

        {

            /*aº?À¨¦¤¨²Ì?ä?Ì?¨²Ì?¡¥?*/

            foreach (Node nd in nds)

            {

                Work wk = nd.HisWork;

                wk.OID = this.WorkID;

                if (wk.Delete() == 0)

                {

                    wk.FID = this.WorkID;

                    if (wk.Delete(WorkAttr.FID, this.WorkID) == 0)

                        continue;

                }

 

                /*¦Ì¡Â:°?-¦?y?¨²Ì?ºyY¡ê*/

                DBAccess.RunSQL("DELETE WF_GenerWorkerList WHERE (WorkID=" + this.WorkID + " OR FID=" + this.WorkID + ") AND FK_Node=" + nd.NodeID);

 

                //¦?yy¡êÌ?¤??ºyY¡ê

                DBAccess.RunSQL("DELETE WF_GenerWorkFlow WHERE WorkID NOT IN (SELECT WorkID FROM WF_GenerWorkerList )");

                DBAccess.RunSQL("DELETE WF_GenerFH WHERE FID NOT IN (SELECT FID FROM WF_GenerWorkerList)");

 

                

                DeleteToNodesData(nd.HisToNodes);

            }

        }

 

 

 



应用二:在分合流程过程中,流程结束时,要根据用户的需要判断并杀掉没有完成的进程。

 

/// <summary>

        /// ¨¢º?¢¡Â¨¬

        /// </summary>

        /// <returns></returns>

        publicstring DoFlowOver()

        {

            // ¡§¢¡é¢¡Â¨¬º?¤y¡ê

            GenerWorkFlow gwf = newGenerWorkFlow(this.WorkID);

            Node nd = newNode(gwf.FK_Node);

            string msg = this.BeforeFlowOver();

 

            //¨¨¨?¨¹Ì?Á¨®¢¡Â¨¬¨¢º?¡ê

            WorkerLists wls = newWorkerLists();

            wls.Retrieve(WorkerListAttr.FID, this.WorkID);

            foreach (WorkerList wl in wls)

            {

                WorkFlow wf = newWorkFlow(wl.FK_Flow, wl.WorkID);

                wf.DoFlowOver();

            }

    。。。。。。。。。。。。。。

   }

 

 

 

应用三:根据当前节点的ID,向上追溯一个分流节点。

/// <summary>

        /// ?¨?¨¹Ì?¦?°??Ì?¤?¢¡ÂÌ?

        /// </summary>

        privateNode _GetHisPriFLNode(Nodes nds)

        {

            foreach (Node mynd in nds)

            {

                if (mynd.IsHL)

                    return mynd;

                else

                    return _GetHisPriFLNode(mynd.HisFromNodes);

            }

            returnnull;

        }

        /// <summary>

        /// ¨¹Ì?¦?°??¤?¢¡Â¨²Ì?

        /// </summary>

        publicNode HisPriFLNode

        {

            get

            {

                return _GetHisPriFLNode(this.HisFromNodes);

            }

        }

 

 

 


类别:工作流开发 查看评论

大量的多个行业的流程设计案例,都以操作录像演示给您。
驰骋工作流,好用看的见。
http://ccflow.org   QQ:hiflow@qq.com
posted on 2011-05-12 10:02 驰骋工作流,工作流程管理系统. 阅读(271) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: