Browse Source

冲压件要货看板发布优化

master
qian 9 months ago
parent
commit
03cad02474
  1. 13
      Common/CK.SCP.Common.csproj
  2. 110
      Common/MyWebSmtpMail.cs
  3. 2
      Common/app.config
  4. 4
      Common/packages.config
  5. 124
      Controller/SCP_ASK_CONTROLLER.cs
  6. 83
      SCP/Common/MailHelper.cs
  7. 11
      SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs
  8. 24
      SCP/Web.config
  9. 4
      SCP/packages.config
  10. 2
      UniApiGroup/App.config

13
Common/CK.SCP.Common.csproj

@ -31,6 +31,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar.Layout"> <Reference Include="DevComponents.DotNetBar.Layout">
<HintPath>..\DLL\DevComponents.DotNetBar.Layout.dll</HintPath> <HintPath>..\DLL\DevComponents.DotNetBar.Layout.dll</HintPath>
</Reference> </Reference>
@ -40,6 +43,12 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"> <Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath> <HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="MailKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b, processorArchitecture=MSIL">
<HintPath>..\packages\MailKit.3.1.0\lib\net452\MailKit.dll</HintPath>
</Reference>
<Reference Include="MimeKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
<HintPath>..\packages\MimeKit.3.1.0\lib\net452\MimeKit.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@ -56,10 +65,14 @@
<HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.OpenXmlFormats.dll</HintPath> <HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.OpenXmlFormats.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.Entity" /> <Reference Include="System.Data.Entity" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Security" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />

110
Common/MyWebSmtpMail.cs

