Пример #1
0
        protected void Page_PreRenderComplete(object sender, System.EventArgs e)  //120302 修改,原本為Page_PreRender改成Page_PreRenderComplete, 如此一來仿多筆審核的連下關一起簽的mail才能正常
        {
            //發信測試------------------------------------------

            //Response.Write(this.CurrentUser.LogonID.ToString());

            if (_NotifyReview)
            {
                if (this.FIELD_QUICK.Text == "Y")
                {
                    quick = "  --急件";
                }


                SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
                //Response.Write("select top 1 REPLACE(requesturl,'EDIT','VIEW') requesturl,b.name name,email,b.id bid from dgflowqueue a left join dguser b on revieweruid=b.id where requesturl like '%" + Request.QueryString["id"] + "'  AND reviewdate IS NULL AND qseq is not null");
                rss.Open("select top 1 REPLACE(requesturl,'EDIT','VIEW') requesturl,b.name name,email,b.id bid,revieweruid from dgflowqueue a left join dguser b on revieweruid=b.id where requesturl like '%" + Request.QueryString["id"] + "'  AND reviewdate IS NULL AND qseq is not null ");
                if (!rss.EOF)
                {
                    MyLibrary_apmt420 Backsend = new MyLibrary_apmt420();
                    Backsend.RunMailProcess(rss["requesturl"].ToString(),
                                            rss["name"].ToString(), rss["email"].ToString(), " 請購單號:" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + quick.ToString()); //link,name,who mail,titel
                                                                                                                                                                                    //DBTransfer actsql1 = new DBTransfer();
                                                                                                                                                                                    //actsql1.RunIUSql("insert into  misbuffer2(caption)values('ann信裡面" + this.FIELD_pmk01.Text + "')");

                    #region 代理人
                    SmoothEnterprise.Database.DataSet rs2 = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate);
                    rs2.Open(" SELECT b.name name,email FROM dguserdeputy a left join dguser b on a.deputyuid=b.id left join dgflow c on a.sid=c.id  " +
                             " where  a.uid='" + rss["bid"].ToString() + "'  " +
                             " and  b.id not in (  select revieweruid from dgflowqueue a left join dguser b on revieweruid=b.id where requesturl like '%" + Request.QueryString["id"] + "' and revieweruid <> '00000000-0000-0000-0000-000000000000') and " +
                             " ((a.sid is null and  sdate < GETDATE() and edate is null) or " +
                             " (c.typename like 'ERP_FLOW%' and sdate < GETDATE() and edate is null) or " +
                             " (c.typename like 'ERP_FLOW%' and sdate < GETDATE() and edate > GETDATE()) or " +
                             "  a.sid is null and sdate < GETDATE() and edate  > GETDATE())   group by b.name,email ");  //20120302  增加" and  b.id not in (  select revieweruid from dgflowqueue a left join dguser b on revieweruid=b.id where requesturl like '%" + Request.QueryString["id"] + "' and revieweruid <> '00000000-0000-0000-0000-000000000000') and " 因為仿多筆審核下一關時, 讓宋協理不要收到信
                    while (!rs2.EOF)
                    {
                        //MyLibrary_AXMT610 Backsend = new MyLibrary_AXMT610();
                        Backsend.RunMailProcess("/ERP_APMT420/APMT420view.aspx?id=" + Request.QueryString["id"],
                                                rs2["name"].ToString(), rs2["email"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + quick.ToString()); //link,name,who mail,titel
                        rs2.MoveNext();
                    }
                    rs2.Close();

                    #endregion
                }
            }
            //DBTransfer actsql3 = new DBTransfer();
            //actsql3.RunIUSql("insert into  misbuffer2(caption)values('ann信最外裡面" + this.FIELD_pmk01.Text + "')");
        }
