//同意 protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { switch (e.ResultType) { //完成 case SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete: Complete(); break; case SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate: Back(); break; } }
/// <summary> /// 簽核流程結束 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { string uName = "", eMail = ""; string mail_script = ""; string rowid = Request.QueryString["rowid"]; status s = 0; string url = Utility.LocalUrl + Request.RawUrl; string reslut = "", subject = ""; switch (e.ResultType) { case SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete: //完成 //結束 s = status.Complete; mail_script = MABase.Flow.MailFormat.Complete(Title, uName, lab_NO.Text, url); reslut = "審核通過"; f.getCreateUser(rowid, ref uName, ref eMail); subject = string.Format("{0} No:{1}({2})", Title, lab_NO.Text, reslut); Utility.SendMail(eMail, "EIP(員工入口網站)", subject, mail_script); break; case SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate: //退回提案人 s = status.Back; f.getCreateUser(rowid, ref uName, ref eMail); mail_script = MABase.Flow.MailFormat.Terminate(Title, uName, lab_NO.Text, url); reslut = "退回"; f.getCreateUser(rowid, ref uName, ref eMail); subject = string.Format("{0} No:{1}({2})", Title, lab_NO.Text, reslut); Utility.SendMail(eMail, "EIP(員工入口網站)", subject, mail_script); break; case SmoothEnterprise.Flowwork.Control.ReviewResultType.Next: s = status.Send; mail_script = MABase.Flow.MailFormat.Approve(Title, uName, lab_NO.Text, url); reslut = "審核"; subject = string.Format("{0} No:{1}({2})", Title, lab_NO.Text, reslut); f.ToApproval(rowid, uName, subject, mail_script); break; } Leica_Head.Stata_Change(s, rowid); }
//同意 protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { switch (e.ResultType) { //完成 case SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete: _NotifyType = "Complete"; action = (int)status.Complete; Complete(); break; case SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate: case SmoothEnterprise.Flowwork.Control.ReviewResultType.Return: // 中止 Stop(); break; } }
protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { DBTransfer RunCommand = new DBTransfer(); ShrFlowMail Usemail = new ShrFlowMail(); SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); string Sql = ""; string requesturl = ""; #region 流程 Complete if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete) { //寫回 status 為 C 表示 Complete //恢復staus flag Sql = "update [EIPB].[dbo].[CBGI014_Head] set status='C' where rowid='" + Request.QueryString["rowid"] + "'"; RunCommand.RunIUSql(Sql); //發信通知送審者,表示單據已經簽核完畢 AppDate ,[Appuser] ds.Open("select top 1 email,name from dgflowqueue a " + " left join dguser b on a.inituid=b.id where " + " requesturl='" + Request.RawUrl.ToString().Trim().ToLower().Replace("view", "edit") + "' order by a.initdate asc "); if (!ds.EOF) { string MId = "{c294bd9b-ebbd-4c6a-a608-c5175f3a3de2}"; requesturl = "http://eip.minaik.com.tw/" + Request.RawUrl.ToString().Trim(); Usemail.FinishApprove(MId, "固定資產預算申請單", FIELD_sn.Text, ds["email"].ToString(), "", this.CurrentUser.Name, requesturl, "審核完成"); Usemail.FinishApprove(MId, "固定資產預算申請單", FIELD_sn.Text, "*****@*****.**", "", this.CurrentUser.Name, requesturl, "審核完成"); } ResTxt(); Response.Redirect("http://" + Request.Url.Authority.ToString() + "/Flowwork/MyApproval.aspx"); ds.Close(); } #endregion #region 流程 Reject if ((e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate) || (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Return)) { Sql = "update [EIPB].[dbo].[CBGI014_Head] set status='T' where rowid='" + Request.QueryString["rowid"] + "'"; RunCommand.RunIUSql(Sql); // SmoothEnterprise.Database.DataSet ds = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); ds.Open("SELECT top 1 name,email from EIPA.dbo.dgflowqueue a " + " left join dguser b on a.inituid=b.id where requesturl " + " like '%" + Request.QueryString[0] + "%' order by a.initdate asc"); // " left join [dguser] b on a.IniUser=b.id where rowid='" + Request.QueryString[0] + "'"); if (!ds.EOF) { string MId = "{5a3f8c87-e0dc-4bbb-8116-661521bfc6c7}"; string PapCaption = "固定資產預算申請單"; string PID = FIELD_sn.Text; string receivername = ds["name"].ToString(); string requestername = this.CurrentUser.Name; string sendername = this.CurrentUser.Name; requesturl = "http://eip.minaik.com.tw" + Request.RawUrl.ToString().Trim().ToLower().Replace("view", "edit"); string AppMail = ds["email"].ToString(); string reviewresult = "退回"; string body = ""; Usemail.StopApprove(MId, PID, PapCaption, receivername, requestername, requesturl, reviewresult, body, "*****@*****.**"); Usemail.StopApprove(MId, PID, PapCaption, receivername, requestername, requesturl, reviewresult, body, AppMail); } } #endregion }
protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { string FileName = ""; string INV_Num = ""; string ForwarderID = ""; string ERP_Key = ""; try { if (e.ResultType.ToString() == "Complete") { string InitDirectory = @"D:\Forwarder\4GL\"; //原始目錄 string Plant = ""; string strYMD = DateTime.Now.ToString("yyyy-MM-dd_hhmmss"); SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate); rs.Open(" Select Pkey,ID,ERP_Key,ERP_Key2,PlantID,ProgramID,IsStatus,FileName,INV_Num,SHIP_To,SHIPPING_No,SHIPPING_Dec,SHIPPING_Mode,SHIPPING_ModeDec " + " FORWARDER_Num,FORWARDER_Dec,HawbNo,FitNo, CONVERT(VARCHAR, ETD, 111 ) ETD,CONVERT(VARCHAR, ATD, 111 ) ATD,CONVERT(VARCHAR, ETA, 111 ) ETA,CONVERT(VARCHAR, ATAAS, 111 ) ATAAS,CONVERT(VARCHAR, ATAC, 111 ) ATAC " + " From Forwarder Where ID = '" + Request.QueryString["ID"] + "'"); while (!rs.EOF) { ForwarderID = rs["ID"].ToString(); FileName = rs["FileName"].ToString(); INV_Num = rs["INV_Num"].ToString(); ERP_Key = rs["ERP_Key"].ToString(); FileStream fs = new FileStream(InitDirectory + rs["FileName"].ToString().Replace("axmt850", "axmt610").Replace("axmt620", "axmt610").Replace(".xml", "") + ".txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("\"" + rs["PlantID"].ToString() + "\",\"" + rs["ProgramID"].ToString() + "\",\"" + rs["ERP_Key"].ToString() + "\",\"N\"," + "\"" + rs["HawbNo"].ToString() + "\",\"" + rs["FitNo"].ToString() + "\",\"" + rs["ETD"].ToString() + "\"," + "\"" + rs["ATD"].ToString() + "\",\"" + rs["ETA"].ToString() + "\",\"" + rs["ATAAS"].ToString() + "\",\"" + rs["ATAC"].ToString() + "\""); sw.Close(); fs.Close(); Upload(InitDirectory + rs["FileName"].ToString().Replace("axmt850", "axmt610").Replace("axmt620", "axmt610").Replace(".xml", "") + ".txt", "ftp://192.168.0.250/" + rs["FileName"].ToString().Replace("axmt850", "axmt610").Replace("axmt620", "axmt610").Replace(".xml", "") + ".txt", "4gl", "4gl"); if (rs["ERP_Key2"].ToString() != "") { FileStream fs2 = new FileStream(InitDirectory + rs["PlantID"].ToString() + "_axmt610_" + rs["ERP_Key2"].ToString() + ".txt", FileMode.Create, FileAccess.Write); StreamWriter sw2 = new StreamWriter(fs2); sw2.WriteLine("\"" + rs["PlantID"].ToString() + "\",\"" + rs["ProgramID"].ToString() + "\",\"" + rs["ERP_Key2"].ToString() + "\",\"N\"," + "\"" + rs["HawbNo"].ToString() + "\",\"" + rs["FitNo"].ToString() + "\",\"" + rs["ETD"].ToString() + "\"," + "\"" + rs["ATD"].ToString() + "\",\"" + rs["ETA"].ToString() + "\",\"" + rs["ATAAS"].ToString() + "\",\"" + rs["ATAC"].ToString() + "\""); sw2.Close(); fs2.Close(); Plant = rs["PlantID"].ToString().ToUpper().Trim(); Upload(InitDirectory + rs["PlantID"].ToString() + "_axmt610_" + rs["ERP_Key2"].ToString() + ".txt", "ftp://192.168.0.250/" + rs["PlantID"].ToString() + "_axmt610_" + rs["ERP_Key2"].ToString() + ".txt", "4gl", "4gl"); } rs["IsStatus"] = "Complete"; rs.Update(); MailAddress from = new MailAddress("*****@*****.**", "Forwarder(審核通知)"); MailAddress to = new MailAddress("*****@*****.**"); if (Plant == "MAP") { MailAddress cc = new MailAddress("*****@*****.**"); } else { MailAddress cc = new MailAddress("*****@*****.**"); } MailMessage message = new MailMessage(from, to); message.Subject = "Forwarder(審核通知)"; string ques = ""; ques = "您好:" + "<br>" + "<br>" + "Forwarder 審核通知~<br>" + "發票編號:" + INV_Num + "<br>" + "出通單號:" + ERP_Key + "<br>" + "價格條件:" + rs["SHIPPING_No"].ToString() + "<br>" + "價格描述:" + rs["SHIPPING_Dec"].ToString() + "<br>" + "廠商名稱:" + rs["FORWARDER_Dec"].ToString() + "<br>" + "=====================================================<br>" + "<a href=http://eip.minaik.com.tw/Shipping/ForwarderView.aspx?ID=" + ForwarderID + ">http://eip.minaik.com.tw/Shipping/ForwarderView.aspx?ID=" + ForwarderID + "</a><br>" + "因本信件為系統自動發送,請勿直接以此郵件回覆。"; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Send(message); rs.MoveNext(); } rs.Close(); } else { SmoothEnterprise.Database.DataSet rs = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenUpdate); rs.Open(" Select Pkey,IsStatus From Forwarder Where ID = '" + Request.QueryString["ID"] + "'"); while (!rs.EOF) { rs["IsStatus"] = e.ResultType.ToString(); rs.Update(); rs.MoveNext(); } rs.Close(); } } catch (Exception ex) { MailAddress from = new MailAddress("*****@*****.**", "Forwarder(錯誤訊息)"); MailAddress to = new MailAddress("*****@*****.**"); MailMessage message = new MailMessage(from, to); message.Subject = "Forwarder(錯誤訊息)"; string ques = ""; ques = "您好:" + "<br>" + "<br>" + "Forwarder 系統發生錯誤~<br>" + "<br>" + "錯誤編號:" + INV_Num + "<br>" + "錯誤檔案:" + FileName + "<br>" + "錯誤訊息:" + ex + "<br><br>" + "因本信件為系統自動發送,請勿直接以此郵件回覆。"; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Send(message); } }
protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete) { try { string sqlstr = ""; sqlstr = "SELECT * FROM EngineeringTest_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"] = "完成審核"; ds.Update(); SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rss.Open("select add_user , email,mail,name from EngineeringTest_head a left join dguser b on a.add_user=b.id where a.id='" + Request.QueryString["id"] + "' "); if (!rss.EOF) { #region 寄給申請人完成的mail ArrayList email_list = new ArrayList(); //email list email_list.Add(rss["email"].ToString()); #endregion #region 寄給通知者 String[] s = rss["mail"].ToString().Split(';'); foreach (string bb in s) { email_list.Add(bb.ToString()); //Response.Write(bb.ToString()); } #endregion #region Send email String ques; MailAddress from = new MailAddress("*****@*****.**", "ePortal(員工入口網站)"); //MailAddress to = new MailAddress(i); MailAddress bcc = new MailAddress("*****@*****.**"); MailMessage message = new MailMessage("*****@*****.**", rss["email"].ToString()); foreach (string i in email_list) { if (!string.IsNullOrEmpty(i)) { message.To.Add(i); } } DateTime de = Convert.ToDateTime(this.FIELD_expect_date.Text); ques = "您好:" + "<br>" + "<br>" + "EIP工程試作單系統已完成審核, 詳細資料如下:" + "<br>" + "<br>" + "單號 : " + this.no.Text + "<br>" + "申請日期 : " + de.ToString("yyyy/MM/dd") + "<br>" + "申請內容 : " + "<a href=\"http://eip.minaik.com.tw/EngineeringTest/EngineeringTestView.aspx?id=" + Request.QueryString["id"] + "\" >至EIP工程試作單系統查看</a>" + "<br>" + "如您想了解更多有關員工入口網站的資訊請點選以下連結進入" + "<br>" + "<a href=\"http://eip.minaik.com.tw/\">員工入口網站</a>" + "<br>" + "感謝您對員工入口網站的支持與愛護,<font Color='red'>。因本信件為系統自動發送,請勿直接以此郵件回覆。</font>"; message.Subject = "EIP工程試作單號 - " + this.no.Text + " 成品料號-" + this.cima01.Text + "己完成審核"; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Send(message); #endregion if (this.cima01.Text.Substring(1, 1) == "9") //料號的開頭如果是”9”的時候要寄出去信件並新增至模具試模試作系統中 { #region 寫入NPI_TryoutFeedback EIPSysSha eip = new EIPSysSha(); SmoothEnterprise.Database.DataSet rss2 = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); string NPI_TryoutFeedbackSN = eip.GetNewSn("N301", DateTime.Now.Year.ToString().Substring(2, 2) + DateTime.Now.Month.ToString("00"), "EIPB", "PAPDETAIL"); string Guidstring = Guid.NewGuid().ToString(); string sqlcommand = "INSERT INTO EIPB.dbo.NPI_TryoutFeedback " + " (rowno , " + " SN , " + " PNO , " + " PRODUCTION_NAME ," + " Drawing , " + " NPI , " + " VER , " + " QUARYTI ," + " samples," + " ORDERS," + " Explanation," + " NOTE, " + " Measured_datetime ," + " initdate ," + " inituid) " + " VALUES('" + Guidstring + "'," + " '" + NPI_TryoutFeedbackSN + "'," + " '" + this.cima01.Text + "'," + " '" + this.cima02.Text + "'," + " '" + this.cima03.Text + "'," + " '" + rss["add_user"].ToString() + "'," + " '" + this.rev.Text + "'," + " " + this.oduction_amount.Text + "," + " " + this.delivers_amount.Text + "," + " '" + this.order_no.Text + "'," + " '" + this.oduction_explain.Text + "'," + " '" + this.remark.Text + "'," + " '" + this.FIELD_expect_date.Text + "' , " + " SYSDATETIME()," + " '" + rss["add_user"].ToString() + "')"; //throw new Exception(sqlcommand); rss2.ExecuteNonQuery(sqlcommand); #endregion #region 寫入NPI的預設MailGrid InsertIntoMailGrid(Guidstring); #endregion #region 寄出模具試模計劃的EMail SendMail(email_list, Guidstring, NPI_TryoutFeedbackSN); #endregion } } } } catch (Exception ex) { Response.Write(ex.Message + ex.StackTrace); //showError(ex.Message); } } if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate || e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Return) { //try //{ string sqlstr = ""; sqlstr = "SELECT * FROM EngineeringTest_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"] = "退回"; ds.Update(); SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rss.Open("select add_user bid,email,name from EngineeringTest_head a left join dguser b on a.add_user=b.id where a.id='" + Request.QueryString["id"] + "' "); if (!rss.EOF) { #region 寄給申請人退回的mail ArrayList email_list = new ArrayList(); //email list email_list.Add(rss["email"].ToString()); #region 如資材單位已簽核過, 也給生管單位一份 SmoothEnterprise.Database.DataSet rsa = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rsa.Open("select * from dgflowqueue where text='資材單位' and qseq='1' and reviewresult is not null and requesturl like '%" + Request.QueryString["id"] + "'"); if (!rsa.EOF) { SmoothEnterprise.Database.DataSet rsb = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rsb.Open("select email from dguser where id='" + this.FIELD_pmcsend.Text + "'"); if (!rsb.EOF) { email_list.Add(rsb["email"].ToString()); } } #endregion #endregion #region Send email foreach (string i in email_list) { String ques; MailAddress from = new MailAddress("*****@*****.**", "ePortal(員工入口網站)"); MailAddress to = new MailAddress(i); MailAddress bcc = new MailAddress("*****@*****.**"); MailMessage message = new MailMessage(from, to); DateTime de = Convert.ToDateTime(this.FIELD_expect_date.Text); ques = "您好:" + "<br>" + "<br>" + "EIP工程試作單系統已被退回, 詳細資料如下:" + "<br>" + "<br>" + "單號 : " + this.no.Text + "<br>" + "申請日期 : " + de.ToString("yyyy/MM/dd") + "<br>" + "申請內容 : " + "<a href=\"http://eip.minaik.com.tw/EngineeringTest/EngineeringTestView.aspx?id=" + Request.QueryString["id"] + "\" >至EIP工程試作單系統查看</a>" + "<br>" + "如您想了解更多有關員工入口網站的資訊請點選以下連結進入" + "<br>" + "<a href=\"http://eip.minaik.com.tw/\">員工入口網站</a>" + "<br>" + "感謝您對員工入口網站的支持與愛護,<font Color='red'>。因本信件為系統自動發送,請勿直接以此郵件回覆。</font>"; message.Subject = "EIP工程試作單號 - " + this.no.Text + " 成品料號-" + this.cima01.Text + "己被退回"; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Send(message); } #endregion } } //} //catch //{ // Response.Write("有問題"); //} } }
protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete) { //try //{ string sqlstr = ""; sqlstr = "SELECT * FROM " + db1 + "cxmt310_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"] = "OK"; ds.Update(); SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rss.Open("select senduser bid,email,name from " + db1 + "cxmt310_in_head a left join dguser b on a.senduser=b.id where a.id='" + Request.QueryString["id"] + "' "); if (!rss.EOF) { #region 寄給申請人完成的mail ArrayList email_list = new ArrayList(); //email list email_list.Add(rss["email"].ToString()); #endregion #region Send email foreach (string i in email_list) { Response.Write(i); String ques; MailAddress from = new MailAddress("*****@*****.**", "ePortal(員工入口網站)"); MailAddress to = new MailAddress(i); MailAddress bcc = new MailAddress("*****@*****.**"); MailMessage message = new MailMessage(from, to); ques = "您好:" + "<br>" + "<br>" + "ERP報價電子簽核系統已完成審核, 詳細資料如下:" + "<br>" + "<br>" + "申請單號 : " + this.FIELD_no.Text + "<br>" + "ERP單號 : " + this.FIELD_oqa01.Text + "<br>" + "申請日期 : " + this.FIELD_oqa02.Text + "<br>" + "申請內容 : " + "<a href=\"http://eip.minaik.com.tw/ERP_CXMT310/CXMT310View.aspx?id=" + Request.QueryString["id"] + "\" >至ERP報價電子簽核系統查看</a>" + "<br>" + "如您想了解更多有關員工入口網站的資訊請點選以下連結進入" + "<br>" + "<a href=\"http://eip.minaik.com.tw/\">員工入口網站</a>" + "<br>" + "感謝您對員工入口網站的支持與愛護,<font Color='red'>。因本信件為系統自動發送,請勿直接以此郵件回覆。</font>"; message.Subject = "(完成審核)報價單號 - " + this.FIELD_no.Text + " ERP單號-" + this.FIELD_oqa01.Text; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Credentials = new NetworkCredential("eip", "eip1106"); client.Send(message); } #endregion } } //傳簽核完成的TXT給ERP FileStream fs = new FileStream(@"D:\CXMT310_XML\4GL\" + this.FIELD_plantid.Text.ToString() + "_cxmt310_" + this.FIELD_oqa01.Text.ToString() + ".txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("\"" + this.FIELD_plantid.Text.ToString() + "\",\"CXMT310\",\"" + this.FIELD_oqa01.Text + "\",\"Y\",\"" + this.FIELD_no.Text + "\""); sw.Close(); fs.Close(); Upload("D:\\CXMT310_XML\\4GL\\" + this.FIELD_plantid.Text.ToString() + "_cxmt310_" + this.FIELD_oqa01.Text.ToString() + ".txt", "ftp://192.168.0.250/" + this.FIELD_plantid.Text.ToString() + "_cxmt310_" + this.FIELD_oqa01.Text.ToString() + ".txt", "4gl", "4gl"); } if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate || e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Return) { //try //{ string sqlstr = ""; sqlstr = "SELECT * FROM " + db1 + "cxmt310_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"] = "NO"; ds.Update(); SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rss.Open("select senduser bid,email,name from " + db1 + "cxmt310_in_head a left join dguser b on a.senduser=b.id where a.id='" + Request.QueryString["id"] + "' "); if (!rss.EOF) { #region 寄給申請人退回的mail ArrayList email_list = new ArrayList(); //email list email_list.Add(rss["email"].ToString()); #endregion #region Send email foreach (string i in email_list) { String ques; MailAddress from = new MailAddress("*****@*****.**", "ePortal(員工入口網站)"); MailAddress to = new MailAddress(i); MailAddress bcc = new MailAddress("*****@*****.**"); MailMessage message = new MailMessage(from, to); ques = "您好:" + "<br>" + "<br>" + "ERP報價電子簽核系統已被退回, 詳細資料如下:" + "<br>" + "<br>" + "申請單號 : " + this.FIELD_no.Text + "<br>" + "ERP單號 : " + this.FIELD_oqa01.Text + "<br>" + "申請日期 : " + this.FIELD_oqa02.Text + "<br>" + "申請內容 : " + "<a href=\"http://eip.minaik.com.tw/ERP_CXMT310/CXMT310View.aspx?id=" + Request.QueryString["id"] + "\" >至ERP報價電子簽核系統查看</a>" + "<br>" + "如您想了解更多有關員工入口網站的資訊請點選以下連結進入" + "<br>" + "<a href=\"http://eip.minaik.com.tw/\">員工入口網站</a>" + "<br>" + "感謝您對員工入口網站的支持與愛護,<font Color='red'>。因本信件為系統自動發送,請勿直接以此郵件回覆。</font>"; message.Subject = "(退回)報價單號 - " + this.FIELD_no.Text + " ERP單號-" + this.FIELD_oqa01.Text; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Credentials = new NetworkCredential("eip", "eip1106"); client.Send(message); } #endregion //傳簽核退回的TXT給ERP FileStream fs = new FileStream(@"D:\CXMT310_XML\4GL\" + this.FIELD_plantid.Text.ToString() + "_cxmt310_" + this.FIELD_oqa01.Text.ToString() + ".txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("\"" + this.FIELD_plantid.Text.ToString() + "\",\"CXMT310\",\"" + this.FIELD_oqa01.Text + "\",\"N\",\"" + this.FIELD_no.Text + "\""); sw.Close(); fs.Close(); Upload("D:\\CXMT310_XML\\4GL\\" + this.FIELD_plantid.Text.ToString() + "_cxmt310_" + this.FIELD_oqa01.Text.ToString() + ".txt", "ftp://192.168.0.250/" + this.FIELD_plantid.Text.ToString() + "_cxmt310_" + this.FIELD_oqa01.Text.ToString() + ".txt", "4gl", "4gl"); } } } }
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("有問題"); } } }
protected void FlowFeedback1_FlowStop(object sender, SmoothEnterprise.Flowwork.UI.WebControl.FlowStopEventArgs e) { if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Complete) { //try //{ string sqlstr = ""; sqlstr = "SELECT * FROM " + db + "apmi255_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"] = "OK"; ds.Update(); SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rss.Open("select senduser bid,email,name from " + db + "apmi255_in_head a left join dguser b on a.senduser=b.id where a.id='" + Request.QueryString["id"] + "' "); if (!rss.EOF) { #region 寄給申請人完成的mail ArrayList email_list = new ArrayList(); //email list email_list.Add(rss["email"].ToString()); #endregion #region 寄給通知者 SmoothEnterprise.Database.DataSet plant = new SmoothEnterprise.Database.DataSet(); object planta = plant.ExecuteScalar("select comid from dguser a left join " + db + "apmi255_in_head b on a.id=b.senduser where b.id='" + Request.QueryString["id"] + "' "); Response.Write("select comid from dguser a left join " + db + "apmi255_in_head b on a.id=b.senduser where b.id='" + Request.QueryString["id"] + "' "); if (this.FIELD_flowstatus.Text.Trim().Substring(0, 1) == "0") { switch (planta.ToString().Trim()) { case "MAY": SmoothEnterprise.Database.DataSet rs2 = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rs2.Open("select email from erp_flow a left join dguser b on a.pid=b.id where erp_name='apmi255' and no='MAT_CC' "); while (!rs2.EOF) { email_list.Add(rs2["email"].ToString()); rs2.MoveNext(); } rs2.Close(); break; case "MAT": SmoothEnterprise.Database.DataSet rs3 = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rs3.Open("select email from erp_flow a left join dguser b on a.pid=b.id where erp_name='apmi255' and no='MAY_CC' "); while (!rs3.EOF) { email_list.Add(rs3["email"].ToString()); rs3.MoveNext(); } rs3.Close(); break; } } else { if (planta.ToString().Trim() == "MAT") { //Response.Write("??<br>"); SmoothEnterprise.Database.DataSet rs2 = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rs2.Open("select email from erp_flow a left join dguser b on a.pid=b.id where erp_name='apmi255' and no='MAY_CC' "); while (!rs2.EOF) { email_list.Add(rs2["email"].ToString()); rs2.MoveNext(); } rs2.Close(); } } #endregion #region Send email foreach (string i in email_list) { Response.Write(i); String ques; MailAddress from = new MailAddress("*****@*****.**", "ePortal(員工入口網站)"); MailAddress to = new MailAddress(i); MailAddress bcc = new MailAddress("*****@*****.**"); MailMessage message = new MailMessage(from, to); ques = "您好:" + "<br>" + "<br>" + "ERP採購核價電子簽核系統已完成審核, 詳細資料如下:" + "<br>" + "<br>" + "申請單號 : " + this.FIELD_no.Text + "<br>" + "ERP單號 : " + this.FIELD_pmi01.Text + "<br>" + "申請日期 : " + this.FIELD_pmi02.Text + "<br>" + "申請內容 : " + "<a href=\"http://eip.minaik.com.tw/ERP_APMI255/ERP_APMI255View.aspx?id=" + Request.QueryString["id"] + "\" >至ERP採購核價電子簽核系統查看</a>" + "<br>" + "如您想了解更多有關員工入口網站的資訊請點選以下連結進入" + "<br>" + "<a href=\"http://eip.minaik.com.tw/\">員工入口網站</a>" + "<br>" + "感謝您對員工入口網站的支持與愛護,<font Color='red'>。因本信件為系統自動發送,請勿直接以此郵件回覆。</font>"; message.Subject = "(完成審核)核價單號 - " + this.FIELD_no.Text + " ERP單號-" + this.FIELD_pmi01.Text; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Credentials = new NetworkCredential("eip", "eip1106"); client.Send(message); } #endregion } } //傳簽核完成的TXT給ERP FileStream fs = new FileStream(@"D:\APMI255_XML\4GL\" + this.FIELD_plantid.Text.ToString() + "_apmi255_" + this.FIELD_pmi01.Text.ToString() + ".txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("\"" + this.FIELD_plantid.Text.ToString() + "\",\"apmi255\",\"" + this.FIELD_pmi01.Text.ToString() + "\",\"Y\""); sw.Close(); fs.Close(); Upload("D:\\APMI255_XML\\4GL\\" + this.FIELD_plantid.Text.ToString() + "_apmi255_" + this.FIELD_pmi01.Text.ToString() + ".txt", "ftp://192.168.0.250/" + this.FIELD_plantid.Text.ToString() + "_apmi255_" + this.FIELD_pmi01.Text.ToString() + ".txt", "4gl", "4gl"); } if (e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Terminate || e.ResultType == SmoothEnterprise.Flowwork.Control.ReviewResultType.Return) { //try //{ string sqlstr = ""; sqlstr = "SELECT * FROM " + db + "apmi255_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"] = "NO"; ds.Update(); SmoothEnterprise.Database.DataSet rss = new SmoothEnterprise.Database.DataSet(SmoothEnterprise.Database.DataSetType.OpenRead); rss.Open("select senduser bid,email,name from " + db + "apmi255_in_head a left join dguser b on a.senduser=b.id where a.id='" + Request.QueryString["id"] + "' "); if (!rss.EOF) { #region 寄給申請人退回的mail ArrayList email_list = new ArrayList(); //email list email_list.Add(rss["email"].ToString()); #endregion #region Send email foreach (string i in email_list) { String ques; MailAddress from = new MailAddress("*****@*****.**", "ePortal(員工入口網站)"); MailAddress to = new MailAddress(i); MailAddress bcc = new MailAddress("*****@*****.**"); MailMessage message = new MailMessage(from, to); ques = "您好:" + "<br>" + "<br>" + "ERP採購核價電子簽核系統已被退回, 詳細資料如下:" + "<br>" + "<br>" + "申請單號 : " + this.FIELD_no.Text + "<br>" + "ERP單號 : " + this.FIELD_pmi01.Text + "<br>" + "申請日期 : " + this.FIELD_pmi02.Text + "<br>" + "申請內容 : " + "<a href=\"http://eip.minaik.com.tw/ERP_APMI255/ERP_APMI255View.aspx?id=" + Request.QueryString["id"] + "\" >至ERP採購核價電子簽核系統查看</a>" + "<br>" + "如您想了解更多有關員工入口網站的資訊請點選以下連結進入" + "<br>" + "<a href=\"http://eip.minaik.com.tw/\">員工入口網站</a>" + "<br>" + "感謝您對員工入口網站的支持與愛護,<font Color='red'>。因本信件為系統自動發送,請勿直接以此郵件回覆。</font>"; message.Subject = "(退回)核價單號 - " + this.FIELD_no.Text + " ERP單號-" + this.FIELD_pmi01.Text; message.IsBodyHtml = true; message.Body = ques; SmtpClient client = new SmtpClient("192.168.0.12"); client.Credentials = new NetworkCredential("eip", "eip1106"); client.Send(message); } #endregion //傳簽核退回的TXT給ERP FileStream fs = new FileStream(@"D:\APMI255_XML\4GL\" + this.FIELD_plantid.Text.ToString() + "_apmi255_" + this.FIELD_pmi01.Text.ToString() + ".txt", FileMode.Create, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("\"" + this.FIELD_plantid.Text.ToString() + "\",\"apmi255\",\"" + this.FIELD_pmi01.Text.ToString() + "\",\"N\""); sw.Close(); fs.Close(); Upload("D:\\APMI255_XML\\4GL\\" + this.FIELD_plantid.Text.ToString() + "_apmi255_" + this.FIELD_pmi01.Text.ToString() + ".txt", "ftp://192.168.0.250/" + this.FIELD_plantid.Text.ToString() + "_apmi255_" + this.FIELD_pmi01.Text.ToString() + ".txt", "4gl", "4gl"); } } } }