@ -1,4 +1,7 @@
using System; using MailKit.Security;
using MimeKit;
using MimeKit.Text;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Linq; using System.Linq;
@ -85,4 +88,109 @@ namespace CK.SCP.Common
} }
} }
} }
public class EmailAddress
{
public EmailAddress(string address, string name)
{
Address = address;
Name = name;
}
public string Name { get; set; }
public string Address { get; set; }
}
public class MailKitMailSender
{
private readonly MailKit.Net.Smtp.SmtpClient _client = new MailKit.Net.Smtp.SmtpClient();
private MimeMessage _message = new MimeMessage();
private string host;//邮箱服务器
private int port;//端口
private string from;//发送的邮箱
private string password;//密码
private bool enablessl;//是否ssl
private string username;//发送名称
private readonly SecureSocketOptions _secureSocketOptions;
private MailKitMailSender()
{
_client.ServerCertificateValidationCallback = (s, c, h, e) => true;
}
public MailKitMailSender(SecureSocketOptions secureSocketOptions) : this()
{
_secureSocketOptions = secureSocketOptions;
host = ConfigurationManager.AppSettings["MailServer"];
port = Convert.ToInt32(ConfigurationManager.AppSettings["MailPort"]);
from = ConfigurationManager.AppSettings["MailSender"];
username = ConfigurationManager.AppSettings["MailUserName"];
password = ConfigurationManager.AppSettings["MailPassword"];
enablessl = false;
}
public void BuildMessage(List<EmailAddress> toAddressList, string subject, string body, string model)
{
_message = new MimeMessage();
_message.Sender = new MailboxAddress(username, from);
_message.From.Add(new MailboxAddress(username, from));
_message.Subject = subject;
_message.Body = new TextPart(TextFormat.Html) { Text = body };
foreach (var emailAddress in toAddressList)
{
if (model == "BCC")//抄送模式(抄送模式只发送一个邮件,避免大量发重复邮件)
{
_message.Bcc.Add(new MailboxAddress(emailAddress.Name, emailAddress.Address));
}
else
{
_message.To.Add(new MailboxAddress(emailAddress.Name, emailAddress.Address));
}
}
}
public void Send()
{
try
{
_client.Connect(host, port, _secureSocketOptions);
_client.Authenticate(from, password);
_client.Send(_message);
_client.Disconnect(true);
Console.WriteLine("MailKit Send Success:" + _message.To.Mailboxes.First());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
public async Task SendAsync()
{
try
{
await _client.ConnectAsync(host, port, _secureSocketOptions);
await _client.AuthenticateAsync(from, password);
await _client.SendAsync(_message);
await _client.DisconnectAsync(true);
Console.WriteLine("MailKit Send Success:" + _message.To.Mailboxes.First());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
}
} }

2
Common/app.config

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

4
Common/packages.config

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MailKit" version="3.1.0" targetFramework="net452" />
<package id="MimeKit" version="3.1.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" /> <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
<package id="NPOI" version="2.3.0" targetFramework="net452" /> <package id="NPOI" version="2.3.0" targetFramework="net452" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net452" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" /> <package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
<package id="System.Buffers" version="4.5.1" targetFramework="net452" />
</packages> </packages>

124
Controller/SCP_ASK_CONTROLLER.cs

@ -2650,9 +2650,9 @@ namespace CK.SCP.Controller
{ {
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{ {
switch (p_state)
if (p_state == AskState.Close)
{ {
case AskState.Close:
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
if (_ls.Count > 0) if (_ls.Count > 0)
{ {
@ -2688,14 +2688,13 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录,不能关闭!"; _ret.Message = "选择的记录,不能关闭!";
} }
} break;
if (p_state == AskState.Complete) case AskState.Complete:
{ var _ls1 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); int count1 = _ls1.Count(p => p.State == (int)AskState.Ship);
int count = _ls.Count(p => p.State == (int)AskState.Ship); if (count1 == _ls1.Count && _ls1.Count > 0)
if (count == _ls.Count && _ls.Count > 0)
{ {
_ls.ForEach(p => _ls1.ForEach(p =>
{ {
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList(); var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
if (_asnlist.Count > 0) if (_asnlist.Count > 0)
@ -2711,7 +2710,7 @@ namespace CK.SCP.Controller
} }
} }
); );
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls1.ToArray());
} }
else else
{ {
@ -2719,14 +2718,13 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录非已发货状态,不能关闭!"; _ret.Message = "选择的记录非已发货状态,不能关闭!";
} }
} break;
if (p_state == AskState.Confirm) case AskState.Confirm:
{ var _ls2 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); int count2 = _ls2.Count(p => p.State == (int)AskState.Release);
int count = _ls.Count(p => p.State == (int)AskState.Release); if (count2 == _ls2.Count && _ls2.Count > 0)
if (count == _ls.Count && _ls.Count > 0)
{ {
_ls.ForEach(p => _ls2.ForEach(p =>
{ {
p.State = (int)AskState.Confirm; p.State = (int)AskState.Confirm;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
@ -2751,7 +2749,7 @@ namespace CK.SCP.Controller
#endregion #endregion
} }
); );
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls2.ToArray());
} }
else else
{ {
@ -2759,14 +2757,13 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录,有不是发布状态记录!"; _ret.Message = "选择的记录,有不是发布状态记录!";
} }
} break;
if (p_state == AskState.New) case AskState.New:
{ var _ls3 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); int count3 = _ls3.Count(p => p.State == (int)AskState.Release);
int count = _ls.Count(p => p.State == (int)AskState.Release); if (count3 == _ls3.Count && _ls3.Count > 0)
if (count == _ls.Count && _ls.Count > 0)
{ {
_ls.ForEach(p => _ls3.ForEach(p =>
{ {
p.State = (int)AskState.New; p.State = (int)AskState.New;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
@ -2774,7 +2771,7 @@ namespace CK.SCP.Controller
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
} }
); );
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls3.ToArray());
} }
else else
{ {
@ -2782,11 +2779,10 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录,有不是发布状态记录!"; _ret.Message = "选择的记录,有不是发布状态记录!";
} }
} break;
if (p_state == AskState.Release) case AskState.Release:
{ var _ls4 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); foreach (var mail in _ls4)
foreach (var mail in _ls)
{ {
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL(); TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL();
mall.State = 0; mall.State = 0;
@ -2795,10 +2791,10 @@ namespace CK.SCP.Controller
mall.Email = mail.PoBillNum; mall.Email = mail.PoBillNum;
db.TB_SUPPLIER_MAIL.Add(mall); db.TB_SUPPLIER_MAIL.Add(mall);
} }
int count = _ls.Count(p => p.State == (int)AskState.New); int count4 = _ls4.Count(p => p.State == (int)AskState.New);
if (count > 0) if (count4 > 0)
{ {
_ls.ForEach(p => _ls4.ForEach(p =>
{ {
p.State = (int)AskState.Release; p.State = (int)AskState.Release;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
@ -2811,7 +2807,7 @@ namespace CK.SCP.Controller
} }
); );
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls4.ToArray());
} }
else else
{ {
@ -2819,14 +2815,13 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录,有不是新建状态记录!"; _ret.Message = "选择的记录,有不是新建状态记录!";
} }
} break;
if (p_state == AskState.Reject) case AskState.Reject:
{ var _ls5 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); int count5 = _ls5.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); if (count5 == _ls5.Count && _ls5.Count > 0)
if (count == _ls.Count && _ls.Count > 0)
{ {
_ls.ForEach(p => _ls5.ForEach(p =>
{ {
p.State = (int)AskState.Reject; p.State = (int)AskState.Reject;
p.IsDeleted = true; p.IsDeleted = true;
@ -2844,7 +2839,7 @@ namespace CK.SCP.Controller
//#endregion //#endregion
} }
); );
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls5.ToArray());
} }
else else
{ {
@ -2852,15 +2847,13 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; _ret.Message = "选择的记录,有不是新建或发布状态记录!";
} }
break;
} case AskState.CompleteForce:
if (p_state == AskState.CompleteForce) var _ls6 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
{ int count6 = _ls6.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship);
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); if (count6 == _ls6.Count && _ls6.Count > 0)
int count = _ls.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship);
if (count == _ls.Count && _ls.Count > 0)
{ {
_ls.ForEach(p => _ls6.ForEach(p =>
{ {
if (p.State == (int)AskState.Complete) if (p.State == (int)AskState.Complete)
{ {
@ -2906,7 +2899,7 @@ namespace CK.SCP.Controller
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
} }
); );
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls6.ToArray());
} }
else else
{ {
@ -2914,15 +2907,13 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!"; _ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!";
} }
break;
} case AskState.Receive:
if (p_state == AskState.Receive) var _ls7 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
{ int count7 = _ls7.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); if (count7 > 0)
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
if (count > 0)
{ {
_ls.ForEach(p => _ls7.ForEach(p =>
{ {
p.State = (int)AskState.Receive; p.State = (int)AskState.Receive;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
@ -2935,7 +2926,7 @@ namespace CK.SCP.Controller
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
} }
); );
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls7.ToArray());
} }
else else
{ {
@ -2943,12 +2934,10 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; _ret.Message = "选择的记录,有不是新建或发布状态记录!";
} }
break;
} case AskState.NoConfirm:
if (p_state == AskState.NoConfirm) var _ls8 = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
{ if (_ls8.Count == 0)
var _ls = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
if (_ls.Count == 0)
{ {
var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
_askList.ForEach(p => _askList.ForEach(p =>
@ -2971,6 +2960,7 @@ namespace CK.SCP.Controller
_ret.Result = false; _ret.Result = false;
_ret.Message = "选择的记录已经有发货单据不能取消!"; _ret.Message = "选择的记录已经有发货单据不能取消!";
} }
break;
} }
if (string.IsNullOrEmpty(_ret.Message)) if (string.IsNullOrEmpty(_ret.Message))
{ {

83
SCP/Common/MailHelper.cs

@ -10,6 +10,7 @@ using System.Text;
using CK.SCP.Utils; using CK.SCP.Utils;
using System.Configuration; using System.Configuration;
using static CK.SCP.UniApi.Controller.MailController; using static CK.SCP.UniApi.Controller.MailController;
using MailKit.Security;
namespace SCP.Common namespace SCP.Common
{ {
@ -59,6 +60,7 @@ namespace SCP.Common
{ {
mails = mails.Substring(0, mails.Length - 1); mails = mails.Substring(0, mails.Length - 1);
} }
string mailbody = ""; string mailbody = "";
mailbody += "尊敬的供应商<br>"; mailbody += "尊敬的供应商<br>";
mailbody += "你好!<br><br>"; mailbody += "你好!<br><br>";
@ -295,5 +297,86 @@ namespace SCP.Common
} }
} }
public static void ASKSendMail(string p_VendId, string p_Content, string p_title, string p_site)
{
try
{
List<String> result = new List<String>();
using (AppBoxContext db = EntitiesFactory.CreateAppBoxInstance())
{
StringBuilder _buffer = new StringBuilder();
_buffer.Append("SELECT b.Email ");
_buffer.Append(" FROM VenderUsers AS a INNER JOIN ");
_buffer.Append(" Users AS b ON a.UserId = b.ID INNER JOIN ");
_buffer.Append(" FactoryUsers AS c ON a.UserId = c.UserID INNER JOIN ");
_buffer.Append(" TA_FACTORY AS d ON c.FACTORY_ID = d.ID INNER JOIN ");
_buffer.Append(" Users AS f ON c.UserID = f.ID INNER JOIN ");
_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);
}
}
}
}
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)
{
EmailAddress add = new EmailAddress(em1, em1);
toList.Add(add);
}
var smtpMailSender = new MailKitMailSender(SecureSocketOptions.StartTls);
smtpMailSender.BuildMessage(
toList,
p_title,
mailbody,
"BCC"
);
smtpMailSender.Send();
LogHelper.Writlog(LogHelper.LogType.Debug, typeof(MailManager), "ASKSendMail", "发送成功");
}
catch (Exception e)
{
LogHelper.Writlog(LogHelper.LogType.Error, typeof(MailManager), "ASKSendMail", e.Message);
throw e;
}
}
} }
} }

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

