Exemplo n.º 1
0
        private void ReorderLog(Node fromND, Node toND, ReturnWork rw)
        {
            string filePath = BP.SystemConfig.PathOfDataUser + "\\ReturnLog\\" + this.HisNode.FK_Flow + "\\";

            if (System.IO.Directory.Exists(filePath) == false)
            {
                System.IO.Directory.CreateDirectory(filePath);
            }

            string file = filePath + "\\" + rw.MyPK;

            infoLog  = "\r\n退回人:" + WebUser.No + "," + WebUser.Name + " \r\n退回节点:" + fromND.Name + " \r\n退回到:" + toND.Name;
            infoLog += "\r\n退回时间:" + DataType.CurrentDataTime;
            infoLog += "\r\n原因:" + rw.Note;

            ReorderLog(fromND, toND);
            DataType.WriteFile(file + ".txt", infoLog);
            DataType.WriteFile(file + ".htm", infoLog.Replace("\r\n", "<br>"));

            // this.HisWork.Delete();
        }
Exemplo n.º 2
0
        private WorkNode DoReturnSubFlow(int backtoNodeID, string msg, bool isHiden)
        {
            Node nd = new Node(backtoNodeID);

            ps     = new Paras();
            ps.SQL = "DELETE  FROM WF_GenerWorkerList WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID  AND FID=" + dbStr + "FID";
            ps.Add("FK_Node", backtoNodeID);
            ps.Add("WorkID", this.HisWork.OID);
            ps.Add("FID", this.HisWork.FID);
            BP.DA.DBAccess.RunSQL(ps);

            // 找出分合流点处理的人员.
            ps     = new Paras();
            ps.SQL = "SELECT FK_Emp FROM WF_GenerWorkerList WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "FID";
            ps.Add("FID", this.HisWork.FID);
            ps.Add("FK_Node", backtoNodeID);
            DataTable dt = DBAccess.RunSQLReturnTable(ps);

            if (dt.Rows.Count != 1)
            {
                throw new Exception("@ system error , this values must be =1");
            }

            string FK_Emp = dt.Rows[0][0].ToString();
            // 获取当前工作的信息.
            GenerWorkerList wl  = new GenerWorkerList(this.HisWork.FID, this.HisNode.NodeID, FK_Emp);
            Emp             emp = new Emp(FK_Emp);

            // 改变部分属性让它适应新的数据,并显示一条新的待办工作让用户看到。
            wl.IsPass     = false;
            wl.WorkID     = this.HisWork.OID;
            wl.FID        = this.HisWork.FID;
            wl.RDT        = DataType.CurrentDataTime;
            wl.FK_Emp     = FK_Emp;
            wl.FK_EmpText = emp.Name;

            wl.FK_Node     = backtoNodeID;
            wl.FK_NodeText = nd.Name;
            wl.WarningDays = nd.WarningDays;
            wl.FK_Dept1    = emp.FK_Dept;

            DateTime dtNew = DateTime.Now;

            dtNew      = dtNew.AddDays(nd.WarningDays);
            wl.SDT     = dtNew.ToString(DataType.SysDataFormat); // DataType.CurrentDataTime;
            wl.FK_Flow = this.HisNode.FK_Flow;
            wl.Insert();

            GenerWorkFlow gwf = new GenerWorkFlow(this.HisWork.OID);

            gwf.FK_Node  = backtoNodeID;
            gwf.NodeName = nd.Name;
            gwf.DirectUpdate();

            ps = new Paras();
            ps.Add("FK_Node", backtoNodeID);
            ps.Add("WorkID", this.HisWork.OID);
            ps.SQL = "UPDATE WF_GenerWorkerList SET IsPass=3 WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID";
            BP.DA.DBAccess.RunSQL(ps);

            /* 如果是隐性退回。*/
            BP.WF.ReturnWork rw = new ReturnWork();
            rw.WorkID         = wl.WorkID;
            rw.ReturnToNode   = wl.FK_Node;
            rw.ReturnNode     = this.HisNode.NodeID;
            rw.ReturnNodeName = this.HisNode.Name;
            rw.ReturnToEmp    = FK_Emp;
            rw.Note           = msg;
            try
            {
                rw.MyPK = rw.ReturnToNode + "_" + rw.WorkID + "_" + DateTime.Now.ToString("yyyyMMddhhmmss");
                rw.Insert();
            }
            catch
            {
                rw.MyPK = rw.ReturnToNode + "_" + rw.WorkID + "_" + BP.DA.DBAccess.GenerOID();
                rw.Insert();
            }


            // 加入track.
            this.AddToTrack(ActionType.Return, FK_Emp, emp.Name, backtoNodeID, nd.Name, msg);

            WorkNode wn = new WorkNode(this.HisWork.FID, backtoNodeID);

            if (Glo.IsEnableSysMessage)
            {
                //  WF.Port.WFEmp wfemp = new Port.WFEmp(wn.HisWork.Rec);
                string title = string.Format("工作退回:流程:{0}.工作:{1},退回人:{2},需您处理",
                                             wn.HisNode.FlowName, wn.HisNode.Name, WebUser.Name);

                BP.WF.Dev2Interface.Port_SendMail(wn.HisWork.Rec, title, msg,
                                                  "RESub" + backtoNodeID + "_" + this.WorkID, nd.FK_Flow, nd.NodeID, this.WorkID, this.FID);
            }
            return(wn);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 普通节点到普通节点的退回
        /// </summary>
        /// <returns></returns>
        private string ExeReturn1_1()
        {
            //退回前事件
            string atPara = "@ToNode=" + this.ReurnToNode.NodeID;

            this.HisNode.MapData.FrmEvents.DoEventNode(EventListOfNode.ReturnBefore, this.HisWork, atPara);
            if (this.HisNode.FocusField != "")
            {
                // 把数据更新它。
                this.HisWork.Update(this.HisNode.FocusField, "");
            }

            // 改变当前待办工作节点。
            Paras ps = new Paras();

            ps.SQL = "UPDATE WF_GenerWorkFlow  SET WFState=" + dbStr + "WFState,FK_Node=" + dbStr + "FK_Node,NodeName=" + dbStr + "NodeName WHERE  WorkID=" + dbStr + "WorkID";
            ps.Add(GenerWorkFlowAttr.WFState, (int)WFState.ReturnSta);
            ps.Add(GenerWorkFlowAttr.FK_Node, this.ReurnToNode.NodeID);
            ps.Add(GenerWorkFlowAttr.NodeName, this.ReurnToNode.Name);
            ps.Add(GenerWorkFlowAttr.WorkID, this.WorkID);
            DBAccess.RunSQL(ps);

            ps     = new Paras();
            ps.SQL = "UPDATE WF_GenerWorkerList SET IsPass=0 WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID";
            ps.Add("FK_Node", this.ReurnToNode.NodeID);
            ps.Add("WorkID", this.WorkID);
            DBAccess.RunSQL(ps);


            //更新流程报表数据.
            ps     = new Paras();
            ps.SQL = "UPDATE " + this.HisNode.HisFlow.PTable + " SET  WFState=" + dbStr + "WFState, FlowEnder=" + dbStr + "FlowEnder, FlowEndNode=" + dbStr + "FlowEndNode WHERE OID=" + dbStr + "OID";
            ps.Add("WFState", (int)WFState.ReturnSta);
            ps.Add("FlowEnder", WebUser.No);
            ps.Add("FlowEndNode", ReurnToNode.NodeID);
            ps.Add("OID", this.WorkID);
            DBAccess.RunSQL(ps);


            //从工作人员列表里找到被退回人的接受人.
            GenerWorkerList gwl = new GenerWorkerList();

            gwl.Retrieve(GenerWorkerListAttr.FK_Node, this.ReurnToNode.NodeID, GenerWorkerListAttr.WorkID, this.WorkID);

            // 记录退回轨迹。
            ReturnWork rw = new ReturnWork();

            rw.WorkID         = this.WorkID;
            rw.ReturnToNode   = this.ReurnToNode.NodeID;
            rw.ReturnNodeName = this.ReurnToNode.Name;

            rw.ReturnNode  = this.HisNode.NodeID; // 当前退回节点.
            rw.ReturnToEmp = gwl.FK_Emp;          //退回给。

            rw.Note           = Msg;
            rw.IsBackTracking = this.IsBackTrack;
            rw.MyPK           = DBAccess.GenerOIDByGUID().ToString();
            rw.Insert();

            // 加入track.
            this.AddToTrack(ActionType.Return, gwl.FK_Emp, gwl.FK_EmpText,
                            this.ReurnToNode.NodeID, this.ReurnToNode.Name, Msg);

            try
            {
                // 记录退回日志.
                ReorderLog(this.ReurnToNode, this.HisNode, rw);
            }
            catch (Exception ex)
            {
                Log.DebugWriteWarning(ex.Message);
            }

            // 以退回到的节点向前数据用递归删除它。
            if (IsBackTrack == false)
            {
                /*如果退回不需要原路返回,就删除中间点的数据。*/
#warning 没有考虑两种流程数据存储模式。
                //DeleteToNodesData(this.ReurnToNode.HisToNodes);
            }

            // 向他发送消息。
            if (Glo.IsEnableSysMessage == true)
            {
                //   WF.Port.WFEmp wfemp = new Port.WFEmp(wnOfBackTo.HisWork.Rec);
                string title = string.Format("工作退回:流程:{0}.工作:{1},退回人:{2},需您处理",
                                             this.HisNode.FlowName, this.ReurnToNode.Name, WebUser.Name);

                BP.WF.Dev2Interface.Port_SendMail(gwl.FK_Emp, title, Msg, "RE" + this.HisNode.NodeID + this.WorkID, ReurnToNode.FK_Flow, ReurnToNode.NodeID, this.WorkID, this.FID);
            }

            //退回后事件
            this.HisNode.MapData.FrmEvents.DoEventNode(EventListOfNode.ReturnAfter, this.HisWork, atPara);

            // 返回退回信息.
            return("工作已经被您退回到(" + this.ReurnToNode.Name + "),退回给(" + gwl.FK_Emp + "," + gwl.FK_EmpText + ").");
        }
Exemplo n.º 4
0
        /// <summary>
        /// 合流点向子线程退回
        /// </summary>
        private string ExeReturn3_4()
        {
            GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID);

            gwf.FK_Node = this.ReurnToNode.NodeID;
            gwf.WFState = WFState.Runing;
            gwf.Update();

            string           info = "@工作已经成功的退回到(" + ReurnToNode.Name + ")退回给:";
            GenerWorkerLists gwls = new GenerWorkerLists();

            gwls.Retrieve(GenerWorkerListAttr.WorkID, this.WorkID,
                          GenerWorkerListAttr.FK_Node, this.ReurnToNode.NodeID);

            string toEmp     = "";
            string toEmpName = "";

            foreach (GenerWorkerList item in gwls)
            {
                item.IsPass = false;
                item.IsRead = false;
                item.Update();
                info     += item.FK_Emp + "," + item.FK_EmpText;
                toEmp     = item.FK_Emp;
                toEmpName = item.FK_EmpText;
            }

            //删除已经发向合流点的汇总数据.
            MapDtls dtls = new MapDtls("ND" + this.HisNode.NodeID);

            foreach (MapDtl dtl in dtls)
            {
                /*如果是合流数据*/
                if (dtl.IsHLDtl)
                {
                    BP.DA.DBAccess.RunSQL("DELETE " + dtl.PTable + " WHERE OID=" + this.WorkID);
                }
            }



            // 记录退回轨迹。
            ReturnWork rw = new ReturnWork();

            rw.WorkID         = this.WorkID;
            rw.ReturnToNode   = this.ReurnToNode.NodeID;
            rw.ReturnNodeName = this.ReurnToNode.Name;

            rw.ReturnNode  = this.HisNode.NodeID; // 当前退回节点.
            rw.ReturnToEmp = toEmp;               //退回给。

            rw.MyPK           = DBAccess.GenerOIDByGUID().ToString();
            rw.Note           = Msg;
            rw.IsBackTracking = this.IsBackTrack;
            rw.Insert();

            // 加入track.
            this.AddToTrack(ActionType.Return, toEmp, toEmpName,
                            this.ReurnToNode.NodeID, this.ReurnToNode.Name, Msg);

            // 返回退回信息.
            return(info);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 普通节点到普通节点的退回
        /// </summary>
        /// <returns></returns>
        private string ExeReturn1_1()
        {
            //退回前事件
            string atPara = "@ToNode=" + this.ReturnToNode.NodeID;
            string msg    = this.HisNode.HisFlow.DoFlowEventEntity(EventListOfNode.ReturnBefore, this.HisNode, this.HisWork,
                                                                   atPara);

            if (this.HisNode.FocusField != "")
            {
                try
                {
                    string   focusField  = "";
                    string[] focusFields = this.HisNode.FocusField.Split('@');
                    if (focusFields.Length >= 2)
                    {
                        focusField = focusFields[1];
                    }
                    else
                    {
                        focusField = focusFields[0];
                    }



                    // 把数据更新它。
                    this.HisWork.Update(focusField, "");
                }
                catch (Exception ex)
                {
                    Log.DefaultLogWriteLineError("退回时更新焦点字段错误:" + ex.Message);
                }
            }

            // 改变当前待办工作节点。
            Paras ps = new Paras();

            ps.SQL = "UPDATE WF_GenerWorkFlow  SET WFState=" + dbStr + "WFState,FK_Node=" + dbStr + "FK_Node,NodeName=" + dbStr + "NodeName WHERE  WorkID=" + dbStr + "WorkID";
            ps.Add(GenerWorkFlowAttr.WFState, (int)WFState.ReturnSta);
            ps.Add(GenerWorkFlowAttr.FK_Node, this.ReturnToNode.NodeID);
            ps.Add(GenerWorkFlowAttr.NodeName, this.ReturnToNode.Name);
            ps.Add(GenerWorkFlowAttr.WorkID, this.WorkID);
            DBAccess.RunSQL(ps);

            ps     = new Paras();
            ps.SQL = "UPDATE WF_GenerWorkerList SET IsPass=0,IsRead=0 WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID";
            ps.Add("FK_Node", this.ReturnToNode.NodeID);
            ps.Add("WorkID", this.WorkID);
            DBAccess.RunSQL(ps);


            //更新流程报表数据.
            ps     = new Paras();
            ps.SQL = "UPDATE " + this.HisNode.HisFlow.PTable + " SET  WFState=" + dbStr + "WFState, FlowEnder=" + dbStr + "FlowEnder, FlowEndNode=" + dbStr + "FlowEndNode WHERE OID=" + dbStr + "OID";
            ps.Add("WFState", (int)WFState.ReturnSta);
            ps.Add("FlowEnder", WebUser.No);
            ps.Add("FlowEndNode", ReturnToNode.NodeID);

            ps.Add("OID", this.WorkID);
            DBAccess.RunSQL(ps);

            //从工作人员列表里找到被退回人的接受人.
            GenerWorkerList gwl = new GenerWorkerList();

            gwl.Retrieve(GenerWorkerListAttr.FK_Node, this.ReturnToNode.NodeID, GenerWorkerListAttr.WorkID, this.WorkID);

            // 记录退回轨迹。
            ReturnWork rw = new ReturnWork();

            rw.WorkID         = this.WorkID;
            rw.ReturnToNode   = this.ReturnToNode.NodeID;
            rw.ReturnNodeName = this.ReturnToNode.Name;

            rw.ReturnNode  = this.HisNode.NodeID; // 当前退回节点.
            rw.ReturnToEmp = gwl.FK_Emp;          //退回给。
            rw.Note        = Msg;

            if (this.HisNode.TodolistModel == TodolistModel.Order ||
                this.HisNode.TodolistModel == TodolistModel.Sharing ||
                this.HisNode.TodolistModel == TodolistModel.Teamup)
            {
                rw.IsBackTracking = true; /*如果是共享,顺序,协作模式,都必须是退回并原路返回.*/

                // 需要更新当前人待办的状态, 把1000作为特殊标记,让其发送时可以找到他.
                string sql = "UPDATE WF_GenerWorkerlist SET IsPass=1000 WHERE FK_Node=" + this.HisNode.NodeID + " AND WorkID=" + this.WorkID + " AND FK_Emp='" + WebUser.No + "'";
                if (BP.DA.DBAccess.RunSQL(sql) == 0)
                {
                    throw new Exception("@退回错误,没有找到要更新的目标数据.技术信息:" + sql);
                }
            }
            else
            {
                rw.IsBackTracking = this.IsBackTrack;

                //调用删除GenerWorkerList数据,不然会导致两个节点之间有垃圾数据,特别遇到中间有分合流时候。
                this.DeleteSpanNodesGenerWorkerListData();
            }

            rw.MyPK = DBAccess.GenerOIDByGUID().ToString();
            rw.Insert();


            // 加入track.
            this.AddToTrack(ActionType.Return, gwl.FK_Emp, gwl.FK_EmpText,
                            this.ReturnToNode.NodeID, this.ReturnToNode.Name, Msg);



            try
            {
                // 记录退回日志. this.HisNode, this.ReturnToNode
                ReorderLog(this.ReturnToNode, this.HisNode, rw);
            }
            catch (Exception ex)
            {
                Log.DebugWriteWarning(ex.Message);
            }

            // 以退回到的节点向前数据用递归删除它。
            if (IsBackTrack == false)
            {
                /*如果退回不需要原路返回,就删除中间点的数据。*/
#warning 没有考虑两种流程数据存储模式。
                //DeleteToNodesData(this.ReturnToNode.HisToNodes);
            }

            // 向他发送消息。
            if (Glo.IsEnableSysMessage == true)
            {
                //   WF.Port.WFEmp wfemp = new Port.WFEmp(wnOfBackTo.HisWork.Rec);
                string title = string.Format("工作退回:流程:{0}.工作:{1},退回人:{2},需您处理",
                                             this.HisNode.FlowName, this.ReturnToNode.Name, WebUser.Name);

                BP.WF.Dev2Interface.Port_SendMsg(gwl.FK_Emp, title, Msg, "RE" + this.HisNode.NodeID + this.WorkID, BP.WF.SMSMsgType.ToDo, ReturnToNode.FK_Flow, ReturnToNode.NodeID, this.WorkID, this.FID);
            }

            string text = this.HisNode.HisFlow.DoFlowEventEntity(EventListOfNode.ReturnAfter, this.HisNode, this.HisWork,
                                                                 atPara);

            if (text != null && text.Length > 1000)
            {
                text = "退回事件:无返回信息.";
            }
            // 返回退回信息.
            if (this.ReturnToNode.IsGuestNode)
            {
                GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID);
                return("工作已经被您退回到(" + this.ReturnToNode.Name + "),退回给(" + gwf.GuestNo + "," + gwf.GuestName + ").\n\r" + text);
            }
            else
            {
                return("工作已经被您退回到(" + this.ReturnToNode.Name + "),退回给(" + gwl.FK_Emp + "," + gwl.FK_EmpText + ").\n\r" + text);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 子线程退回给分流点
        /// </summary>
        /// <returns></returns>
        private string ExeReturn5_2()
        {
            GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID);

            gwf.FK_Node = this.ReturnToNode.NodeID;
            string info = "@工作已经成功的退回到(" + ReturnToNode.Name + ")退回给:";

            //查询退回到的工作人员列表.
            GenerWorkerLists gwls = new GenerWorkerLists();

            gwls.Retrieve(GenerWorkerListAttr.WorkID, this.WorkID,
                          GenerWorkerListAttr.FK_Node, this.ReturnToNode.NodeID);

            string toEmp     = "";
            string toEmpName = "";

            if (gwls.Count == 1)
            {
                /*有可能多次退回的情况,表示曾经退回过n次。*/
                foreach (GenerWorkerList item in gwls)
                {
                    item.IsPass = false; // 显示待办, 这个是合流节点的工作人员.
                    item.IsRead = false; //
                    item.Update();
                    info     += item.FK_Emp + "," + item.FK_EmpText;
                    toEmp     = item.FK_Emp;
                    toEmpName = item.FK_EmpText;
                    info     += "(" + item.FK_Emp + "," + item.FK_EmpText + ")";
                }
            }
            else
            {
                // 找到合流点的发送人.
                Nodes nds = this.HisNode.FromNodes;
                gwls = new GenerWorkerLists();
                GenerWorkerList gwl = new GenerWorkerList();
                foreach (Node nd in nds)
                {
                    gwls.Retrieve(GenerWorkerListAttr.WorkID, this.FID,
                                  GenerWorkerListAttr.FK_Node, nd.NodeID,
                                  GenerWorkerListAttr.IsPass, 1);
                    if (gwls.Count == 0)
                    {
                        continue;
                    }

                    if (gwls.Count != 1)
                    {
                        throw new Exception("@应该只有一个记录,现在有多个,可能错误。");
                    }

                    //求出分流节点的发送人.
                    gwl       = (GenerWorkerList)gwls[0];
                    toEmp     = gwl.FK_Emp;
                    toEmpName = gwl.FK_EmpText;
                    info     += "(" + toEmp + "," + toEmpName + ")";
                }

                if (string.IsNullOrEmpty(toEmp) == true)
                {
                    throw new Exception("@在退回时出现错误,没有找到分流节点的发送人。");
                }

                // 插入一条数据, 行程一个工作人员记录,这个记录就是子线程的延长点. 给合流点上的接受人设置待办.
                gwl.WorkID = this.WorkID;
                gwl.FID    = this.FID;
                gwl.IsPass = false;
                if (gwl.IsExits == false)
                {
                    gwl.Insert();
                }
                else
                {
                    gwl.Update();
                }
            }

            // 记录退回轨迹。
            ReturnWork rw = new ReturnWork();

            rw.WorkID         = this.WorkID;
            rw.ReturnToNode   = this.ReturnToNode.NodeID;
            rw.ReturnNodeName = this.ReturnToNode.Name;

            rw.ReturnNode  = this.HisNode.NodeID; // 当前退回节点.
            rw.ReturnToEmp = toEmp;               //退回给。

            rw.MyPK           = DBAccess.GenerOIDByGUID().ToString();
            rw.Note           = Msg;
            rw.IsBackTracking = this.IsBackTrack;
            rw.Insert();

            // 加入track.
            this.AddToTrack(ActionType.Return, toEmp, toEmpName,
                            this.ReturnToNode.NodeID, this.ReturnToNode.Name, Msg);

            gwf.WFState     = WFState.ReturnSta;
            gwf.FK_Node     = this.ReturnToNode.NodeID;
            gwf.NodeName    = this.ReturnToNode.Name;
            gwf.Starter     = toEmp;
            gwf.StarterName = toEmpName;
            gwf.Update();

            //找到当前的工作数据.
            GenerWorkerList currWorker = new GenerWorkerList();
            int             i          = currWorker.Retrieve(GenerWorkerListAttr.FK_Emp, WebUser.No,
                                                             GenerWorkerListAttr.WorkID, this.WorkID,
                                                             GenerWorkerListAttr.FK_Node, this.HisNode.NodeID);

            if (i != 1)
            {
                throw new Exception("@当前的工作人员列表数据丢失了,流程引擎错误.");
            }

            //设置当前的工作数据为退回状态,让其不能看到待办, 这个是约定的值.
            currWorker.IsPassInt = (int)WFState.ReturnSta;
            currWorker.Update();

            // 返回退回信息.
            return(info);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 队列节点上一个人退回另外一个人.
        /// </summary>
        /// <returns></returns>
        public string DoOrderReturn()
        {
            //退回前事件
            string atPara = "@ToNode=" + this.ReturnToNode.NodeID;
            string msg    = this.HisNode.HisFlow.DoFlowEventEntity(EventListOfNode.ReturnBefore, this.HisNode, this.HisWork, atPara);

            if (this.HisNode.FocusField != "")
            {
                try
                {
                    string   focusField  = "";
                    string[] focusFields = this.HisNode.FocusField.Split('@');
                    if (focusFields.Length >= 2)
                    {
                        focusField = focusFields[1];
                    }
                    else
                    {
                        focusField = focusFields[0];
                    }



                    // 把数据更新它。
                    this.HisWork.Update(focusField, "");
                }
                catch (Exception ex)
                {
                    Log.DefaultLogWriteLineError("退回时更新焦点字段错误:" + ex.Message);
                }
            }

            //退回到人.
            Emp returnToEmp = new Emp(this.ReturnToEmp);

            // 退回状态。
            Paras ps = new Paras();

            ps.SQL = "UPDATE WF_GenerWorkFlow SET WFState=" + dbStr + "WFState,FK_Node=" + dbStr + "FK_Node,NodeName=" + dbStr + "NodeName,TodoEmps=" + dbStr + "TodoEmps, TodoEmpsNum=0 WHERE  WorkID=" + dbStr + "WorkID";
            ps.Add(GenerWorkFlowAttr.WFState, (int)WFState.ReturnSta);
            ps.Add(GenerWorkFlowAttr.FK_Node, this.ReturnToNode.NodeID);
            ps.Add(GenerWorkFlowAttr.NodeName, this.ReturnToNode.Name);

            ps.Add(GenerWorkFlowAttr.TodoEmps, returnToEmp.No + "," + returnToEmp.Name + ";");

            ps.Add(GenerWorkFlowAttr.WorkID, this.WorkID);

            DBAccess.RunSQL(ps);

            ps     = new Paras();
            ps.SQL = "UPDATE WF_GenerWorkerList SET IsPass=0,IsRead=0 WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID AND FK_Emp=" + dbStr + "FK_Emp ";
            ps.Add("FK_Node", this.ReturnToNode.NodeID);
            ps.Add("WorkID", this.WorkID);
            ps.Add("FK_Emp", this.ReturnToEmp);
            DBAccess.RunSQL(ps);

            ps     = new Paras();
            ps.SQL = "UPDATE WF_GenerWorkerList SET IsPass=1000,IsRead=0 WHERE FK_Node=" + dbStr + "FK_Node AND WorkID=" + dbStr + "WorkID AND FK_Emp=" + dbStr + "FK_Emp ";
            ps.Add("FK_Node", this.HisNode.NodeID);
            ps.Add("WorkID", this.WorkID);
            ps.Add("FK_Emp", WebUser.No);
            DBAccess.RunSQL(ps);

            //更新流程报表数据.
            ps     = new Paras();
            ps.SQL = "UPDATE " + this.HisNode.HisFlow.PTable + " SET  WFState=" + dbStr + "WFState, FlowEnder=" + dbStr + "FlowEnder, FlowEndNode=" + dbStr + "FlowEndNode WHERE OID=" + dbStr + "OID";
            ps.Add("WFState", (int)WFState.ReturnSta);
            ps.Add("FlowEnder", WebUser.No);
            ps.Add("FlowEndNode", ReturnToNode.NodeID);
            ps.Add("OID", this.WorkID);
            DBAccess.RunSQL(ps);

            ////从工作人员列表里找到被退回人的接受人.
            //GenerWorkerList gwl = new GenerWorkerList();
            //gwl.Retrieve(GenerWorkerListAttr.FK_Node, this.ReturnToNode.NodeID, GenerWorkerListAttr.WorkID, this.WorkID);

            // 记录退回轨迹。
            ReturnWork rw = new ReturnWork();

            rw.WorkID         = this.WorkID;
            rw.ReturnToNode   = this.ReturnToNode.NodeID;
            rw.ReturnNodeName = this.ReturnToNode.Name;

            rw.ReturnNode  = this.HisNode.NodeID; // 当前退回节点.
            rw.ReturnToEmp = this.ReturnToEmp;    //退回给。
            rw.Note        = Msg;

            rw.MyPK = DBAccess.GenerOIDByGUID().ToString();
            rw.Insert();

            // 加入track.
            this.AddToTrack(ActionType.Return, returnToEmp.No, returnToEmp.Name,
                            this.ReturnToNode.NodeID, this.ReturnToNode.Name, Msg);

            try
            {
                // 记录退回日志.
                ReorderLog(this.HisNode, this.ReturnToNode, rw);
            }
            catch (Exception ex)
            {
                Log.DebugWriteWarning(ex.Message);
            }

            // 以退回到的节点向前数据用递归删除它。
            if (IsBackTrack == false)
            {
                /*如果退回不需要原路返回,就删除中间点的数据。*/
#warning 没有考虑两种流程数据存储模式。
                //DeleteToNodesData(this.ReturnToNode.HisToNodes);
            }

            // 向他发送消息。
            if (Glo.IsEnableSysMessage == true)
            {
                //   WF.Port.WFEmp wfemp = new Port.WFEmp(wnOfBackTo.HisWork.Rec);
                string title = string.Format("工作退回:流程:{0}.工作:{1},退回人:{2},需您处理",
                                             this.HisNode.FlowName, this.ReturnToNode.Name, WebUser.Name);

                BP.WF.Dev2Interface.Port_SendMsg(returnToEmp.No, title, Msg, "RE" + this.HisNode.NodeID + this.WorkID, BP.WF.SMSMsgType.ToDo, ReturnToNode.FK_Flow, ReturnToNode.NodeID, this.WorkID, this.FID);
            }
            //退回后事件

            string text = this.HisNode.HisFlow.DoFlowEventEntity(EventListOfNode.ReturnAfter, this.HisNode, this.HisWork,
                                                                 atPara);
            if (text != null && text.Length > 1000)
            {
                text = "退回事件:无返回信息.";
            }
            // 返回退回信息.
            if (this.ReturnToNode.IsGuestNode)
            {
                GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID);
                return("工作已经被您退回到(" + this.ReturnToNode.Name + "),退回给(" + gwf.GuestNo + "," + gwf.GuestName + ").\n\r" + text);
            }
            else
            {
                return("工作已经被您退回到(" + this.ReturnToNode.Name + "),退回给(" + returnToEmp.No + "," + returnToEmp.Name + ").\n\r" + text);
            }
        }