Browse Source

1.邮件分等级发送

2.卸货点与代码对应唯一
master
hao.jin 3 years ago
parent
commit
ce3c981a98
  1. 6
      Stone.WinForm/Stone.WinBiz/BasicData/F_Location.cs
  2. 67
      Stone.WinForm/Stone.WinBiz/JISAdmin/F_EDI_JIS5000Sequence.cs
  3. 25
      Stone.WinForm/Stone.WinBiz/JISAdmin/F_Mail.cs
  4. 6
      Stone.WinForm/Stone.WinModule/BasicData/frmLocation.cs
  5. 30
      Stone.WinForm/Stone.WinModule/BasicData/frmLocationDetail.Designer.cs
  6. 12
      Stone.WinForm/Stone.WinModule/BasicData/frmLocationDetail.cs
  7. 2
      Stone.WinForm/Stone.WinModule/Standard/frmPREDN.cs

6
Stone.WinForm/Stone.WinBiz/BasicData/F_Location.cs

@ -27,9 +27,9 @@ namespace Stone.WinBiz.BasicData
dgv.Columns["Address2"].HeaderText = "地址2";
dgv.Columns["Address3"].HeaderText = "地址3";
dgv.Columns["LocCode1"].HeaderText = "卸货点代码1";
dgv.Columns["LocCode2"].HeaderText = "卸货点代码2";
dgv.Columns["LocCode3"].HeaderText = "卸货点代码3";
dgv.Columns["LocCode4"].HeaderText = "卸货点代码4";
//// dgv.Columns["LocCode2"].HeaderText = "卸货点代码2";
//// dgv.Columns["LocCode3"].HeaderText = "卸货点代码3";
//// dgv.Columns["LocCode4"].HeaderText = "卸货点代码4";
dgv.Columns["State"].HeaderText = "状态";
}

67
Stone.WinForm/Stone.WinBiz/JISAdmin/F_EDI_JIS5000Sequence.cs

@ -131,8 +131,25 @@ namespace Stone.WinBiz.JISAdmin
MoveFile(file, Path_Error);
//F_SMS.SendSMS(file.Name + " 处理失败,原因为:" + ex.Message);
LocalDBService db = new LocalDBService();
var strErrTypeCode = "01";
var strsql = "select top 1 * from t_ErrTypeLevel" +
" where Code = '" + strErrTypeCode + "'" +
" order by id desc";
var dsErrMail = db.Exec_DataSet(strsql);
if (dsErrMail.Tables[0].Rows.Count > 0)
{
//获取收件人
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString();
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLvevl"].ToString();
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString();
//设置邮件标题
var title = "";
title = "LAB解析异常:错误级别-" + errLvevl + " " + errTypeDesc;
F_Mail.Send(file.Name + " 处理失败,未能成功解析!", title, mailTo);
}
F_Mail.Send(file.Name + " 处理失败,原因为:" + ex.Message);
// F_Mail.Send(file.Name + " 处理失败,原因为:" + ex.Message);
//如果文件有问题,不移动文件,等待一分钟后再处理
Thread.Sleep(60 * 1000);
@ -176,6 +193,9 @@ namespace Stone.WinBiz.JISAdmin
//版本号在需求日期之后,目前是在需求日期处进行的数据插入
var lstPartRelease = new List<PartRelease>();
var partRelese = new PartRelease();
//定义预警级别
var errType = 0;
foreach (var line_text in sp_text)
{
if (line_text.Trim() == "") continue;
@ -261,11 +281,21 @@ namespace Stone.WinBiz.JISAdmin
{
var strState = dsProd.Tables[0].Rows[0]["State"].ToString();
if (strState == "0" || string.IsNullOrEmpty(strState))
{
strPartMsg += "零件号 " + partNumber + " 已失效!" + Environment.NewLine;
if (errType == 0 || errType > 6)
{
errType = 6;
}
}
}
else
{
strPartMsg += "零件号 " + partNumber + " 未定义!" + Environment.NewLine;
if (errType == 0 || errType > 5)
{
errType = 5;
}
}
}
@ -285,22 +315,37 @@ namespace Stone.WinBiz.JISAdmin
{
var strState = dsLoc.Tables[0].Rows[0]["State"].ToString();
if (strState == "0" || string.IsNullOrEmpty(strState))
{
strPartMsg += "卸货点 " + location + " 已失效!" + Environment.NewLine;
if (errType == 0 || errType > 4)
{
errType = 4;
}
}
}
else
{
strPartMsg += "卸货点 " + location + " 未在系统中定义效!" + Environment.NewLine;
if (errType == 0 || errType > 2)
{
errType = 2;
}
}
//校验卸货点、卸货点代码是否匹配
strsql = "select top 1 * from t_Location" +
" where Code = '" + location + "'" +
" and (LocCode1 = '" + LocationCode + "' or LocCode2 = '" + LocationCode + "' or LocCode3 = '" + LocationCode + "' or LocCode4 = '" + LocationCode + "')"+
//" and (LocCode1 = '" + LocationCode + "' or LocCode2 = '" + LocationCode + "' or LocCode3 = '" + LocationCode + "' or LocCode4 = '" + LocationCode + "')"+
" and (LocCode1 = '" + LocationCode + "')" +
" order by id desc";
dsLoc = db.Exec_DataSet(strsql);
if (dsLoc.Tables[0].Rows.Count == 0)
{
strPartMsg += "卸货点 " + location + " 对应的代码 " + LocationCode + " 未在系统中定义效!" + Environment.NewLine;
if (errType == 0 || errType > 3)
{
errType = 3;
}
}
}
@ -382,7 +427,23 @@ namespace Stone.WinBiz.JISAdmin
if (strPartMsg != "")
{
F_Mail.Send(strPartMsg);
var strErrTypeCode = errType.ToString("00");
var strsql = "select top 1 * from t_ErrTypeLevel" +
" where Code = '" + strErrTypeCode + "'" +
" order by id desc";
var dsErrMail = db.Exec_DataSet(strsql);
if (dsErrMail.Tables[0].Rows.Count > 0)
{
//获取收件人
var mailTo = dsErrMail.Tables[0].Rows[0]["ToPerson"].ToString();
var errLvevl = dsErrMail.Tables[0].Rows[0]["ErrLvevl"].ToString();
var errTypeDesc = dsErrMail.Tables[0].Rows[0]["ErrTypeDesc"].ToString();
//设置邮件标题
var title = "";
title = "LAB解析异常:错误级别-" + errLvevl + " " + errTypeDesc;
F_Mail.Send(strPartMsg,title, mailTo);
}
}
Msg = strPartMsg;