@ -253,6 +253,8 @@ namespace SCP.PlanData
{ {
var _ask = Session["Ask"] as V_TB_ASK; var _ask = Session["Ask"] as V_TB_ASK;
var ret = SCP_ASK_CONTROLLER.Save_TB_ASK_STATE(new List<string>() { _ask.AskBillNum }, p_state); var ret = SCP_ASK_CONTROLLER.Save_TB_ASK_STATE(new List<string>() { _ask.AskBillNum }, p_state);
try
{
if (ret.State == ReturnStatus.Succeed) if (ret.State == ReturnStatus.Succeed)
{ {
switch (p_state) switch (p_state)
@ -262,8 +264,9 @@ namespace SCP.PlanData
{ {
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0) if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
{ {
SCP.Common.MailManager.SendMail(_ask.VendId, string.Format("发布了新的要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault()); SCP.Common.MailManager.ASKSendMail(_ask.VendId, string.Format("发布了新的要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
//SCP.Common.MailManager.GetPoMailList(); //SCP.Common.MailManager.GetPoMailList();
} }
} }
Alert.Show(p_msg); Alert.Show(p_msg);
@ -309,6 +312,12 @@ namespace SCP.PlanData
Alert.Show(ret.Message); Alert.Show(ret.Message);
} }
} }
catch(Exception ex)
{
Alert.Show(ex.Message);
}
}
} }
protected void Grid_V_TB_ASK_DETAIL_PageIndexChange(object sender, GridPageEventArgs e) protected void Grid_V_TB_ASK_DETAIL_PageIndexChange(object sender, GridPageEventArgs e)