Пример #2
0
        protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e)
        {
            Utility.log(1, "ERP_APMT420", e.ResultType.ToString(), CurrentUser.Name);
            if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete)
            {
                //審核通過要執行的程式碼
                try
                {
                    string sqlstr = "";
                    sqlstr = "SELECT * FROM APMT420_IN_HEAD where id='" + Request.QueryString["id"] + "'";
                    SmoothEnterprise.Database.DataSet ds;
                    ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate);
                    ds.Open(sqlstr);

                    if (!ds.EOF)
                    {
                        ds["STATUS"] = "Y";
                        ds.Update();
                        SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
                        //Response.Write("select * from apmt420_in_head WHERE id='" + Request.QueryString["id"] + "' ");
                        rs.Open("select plantid,pmk01,b.empid purempid,c.name username,c.email usermail from apmt420_in_head a left join dguser b on  pur=b.id left join dguser c on senduser=c.id WHERE a.id='" + Request.QueryString["id"] + "' ");
                        if (!rs.EOF)
                        {
                            FileStream   fs = new FileStream(@"D:\APMT420_XML\4GL\" + rs["plantid"].ToString() + "_apmt420_" + rs["pmk01"].ToString() + ".txt", FileMode.Create, FileAccess.Write);
                            StreamWriter sw = new StreamWriter(fs);
                            sw.WriteLine("\"" + rs["plantid"].ToString() + "\",\"apmt420\",\"" + rs["pmk01"].ToString() + "\",\"Y\",\"" + rs["purempid"].ToString() + "\"");
                            sw.Close();
                            fs.Close();
                            Upload("D:\\APMT420_XML\\4GL\\" + rs["plantid"].ToString() + "_apmt420_" + rs["pmk01"].ToString() + ".txt", "ftp://192.168.0.250/" + rs["plantid"].ToString() + "_APMT420_" + rs["pmk01"].ToString() + ".txt", "4gl", "4gl");



                            //發信測試------------------------------------------
                            SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
                            //Response.Write("select * from apmt420_in_head WHERE id='" + Request.QueryString["id"] + "' ");
                            rss.Open("select * from dguser where name='" + this.FIELD_gen02_3.Text + "' ");
                            if (!rss.EOF)
                            {
                                if (rs["usermail"].ToString() == "" || rs["usermail"].ToString() == rss["email"].ToString())
                                {
                                    MyLibrary_apmt420 Backsend = new MyLibrary_apmt420();
                                    Backsend.RunMailProcess("/ERP_APMT420/APMT420view.aspx?id=" + Request.QueryString["id"],
                                                            rss["name"].ToString(), rss["email"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + "  ,結果為:完成審核"); //link,name,who mail,titel
                                                                                                                                                                                              //Response.Write("/ERP_APMT420/APMT420Edit.aspx?id=" + Request.QueryString["id"] + "<br>" + rss["name"].ToString() + "<br>" + rss["email"].ToString() + "<br>" + " 請購單號:" + this.FIELD_pmk01.Text + "<br>" + " 廠商:" + this.FIELD_pmc03.Text + "<br>");
                                }
                                else
                                {
                                    MyLibrary_apmt420 Backsend = new MyLibrary_apmt420();
                                    Backsend.RunMailProcess("/ERP_APMT420/APMT420view.aspx?id=" + Request.QueryString["id"],
                                                            rss["name"].ToString(), rss["email"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + "  ,結果為:完成審核"); //link,name,who mail,titel

                                    MyLibrary_apmt420 Backsend1 = new MyLibrary_apmt420();
                                    Backsend1.RunMailProcess("/ERP_APMT420/APMT420view.aspx?id=" + Request.QueryString["id"],
                                                             rs["username"].ToString(), rs["usermail"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + "  ,結果為:完成審核"); //link,name,who mail,titel
                                }
                            }
                            //發信測試------------------------------------------

                            if (this.FIELD_chemistry.Text == "Y")
                            {
                                SmoothEnterprise.Database.DataSet rsx = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
                                rsx.Open("select b.name name,b.id id,b.email email from ERP_FLOW a left join dguser b on a.PID=b.id WHERE ERP_NAME='apmt420' and DEP_NAME='GAD'");
                                while (!rsx.EOF)
                                {
                                    MyLibrary_apmt420 Backsenda = new MyLibrary_apmt420();
                                    Backsenda.RunMailProcess("/ERP_APMT420/APMT420view.aspx?id=" + Request.QueryString["id"],
                                                             rsx["name"].ToString(), rsx["email"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + "  ,為化學氣體類或外包修繕類"); //link,name,who mail,titel
                                    rsx.MoveNext();
                                }
                                rsx.Close();
                            }
                        }
                    }
                    else
                    {
                        ds["STATUS"] = " ";
                        ds.Update();
                    }
                }
                catch
                {
                    //Response.Write("有問題");
                }
            }
            if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate ||
                e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Return)
            {
                //被退回要執行的程式碼
                try
                {
                    string sqlstr = "";
                    sqlstr = "SELECT * FROM APMT420_IN_HEAD where id='" + Request.QueryString["id"] + "'";



                    SmoothEnterprise.Database.DataSet ds;
                    ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate);
                    ds.Open(sqlstr);

                    //ds.Open("SELECT * FROM emp_add WHERE id='" + Request.QueryString["id"] + "'");
                    //Response.Write(ds.EOF);
                    //Response.Write("SELECT * FROM bomheadbuffer WHERE TROWID='" + Request.QueryString["TROWID"] + "'");
                    if (!ds.EOF)
                    {
                        //Response.Write("有資料");
                        ds["STATUS"] = "退回";  //被退回
                        ds.Update();
                        SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
                        //Response.Write("select * from apmt420_in_head WHERE id='" + Request.QueryString["id"] + "' ");
                        rs.Open("select plantid,pmk01,b.empid purempid,c.name username,c.email usermail from apmt420_in_head a left join dguser b on  pur=b.id left join dguser c on senduser=c.id WHERE a.id='" + Request.QueryString["id"] + "' ");
                        if (!rs.EOF)
                        {
                            FileStream   fs = new FileStream(@"D:\APMT420_XML\4GL\" + rs["plantid"].ToString() + "_apmt420_" + rs["pmk01"].ToString() + ".txt", FileMode.Create, FileAccess.Write);
                            StreamWriter sw = new StreamWriter(fs);
                            sw.WriteLine("\"" + rs["plantid"].ToString() + "\",\"apmt420\",\"" + rs["pmk01"].ToString() + "\",\"N\",\"\"");
                            sw.Close();
                            fs.Close();
                            Upload("D:\\APMT420_XML\\4GL\\" + rs["plantid"].ToString() + "_apmt420_" + rs["pmk01"].ToString() + ".txt", "ftp://192.168.0.250/" + rs["plantid"].ToString() + "_APMT420_" + rs["pmk01"].ToString() + ".txt", "4gl", "4gl");


                            //發信測試------------------------------------------
                            SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead);
                            //Response.Write("select * from apmt420_in_head WHERE id='" + Request.QueryString["id"] + "' ");


                            //rss.Open("select * from dguser where name='" + this.FIELD_gen02_3.Text + "' ");
                            rss.Open("select b.* from apmt420_in_head  a " +
                                     "  left join dguser b on pmk12=erpid WHERE a.id='" + Request.QueryString["id"] + "'");

                            if (!rss.EOF)
                            {
                                if (rs["usermail"].ToString() == "" || rs["usermail"].ToString() == rss["email"].ToString())
                                {
                                    MyLibrary_apmt420 Backsend = new MyLibrary_apmt420();
                                    Backsend.RunMailProcess("/ERP_APMT420/APMT420edit.aspx?id=" + Request.QueryString["id"],
                                                            rss["name"].ToString(), rss["email"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + "  ,結果為:退回"); //link,name,who mail,titel
                                                                                                                                                                                            //Response.Write("/ERP_APMT420/APMT420Edit.aspx?id=" + Request.QueryString["id"] + "<br>" + rss["name"].ToString() + "<br>" + rss["email"].ToString() + "<br>" + " 請購單號:" + this.FIELD_pmk01.Text + "<br>" + " 廠商:" + this.FIELD_pmc03.Text + "<br>");
                                }
                                else
                                {
                                    MyLibrary_apmt420 Backsend = new MyLibrary_apmt420();
                                    Backsend.RunMailProcess("/ERP_APMT420/APMT420edit.aspx?id=" + Request.QueryString["id"],
                                                            rss["name"].ToString(), rss["email"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + "  ,結果為:退回"); //link,name,who mail,titel

                                    MyLibrary_apmt420 Backsend1 = new MyLibrary_apmt420();
                                    Backsend1.RunMailProcess("/ERP_APMT420/APMT420edit.aspx?id=" + Request.QueryString["id"],
                                                             rs["username"].ToString(), rs["usermail"].ToString(), "請購單" + this.FIELD_pmk01.Text + " 廠商:" + this.FIELD_pmc03.Text + "  ,結果為:退回"); //link,name,who mail,titel
                                }
                            }
                            //發信測試------------------------------------------
                        }
                    }
                    else
                    {
                        ds["STATUS"] = "Y";
                        ds.Update();
                    }
                }
                catch
                {
                    // Response.Write("有問題");
                }
            }
        }