From 6764fbd104b79b8d6aaab114e411ece992377095 Mon Sep 17 00:00:00 2001 From: xusc Date: Wed, 30 Oct 2024 10:18:20 +0800 Subject: [PATCH] .. --- .vs/ICSSoft.FromERP/v16/.suo | Bin 308224 -> 306688 bytes ICSSoft.FromERP/App.config | 1 + ICSSoft.FromERP/AutoSendMail_KBS.cs | 193 +++++++++++++++++++++++++ ICSSoft.FromERP/ICSSoft.FromERP.csproj | 1 + 4 files changed, 195 insertions(+) create mode 100644 ICSSoft.FromERP/AutoSendMail_KBS.cs diff --git a/.vs/ICSSoft.FromERP/v16/.suo b/.vs/ICSSoft.FromERP/v16/.suo index 413239a5e5b65abd33b3879fa066aabfc26b94df..ba40920726ce65915a0aac58cff8b45ac564eb2f 100644 GIT binary patch delta 12518 zcmdT~3tW}emOty;`yg)t5fM=jh=d3Th=^u-JRrUi5g(~3AS%8970L(7(acQEkk8IC zHB+)4=|^q785&2+7+cWy78|2_wh%(~r~`TgcMpZ?kV+t0Pv z+H38#*LUofLhR>5YLb&otxu52v=n(C;M(=;*HtkAlYnP|RY0Zb(5yf$u<65lzg`;u z5uHVmRqCs>Ra%hL|Dxr|O(@X|4|if$SL)0KQ6%*hViWo5B)jRBv9cNiU-w6&5MVYi z3wR!Q3fKX}0vmvGAQ~72H~~e`qe!0s`hu)Tq-w10NCyCmfrG$fz+RvSumYG2^a65$ zH6~N4X%8~b0sjmzFbud0NCjemzCad`0;B!)O|&UYhM2z0^J!;$U-@^v3`x9YCQ zDMJ2)ni}Ls0?z=i08;?P-)X>4Xww1dOF$Sf9T)1#+!fuTSVupHP390e31y^%hR$&!)Y(^B>b(zU=m zpboensMQt+Hu>H+>-P)0!_HtOs^jRa#H*;CrAK*pslHjjs-{)Io6+)C0**uZ%>up? zWxpX{w|qxqX*bC?;_npjNlbG?z=~(>1w0B9Oaj^qSS?7R*94Te7x23%`!xaQp{*C{ zmjFt@HbBYiX96CFMoPeSNR@z_fc64b6SoTZY1I8)0zMudtvK%u%6$Np_e1L6k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`9YK#s=(X4&6{ze8ksCC7Ve>?f5hu=sUFTIiY-SdP_yWjN=&YW>ovWb z@(qH1iktf4Di5)72`YzsD~-JyQ610Sel_&U9A1EpI6$)!#MrL1* kZ~-^`%Y{2js$=7$B51gx*Pd9(i+hOUZ{N&^+E*& + diff --git a/ICSSoft.FromERP/AutoSendMail_KBS.cs b/ICSSoft.FromERP/AutoSendMail_KBS.cs new file mode 100644 index 0000000..e01dd82 --- /dev/null +++ b/ICSSoft.FromERP/AutoSendMail_KBS.cs @@ -0,0 +1,193 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Quartz; +using System.Data; +//using NFine.Data.Extensions; +using System.Configuration; +using ICSSoft.FromERP; +//using ICSSoft.SendMail; +using System.Data.SqlClient; +using System.Net; +using System.Net.Mail; +using System.Security.Cryptography.X509Certificates; +using System.Net.Security; + + +namespace ICSSoft.FromERP +{ + /// + /// 发送SQE人员复判 + /// + public class AutoSendMail_KBS : IJob + { + private static object key = new object(); + private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public void Execute(IJobExecutionContext context) + { + try + { + lock (key) + { + log.Info("开始……………………………………………………………………"); + Execute(); + log.Info("结束……………………………………………………………………"); + } + } + catch (Exception ex) + { + log.Error(ex.ToString()); + } + } + + private void Execute() + { + string erpName = ICSHelper.GetConfigString()["ERPDB"]; + string conStr = ICSHelper.GetConnectString(); + string Namespace = this.GetType().Namespace; + //string Class = this.GetType().Name; + + DataTable dt = ICSHelper.GetOldERPDB(conStr); + + foreach (DataRow dr1 in dt.Rows) + { + string WorkPoint = dr1["WorkPointCode"].ToString(); + string Class = this.GetType().Name + WorkPoint; + + string sql = @"select +a.* +from IcsMatCheckResult a with(nolock) +where 1=1 +and a.WorkPoint='KC47' +and a.CheckNo='CR202410290034' +--and a.IsCheckComplete='是' +--and a.AsnCode='DNA08S000072400088' +--and a.InvCode='8S11332' +--and a.InvBatcgNo='' + +order by a.Mtime desc +"; + + + DataTable dtInInfo = ICSHelper.ExecuteTable(conStr, sql); + if (dtInInfo == null || dtInInfo.Rows.Count == 0) + { + return; + } + + string MailOpen = ICSHelper.GetConfigString("MailOpen"); + + if (MailOpen != "true") + { + return; + } + + string SendHost = ICSHelper.GetConfigString("SendHost"); + string StrSendPort = ICSHelper.GetConfigString("SendPort"); + int SendPort = 25; + if (!string.IsNullOrEmpty(StrSendPort)) + SendPort = Convert.ToInt32(ICSHelper.GetConfigString("SendPort")); + string SendDisplayName = ICSHelper.GetConfigString("SendDisplayName"); + string SendAddress = ICSHelper.GetConfigString("SendAddress"); + string SendPassword = ICSHelper.GetConfigString("SendPassword"); + + string sqls = @" select * +from V_QuerySysEnumItem a +where a.F_EnCode = 'SQESendMail'"; + DataTable dts = ICSHelper.ExecuteTable(conStr, sqls); + + string Email = string.Empty; + foreach (DataRow drs in dts.Rows) + { + Email += drs["Ext1"].ToString() + ","; + } + + foreach (DataRow dr in dtInInfo.Rows) + { + string TOAddress = Email.TrimEnd(','); + string CCAddress = ""; + string Subject = "SQE复判提醒"; + bool isBodyHtml = true; + //string VenName = dr["VENDORNAME"].ToString(); + //string STNO = dr["STNO"].ToString(); + string NowDate = DateTime.Now.GetDateTimeFormats('D')[0].ToString(); + string body = "SQE复判" + ":"; + body += "\r\n"; + body += " 您好!有一个来料复判的检验单,单号为:" + dr["CheckNo"].ToString() + " 的检验单已经超过48小时没有复判,请及时处理 !"; + + body += "\r\n"; + body += " 苏州咖博士咖啡系统科技有限公司"; + body += "\r\n"; + body += " " + NowDate; + + + //string StrConn = ConfigurationManager.ConnectionStrings["connstr"].ConnectionString; + SendEmail(conStr, SendHost, SendPort, SendDisplayName, SendAddress, SendPassword, TOAddress, CCAddress, Subject, isBodyHtml, body); + } + + + } + } + + public void SendEmail(string ConnectionString, string SendHost, int SendPort, string SendDisplayName, string SendAddress, string SendPassword, string TOAddress, string CCAddress, string Subject, bool IsBodyHtml, string Body) + { + try + { + SmtpClient smtpClient = new SmtpClient + { + //EnableSsl = false, + UseDefaultCredentials = false, + Host = SendHost, + Port = SendPort, + Credentials = new NetworkCredential(SendAddress, SendPassword) + }; + MailMessage mailMessage = new MailMessage + { + Subject = Subject, + SubjectEncoding = Encoding.GetEncoding("utf-8"), + BodyEncoding = Encoding.GetEncoding("utf-8"), + From = new MailAddress(SendAddress, SendDisplayName), + IsBodyHtml = IsBodyHtml, + Body = Body + }; + string[] array = TOAddress.Split(new char[] + { + ',' + }); + string[] array2 = array; + for (int i = 0; i < array2.Length; i++) + { + string text = array2[i]; + if (!string.IsNullOrEmpty(text)) + { + mailMessage.To.Add(text); + } + } + string[] array3 = CCAddress.Split(new char[] + { + ',' + }); + array2 = array3; + for (int i = 0; i < array2.Length; i++) + { + string text2 = array2[i]; + if (!string.IsNullOrEmpty(text2)) + { + mailMessage.CC.Add(text2); + } + } + ServicePointManager.ServerCertificateValidationCallback = ((object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) => true); + smtpClient.Send(mailMessage); + //InsertData(ConnectionString, SendHost, SendPort, SendDisplayName, SendAddress, SendPassword, TOAddress, CCAddress, Subject, IsBodyHtml, Body, "1", null); + } + catch (Exception ex) + { + //InsertData(ConnectionString, SendHost, SendPort, SendDisplayName, SendAddress, SendPassword, TOAddress, CCAddress, Subject, IsBodyHtml, Body, "2", ex.Message); + throw ex; + } + } + + + } +} diff --git a/ICSSoft.FromERP/ICSSoft.FromERP.csproj b/ICSSoft.FromERP/ICSSoft.FromERP.csproj index 63ed365..5fe1025 100644 --- a/ICSSoft.FromERP/ICSSoft.FromERP.csproj +++ b/ICSSoft.FromERP/ICSSoft.FromERP.csproj @@ -86,6 +86,7 @@ +