Browse Source

冲压件优化

master
qian 9 months ago
parent
commit
7578387986
  1. 13
      Controller/SCP_ASK_CONTROLLER.cs
  2. 37
      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();

37
SCP/Common/MailHelper.cs

@ -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