Ejemplo n.º 1
0
        /// <summary>
        /// 按照约定的字段 SysCCEmps 系统人员.
        /// </summary>
        public void CCByEmps()
        {
            if (this.HisNode.HisCCRole != CCRole.BySysCCEmps)
            {
                return;
            }

            CC cc = this.HisNode.HisCC;

            //生成标题与内容.
            string ccTitle = cc.CCTitle.Clone() as string;

            ccTitle = BP.WF.Glo.DealExp(ccTitle, this.rptGe, null);

            string ccDoc = cc.CCDoc.Clone() as string;

            ccDoc = BP.WF.Glo.DealExp(ccDoc, this.rptGe, null);

            //取出抄送人列表
            string ccers = this.rptGe.GetValStrByKey("SysCCEmps");

            if (!string.IsNullOrEmpty(ccers))
            {
                string[]  cclist = ccers.Split('|');
                Hashtable ht     = new Hashtable();
                foreach (string item in cclist)
                {
                    string[] tmp = item.Split(',');
                    ht.Add(tmp[0], tmp[1]);
                }
                string ccMsg    = "@消息自动抄送给";
                string basePath = BP.WF.Glo.HostURL;

                string mailTemp = BP.DA.DataType.ReadTextFile2Html(BP.Sys.SystemConfig.PathOfDataUser + "\\EmailTemplete\\CC_" + WebUser.SysLang + ".txt");
                foreach (DictionaryEntry item in ht)
                {
                    ccDoc   = ccDoc.Replace("@Accepter", item.Value.ToString());
                    ccTitle = ccTitle.Replace("@Accepter", item.Value.ToString());

                    //抄送信息.
                    ccMsg += "(" + item.Value.ToString() + " - " + item.Value.ToString() + ");";

                    #region 如果是写入抄送列表.
                    CCList list = new CCList();
                    list.MyPK       = this.WorkID + "_" + this.HisNode.NodeID + "_" + item.Key.ToString();
                    list.FK_Flow    = this.HisNode.FK_Flow;
                    list.FlowName   = this.HisNode.FlowName;
                    list.FK_Node    = this.HisNode.NodeID;
                    list.NodeName   = this.HisNode.Name;
                    list.Title      = ccTitle;
                    list.Doc        = ccDoc;
                    list.CCTo       = item.Key.ToString();
                    list.CCToName   = item.Value.ToString();
                    list.RDT        = DataType.CurrentDataTime;
                    list.Rec        = WebUser.No;
                    list.WorkID     = this.WorkID;
                    list.FID        = this.HisWorkNode.HisWork.FID;
                    list.InEmpWorks = this.HisNode.CCWriteTo == CCWriteTo.CCList ? false : true;    //added by liuxc,2015.7.6
                    //写入待办和写入待办与抄送列表,状态不同
                    if (this.HisNode.CCWriteTo == CCWriteTo.All || this.HisNode.CCWriteTo == CCWriteTo.Todolist)
                    {
                        //如果为写入待办则抄送列表中置为已读,原因:只为不提示有未读抄送。
                        list.HisSta = this.HisNode.CCWriteTo == CCWriteTo.All ? CCSta.UnRead : CCSta.Read;
                    }
                    //如果为结束节点,只写入抄送列表
                    if (this.HisNode.IsEndNode == true)
                    {
                        list.HisSta     = CCSta.UnRead;
                        list.InEmpWorks = false;
                    }

                    //执行保存或更新
                    try
                    {
                        list.Insert();
                    }
                    catch
                    {
                        list.CheckPhysicsTable();
                        list.Update();
                    }
                    #endregion 如果要写入抄送

                    if (BP.WF.Glo.IsEnableSysMessage == true)
                    {
                        ccMsg += list.CCTo + "(" + item.Value.ToString() + ");";
                        BP.WF.Port.WFEmp wfemp = new Port.WFEmp(list.CCTo);

                        string sid = list.CCTo + "_" + list.WorkID + "_" + list.FK_Node + "_" + list.RDT;
                        string url = basePath + "WF/Do.aspx?DoType=OF&SID=" + sid;
                        url = url.Replace("//", "/");
                        url = url.Replace("//", "/");

                        string urlWap = basePath + "WF/Do.aspx?DoType=OF&SID=" + sid + "&IsWap=1";
                        urlWap = urlWap.Replace("//", "/");
                        urlWap = urlWap.Replace("//", "/");

                        string mytemp = mailTemp.Clone() as string;
                        mytemp = string.Format(mytemp, wfemp.Name, WebUser.Name, url, urlWap);

                        string title = string.Format("工作抄送:{0}.工作:{1},发送人:{2},需您查阅",
                                                     this.HisNode.FlowName, this.HisNode.Name, WebUser.Name);

                        BP.WF.Dev2Interface.Port_SendMsg(wfemp.No, title, mytemp, null, BP.WF.SMSMsgType.CC, list.FK_Flow, list.FK_Node, list.WorkID, list.FID);
                    }
                }

                //写入系统消息.
                this.HisWorkNode.addMsg(SendReturnMsgFlag.CCMsg, ccMsg);

                //写入日志.
                this.HisWorkNode.AddToTrack(ActionType.CC, WebUser.No, WebUser.Name, this.HisNode.NodeID, this.HisNode.Name, ccMsg, this.HisNode);
            }
        }