24
SCP/Web.config

@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问 有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=169433 https://go.microsoft.com/fwlink/?LinkId=169433
@ -10,25 +10,19 @@
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections> </configSections>
<appSettings> <appSettings>
<add key="MailSender" value="wuliu@faway.com"/> <!--<add key="MailSender" value="3264161989@qq.com"/>
<add key="MailServer" value="smtp.partner.outlook.cn"/> <add key="MailServer" value="smtp.qq.com"/>
<add key="MailUserName" value="wuliu@faway.com"/> <add key="MailUserName" value="3264161989@qq.com"/>
<add key="MailPassword" value="BTL1234@12aa"/> <add key="MailPassword" value="bsvdsyyhsonjchgh"/>
<add key="MailPort" value="587"/> <add key="MailPort" value="587"/>
<add key="ResetPassWord" value="http://123.150.38.30:8091"/> <add key="ResetPassWord" value="localhost:5678" />-->
<!--<add key="MailSender" value="scp@fs-cockpit.com"/>
<add key="MailServer" value="smtp.partner.outlook.cn"/>
<add key="MailUserName" value="scp@fs-cockpit.com"/>
<add key="MailPassword" value="Law73743"/>
<add key="MailPort" value="587"/>
<add key="ResetPassWord" value="http://192.168.0.101:8081" />-->
<!--发邮件配置开始--> <!--发邮件配置开始-->
<!--<add key="MailSender" value="qcjscp@fawayqcj.com"/> <add key="MailSender" value="qcjscp@fawayqcj.com" />
<add key="MailServer" value="smtp.exmail.qq.com" /> <add key="MailServer" value="smtp.exmail.qq.com" />
<add key="MailUserName" value="qcjscp@fawayqcj.com" /> <add key="MailUserName" value="qcjscp@fawayqcj.com" />
<add key="MailPassword" value="ZdmcwmoUP66MKkQ2" /> <add key="MailPassword" value="ZdmcwmoUP66MKkQ2" />
<add key="MailPort" value="25" /> <add key="MailPort" value="25" />
<add key="ResetPassWord" value="localhost:5678" />--> <add key="ResetPassWord" value="localhost:5678" />
<!--<add key="MailSender" value="scp@jinhengairbag.com" /> <!--<add key="MailSender" value="scp@jinhengairbag.com" />
<add key="MailServer" value="smtp.qiye.aliyun.com" /> <add key="MailServer" value="smtp.qiye.aliyun.com" />
<add key="MailUserName" value="scp@jinhengairbag.com" /> <add key="MailUserName" value="scp@jinhengairbag.com" />
@ -88,7 +82,7 @@
<httpRuntime executionTimeout="120" maxRequestLength="204800" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="false" /> <httpRuntime executionTimeout="120" maxRequestLength="204800" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="false" />
<customErrors mode="Off" /> <customErrors mode="Off" />
<authentication mode="Forms"> <authentication mode="Forms">
<forms name=".APPBOX_FORMS_AUTH" loginUrl="~/default.aspx" timeout="3" defaultUrl="~/main.aspx" protection="All" path="/"/> <forms name=".APPBOX_FORMS_AUTH" loginUrl="~/default_CYJ.aspx" timeout="3" defaultUrl="~/main.aspx" protection="All" path="/" />
</authentication> </authentication>
<authorization> <authorization>
<deny users="?" /> <deny users="?" />