25
Stone.WinForm/Stone.WinBiz/JISAdmin/F_Mail.cs

@ -58,5 +58,30 @@ namespace Stone.WinBiz.JISAdmin
}
public static void Send(string title, string msg,string to)
{
try
{
string To = to; if (To == "") return;
string From = MyAppconfig.ReadValue("MailSender");
string Server = MyAppconfig.ReadValue("MailServer");
string MailUserName = MyAppconfig.ReadValue("MailUserName");
string Password = MyAppconfig.ReadValue("MailPassword");
int Port = Convert.ToInt32(MyAppconfig.ReadValue("MailPort"));
string MailTitle = title;
string MailBody = msg + "<br><br>时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
MySmtpMail SmtpMail = new MySmtpMail(To, From, MailBody, MailTitle, Server, MailUserName, Password, false, Port, false, "");
SmtpMail.Send();
}
catch (Exception ex)
{
MyLogger.Write("发邮件失败,原因为:" + ex.Message);
}
}
}
}

6
Stone.WinForm/Stone.WinModule/BasicData/frmLocation.cs

@ -24,9 +24,9 @@ namespace Stone.WinModule.BasicData
strWhere += " or [Address2] like '%" + code + "%'";
strWhere += " or [Address3] like '%" + code + "%'";
strWhere += " or [LocCode1] like '%" + code + "%'";
strWhere += " or [LocCode2] like '%" + code + "%'";
strWhere += " or [LocCode3] like '%" + code + "%'";
strWhere += " or [LocCode4] like '%" + code + "%'";
// strWhere += " or [LocCode2] like '%" + code + "%'";
// strWhere += " or [LocCode3] like '%" + code + "%'";
// strWhere += " or [LocCode4] like '%" + code + "%'";
}
}
}

30
Stone.WinForm/Stone.WinModule/BasicData/frmLocationDetail.Designer.cs