Ejemplo n.º 2
0
        public void AutoCC()
        {
            if (this.HisWorkNode.HisNode.HisCCRole == CCRole.AutoCC ||
                this.HisWorkNode.HisNode.HisCCRole == CCRole.HandAndAuto)
            {
            }
            else
            {
                return;
            }

            /*如果是自动抄送*/
            CC cc = this.HisWorkNode.HisNode.HisCC;

            #region 替换节点变量
            cc.CCSQL = cc.CCSQL.Replace("@FK_Node", this.HisNode.NodeID + "");
            cc.CCSQL = cc.CCSQL.Replace("@FK_Flow", this.HisNode.FK_Flow);
            cc.CCSQL = cc.CCSQL.Replace("@OID", this.HisWorkNode.WorkID + "");
            #endregion

            // 执行抄送.
            DataTable dt = cc.GenerCCers(this.HisWorkNode.rptGe);
            if (dt.Rows.Count == 0)
            {
                return;
            }

            string ccMsg    = "@消息自动抄送给";
            string basePath = BP.WF.Glo.HostURL;
            string mailTemp = BP.DA.DataType.ReadTextFile2Html(BP.Sys.SystemConfig.PathOfDataUser + "\\EmailTemplete\\CC_" + WebUser.SysLang + ".txt");

            GenerWorkerLists gwls = null;
            if (this.HisWorkNode.town != null)
            {
                //取出抄送集合,如果待办里有此人就取消该人员的抄送.
                gwls = new GenerWorkerLists(this.WorkID, this.HisWorkNode.town.HisNode.NodeID);
            }
            foreach (DataRow dr in dt.Rows)
            {
                string toUserNo = dr[0].ToString();

                //如果待办包含了它.
                if (gwls != null && gwls.Contains(GenerWorkerListAttr.FK_Emp, toUserNo) == true)
                {
                    continue;
                }

                string toUserName = dr[1].ToString();

                //生成标题与内容.
                string ccTitle = cc.CCTitle.Clone() as string;
                ccTitle = BP.WF.Glo.DealExp(ccTitle, this.rptGe, null);

                string ccDoc = cc.CCDoc.Clone() as string;
                ccDoc = BP.WF.Glo.DealExp(ccDoc, this.rptGe, null);

                ccDoc   = ccDoc.Replace("@Accepter", toUserNo);
                ccTitle = ccTitle.Replace("@Accepter", toUserNo);

                //抄送信息.
                ccMsg += "(" + toUserNo + " - " + toUserName + ");";
                CCList list = new CCList();
                list.MyPK       = this.HisWorkNode.WorkID + "_" + this.HisWorkNode.HisNode.NodeID + "_" + dr[0].ToString();
                list.FK_Flow    = this.HisWorkNode.HisNode.FK_Flow;
                list.FlowName   = this.HisWorkNode.HisNode.FlowName;
                list.FK_Node    = this.HisWorkNode.HisNode.NodeID;
                list.NodeName   = this.HisWorkNode.HisNode.Name;
                list.Title      = ccTitle;
                list.Doc        = ccDoc;
                list.CCTo       = dr[0].ToString();
                list.CCToName   = dr[1].ToString();
                list.RDT        = DataType.CurrentDataTime;
                list.Rec        = WebUser.No;
                list.WorkID     = this.HisWorkNode.WorkID;
                list.FID        = this.HisWorkNode.HisWork.FID;
                list.InEmpWorks = this.HisNode.CCWriteTo == CCWriteTo.CCList ? false : true;    //added by liuxc,2015.7.6
                //写入待办和写入待办与抄送列表,状态不同
                if (this.HisNode.CCWriteTo == CCWriteTo.All || this.HisNode.CCWriteTo == CCWriteTo.Todolist)
                {
                    //如果为写入待办则抄送列表中置为已读,原因:只为不提示有未读抄送。
                    list.HisSta = this.HisNode.CCWriteTo == CCWriteTo.All ? CCSta.UnRead : CCSta.Read;
                }
                //结束节点只写入抄送列表
                if (this.HisNode.IsEndNode == true)
                {
                    list.HisSta     = CCSta.UnRead;
                    list.InEmpWorks = false;
                }
                try
                {
                    list.Insert();
                }
                catch
                {
                    list.Update();
                }

                if (BP.WF.Glo.IsEnableSysMessage == true)
                {
                    //     //写入消息提示.
                    //     ccMsg += list.CCTo + "(" + dr[1].ToString() + ");";
                    //     BP.WF.Port.WFEmp wfemp = new Port.WFEmp(list.CCTo);
                    //     string sid = list.CCTo + "_" + list.WorkID + "_" + list.FK_Node + "_" + list.RDT;
                    //     string url = basePath + "WF/Do.aspx?DoType=OF&SID=" + sid;
                    //     string urlWap = basePath + "WF/Do.aspx?DoType=OF&SID=" + sid + "&IsWap=1";
                    //     string mytemp = mailTemp.Clone() as string;
                    //     mytemp = string.Format(mytemp, wfemp.Name, WebUser.Name, url, urlWap);
                    //     string title = string.Format("工作抄送:{0}.工作:{1},发送人:{2},需您查阅",
                    //this.HisNode.FlowName, this.HisNode.Name, WebUser.Name);
                    //     BP.WF.Dev2Interface.Port_SendMsg(wfemp.No, title, mytemp, null, BP.Sys.SMSMsgType.CC, list.FK_Flow, list.FK_Node, list.WorkID, list.FID);
                }
            }

            this.HisWorkNode.addMsg(SendReturnMsgFlag.CCMsg, ccMsg);

            //写入日志.
            this.HisWorkNode.AddToTrack(ActionType.CC, WebUser.No, WebUser.Name, this.HisNode.NodeID, this.HisNode.Name, ccMsg, this.HisNode);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.AddHeader("P3P", "CP=CAO PSA OUR");
            Response.AddHeader("Cache-Control", "no-store");
            Response.AddHeader("Expires", "0");
            Response.AddHeader("Pragma", "no-cache");
            string url = this.Request.RawUrl;

            if (url.Contains("DTT=") == false)
            {
                //this.Response.Redirect(url + "&DTT=" + DateTime.Now.ToString("mmDDhhmmss"), true);
                //return;
            }

            try
            {
                string str = "";
                switch (this.ActionType)
                {
                case "DoOpenCC":
                    string fk_flow1 = this.Request.QueryString["FK_Flow"];
                    string fk_node1 = this.Request.QueryString["FK_Node"];
                    string workid1  = this.Request.QueryString["WorkID"];
                    string fid1     = this.Request.QueryString["FID"];
                    string Sta      = this.Request.QueryString["Sta"];
                    if (Sta == "0")
                    {
                        BP.WF.CCList cc1 = new BP.WF.CCList();
                        cc1.MyPK = this.Request.QueryString["MyPK"];
                        cc1.Retrieve();
                        cc1.HisSta = CCSta.Read;
                        cc1.Update();
                    }
                    this.Response.Redirect(this.Request.ApplicationPath + "WF/WorkOpt/OneWork/Track.aspx?FK_Flow=" + fk_flow1 + "&FK_Node=" + fk_node1 + "&WorkID=" + workid1 + "&FID=" + fid1, false);
                    return;

                case "DelCC":     //删除抄送.
                    CCList cc = new CCList();
                    cc.MyPK = this.MyPK;
                    cc.Retrieve();
                    cc.HisSta = CCSta.Del;
                    cc.Update();
                    this.WinClose();
                    break;

                case "DelSubFlow":     //删除进程。
                    try
                    {
                        WorkFlow wf14 = new WorkFlow(this.FK_Flow, this.WorkID);
                        wf14.DoDeleteWorkFlowByReal(true);
                        this.WinClose();
                    }
                    catch (Exception ex)
                    {
                        this.WinCloseWithMsg(ex.Message);
                    }
                    break;

                case "DownBill":
                    BP.WF.Bill b = new Bill(this.MyPK);
                    b.DoOpen();
                    break;

                case "DelDtl":
                    GEDtls dtls = new GEDtls(this.EnsName);
                    GEDtl  dtl  = (GEDtl)dtls.GetNewEntity;
                    dtl.OID = this.RefOID;
                    if (dtl.RetrieveFromDBSources() == 0)
                    {
                        this.WinClose();
                        break;
                    }
                    FrmEvents fes = new FrmEvents(this.EnsName);     //获得事件.
                    // 处理删除前事件.
                    try
                    {
                        fes.DoEventNode(BP.WF.XML.EventListDtlList.DtlItemDelBefore, dtl);
                    }
                    catch (Exception ex)
                    {
                        this.WinCloseWithMsg(ex.Message);
                        break;
                    }
                    dtl.Delete();

                    // 处理删除后事件.
                    try
                    {
                        fes.DoEventNode(BP.WF.XML.EventListDtlList.DtlItemDelAfter, dtl);
                    }
                    catch (Exception ex)
                    {
                        this.WinCloseWithMsg(ex.Message);
                        break;
                    }
                    this.WinClose();
                    break;

                case "EmpDoUp":
                    BP.WF.Port.WFEmp ep = new BP.WF.Port.WFEmp(this.RefNo);
                    ep.DoUp();

                    BP.WF.Port.WFEmps emps111 = new BP.WF.Port.WFEmps();
                    //  emps111.RemoveCash();
                    emps111.RetrieveAll();
                    this.WinClose();
                    break;

                case "EmpDoDown":
                    BP.WF.Port.WFEmp ep1 = new BP.WF.Port.WFEmp(this.RefNo);
                    ep1.DoDown();

                    BP.WF.Port.WFEmps emps11441 = new BP.WF.Port.WFEmps();
                    //  emps11441.RemoveCash();
                    emps11441.RetrieveAll();
                    this.WinClose();
                    break;

                case "OF":
                    string          sid  = this.Request.QueryString["SID"];
                    string[]        strs = sid.Split('_');
                    GenerWorkerList wl   = new GenerWorkerList();
                    int             i    = wl.Retrieve(GenerWorkerListAttr.FK_Emp, strs[0],
                                                       GenerWorkerListAttr.WorkID, strs[1],
                                                       GenerWorkerListAttr.FK_Node, strs[2]);
                    if (i == 0)
                    {
                        this.Response.Write("<h2>提示</h2>此工作已经被别人处理或者此流程已删除。");
                        return;
                    }
                    BP.Port.Emp emp155 = new BP.Port.Emp(wl.FK_Emp);
                    Web.WebUser.SignInOfGener(emp155, true);
                    string u = "MyFlow.aspx?FK_Flow=" + wl.FK_Flow + "&WorkID=" + wl.WorkID;
                    if (this.Request.QueryString["IsWap"] != null)
                    {
                        u = "./../WF/WAP/" + u;
                    }
                    this.Response.Write("<script> window.location.href='" + u + "'</script> *^_^*  <br><br>正在进入系统请稍后,如果长时间没有反应,请<a href='" + u + "'>点这里进入。</a>");
                    return;

                case "ExitAuth":
                    BP.Port.Emp emp = new BP.Port.Emp(this.FK_Emp);
                    BP.Web.WebUser.SignInOfGenerLang(emp, WebUser.SysLang);
                    this.WinClose();
                    return;

                case "LogAs":
                    BP.WF.Port.WFEmp wfemp = new BP.WF.Port.WFEmp(this.FK_Emp);
                    if (wfemp.AuthorIsOK == false)
                    {
                        this.WinCloseWithMsg("授权失败");
                        return;
                    }
                    BP.Port.Emp emp1 = new BP.Port.Emp(this.FK_Emp);
                    BP.Web.WebUser.SignInOfGener(emp1, WebUser.SysLang, WebUser.No, true, false);
                    this.WinClose();
                    return;

                case "TakeBack":     // 取消授权。
                    BP.WF.Port.WFEmp myau = new BP.WF.Port.WFEmp(WebUser.No);
                    BP.DA.Log.DefaultLogWriteLineInfo("取消授权:" + WebUser.No + "取消了对(" + myau.Author + ")的授权。");
                    myau.Author    = "";
                    myau.AuthorWay = 0;
                    myau.Update();
                    this.WinClose();
                    return;

                case "AutoTo":     // 执行授权。
                    BP.WF.Port.WFEmp au = new BP.WF.Port.WFEmp();
                    au.No = WebUser.No;
                    au.RetrieveFromDBSources();
                    au.AuthorDate = BP.DA.DataType.CurrentData;
                    au.Author     = this.FK_Emp;
                    au.AuthorWay  = 1;
                    au.Save();
                    BP.DA.Log.DefaultLogWriteLineInfo("执行授权:" + WebUser.No + "执行了对(" + au.Author + ")的授权。");
                    this.WinClose();
                    return;

                case "UnSend":     // 执行撤消发送。
                    try
                    {
                        string str1 = BP.WF.Dev2Interface.Flow_DoUnSend(this.FK_Flow, this.WorkID);
                        this.Session["info"] = str1;
                        this.Response.Redirect("MyFlowInfo" + this.PageID + ".aspx?FK_Flow=" + this.FK_Flow + "&WorkID=" + this.WorkID, false);
                        return;
                    }
                    catch (Exception ex)
                    {
                        this.Session["info"] = "@执行撤消失败。@失败信息" + ex.Message;
                        this.Alert(ex.Message);
                        //this.WinCloseWithMsg(ex.Message);
                        this.Response.Redirect("MyFlowInfo" + this.PageID + ".aspx?FK_Flow=" + this.FK_Flow + "&WorkID=" + this.WorkID + "&FK_Type=warning", false);
                        return;
                    }

                // this.Response.Redirect("MyFlow.aspx?WorkID=" + this.WorkID + "&FK_Flow=" + this.FK_Flow, true);
                case "SetBillState":
                    break;

                case "WorkRpt":
                    Bill bk1 = new Bill(this.Request.QueryString["OID"]);
                    Node nd  = new Node(bk1.FK_Node);
                    this.Response.Redirect("WFRpt.aspx?WorkID=" + bk1.WorkID + "&FID=" + bk1.FID + "&FK_Flow=" + nd.FK_Flow + "&NodeId=" + bk1.FK_Node, false);
                    //this.WinOpen();
                    //this.WinClose();
                    break;

                case "PrintBill":
                    //Bill bk2 = new Bill(this.Request.QueryString["OID"]);
                    //Node nd2 = new Node(bk2.FK_Node);
                    //this.Response.Redirect("NodeRefFunc.aspx?NodeId=" + bk2.FK_Node + "&FlowNo=" + nd2.FK_Flow + "&NodeRefFuncOID=" + bk2.FK_NodeRefFunc + "&WorkFlowID=" + bk2.WorkID);
                    ////this.WinClose();
                    break;

                //删除流程中第一个节点的数据,包括待办工作
                case "DeleteFlow":
                    string fk_flow = this.Request.QueryString["FK_Flow"];
                    Int64  workid  = Int64.Parse(this.Request.QueryString["WorkID"]);
                    //调用DoDeleteWorkFlowByReal方法
                    WorkFlow wf = new WorkFlow(new Flow(fk_flow), workid);
                    wf.DoDeleteWorkFlowByReal(true);
                    this.ToMsgPage("流程删除成功");
                    break;

                default:
                    throw new Exception("ActionType error" + this.ActionType);
                }
            }
            catch (Exception ex)
            {
                this.ToErrorPage("执行其间如下异常:<BR>" + ex.Message);
            }
        }