Browse Source

冲压件优化

master
qian 9 months ago
parent
commit
7578387986
  1. 13
      Controller/SCP_ASK_CONTROLLER.cs
  2. 51
      SCP/Common/MailHelper.cs
  3. 3
      SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs

13
Controller/SCP_ASK_CONTROLLER.cs

@ -2650,6 +2650,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
switch (p_state)
{
case AskState.Close:
@ -2781,7 +2782,17 @@ namespace CK.SCP.Controller
}
break;
case AskState.Release:
var _ls4 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
List<TB_ASK> _ls4 = new List<TB_ASK>();
foreach (var item in p_list)
{
TB_ASK ask = db.TB_ASK.FirstOrDefault(q => q.AskBillNum == item);
if (ask != null)
{
_ls4.Add(ask);
}
}
//var _ls4 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
foreach (var mail in _ls4)
{
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL();

51
SCP/Common/MailHelper.cs

@ -16,7 +16,7 @@ namespace SCP.Common
{
public class MailManager
{
public static void SendMail(string p_VendId, string p_Content, string p_title,string p_site)
public static void SendMail(string p_VendId, string p_Content, string p_title, string p_site)
{
try
{
@ -73,7 +73,7 @@ namespace SCP.Common
}
}
catch(Exception e)
catch (Exception e)
{
LogHelper.Writlog(LogHelper.LogType.Error, typeof(MailManager), "MailManager", e.Message);
}
@ -85,7 +85,7 @@ namespace SCP.Common
/// <param name="p_VendId">供应商编码</param>
/// <param name="p_Content">邮件内容</param>
/// <param name="p_title">邮件头</param>
public static void SendMail(string p_VendId,string p_Content,string p_title)
public static void SendMail(string p_VendId, string p_Content, string p_title)
{
using (AppBoxContext db = EntitiesFactory.CreateAppBoxInstance())
{
@ -98,7 +98,7 @@ namespace SCP.Common
_buffer.AppendFormat(" WHERE(h.Name = '供应商' and a.VenderId='{0}' ) ", p_VendId);
var _userList = db.Database.SqlQuery<string>(_buffer.ToString()).ToList();
//var _vender = ScpCache.VenderList.Where(itm => itm.VendId == p_VendId).FirstOrDefault();
if (_userList != null && _userList.Count>0)
if (_userList != null && _userList.Count > 0)
{
foreach (var itm in _userList)
{
@ -111,7 +111,7 @@ namespace SCP.Common
string mailbody = "";
mailbody += "尊敬的供应商<br>";
mailbody += "你好!<br><br>";
mailbody += "<b>" + p_Content + "</b> ,请到供应商协同网站"+ ConfigurationManager.AppSettings["ResetPassWord"] + "打开查看!<br>";
mailbody += "<b>" + p_Content + "</b> ,请到供应商协同网站" + ConfigurationManager.AppSettings["ResetPassWord"] + "打开查看!<br>";
mailbody += "<br><br><br><br>日期:" + DateTime.Now;
MyWebSmtpMail webmail = new MyWebSmtpMail();
webmail.Send(mails, mailbody, p_title);
@ -270,7 +270,7 @@ namespace SCP.Common
}
}
public static void SendCompanyMail(string p_tl,string p_User, string p_Content, string p_title)
public static void SendCompanyMail(string p_tl, string p_User, string p_Content, string p_title)
{
using (AppBoxContext db = EntitiesFactory.CreateAppBoxInstance())
{
@ -286,7 +286,7 @@ namespace SCP.Common
mails = mails.Substring(0, mails.Length - 1);
}
string mailbody = "";
mailbody += "尊敬的"+ p_tl+ "<br>";
mailbody += "尊敬的" + p_tl + "<br>";
mailbody += "你好!<br><br>";
mailbody += "<b>" + p_Content + "</b> ,请到供应商协同网站" + ConfigurationManager.AppSettings["ResetPassWord"] + "打开查看!<br>";
mailbody += "<br><br><br><br>日期:" + DateTime.Now;
@ -303,6 +303,7 @@ namespace SCP.Common
try
{
List<String> result = new List<String>();
List<String> _userList = new List<String>();
using (AppBoxContext db = EntitiesFactory.CreateAppBoxInstance())
{
StringBuilder _buffer = new StringBuilder();
@ -315,46 +316,15 @@ namespace SCP.Common
_buffer.Append(" RoleUsers AS g ON a.UserId = g.UserID INNER JOIN ");
_buffer.Append(" Roles AS h ON g.RoleID = h.ID ");
_buffer.AppendFormat(" WHERE(h.Name = '供应商' and a.VenderId='{0}' and d.FactoryId='{1}' ) ", p_VendId, p_site);
var _userList = db.Database.SqlQuery<string>(_buffer.ToString()).ToList();
if (_userList != null && _userList.Count > 0)
{
foreach (var itm in _userList)
{
if (itm.Contains('@'))
{
using (ScpEntities dbb = EntitiesFactory.CreateScpInstance())
{
string[] arr = itm.Split('@');
string vendid = arr[0];
var vend = dbb.TA_VENDER.FirstOrDefault(p => p.VendId == vendid);
if (vend != null)
{
break;
}
}
}
string mails = "";
mails += itm + ",";
if (mails != "")
{
mails = mails.Substring(0, mails.Length - 1);
result.Add(mails);
}
}
}
_userList = db.Database.SqlQuery<string>(_buffer.ToString()).ToList();
}
var toMail = result;
string mailbody = "";
mailbody += "尊敬的供应商<br>";
mailbody += "你好!<br><br>";
mailbody += "<b>" + p_Content + "</b> ," + ConfigurationManager.AppSettings["ResetPassWord"] + "<br>";
mailbody += "<br><br><br><br>日期:" + DateTime.Now;
List<EmailAddress> toList = new List<EmailAddress>();
foreach (var em1 in toMail)
foreach (var em1 in _userList)
{
EmailAddress add = new EmailAddress(em1, em1);
toList.Add(add);
@ -368,7 +338,6 @@ namespace SCP.Common
"BCC"
);
smtpMailSender.Send();
LogHelper.Writlog(LogHelper.LogType.Debug, typeof(MailManager), "ASKSendMail", "发送成功");
}
catch (Exception e)

3
SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs

@ -264,7 +264,8 @@ namespace SCP.PlanData
{
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
{
SCP.Common.MailManager.ASKSendMail(_ask.VendId, string.Format("发布了新的要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
Common.MailManager.ASKSendMail(_ask.VendId, string.Format("发布了新的要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
//SCP.Common.MailManager.GetPoMailList();
}

Loading…
Cancel
Save