@ -51,17 +51,17 @@
//
// btnAddNewLine
//
this.btnAddNewLine.Location = new System.Drawing.Point(62, 449);
this.btnAddNewLine.Location = new System.Drawing.Point(47, 323);
this.btnAddNewLine.Margin = new System.Windows.Forms.Padding(6);
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(381, 449);
this.btnClose.Location = new System.Drawing.Point(366, 323);
this.btnClose.Margin = new System.Windows.Forms.Padding(6);
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(250, 449);
this.btnOK.Location = new System.Drawing.Point(235, 323);
this.btnOK.Margin = new System.Windows.Forms.Padding(6);
//
// txtAddress2
@ -143,7 +143,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(88, 417);
this.label5.Location = new System.Drawing.Point(73, 291);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(62, 18);
@ -155,7 +155,7 @@
this.cbState.AutoSize = true;
this.cbState.Checked = true;
this.cbState.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbState.Location = new System.Drawing.Point(170, 416);
this.cbState.Location = new System.Drawing.Point(155, 290);
this.cbState.Name = "cbState";
this.cbState.Size = new System.Drawing.Size(70, 22);
this.cbState.TabIndex = 116;
@ -183,65 +183,71 @@
//
// txtLocCode2
//
this.txtLocCode2.Location = new System.Drawing.Point(170, 289);
this.txtLocCode2.Location = new System.Drawing.Point(250, 13);
this.txtLocCode2.Margin = new System.Windows.Forms.Padding(4);
this.txtLocCode2.MaxLength = 200;
this.txtLocCode2.Name = "txtLocCode2";
this.txtLocCode2.Size = new System.Drawing.Size(331, 28);
this.txtLocCode2.TabIndex = 119;
this.txtLocCode2.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(32, 290);
this.label7.Location = new System.Drawing.Point(112, 14);
this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(125, 18);
this.label7.TabIndex = 120;
this.label7.Text = "卸货点代码2:";
this.label7.Visible = false;
//
// txtLocCode3
//
this.txtLocCode3.Location = new System.Drawing.Point(172, 331);
this.txtLocCode3.Location = new System.Drawing.Point(252, 55);
this.txtLocCode3.Margin = new System.Windows.Forms.Padding(4);
this.txtLocCode3.MaxLength = 200;
this.txtLocCode3.Name = "txtLocCode3";
this.txtLocCode3.Size = new System.Drawing.Size(331, 28);
this.txtLocCode3.TabIndex = 121;
this.txtLocCode3.Visible = false;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(32, 334);
this.label8.Location = new System.Drawing.Point(112, 58);
this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(125, 18);
this.label8.TabIndex = 122;
this.label8.Text = "卸货点代码3:";
this.label8.Visible = false;
//
// txtLocCode4
//
this.txtLocCode4.Location = new System.Drawing.Point(172, 372);
this.txtLocCode4.Location = new System.Drawing.Point(252, 96);
this.txtLocCode4.Margin = new System.Windows.Forms.Padding(4);
this.txtLocCode4.MaxLength = 200;
this.txtLocCode4.Name = "txtLocCode4";
this.txtLocCode4.Size = new System.Drawing.Size(331, 28);
this.txtLocCode4.TabIndex = 123;
this.txtLocCode4.Visible = false;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(32, 382);
this.label9.Location = new System.Drawing.Point(112, 106);
this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(125, 18);
this.label9.TabIndex = 124;
this.label9.Text = "卸货点代码4:";
this.label9.Visible = false;
//
// frmLocationDetail
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.ClientSize = new System.Drawing.Size(572, 531);
this.ClientSize = new System.Drawing.Size(572, 400);
this.Controls.Add(this.txtLocCode4);
this.Controls.Add(this.label9);
this.Controls.Add(this.txtLocCode3);

12
Stone.WinForm/Stone.WinModule/BasicData/frmLocationDetail.cs

@ -34,9 +34,9 @@ namespace Stone.WinModule.BasicData
drData["Address2"] = MyStrings.GetString(this.txtAddress2.Text.Trim());
drData["Address3"] = MyStrings.GetString(this.txtAddress3.Text.Trim());
drData["LocCode1"] = MyStrings.GetString(this.txtLocCode1.Text.Trim());
drData["LocCode2"] = MyStrings.GetString(this.txtLocCode2.Text.Trim());
drData["LocCode3"] = MyStrings.GetString(this.txtLocCode3.Text.Trim());
drData["LocCode4"] = MyStrings.GetString(this.txtLocCode4.Text.Trim());
// drData["LocCode2"] = MyStrings.GetString(this.txtLocCode2.Text.Trim());
// drData["LocCode3"] = MyStrings.GetString(this.txtLocCode3.Text.Trim());
// drData["LocCode4"] = MyStrings.GetString(this.txtLocCode4.Text.Trim());
if (cbState.Checked)
{
drData["State"] = "1";
@ -61,9 +61,9 @@ namespace Stone.WinModule.BasicData
this.txtAddress2.Text = drData["Address2"].ToString();
this.txtAddress3.Text = drData["Address3"].ToString();
this.txtLocCode1.Text = drData["LocCode1"].ToString();
this.txtLocCode2.Text = drData["LocCode2"].ToString();
this.txtLocCode3.Text = drData["LocCode3"].ToString();
this.txtLocCode4.Text = drData["LocCode4"].ToString();
// this.txtLocCode2.Text = drData["LocCode2"].ToString();
// this.txtLocCode3.Text = drData["LocCode3"].ToString();
// this.txtLocCode4.Text = drData["LocCode4"].ToString();
var strState = drData["State"].ToString();
if (strState == "1")
{

2
Stone.WinForm/Stone.WinModule/Standard/frmPREDN.cs

@ -59,7 +59,7 @@ namespace Stone.WinModule.Standard
// drNew["Required Pick-up Date"] = Convert.ToDateTime(drData["Date"]).AddDays(-1).ToString("yyyy-MM-dd");
// drNew["Required Pick-up Time"] = "23:59:59";
drNew["Required Pick-up Date"] = dtPickUpTime.Date.ToString("yyyy-MM-dd");
drNew["Required Pick-up Time"] = dtPickUpTime.Hour.ToString("00") + ":" + dtPickUpTime.Minute.ToString("00");
drNew["Required Pick-up Time"] = dtPickUpTime.Hour.ToString("00") + ":" + dtPickUpTime.Minute.ToString("00") + ":00";
drNew["Required Swet Date"] = Convert.ToDateTime(drData["Date"]).ToString("yyyy-MM-dd");
drNew["Required Swet Time"] = "23:59:59";
drNew["Material Number"] = drData["PartNumber"].ToString();

Loading…
Cancel
Save