Exemplo n.º 1
0
        /// <summary>
        /// 初始化节点属性列表.
        /// </summary>
        /// <returns></returns>
        public string NodeAttrs_Init()
        {
            var strFlowId = GetRequestVal("FK_Flow");

            if (DataType.IsNullOrEmpty(strFlowId))
            {
                return("err@参数错误!");
            }

            Nodes nodes = new Nodes();

            nodes.Retrieve("FK_Flow", strFlowId);
            //因直接使用nodes.ToJson()无法获取某些字段(e.g.HisFormTypeText,原因:Node没有自己的Attr类)
            //故此处手动创建前台所需的DataTable
            DataTable dt = new DataTable();

            dt.Columns.Add("NodeID");      //节点ID
            dt.Columns.Add("Name");        //节点名称
            dt.Columns.Add("HisFormType"); //表单方案
            dt.Columns.Add("HisFormTypeText");
            dt.Columns.Add("HisRunModel"); //节点类型
            dt.Columns.Add("HisRunModelT");

            dt.Columns.Add("HisDeliveryWay");   //接收方类型
            dt.Columns.Add("HisDeliveryWayText");
            dt.Columns.Add("HisDeliveryWayJsFnPara");
            dt.Columns.Add("HisDeliveryWayCountLabel");
            dt.Columns.Add("HisDeliveryWayCount"); //接收方Count

            dt.Columns.Add("HisCCRole");           //抄送人
            dt.Columns.Add("HisCCRoleText");
            dt.Columns.Add("HisFrmEventsCount");   //消息&事件Count
            dt.Columns.Add("HisFinishCondsCount"); //流程完成条件Count
            DataRow dr;

            foreach (Node node in nodes)
            {
                dr                       = dt.NewRow();
                dr["NodeID"]             = node.NodeID;
                dr["Name"]               = node.Name;
                dr["HisFormType"]        = node.HisFormType;
                dr["HisFormTypeText"]    = node.HisFormTypeText;
                dr["HisRunModel"]        = node.HisRunModel;
                dr["HisRunModelT"]       = node.HisRunModelT;
                dr["HisDeliveryWay"]     = node.HisDeliveryWay;
                dr["HisDeliveryWayText"] = node.HisDeliveryWayText;

                //接收方数量
                var intHisDeliveryWayCount = 0;
                if (node.HisDeliveryWay == BP.WF.DeliveryWay.ByStation)
                {
                    dr["HisDeliveryWayJsFnPara"]   = "ByStation";
                    dr["HisDeliveryWayCountLabel"] = "岗位";
                    BP.WF.Template.NodeStations nss = new BP.WF.Template.NodeStations();
                    intHisDeliveryWayCount = nss.Retrieve(BP.WF.Template.NodeStationAttr.FK_Node, node.NodeID);
                }
                else if (node.HisDeliveryWay == BP.WF.DeliveryWay.ByDept)
                {
                    dr["HisDeliveryWayJsFnPara"]   = "ByDept";
                    dr["HisDeliveryWayCountLabel"] = "部门";
                    BP.WF.Template.NodeDepts nss = new BP.WF.Template.NodeDepts();
                    intHisDeliveryWayCount = nss.Retrieve(BP.WF.Template.NodeDeptAttr.FK_Node, node.NodeID);
                }
                else if (node.HisDeliveryWay == BP.WF.DeliveryWay.ByBindEmp)
                {
                    dr["HisDeliveryWayJsFnPara"]   = "ByDept";
                    dr["HisDeliveryWayCountLabel"] = "人员";
                    BP.WF.Template.NodeEmps nes = new BP.WF.Template.NodeEmps();
                    intHisDeliveryWayCount = nes.Retrieve(BP.WF.Template.NodeStationAttr.FK_Node, node.NodeID);
                }
                dr["HisDeliveryWayCount"] = intHisDeliveryWayCount;

                //抄送
                dr["HisCCRole"]     = node.HisCCRole;
                dr["HisCCRoleText"] = node.HisCCRoleText;

                //消息&事件Count
                BP.Sys.FrmEvents fes = new BP.Sys.FrmEvents();
                dr["HisFrmEventsCount"] = fes.Retrieve(BP.Sys.FrmEventAttr.FK_MapData, "ND" + node.NodeID);

                //流程完成条件Count
                BP.WF.Template.Conds conds = new BP.WF.Template.Conds(BP.WF.Template.CondType.Flow, node.NodeID);
                dr["HisFinishCondsCount"] = conds.Count;

                dt.Rows.Add(dr);
            }
            return(BP.Tools.Json.ToJson(dt));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取指定部门下一级子部门及人员列表
        /// </summary>
        /// <returns></returns>
        public string Dot2DotStationModel_GetSubUnits()
        {
            string parentid = this.GetRequestVal("parentid");
            string nid      = this.GetRequestVal("nodeid");
            string tp       = this.GetRequestVal("stype"); //ST,UNIT
            string ttype    = this.GetRequestVal("ttype"); //STROOT,UNITROOT,ST,CST,S

            if (string.IsNullOrWhiteSpace(parentid))
            {
                throw new Exception("参数parentid不能为空");
            }
            if (string.IsNullOrWhiteSpace(nid))
            {
                throw new Exception("参数nodeid不能为空");
            }

            EasyuiTreeNode        node = null;
            List <EasyuiTreeNode> d    = new List <EasyuiTreeNode>();
            string    sql = string.Empty;
            DataTable dt  = null;

            BP.WF.Template.NodeStations sts = new BP.WF.Template.NodeStations();
            string sortField = CheckStationTypeIdxExists() ? "Idx" : "No";

            sts.Retrieve(BP.WF.Template.NodeStationAttr.FK_Node, int.Parse(nid));

            if (tp == "ST")
            {
                if (ttype == "STROOT")
                {
                    sql = "SELECT No,Name FROM Port_StationType ORDER BY " + sortField + " ASC";
                    dt  = DBAccess.RunSQLReturnTable(sql);

                    foreach (DataRow row in dt.Rows)
                    {
                        node                     = new EasyuiTreeNode();
                        node.id                  = "ST_" + row["No"];
                        node.text                = row["Name"] as string;
                        node.iconCls             = "icon-department";
                        node.attributes          = new EasyuiTreeNodeAttributes();
                        node.attributes.No       = row["No"] as string;
                        node.attributes.Name     = row["Name"] as string;
                        node.attributes.ParentNo = "-1";
                        node.attributes.TType    = "ST";
                        node.state               = "closed";
                        node.children            = new List <EasyuiTreeNode>();
                        node.children.Add(new EasyuiTreeNode());
                        node.children[0].text = "loading...";

                        d.Add(node);
                    }
                }
                else
                {
                    sql =
                        string.Format(
                            "SELECT ps.No,ps.Name,ps.FK_StationType,pst.Name FK_StationTypeName FROM Port_Station ps"
                            + " INNER JOIN Port_StationType pst ON pst.No = ps.FK_StationType"
                            + " WHERE ps.FK_StationType = '{0}' ORDER BY ps.Name ASC", parentid);
                    dt = DBAccess.RunSQLReturnTable(sql);

                    foreach (DataRow row in dt.Rows)
                    {
                        node          = new EasyuiTreeNode();
                        node.id       = "S_" + parentid + "_" + row["No"];
                        node.text     = row["Name"] as string;
                        node.iconCls  = "icon-user";
                        node.@checked =
                            sts.GetEntityByKey(BP.WF.Template.NodeStationAttr.FK_Station, row["No"]) != null;
                        node.attributes            = new EasyuiTreeNodeAttributes();
                        node.attributes.No         = row["No"] as string;
                        node.attributes.Name       = row["Name"] as string;
                        node.attributes.ParentNo   = row["FK_StationType"] as string;
                        node.attributes.ParentName = row["FK_StationTypeName"] as string;
                        node.attributes.TType      = "S";
                        node.attributes.Code       = BP.Tools.chs2py.ConvertStr2Code(row["Name"] as string);

                        d.Add(node);
                    }
                }
            }
            else
            {
                //岗位所属单位UNIT
                dt = DBAccess.RunSQLReturnTable(string.Format("SELECT * FROM Port_Dept WHERE IsUnit = 1 AND ParentNo='{0}' ORDER BY Name ASC", parentid));

                foreach (DataRow dept in dt.Rows)
                {
                    node                     = new EasyuiTreeNode();
                    node.id                  = "UNIT_" + dept["No"];
                    node.text                = dept["Name"] as string;
                    node.iconCls             = "icon-department";
                    node.attributes          = new EasyuiTreeNodeAttributes();
                    node.attributes.No       = dept["No"] as string;
                    node.attributes.Name     = dept["Name"] as string;
                    node.attributes.ParentNo = dept["ParentNo"] as string;
                    node.attributes.TType    = "UNIT";
                    node.attributes.Code     = BP.Tools.chs2py.ConvertStr2Code(dept["Name"] as string);
                    node.state               = "closed";
                    node.children            = new List <EasyuiTreeNode>();
                    node.children.Add(new EasyuiTreeNode());
                    node.children[0].text = "loading...";

                    d.Add(node);
                }

                dt = DBAccess.RunSQLReturnTable(
                    string.Format(
                        "SELECT ps.No,ps.Name,pst.No FK_StationType, pst.Name FK_StationTypeName,ps.FK_Unit,pd.Name FK_UnitName FROM Port_Station ps"
                        + " INNER JOIN Port_StationType pst ON pst.No = ps.FK_StationType"
                        + " INNER JOIN Port_Dept pd ON pd.No = ps.FK_Unit"
                        + " WHERE ps.FK_Unit = '{0}' ORDER BY pst.{1} ASC,ps.Name ASC", parentid, sortField));

                //增加岗位
                foreach (DataRow st in dt.Rows)
                {
                    node                       = new EasyuiTreeNode();
                    node.id                    = "S_" + st["FK_Unit"] + "_" + st["No"];
                    node.text                  = st["Name"] + "[" + st["FK_StationTypeName"] + "]";
                    node.iconCls               = "icon-user";
                    node.@checked              = sts.GetEntityByKey(BP.WF.Template.NodeStationAttr.FK_Station, st["No"]) != null;
                    node.attributes            = new EasyuiTreeNodeAttributes();
                    node.attributes.No         = st["No"] as string;
                    node.attributes.Name       = st["Name"] as string;
                    node.attributes.ParentNo   = st["FK_Unit"] as string;
                    node.attributes.ParentName = st["FK_UnitName"] as string;
                    node.attributes.TType      = "S";
                    node.attributes.Code       = BP.Tools.chs2py.ConvertStr2Code(st["Name"] as string);

                    d.Add(node);
                }
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(d));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据部门获取下一步的操作员
        /// </summary>
        /// <param name="deptNo"></param>
        /// <param name="emp1"></param>
        /// <returns></returns>
        public DataTable Func_GenerWorkerList_DiGui(string deptNo, string empNo)
        {
            string sql;

            if (BP.WF.Glo.OSModel == OSModel.BPM)
            {
                sql = "SELECT FK_Emp as No FROM Port_DeptEmpStation A, WF_NodeStation B WHERE A.FK_Station=B.FK_Station AND B.FK_Node=" + dbStr + "FK_Node AND A.FK_Dept=" + dbStr + "FK_Dept AND A.FK_Emp!=" + dbStr + "FK_Emp";
            }
            else
            {
                sql = "SELECT FK_Emp as No FROM Port_EmpStation A, WF_NodeStation B, Port_Emp C WHERE A.FK_Station=B.FK_Station AND A.FK_Emp=C.No AND B.FK_Node=" + dbStr + "FK_Node AND C.FK_Dept=" + dbStr + "FK_Dept AND A.FK_Emp!=" + dbStr + "FK_Emp";
            }
            Paras ps = new Paras();

            ps.SQL = sql;
            ps.Add("FK_Node", town.HisNode.NodeID);
            ps.Add("FK_Dept", deptNo);
            ps.Add("FK_Emp", empNo);


            DataTable dt = DBAccess.RunSQLReturnTable(ps);

            if (dt.Rows.Count == 0)
            {
                NodeStations nextStations = town.HisNode.NodeStations;
                if (nextStations.Count == 0)
                {
                    throw new Exception("@节点没有岗位:" + town.HisNode.NodeID + "  " + town.HisNode.Name);
                }

                sql  = "SELECT No FROM Port_Emp WHERE No IN ";
                sql += "(SELECT  FK_Emp  FROM " + BP.WF.Glo.EmpStation + " WHERE FK_Station IN (SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node ) )";
                sql += " AND No IN ";

                if (deptNo == "1")
                {
                    sql += "(SELECT FK_Emp FROM Port_EmpDept WHERE FK_Emp!=" + dbStr + "FK_Emp ) ";
                }
                else
                {
                    BP.Port.Dept deptP = new BP.Port.Dept(deptNo);
                    sql += "(SELECT FK_Emp FROM Port_EmpDept WHERE FK_Emp!=" + dbStr + "FK_Emp AND FK_Dept = '" + deptP.ParentNo + "')";
                }

                ps     = new Paras();
                ps.SQL = sql;
                ps.Add("FK_Node", town.HisNode.NodeID);
                ps.Add("FK_Emp", empNo);
                dt = DBAccess.RunSQLReturnTable(ps);


                if (dt.Rows.Count == 0)
                {
                    return(null);
                }
                return(dt);
            }
            else
            {
                return(dt);
            }
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存节点绑定岗位信息
        /// </summary>
        /// <returns></returns>
        public string Dot2DotStationModel_SaveNodeStations()
        {
            JsonResultInnerData jr = new JsonResultInnerData();
            string nodeid          = this.GetRequestVal("nodeid");
            string data            = this.GetRequestVal("data");
            string partno          = this.GetRequestVal("partno");
            bool   lastpart        = false;
            int    partidx         = 0;
            int    partcount       = 0;
            int    nid             = 0;

            if (string.IsNullOrWhiteSpace(nodeid) || int.TryParse(nodeid, out nid) == false)
            {
                throw new Exception("参数nodeid不正确");
            }

            if (string.IsNullOrWhiteSpace(data))
            {
                data = "";
            }

            BP.WF.Template.NodeStations nsts = new BP.WF.Template.NodeStations();
            string[] stNos = data.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            //提交内容过长时,采用分段式提交
            if (string.IsNullOrWhiteSpace(partno))
            {
                nsts.Delete(BP.WF.Template.NodeStationAttr.FK_Node, nid);
            }
            else
            {
                string[] parts = partno.Split("/".ToCharArray());

                if (parts.Length != 2)
                {
                    throw new Exception("参数partno不正确");
                }

                partidx   = int.Parse(parts[0]);
                partcount = int.Parse(parts[1]);

                stNos = data.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                if (partidx == 1)
                {
                    nsts.Delete(BP.WF.Template.NodeStationAttr.FK_Node, nid);
                }

                lastpart = partidx == partcount;
            }

            DataTable dtSts = DBAccess.RunSQLReturnTable("SELECT No FROM Port_Station");

            BP.WF.Template.NodeStation nst = null;

            foreach (string stNo in stNos)
            {
                if (dtSts.Select(string.Format("No='{0}'", stNo)).Length + dtSts.Select(string.Format("NO='{0}'", stNo)).Length == 0)
                {
                    continue;
                }

                nst            = new BP.WF.Template.NodeStation();
                nst.FK_Node    = nid;
                nst.FK_Station = stNo;
                nst.Insert();
            }

            if (string.IsNullOrWhiteSpace(partno))
            {
                jr.Msg = "保存成功";
            }
            else
            {
                jr.InnerData = new { lastpart, partidx, partcount };

                if (lastpart)
                {
                    jr.Msg = "保存成功";
                }
                else
                {
                    jr.Msg = string.Format("第{0}/{1}段保存成功", partidx, partcount);
                }
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(jr));
        }
Exemplo n.º 5
0
        private DataTable FindByWorkFlowModel()
        {
            this.town = town;

            DataTable dt = new DataTable();

            dt.Columns.Add("No", typeof(string));
            string sql;
            string FK_Emp;

            // 如果执行了两次发送,那前一次的轨迹就需要被删除,这里是为了避免错误。
            ps = new Paras();
            ps.Add("WorkID", this.WorkID);
            ps.Add("FK_Node", town.HisNode.NodeID);
            ps.SQL = "DELETE FROM WF_GenerWorkerlist WHERE WorkID=" + dbStr + "WorkID AND FK_Node =" + dbStr + "FK_Node";
            DBAccess.RunSQL(ps);

            // 如果指定特定的人员处理。
            if (string.IsNullOrEmpty(JumpToEmp) == false)
            {
                string[] emps = JumpToEmp.Split(',');
                foreach (string emp in emps)
                {
                    if (string.IsNullOrEmpty(emp))
                    {
                        continue;
                    }
                    DataRow dr = dt.NewRow();
                    dr[0] = emp;
                    dt.Rows.Add(dr);
                }
                return(dt);
            }

            // 按上一节点发送人处理。
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByPreviousNodeEmp)
            {
                DataRow dr = dt.NewRow();
                dr[0] = BP.Web.WebUser.No;
                dt.Rows.Add(dr);
                return(dt);
            }

            //首先判断是否配置了获取下一步接受人员的sql.
            if (town.HisNode.HisDeliveryWay == DeliveryWay.BySQL ||
                town.HisNode.HisDeliveryWay == DeliveryWay.BySQLAsSubThreadEmpsAndData)
            {
                if (town.HisNode.DeliveryParas.Length < 4)
                {
                    throw new Exception("@您设置的当前节点按照SQL,决定下一步的接受人员,但是你没有设置sql.");
                }

                sql = town.HisNode.DeliveryParas;
                sql = sql.Clone().ToString();

                sql = Glo.DealExp(sql, this.currWn.rptGe, null);
                if (sql.Contains("@"))
                {
                    if (Glo.SendHTOfTemp != null)
                    {
                        foreach (string key in Glo.SendHTOfTemp.Keys)
                        {
                            sql = sql.Replace("@" + key, Glo.SendHTOfTemp[key].ToString());
                        }
                    }
                }

                dt = DBAccess.RunSQLReturnTable(sql);
                if (dt.Rows.Count == 0 && town.HisNode.HisWhenNoWorker != WhenNoWorker.Skip)
                {
                    throw new Exception("@没有找到可接受的工作人员。@技术信息:执行的sql没有发现人员:" + sql);
                }
                return(dt);
            }

            #region  照明细表,作为子线程的接收人.
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByDtlAsSubThreadEmps)
            {
                if (this.town.HisNode.HisRunModel != RunModel.SubThread)
                {
                    throw new Exception("@您设置的节点接收人方式为:以分流点表单的明细表数据源确定子线程的接收人,但是当前节点非子线程节点。");
                }

                BP.Sys.MapDtls dtls = new BP.Sys.MapDtls(this.currWn.HisNode.NodeFrmID);
                string         msg  = null;
                foreach (BP.Sys.MapDtl dtl in dtls)
                {
                    try
                    {
                        ps     = new Paras();
                        ps.SQL = "SELECT UserNo FROM " + dtl.PTable + " WHERE RefPK=" + dbStr + "OID ORDER BY OID";
                        ps.Add("OID", this.WorkID);
                        dt = DBAccess.RunSQLReturnTable(ps);
                        if (dt.Rows.Count == 0 && town.HisNode.HisWhenNoWorker != WhenNoWorker.Skip)
                        {
                            throw new Exception("@流程设计错误,到达的节点(" + town.HisNode.Name + ")在指定的节点中没有数据,无法找到子线程的工作人员。");
                        }
                        return(dt);
                    }
                    catch (Exception ex)
                    {
                        msg += ex.Message;
                        //if (dtls.Count == 1)
                        //    throw new Exception("@估计是流程设计错误,没有在分流节点的明细表中设置");
                    }
                }
                throw new Exception("@没有找到分流节点的明细表作为子线程的发起的数据源,流程设计错误,请确认分流节点表单中的明细表是否有UserNo约定的系统字段。" + msg);
            }
            #endregion  照明细表,作为子线程的接收人.

            #region  节点绑定的人员处理.
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByBindEmp)
            {
                ps = new Paras();
                ps.Add("FK_Node", town.HisNode.NodeID);
                ps.SQL = "SELECT FK_Emp FROM WF_NodeEmp WHERE FK_Node=" + dbStr + "FK_Node ORDER BY FK_Emp";
                dt     = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count == 0)
                {
                    throw new Exception("@流程设计错误:下一个节点(" + town.HisNode.Name + ")没有绑定工作人员 . ");
                }
                return(dt);
            }
            #endregion  节点绑定的人员处理.

            #region  照选择的人员处理。
            if (town.HisNode.HisDeliveryWay == DeliveryWay.BySelected ||
                town.HisNode.HisDeliveryWay == DeliveryWay.ByFEE)
            {
                ps = new Paras();
                ps.Add("FK_Node", this.town.HisNode.NodeID);
                ps.Add("WorkID", this.currWn.HisWork.OID);
                ps.SQL = "SELECT FK_Emp FROM WF_SelectAccper WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID AND AccType=0 ORDER BY IDX";
                dt     = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count == 0)
                {
                    /*从上次发送设置的地方查询. */
                    SelectAccpers sas = new SelectAccpers();
                    int           i   = sas.QueryAccepterPriSetting(this.town.HisNode.NodeID);
                    if (i == 0)
                    {
                        if (town.HisNode.HisDeliveryWay == DeliveryWay.BySelected)
                        {
                            throw new Exception("@请选择下一步骤工作(" + town.HisNode.Name + ")接受人员。");
                        }
                        else
                        {
                            throw new Exception("@流程设计错误,请重写FEE,然后为节点(" + town.HisNode.Name + ")设置接受人员,详细请参考cc流程设计手册。");
                        }
                    }

                    //插入里面.
                    foreach (SelectAccper item in sas)
                    {
                        DataRow dr = dt.NewRow();
                        dr[0] = item.FK_Emp;
                        dt.Rows.Add(dr);
                    }
                    return(dt);
                }
                return(dt);
            }
            #endregion  照选择的人员处理。

            #region  照指定节点的处理人计算。
            if (town.HisNode.HisDeliveryWay == DeliveryWay.BySpecNodeEmp ||
                town.HisNode.HisDeliveryWay == DeliveryWay.ByStarter)
            {
                /* 按指定节点岗位上的人员计算 */
                string strs = town.HisNode.DeliveryParas;
                if (town.HisNode.HisDeliveryWay == DeliveryWay.ByStarter)
                {
                    /*找开始节点的处理人员. */
                    strs   = int.Parse(this.fl.No) + "01";
                    ps     = new Paras();
                    ps.SQL = "SELECT FK_Emp FROM WF_GenerWorkerList WHERE WorkID=" + dbStr + "OID AND FK_Node=" + dbStr + "FK_Node AND IsPass=1 AND IsEnable=1 ";
                    ps.Add("FK_Node", int.Parse(strs));
                    ps.Add("OID", this.WorkID);
                    dt = DBAccess.RunSQLReturnTable(ps);
                    if (dt.Rows.Count == 1)
                    {
                        return(dt);
                    }
                    else
                    {
                        /* 有可能当前节点就是第一个节点,那个时间还没有初始化数据,就返回当前人. */
                        DataRow dr = dt.NewRow();
                        dr[0] = BP.Web.WebUser.No;
                        dt.Rows.Add(dr);
                        return(dt);
                    }
                }

                // 首先从本流程里去找。
                strs = strs.Replace(";", ",");
                string[] nds = strs.Split(',');
                foreach (string nd in nds)
                {
                    if (string.IsNullOrEmpty(nd))
                    {
                        continue;
                    }

                    if (DataType.IsNumStr(nd) == false)
                    {
                        throw new Exception("流程设计错误:您设置的节点(" + town.HisNode.Name + ")的接收方式为按指定的节点岗位投递,但是您没有在访问规则设置中设置节点编号。");
                    }

                    ps     = new Paras();
                    ps.SQL = "SELECT FK_Emp FROM WF_GenerWorkerList WHERE WorkID=" + dbStr + "OID AND FK_Node=" + dbStr + "FK_Node AND IsPass=1 AND IsEnable=1 ";
                    ps.Add("FK_Node", int.Parse(nd));
                    if (this.currWn.HisNode.HisRunModel == RunModel.SubThread)
                    {
                        ps.Add("OID", this.currWn.HisWork.FID);
                    }
                    else
                    {
                        ps.Add("OID", this.WorkID);
                    }

                    DataTable dt_ND = DBAccess.RunSQLReturnTable(ps);
                    //添加到结果表
                    if (dt_ND.Rows.Count != 0)
                    {
                        foreach (DataRow row in dt_ND.Rows)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = row[0].ToString();
                            dt.Rows.Add(dr);
                        }
                        //此节点已找到数据则不向下找,继续下个节点
                        continue;
                    }

                    //就要到轨迹表里查,因为有可能是跳过的节点.
                    ps     = new Paras();
                    ps.SQL = "SELECT " + TrackAttr.EmpFrom + " FROM ND" + int.Parse(fl.No) + "Track WHERE (ActionType=" + dbStr + "ActionType1 OR ActionType=" + dbStr + "ActionType2 OR ActionType=" + dbStr + "ActionType3 OR ActionType=" + dbStr + "ActionType4 OR ActionType=" + dbStr + "ActionType5) AND NDFrom=" + dbStr + "NDFrom AND WorkID=" + dbStr + "WorkID";
                    ps.Add("ActionType1", (int)ActionType.Skip);
                    ps.Add("ActionType2", (int)ActionType.Forward);
                    ps.Add("ActionType3", (int)ActionType.ForwardFL);
                    ps.Add("ActionType4", (int)ActionType.ForwardHL);
                    ps.Add("ActionType5", (int)ActionType.Start);

                    ps.Add("NDFrom", int.Parse(nd));
                    ps.Add("WorkID", this.WorkID);
                    dt_ND = DBAccess.RunSQLReturnTable(ps);
                    if (dt_ND.Rows.Count != 0)
                    {
                        foreach (DataRow row in dt_ND.Rows)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = row[0].ToString();
                            dt.Rows.Add(dr);
                        }
                    }
                }

                //本流程里没有有可能该节点是配置的父流程节点,也就是说子流程的一个节点与父流程指定的节点的工作人员一致.
                GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID);
                if (gwf.PWorkID != 0)
                {
                    foreach (string pnodeiD in nds)
                    {
                        if (string.IsNullOrEmpty(pnodeiD))
                        {
                            continue;
                        }

                        Node nd = new Node(int.Parse(pnodeiD));
                        if (nd.FK_Flow != gwf.PFlowNo)
                        {
                            continue; // 如果不是父流程的节点,就不执行.
                        }
                        ps     = new Paras();
                        ps.SQL = "SELECT FK_Emp FROM WF_GenerWorkerList WHERE WorkID=" + dbStr + "OID AND FK_Node=" + dbStr + "FK_Node AND IsPass=1 AND IsEnable=1 ";
                        ps.Add("FK_Node", nd.NodeID);
                        if (this.currWn.HisNode.HisRunModel == RunModel.SubThread)
                        {
                            ps.Add("OID", gwf.PFID);
                        }
                        else
                        {
                            ps.Add("OID", gwf.PWorkID);
                        }

                        DataTable dt_PWork = DBAccess.RunSQLReturnTable(ps);
                        if (dt_PWork.Rows.Count != 0)
                        {
                            foreach (DataRow row in dt_PWork.Rows)
                            {
                                DataRow dr = dt.NewRow();
                                dr[0] = row[0].ToString();
                                dt.Rows.Add(dr);
                            }
                            //此节点已找到数据则不向下找,继续下个节点
                            continue;
                        }

                        //就要到轨迹表里查,因为有可能是跳过的节点.
                        ps     = new Paras();
                        ps.SQL = "SELECT " + TrackAttr.EmpFrom + " FROM ND" + int.Parse(fl.No) + "Track WHERE (ActionType=" + dbStr + "ActionType1 OR ActionType=" + dbStr + "ActionType2 OR ActionType=" + dbStr + "ActionType3 OR ActionType=" + dbStr + "ActionType4 OR ActionType=" + dbStr + "ActionType5) AND NDFrom=" + dbStr + "NDFrom AND WorkID=" + dbStr + "WorkID";
                        ps.Add("ActionType1", (int)ActionType.Start);
                        ps.Add("ActionType2", (int)ActionType.Forward);
                        ps.Add("ActionType3", (int)ActionType.ForwardFL);
                        ps.Add("ActionType4", (int)ActionType.ForwardHL);
                        ps.Add("ActionType5", (int)ActionType.Skip);

                        ps.Add("NDFrom", nd.NodeID);

                        if (this.currWn.HisNode.HisRunModel == RunModel.SubThread)
                        {
                            ps.Add("OID", gwf.PFID);
                        }
                        else
                        {
                            ps.Add("OID", gwf.PWorkID);
                        }

                        dt_PWork = DBAccess.RunSQLReturnTable(ps);
                        if (dt_PWork.Rows.Count != 0)
                        {
                            foreach (DataRow row in dt_PWork.Rows)
                            {
                                DataRow dr = dt.NewRow();
                                dr[0] = row[0].ToString();
                                dt.Rows.Add(dr);
                            }
                        }
                    }
                }
                //返回指定节点的处理人
                if (dt.Rows.Count != 0)
                {
                    return(dt);
                }

                throw new Exception("@流程设计错误,到达的节点(" + town.HisNode.Name + ")在指定的节点(" + strs + ")中没有数据,无法找到工作的人员。 @技术信息如下: 投递方式:BySpecNodeEmp sql=" + ps.SQLNoPara);
            }
            #endregion  照节点绑定的人员处理。

            #region  照上一个节点表单指定字段的人员处理。
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByPreviousNodeFormEmpsField)
            {
                // 检查接受人员规则,是否符合设计要求.
                string specEmpFields = town.HisNode.DeliveryParas;
                if (string.IsNullOrEmpty(specEmpFields))
                {
                    specEmpFields = "SysSendEmps";
                }

                if (this.currWn.HisWork.EnMap.Attrs.Contains(specEmpFields) == false)
                {
                    throw new Exception("@您设置的当前节点按照指定的人员,决定下一步的接受人员,但是你没有在节点表单中设置该表单" + specEmpFields + "字段。");
                }

                //获取接受人并格式化接受人,
                string emps = this.currWn.HisWork.GetValStringByKey(specEmpFields);
                emps = emps.Replace(" ", "");
                if (emps.Contains(",") && emps.Contains(";"))
                {
                    /*如果包含,; 例如 zhangsan,张三;lisi,李四;*/
                    string[] myemps1 = emps.Split(';');
                    foreach (string str in myemps1)
                    {
                        if (string.IsNullOrEmpty(str))
                        {
                            continue;
                        }

                        string[] ss = str.Split(',');
                        DataRow  dr = dt.NewRow();
                        dr[0] = ss[0];
                        dt.Rows.Add(dr);
                    }
                    if (dt.Rows.Count == 0)
                    {
                        throw new Exception("@输入的接受人员信息错误;[" + emps + "]。");
                    }
                    else
                    {
                        return(dt);
                    }
                }

                emps = emps.Replace(";", ",");
                emps = emps.Replace(";", ",");
                emps = emps.Replace(",", ",");
                emps = emps.Replace("、", ",");
                emps = emps.Replace("@", ",");

                if (string.IsNullOrEmpty(emps))
                {
                    throw new Exception("@没有在字段[" + this.currWn.HisWork.EnMap.Attrs.GetAttrByKey(specEmpFields).Desc + "]中指定接受人,工作无法向下发送。");
                }

                // 把它加入接受人员列表中.
                string[] myemps = emps.Split(',');
                foreach (string s in myemps)
                {
                    if (string.IsNullOrEmpty(s))
                    {
                        continue;
                    }

                    //if (BP.DA.DBAccess.RunSQLReturnValInt("SELECT COUNT(NO) AS NUM FROM Port_Emp WHERE NO='" + s + "' or name='"+s+"'", 0) == 0)
                    //    continue;

                    DataRow dr = dt.NewRow();
                    dr[0] = s;
                    dt.Rows.Add(dr);
                }
                return(dt);
            }
            #endregion  照上一个节点表单指定字段的人员处理。

            string      prjNo       = "";
            FlowAppType flowAppType = this.currWn.HisNode.HisFlow.HisFlowAppType;
            sql = "";
            if (this.currWn.HisNode.HisFlow.HisFlowAppType == FlowAppType.PRJ)
            {
                prjNo = "";
                try
                {
                    prjNo = this.currWn.HisWork.GetValStrByKey("PrjNo");
                }
                catch (Exception ex)
                {
                    throw new Exception("@当前流程是工程类流程,但是在节点表单中没有PrjNo字段(注意区分大小写),请确认。@异常信息:" + ex.Message);
                }
            }

            #region  部门与岗位的交集计算.
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByDeptAndStation)
            {
                //added by liuxc,2015.6.29.
                //区别集成与BPM模式
                if (BP.WF.Glo.OSModel == OSModel.WorkFlow)
                {
                    sql  = "SELECT No FROM Port_Emp WHERE No IN ";
                    sql += "(SELECT FK_Emp FROM Port_EmpDept WHERE FK_Dept IN ";
                    sql += "( SELECT FK_Dept FROM WF_NodeDept WHERE FK_Node=" + dbStr + "FK_Node1)";
                    sql += ")";
                    sql += "AND No IN ";
                    sql += "(";
                    sql += "SELECT FK_Emp FROM " + BP.WF.Glo.EmpStation + " WHERE FK_Station IN ";
                    sql += "( SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node2 )";
                    sql += ") ORDER BY No ";

                    ps = new Paras();
                    ps.Add("FK_Node1", town.HisNode.NodeID);
                    ps.Add("FK_Node2", town.HisNode.NodeID);
                    ps.SQL = sql;
                    dt     = DBAccess.RunSQLReturnTable(ps);
                }
                else
                {
                    sql = "SELECT pdes.FK_Emp AS No"
                          + " FROM   Port_DeptEmpStation pdes"
                          + " INNER JOIN WF_NodeDept wnd ON wnd.FK_Dept = pdes.FK_Dept"
                          + " AND wnd.FK_Node = " + town.HisNode.NodeID
                          + " INNER JOIN WF_NodeStation wns ON  wns.FK_Station = pdes.FK_Station"
                          + " AND wns.FK_Node =" + town.HisNode.NodeID
                          + " ORDER BY pdes.FK_Emp";

                    dt = DBAccess.RunSQLReturnTable(sql);
                }

                if (dt.Rows.Count > 0)
                {
                    return(dt);
                }
                else
                {
                    throw new Exception("@节点访问规则错误:节点(" + town.HisNode.NodeID + "," + town.HisNode.Name + "), 按照岗位与部门的交集确定接受人的范围错误,没有找到人员:SQL=" + sql);
                }
            }
            #endregion  部门与岗位的交集计算.


            #region 判断节点部门里面是否设置了部门,如果设置了,就按照它的部门处理。
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByDept)
            {
                ps = new Paras();
                ps.Add("FK_Node", this.town.HisNode.NodeID);
                ps.Add("WorkID", this.currWn.HisWork.OID);
                ps.SQL = "SELECT FK_Emp FROM WF_SelectAccper WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID AND AccType=0 ORDER BY IDX";
                dt     = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count > 0)
                {
                    return(dt);
                }
                if (flowAppType == FlowAppType.Normal)
                {
                    ps      = new Paras();
                    ps.SQL  = "SELECT No,Name FROM Port_Emp WHERE FK_Dept IN (SELECT FK_Dept FROM WF_NodeDept WHERE FK_Node=" + dbStr + "FK_Node1)";
                    ps.SQL += " OR ";
                    ps.SQL += " No IN (SELECT FK_Emp FROM Port_EmpDept WHERE FK_Dept IN ( SELECT FK_Dept FROM WF_NodeDept WHERE FK_Node=" + dbStr + "FK_Node2 ) )";
                    ps.SQL += " ORDER BY No";
                    ps.Add("FK_Node1", town.HisNode.NodeID);
                    ps.Add("FK_Node2", town.HisNode.NodeID);

                    dt = DBAccess.RunSQLReturnTable(ps);
                    if (dt.Rows.Count > 0 && town.HisNode.HisWhenNoWorker != WhenNoWorker.Skip)
                    {
                        return(dt);
                    }
                    else
                    {
                        //IsFindWorker = false;
                        //  ps.SQL = "SELECT No,Name FROM Port_Emp WHERE FK_Dept IN ( SELECT FK_Dept FROM WF_NodeDept WHERE FK_Node=" + dbStr + "FK_Node )";
                        throw new Exception("@按部门确定接受人的范围,没有找到人员.");
                    }
                }

                if (flowAppType == FlowAppType.PRJ)
                {
                    sql  = "SELECT No FROM Port_Emp WHERE No IN ";
                    sql += "(SELECT FK_Emp FROM Port_EmpDept WHERE FK_Dept IN ";
                    sql += "( SELECT FK_Dept FROM WF_NodeDept WHERE FK_Node=" + dbStr + "FK_Node1)";
                    sql += ")";
                    sql += "AND NO IN ";
                    sql += "(";
                    sql += "SELECT FK_Emp FROM Prj_EmpPrjStation WHERE FK_Station IN ";
                    sql += "( SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node2) AND FK_Prj=" + dbStr + "FK_Prj ";
                    sql += ")";
                    sql += " ORDER BY No";

                    ps = new Paras();
                    ps.Add("FK_Node1", town.HisNode.NodeID);
                    ps.Add("FK_Node2", town.HisNode.NodeID);
                    ps.Add("FK_Prj", prjNo);
                    ps.SQL = sql;

                    dt = DBAccess.RunSQLReturnTable(ps);
                    if (dt.Rows.Count == 0)
                    {
                        /* 如果项目组里没有工作人员就提交到公共部门里去找。*/
                        sql  = "SELECT NO FROM Port_Emp WHERE NO IN ";
                        sql += "(SELECT FK_Emp FROM Port_EmpDept WHERE FK_Dept IN ";
                        sql += "( SELECT FK_Dept FROM WF_NodeDept WHERE FK_Node=" + dbStr + "FK_Node1)";
                        sql += ")";
                        sql += "AND NO IN ";
                        sql += "(";
                        sql += "SELECT FK_Emp FROM " + BP.WF.Glo.EmpStation + " WHERE FK_Station IN ";
                        sql += "( SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node2)";
                        sql += ")";
                        sql += " ORDER BY No";

                        ps = new Paras();
                        ps.Add("FK_Node1", town.HisNode.NodeID);
                        ps.Add("FK_Node2", town.HisNode.NodeID);
                        ps.SQL = sql;
                    }
                    else
                    {
                        return(dt);
                    }

                    dt = DBAccess.RunSQLReturnTable(ps);
                    if (dt.Rows.Count > 0)
                    {
                        return(dt);
                    }
                }
            }
            #endregion 判断节点部门里面是否设置了部门,如果设置了,就按照它的部门处理。

            #region 仅按岗位计算
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByStationOnly)
            {
                sql = "SELECT A.FK_Emp FROM " + BP.WF.Glo.EmpStation + " A, WF_NodeStation B WHERE A.FK_Station=B.FK_Station AND B.FK_Node=" + dbStr + "FK_Node ORDER BY A.FK_Emp";
                ps  = new Paras();
                ps.Add("FK_Node", town.HisNode.NodeID);
                ps.SQL = sql;
                dt     = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count > 0)
                {
                    return(dt);
                }
                else
                {
                    throw new Exception("@节点访问规则错误:节点(" + town.HisNode.NodeID + "," + town.HisNode.Name + "), 按节点岗位与人员部门集合两个纬度计算,没有找到人员:SQL=" + sql);
                }
            }
            #endregion


            #region  岗位计算(以部门集合为纬度).
            if (town.HisNode.HisDeliveryWay == DeliveryWay.ByStationAndEmpDept)
            {
                sql = "SELECT No FROM Port_Emp WHERE NO IN "
                      + "(SELECT  FK_Emp  FROM " + BP.WF.Glo.EmpStation + " WHERE FK_Station IN (SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node) )"
                      + " AND  FK_Dept IN "
                      + "(SELECT  FK_Dept  FROM Port_EmpDept WHERE FK_Emp =" + dbStr + "FK_Emp)";

                sql += " ORDER BY No";

                ps = new Paras();
                ps.Add("FK_Node", town.HisNode.NodeID);
                ps.Add("FK_Emp", WebUser.No);
                ps.SQL = sql;
                //2012.7.16李健修改
                //+" AND  NO IN "
                //+ "(SELECT  FK_Emp  FROM Port_EmpDept WHERE FK_Emp = '" + WebUser.No + "')";
                dt = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count > 0)
                {
                    return(dt);
                }
                else
                {
                    throw new Exception("@节点访问规则错误:节点(" + town.HisNode.NodeID + "," + town.HisNode.Name + "), 按节点岗位与人员部门集合两个纬度计算,没有找到人员:SQL=" + sql);
                }
            }
            #endregion

            string empNo   = WebUser.No;
            string empDept = WebUser.FK_Dept;

            #region  指定的节点的人员岗位,做为下一步骤的流程接受人。
            if (town.HisNode.HisDeliveryWay == DeliveryWay.BySpecNodeEmpStation)
            {
                /* 按指定的节点的人员岗位 */
                string fk_node = town.HisNode.DeliveryParas;
                if (DataType.IsNumStr(fk_node) == false)
                {
                    throw new Exception("流程设计错误:您设置的节点(" + town.HisNode.Name + ")的接收方式为按指定的节点人员岗位投递,但是您没有在访问规则设置中设置节点编号。");
                }

                ps     = new Paras();
                ps.SQL = "SELECT Rec,FK_Dept FROM ND" + fk_node + " WHERE OID=" + dbStr + "OID";
                ps.Add("OID", this.WorkID);
                dt = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count != 1)
                {
                    throw new Exception("@流程设计错误,到达的节点(" + town.HisNode.Name + ")在指定的节点中没有数据,无法找到工作的人员。");
                }

                empNo   = dt.Rows[0][0].ToString();
                empDept = dt.Rows[0][1].ToString();
            }
            #endregion  指定的节点人员,做为下一步骤的流程接受人。

            #region 最后判断 - 按照岗位来执行。
            if (this.currWn.HisNode.IsStartNode == false)
            {
                ps = new Paras();
                if (flowAppType == FlowAppType.Normal || flowAppType == FlowAppType.DocFlow)
                {
                    // 如果当前的节点不是开始节点, 从轨迹里面查询。
                    sql = "SELECT DISTINCT FK_Emp  FROM " + BP.WF.Glo.EmpStation + " WHERE FK_Station IN "
                          + "(SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + town.HisNode.NodeID + ") "
                          + "AND FK_Emp IN (SELECT FK_Emp FROM WF_GenerWorkerlist WHERE WorkID=" + dbStr + "WorkID AND FK_Node IN (" + DataType.PraseAtToInSql(town.HisNode.GroupStaNDs, true) + ") )";

                    sql += " ORDER BY FK_Emp ";

                    ps.SQL = sql;
                    ps.Add("WorkID", this.WorkID);
                }

                if (flowAppType == FlowAppType.PRJ)
                {
                    // 如果当前的节点不是开始节点, 从轨迹里面查询。
                    sql = "SELECT DISTINCT FK_Emp  FROM Prj_EmpPrjStation WHERE FK_Station IN "
                          + "(SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node ) AND FK_Prj=" + dbStr + "FK_Prj "
                          + "AND FK_Emp IN (SELECT FK_Emp FROM WF_GenerWorkerlist WHERE WorkID=" + dbStr + "WorkID AND FK_Node IN (" + DataType.PraseAtToInSql(town.HisNode.GroupStaNDs, true) + ") )";
                    sql += " ORDER BY FK_Emp ";

                    ps     = new Paras();
                    ps.SQL = sql;
                    ps.Add("FK_Node", town.HisNode.NodeID);
                    ps.Add("FK_Prj", prjNo);
                    ps.Add("WorkID", this.WorkID);

                    dt = DBAccess.RunSQLReturnTable(ps);
                    if (dt.Rows.Count == 0)
                    {
                        /* 如果项目组里没有工作人员就提交到公共部门里去找。*/
                        sql = "SELECT DISTINCT FK_Emp  FROM " + BP.WF.Glo.EmpStation + " WHERE FK_Station IN "
                              + "(SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node ) "
                              + "AND FK_Emp IN (SELECT FK_Emp FROM WF_GenerWorkerlist WHERE WorkID=" + dbStr + "WorkID AND FK_Node IN (" + DataType.PraseAtToInSql(town.HisNode.GroupStaNDs, true) + ") )";
                        sql += " ORDER BY FK_Emp ";

                        ps     = new Paras();
                        ps.SQL = sql;
                        ps.Add("FK_Node", town.HisNode.NodeID);
                        ps.Add("WorkID", this.WorkID);
                    }
                    else
                    {
                        return(dt);
                    }
                }

                dt = DBAccess.RunSQLReturnTable(ps);
                // 如果能够找到.
                if (dt.Rows.Count >= 1)
                {
                    if (dt.Rows.Count == 1)
                    {
                        /*如果人员只有一个的情况,说明他可能要 */
                    }
                    return(dt);
                }
            }

            /* 如果执行节点 与 接受节点岗位集合一致 */
            if (this.currWn.HisNode.GroupStaNDs == town.HisNode.GroupStaNDs)
            {
                /* 说明,就把当前人员做为下一个节点处理人。*/
                DataRow dr = dt.NewRow();
                dr[0] = WebUser.No;
                dt.Rows.Add(dr);
                return(dt);
            }

            /* 如果执行节点 与 接受节点岗位集合不一致 */
            if (this.currWn.HisNode.GroupStaNDs != town.HisNode.GroupStaNDs)
            {
                /* 没有查询到的情况下, 先按照本部门计算。*/
                if (flowAppType == FlowAppType.Normal)
                {
                    if (BP.WF.Glo.OSModel == OSModel.BPM)
                    {
                        sql = "SELECT FK_Emp as No FROM Port_DeptEmpStation A, WF_NodeStation B         WHERE A.FK_Station=B.FK_Station AND B.FK_Node=" + dbStr + "FK_Node AND A.FK_Dept=" + dbStr + "FK_Dept";
                    }
                    else
                    {
                        sql = "SELECT FK_Emp as No FROM Port_EmpStation A, WF_NodeStation B, Port_Emp C WHERE A.FK_Station=B.FK_Station AND A.FK_Emp=C.No  AND B.FK_Node=" + dbStr + "FK_Node AND C.FK_Dept=" + dbStr + "FK_Dept";
                    }
                    ps     = new Paras();
                    ps.SQL = sql;
                    ps.Add("FK_Node", town.HisNode.NodeID);
                    ps.Add("FK_Dept", empDept);
                }

                if (flowAppType == FlowAppType.PRJ)
                {
                    sql = "SELECT  FK_Emp  FROM Prj_EmpPrjStation WHERE FK_Prj=" + dbStr + "FK_Prj1 AND FK_Station IN (SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node)"
                          + " AND  FK_Prj=" + dbStr + "FK_Prj2 ";
                    sql += " ORDER BY FK_Emp ";

                    ps     = new Paras();
                    ps.SQL = sql;
                    ps.Add("FK_Prj1", prjNo);
                    ps.Add("FK_Node", town.HisNode.NodeID);
                    ps.Add("FK_Prj2", prjNo);
                    dt = DBAccess.RunSQLReturnTable(ps);
                    if (dt.Rows.Count == 0)
                    {
                        /* 如果项目组里没有工作人员就提交到公共部门里去找。 */
                        sql = "SELECT No FROM Port_Emp WHERE NO IN "
                              + "(SELECT  FK_Emp  FROM " + BP.WF.Glo.EmpStation + " WHERE FK_Station IN (SELECT FK_Station FROM WF_NodeStation WHERE FK_Node=" + dbStr + "FK_Node))"
                              + " AND  NO IN "
                              + "(SELECT FK_Emp FROM Port_EmpDept WHERE FK_Dept =" + dbStr + "FK_Dept)";

                        sql += " ORDER BY No ";

                        ps     = new Paras();
                        ps.SQL = sql;
                        ps.Add("FK_Node", town.HisNode.NodeID);
                        ps.Add("FK_Dept", empDept);
                        //  dt = DBAccess.RunSQLReturnTable(ps);
                    }
                    else
                    {
                        return(dt);
                    }
                }

                dt = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count == 0)
                {
                    NodeStations nextStations = town.HisNode.NodeStations;
                    if (nextStations.Count == 0)
                    {
                        throw new Exception("节点没有岗位:" + town.HisNode.NodeID + "  " + town.HisNode.Name);
                    }
                }
                else
                {
                    bool isInit = false;
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr[0].ToString() == BP.Web.WebUser.No)
                        {
                            /* 如果岗位分组不一样,并且结果集合里还有当前的人员,就说明了出现了当前操作员,拥有本节点上的岗位也拥有下一个节点的工作岗位
                             * 导致:节点的分组不同,传递到同一个人身上。 */
                            isInit = true;
                        }
                    }