4
SCP/packages.config

@ -13,6 +13,7 @@
<package id="FineUI" version="6.0.1" targetFramework="net452" /> <package id="FineUI" version="6.0.1" targetFramework="net452" />
<package id="jQuery" version="1.10.2" targetFramework="net452" /> <package id="jQuery" version="1.10.2" targetFramework="net452" />
<package id="knockoutjs" version="3.4.2" targetFramework="net452" /> <package id="knockoutjs" version="3.4.2" targetFramework="net452" />
<package id="MailKit" version="3.1.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" /> <package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" /> <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" /> <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" />
@ -32,9 +33,12 @@
<package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net452" developmentDependency="true" /> <package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" version="1.10.9" targetFramework="net452" /> <package id="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" version="1.10.9" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="MimeKit" version="3.1.0" targetFramework="net452" />
<package id="Modernizr" version="2.6.2" targetFramework="net452" /> <package id="Modernizr" version="2.6.2" targetFramework="net452" />
<package id="NPOI" version="2.3.0" targetFramework="net452" /> <package id="NPOI" version="2.3.0" targetFramework="net452" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net452" />
<package id="Respond" version="1.2.0" targetFramework="net452" /> <package id="Respond" version="1.2.0" targetFramework="net452" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" /> <package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
<package id="System.Buffers" version="4.5.1" targetFramework="net452" />
<package id="WebGrease" version="1.5.2" targetFramework="net452" /> <package id="WebGrease" version="1.5.2" targetFramework="net452" />
</packages> </packages>

2
UniApiGroup/App.config

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>

Loading…
Cancel
Save