#warning edit by peng, 用来确定不同岗位集合的传递包含同一个人的处理方式。


                    //  if (isInit == false || isInit == true)
                    return(dt);
                }
            }

            /*这里去掉了向下级别寻找的算法. */


            /* 没有查询到的情况下, 按照最大匹配数 提高一个级别计算,递归算法未完成。
             * 因为:以上已经做的岗位的判断,就没有必要在判断其它类型的节点处理了。
             * */
            string nowDeptID = empDept.Clone() as string;
            while (true)
            {
                BP.Port.Dept myDept = new BP.Port.Dept(nowDeptID);
                nowDeptID = myDept.ParentNo;
                if (nowDeptID == "-1" || nowDeptID.ToString() == "0")
                {
                    break; /*一直找到了最高级仍然没有发现,就跳出来循环从当前操作员人部门向下找。*/
                    throw new Exception("@按岗位计算没有找到(" + town.HisNode.Name + ")接受人.");
                }

                //检查指定的部门下面是否有该人员.
                DataTable mydtTemp = this.Func_GenerWorkerList_DiGui(nowDeptID, empNo);
                if (mydtTemp == null)
                {
                    /*如果父亲级没有,就找父级的平级. */
                    BP.Port.Depts myDepts = new BP.Port.Depts();
                    myDepts.Retrieve(BP.Port.DeptAttr.ParentNo, myDept.ParentNo);
                    foreach (BP.Port.Dept item in myDepts)
                    {
                        if (item.No == nowDeptID)
                        {
                            continue;
                        }
                        mydtTemp = this.Func_GenerWorkerList_DiGui(item.No, empNo);
                        if (mydtTemp == null)
                        {
                            continue;
                        }
                        else
                        {
                            return(mydtTemp);
                        }
                    }

                    continue; /*如果平级也没有,就continue.*/
                }
                else
                {
                    return(mydtTemp);
                }
            }

            /*如果向上找没有找到,就考虑从本级部门上向下找。 */
            nowDeptID = empDept.Clone() as string;
            BP.Port.Depts subDepts = new BP.Port.Depts(nowDeptID);

            //递归出来子部门下有该岗位的人员
            DataTable mydt = Func_GenerWorkerList_DiGui_ByDepts(subDepts, empNo);
            if (mydt == null)
            {
                throw new Exception("@按岗位计算没有找到(" + town.HisNode.Name + ")接受人.");
            }
            return(mydt);

            #endregion   照岗位来执行。
        }