diff --git a/Common/CK.SCP.Common.csproj b/Common/CK.SCP.Common.csproj
index add89b3..a1202e9 100644
--- a/Common/CK.SCP.Common.csproj
+++ b/Common/CK.SCP.Common.csproj
@@ -31,6 +31,9 @@
4
+
+ ..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll
+
..\DLL\DevComponents.DotNetBar.Layout.dll
@@ -40,6 +43,12 @@
..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll
+
+ ..\packages\MailKit.3.1.0\lib\net452\MailKit.dll
+
+
+ ..\packages\MimeKit.3.1.0\lib\net452\MimeKit.dll
+
..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
@@ -56,10 +65,14 @@
..\packages\NPOI.2.3.0\lib\net40\NPOI.OpenXmlFormats.dll
+
+ ..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll
+
+
diff --git a/Common/MyWebSmtpMail.cs b/Common/MyWebSmtpMail.cs
index 6b40df6..b04f877 100644
--- a/Common/MyWebSmtpMail.cs
+++ b/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.Configuration;
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 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();
+
+ }
+
+ }
+
+ }
+
}
diff --git a/Common/app.config b/Common/app.config
index 5573142..8049e1c 100644
--- a/Common/app.config
+++ b/Common/app.config
@@ -1,11 +1,11 @@
-
+
-
-
+
+
-
+
diff --git a/Common/packages.config b/Common/packages.config
index 8e2e973..bbed58f 100644
--- a/Common/packages.config
+++ b/Common/packages.config
@@ -1,6 +1,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/Controller/SCP_ASK_CONTROLLER.cs b/Controller/SCP_ASK_CONTROLLER.cs
index 29e9894..5438978 100644
--- a/Controller/SCP_ASK_CONTROLLER.cs
+++ b/Controller/SCP_ASK_CONTROLLER.cs
@@ -169,21 +169,21 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
- return db.TA_ASK_SUBPART.Where(p=>p.AskBillNum==ASK&&string.IsNullOrEmpty(p.VendBatch)).ToList();
+ return db.TA_ASK_SUBPART.Where(p => p.AskBillNum == ASK && string.IsNullOrEmpty(p.VendBatch)).ToList();
}
}
- public static ResultObject Update_User_ErrorCount(string p_userName,int count )
+ public static ResultObject Update_User_ErrorCount(string p_userName, int count)
{
ResultObject _ret = new ResultObject();
try
{
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
{
- var user = _appdb.Users.FirstOrDefault(p => p.Name == p_userName);
+ var user = _appdb.Users.FirstOrDefault(p => p.Name == p_userName);
if (user != null)
{
user.ErrorCount = user.ErrorCount + 1;
- if(user.ErrorCount== count)
+ if (user.ErrorCount == count)
{
user.Enabled = false;
_ret.Message = $"密码错误超过【{count}】次,账号已锁定请联系管理员";
@@ -191,7 +191,7 @@ namespace CK.SCP.Controller
else
{
_ret.Message = $"密码错误,再输入错【{count - user.ErrorCount}】次后账户将锁定!";
- }
+ }
}
int state = _appdb.SaveChanges();
if (state != -1)
@@ -367,7 +367,7 @@ namespace CK.SCP.Controller
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
- {
+ {
var askdetail = db.TB_ASK_DETAIL.Where(p => p.AskBillNum == ask).ToList();
var subcount = db.TA_ASK_SUBPART.Count(p => p.AskBillNum == ask);
if (subcount == 0)
@@ -377,19 +377,19 @@ namespace CK.SCP.Controller
var sub = db.TA_SubPartCode.Where(p => p.PartCode == ak.PartCode).ToList();
if (sub.Count() > 0)
{
- foreach(var su in sub)
+ foreach (var su in sub)
{
TA_ASK_SUBPART subpart = new TA_ASK_SUBPART();
subpart.PartCode = su.PartCode;
subpart.SubPartCode = su.SubPartCode;
subpart.BOMedtiton = su.BOMedtiton;
subpart.AskBillNum = ask;
- subpart.Qty = su.Qty;
+ subpart.Qty = su.Qty;
db.TA_ASK_SUBPART.AddOrUpdate(subpart);
db.TA_SubPartCode.Remove(su);
}
}
-
+
}
}
@@ -521,7 +521,7 @@ namespace CK.SCP.Controller
_entity.TA_FACTORY.Add(f);
_appdb.Users.Add(_entity);
_appdb.SaveChanges();
-
+
}
}
@@ -918,7 +918,7 @@ namespace CK.SCP.Controller
throw e;
}
}
-
+
public static List RejectQty_SUM(List p_list)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
@@ -1236,7 +1236,7 @@ namespace CK.SCP.Controller
throw e;
}
return _ret;
- }
+ }
public static ResultObject Save_TB_ASK_DETAIL(List p_entitys, AskState p_state)
{
ResultObject _ret = new ResultObject();
@@ -1358,10 +1358,10 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
-
- var ret= db.TB_ASK.Where(p => p.AskBillNum == p_entitys.AskBillNum).FirstOrDefault();
+
+ var ret = db.TB_ASK.Where(p => p.AskBillNum == p_entitys.AskBillNum).FirstOrDefault();
ret.Extend1 = p_entitys.Extend1;
-
+
db.TB_ASK.AddOrUpdate(ret);
if (db.SaveChanges() != -1)
{
@@ -1374,7 +1374,7 @@ namespace CK.SCP.Controller
_ret.Result = false;
}
}
- }
+ }
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
@@ -1425,13 +1425,13 @@ namespace CK.SCP.Controller
}
return _ret;
}
-
- ///
- ///
- ///
- ///
- ///
- public static ResultObject Save_TB_PO(List p_entitys)
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static ResultObject Save_TB_PO(List p_entitys)
{
ResultObject _ret = new ResultObject();
try
@@ -1685,14 +1685,14 @@ namespace CK.SCP.Controller
{
_tDetail.VendBatch = itm.VendBatch;
}
- var subpart = db.TA_ASK_SUBPART.Where(p=>p.PartCode== itm.PartCode&&p.AskBillNum==itm.AskBillNum).ToList();
+ var subpart = db.TA_ASK_SUBPART.Where(p => p.PartCode == itm.PartCode && p.AskBillNum == itm.AskBillNum).ToList();
string str1 = "";
string str2 = "";
- foreach(var sub in subpart)
+ foreach (var sub in subpart)
{
- string str = sub.SubPartCode + "," + sub.BOMedtiton + "," + sub.VendBatch + "#";
+ string str = sub.SubPartCode + "," + sub.BOMedtiton + "," + sub.VendBatch + "#";
str2 = str2 + sub.VendBatch;
- str1 = str1 + str;
+ str1 = str1 + str;
}
_tDetail.VendBatch = str1;
_tDetail.UpdateUser = str2;
@@ -1736,17 +1736,17 @@ namespace CK.SCP.Controller
uni.Batch = _tDetail.Batch;
uni.Qty = _tDetail.Qty;
uni.State = 2;
- uni.CreateOper=_t.CreateUser;
+ uni.CreateOper = _t.CreateUser;
uni.CreateTime = DateTime.Now;
- uni.PutTime= DateTime.Now;
+ uni.PutTime = DateTime.Now;
uni.VendId = _t.VendId;
uni.PoUnit = _tDetail.PoUnit;
uni.LocUnit = _tDetail.PoUnit;
- uni.ValidDate= DateTime.Now;
+ uni.ValidDate = DateTime.Now;
uni.ErpBillNum = _tDetail.PoBillNum;
uni.ErpLineNum = _tDetail.PoLine;
uni.VendBatch = sub.VendBatch;
- uni.PackQty= _tDetail.Qty;
+ uni.PackQty = _tDetail.Qty;
uni.Price = _tDetail.Price;
uni.UmConv = 1;
uni.Buyer = _t.ShipUser;
@@ -1852,7 +1852,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
- var po = db.TB_PO.FirstOrDefault(p=>p.PoBillNum==p_ask.PoBillNum);
+ var po = db.TB_PO.FirstOrDefault(p => p.PoBillNum == p_ask.PoBillNum);
TB_ASN _t = new TB_ASN();
_t.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode();
_t.AskBillNum = p_ask.AskBillNum;
@@ -1883,7 +1883,7 @@ namespace CK.SCP.Controller
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
_t.Extend3 = partgroup.PartGroup;
}
- db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t);
+ db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t);
List _list = new List();
foreach (var itm in p_order_list)
{
@@ -1893,21 +1893,21 @@ namespace CK.SCP.Controller
_tDetail.PoLine = itm.PoLine;
_tDetail.PoUnit = itm.PoUnit;
_tDetail.Batch = itm.Batch;
- if (itm.VendBatch=="55")
- {
+ if (itm.VendBatch == "55")
+ {
_tDetail.VendBatch = "";
}
else
{
_tDetail.VendBatch = itm.VendBatch;
}
-
- if (_t.PoBillNum.Substring(0, 5) == "CYD03"&&_t.Site=="W21")
+
+ if (_t.PoBillNum.Substring(0, 5) == "CYD03" && _t.Site == "W21")
{
- var podetail = db.TB_PO_DETAIL.FirstOrDefault(t=>t.PoBillNum==_t.PoBillNum&&t.PartCode==itm.PartCode&&t.PoLine==itm.PoLine);
+ var podetail = db.TB_PO_DETAIL.FirstOrDefault(t => t.PoBillNum == _t.PoBillNum && t.PartCode == itm.PartCode && t.PoLine == itm.PoLine);
_tDetail.VendBatch = podetail.SubSite + "," + podetail.Extend3 + "," + itm.VendBatch + "#";
}
- _tDetail.UpdateUser= itm.VendBatch;
+ _tDetail.UpdateUser = itm.VendBatch;
_tDetail.PackQty = itm.PackQty == 0 ? 1 : itm.PackQty;
_tDetail.PartCode = itm.PartCode;
_tDetail.State = (int)AsnState.New;
@@ -1925,21 +1925,21 @@ namespace CK.SCP.Controller
_tDetail.UpdateInfo = itm.UpdateInfo;
_tDetail.ReceivedPort = itm.ReceivedPort;
_tDetail.GUID = Guid.NewGuid();
- _tDetail.SubSite = itm.SubSite;
+ _tDetail.SubSite = itm.SubSite;
_tDetail.Site = itm.Site;
_tDetail.Extend2 = itm.ReceivedQty.ToString();
- _tDetail.Remark= itm.ReceivedQty.ToString();
+ _tDetail.Remark = itm.ReceivedQty.ToString();
_tDetail.UpdateInfo = itm.UpdateInfo;
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
- var askdetail=db.TB_ASK_DETAIL.Where(p => p.PartCode == itm.PartCode&&p.AskBillNum==itm.AskBillNum).FirstOrDefault();
+ var askdetail = db.TB_ASK_DETAIL.Where(p => p.PartCode == itm.PartCode && p.AskBillNum == itm.AskBillNum).FirstOrDefault();
_tDetail.Extend3 = partgroup.PartGroup;
- _tDetail.Extend1 =po.VendId;
+ _tDetail.Extend1 = po.VendId;
if (itm.Site == "U32")
{
- var _applin = db.TA_Appliance.FirstOrDefault(p=>p.PartNumber==itm.SubSite&&p.VendID==p_ask.VendId);
+ var _applin = db.TA_Appliance.FirstOrDefault(p => p.PartNumber == itm.SubSite && p.VendID == p_ask.VendId);
if (_applin != null)
{
- var _boxtype = db.TA_BOXTYPE.FirstOrDefault(p=>p.BoxType==_applin.BoxType&&p.Enabled==true);
+ var _boxtype = db.TA_BOXTYPE.FirstOrDefault(p => p.BoxType == _applin.BoxType && p.Enabled == true);
if (_boxtype != null)
{
TB_ASN_PARTBOX PARTBOX = new TB_ASN_PARTBOX();
@@ -1947,14 +1947,14 @@ namespace CK.SCP.Controller
PARTBOX.PartCode = itm.PartCode;
PARTBOX.BoxType = _boxtype.BoxType;
PARTBOX.Box = Convert.ToInt32(_tDetail.Qty) / Convert.ToInt32(_tDetail.PackQty);
- if(Convert.ToInt32(_tDetail.Qty) % Convert.ToInt32(_tDetail.PackQty) > 0)
+ if (Convert.ToInt32(_tDetail.Qty) % Convert.ToInt32(_tDetail.PackQty) > 0)
{
PARTBOX.Box = PARTBOX.Box + 1;
}
PARTBOX.SumBox = PARTBOX.Box;
PARTBOX.PoBillNum = _t.PoBillNum;
PARTBOX.VendId = _t.VendId;
- PARTBOX.ShipTime =DateTime.Parse(_t.ShipTime.ToString()).ToShortDateString();
+ PARTBOX.ShipTime = DateTime.Parse(_t.ShipTime.ToString()).ToShortDateString();
PARTBOX.Batch = _tDetail.Batch;
PARTBOX.PoLine = _tDetail.PoLine;
PARTBOX.PackQty = _tDetail.PackQty;
@@ -1966,15 +1966,15 @@ namespace CK.SCP.Controller
var ModelList = db.TA_CarModel.ToList();
foreach (var model in ModelList)
{
- if(model.Model.Length<=askdetail.Extend2.Length)
- {
+ if (model.Model.Length <= askdetail.Extend2.Length)
+ {
if (askdetail.Extend2.Contains(model.Model))
{
- _tDetail.Extend1 = "FT";
- break;
- }
- }
+ _tDetail.Extend1 = "FT";
+ break;
+ }
+ }
_tDetail.Extend1 = "PT";
}
@@ -1991,16 +1991,16 @@ namespace CK.SCP.Controller
{
_tDetail.Extend1 = "PT";
}
-
+
}
db.TB_ASN_DETAIL.Add(_tDetail);
var _order_detail = db.TB_ASK_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault();
_order_detail.ShippedQty = (decimal)itm.ShippedQty;
-
-
+
+
db.TB_ASK_DETAIL.AddOrUpdate(p => p.UID, _order_detail);
-
+
}
int state = db.SaveChanges();
if (state != -1)
@@ -2086,7 +2086,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
- var _ls = p_list.Select(p => p.AskBillNum);
+ var _ls = p_list.Select(p => p.AskBillNum);
StringBuilder _buffer = new StringBuilder();
_buffer.Append(" select distinct (C.AskBillNum)from V_TB_ASK_DETAIL C");
_buffer.Append(" left JOIN ");
@@ -2111,21 +2111,21 @@ namespace CK.SCP.Controller
return p_list;
}
- public static List GET_IS_COMPLETED_SEND1(List p_list,string lz)
+ public static List GET_IS_COMPLETED_SEND1(List p_list, string lz)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List lt = new List();
var _ls = p_list.Select(p => p.AskBillNum);
StringBuilder _buffer = new StringBuilder();
- _buffer.Append(" select AskBillNum from V_TB_ASK_DETAIL ");
- _buffer.Append($" WHERE Currency like '%{lz}%'");
+ _buffer.Append(" select AskBillNum from V_TB_ASK_DETAIL ");
+ _buffer.Append($" WHERE Currency like '%{lz}%'");
var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray()));
var _list = db.Database.SqlQuery(_str).ToList();
- var ll= p_list.Where(p => _list.Contains(p.AskBillNum)).ToList();
+ var ll = p_list.Where(p => _list.Contains(p.AskBillNum)).ToList();
return ll;
}
-
+
}
public static List GET_IS_COMPLETED_SEND2(List p_list, string lz)
{
@@ -2211,8 +2211,8 @@ namespace CK.SCP.Controller
p_list.ForEach(itm =>
{
- var maxtime = db.TB_ASN_DETAIL.Where(p=>p.PartCode==itm.PartCode&&p.State>-1).Select(t=>t.ProduceDate).Max();
-
+ var maxtime = db.TB_ASN_DETAIL.Where(p => p.PartCode == itm.PartCode && p.State > -1).Select(t => t.ProduceDate).Max();
+
itm.MaxTime = maxtime.ToString();
groupList.ForEach(p =>
{
@@ -2400,7 +2400,7 @@ namespace CK.SCP.Controller
}
}
-
+
public static void Get_V_TB_ASK_DETAIL_Sum(V_TB_ASK_DETAIL p_entity, Action>> p_action)
{
@@ -2650,327 +2650,317 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
-
- if (p_state == AskState.Close)
+ switch (p_state)
{
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
- if (_ls.Count > 0)
- {
- _ls.ForEach(p =>
+ case AskState.Close:
+ var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
+ if (_ls.Count > 0)
{
- var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
- if (_asnlist.Count > 0)
+ _ls.ForEach(p =>
{
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
-
+ var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
+ if (_asnlist.Count > 0)
+ {
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
+
+ }
+ else
+ {
+ p.State = (int)AskState.Close;
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm => itm.State = (int)AskState.Close);
+ db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
+
+
+ }
}
- else
- {
- p.State = (int)AskState.Close;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm => itm.State = (int)AskState.Close);
- db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
-
-
+ );
+ if (_ret.MessageList.Count == 0)
+ {
+ db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
}
- );
- if (_ret.MessageList.Count == 0)
+ else
{
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录,不能关闭!";
}
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录,不能关闭!";
- }
- }
- if (p_state == AskState.Complete)
- {
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
- int count = _ls.Count(p => p.State == (int)AskState.Ship);
- if (count == _ls.Count && _ls.Count > 0)
- {
- _ls.ForEach(p =>
+ break;
+ case AskState.Complete:
+ var _ls1 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
+ int count1 = _ls1.Count(p => p.State == (int)AskState.Ship);
+ if (count1 == _ls1.Count && _ls1.Count > 0)
{
- var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
- if (_asnlist.Count > 0)
+ _ls1.ForEach(p =>
{
- _ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
- }
- else
- {
- p.State = (int)AskState.Complete;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm => itm.State = (int)AskState.Complete);
- db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
+ var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
+ if (_asnlist.Count > 0)
+ {
+ _ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
+ }
+ else
+ {
+ p.State = (int)AskState.Complete;
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm => itm.State = (int)AskState.Complete);
+ db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
+ }
}
+ );
+ db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls1.ToArray());
}
- );
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录非已发货状态,不能关闭!";
- }
- }
- if (p_state == AskState.Confirm)
- {
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
- int count = _ls.Count(p => p.State == (int)AskState.Release);
- if (count == _ls.Count && _ls.Count > 0)
- {
- _ls.ForEach(p =>
+ else
{
- p.State = (int)AskState.Confirm;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm =>
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录非已发货状态,不能关闭!";
+ }
+ break;
+ case AskState.Confirm:
+ var _ls2 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
+ int count2 = _ls2.Count(p => p.State == (int)AskState.Release);
+ if (count2 == _ls2.Count && _ls2.Count > 0)
+ {
+ _ls2.ForEach(p =>
{
+ p.State = (int)AskState.Confirm;
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm =>
+ {
- itm.State = (int)AskState.Confirm;
+ itm.State = (int)AskState.Confirm;
- itm.UpdateTime = DateTime.Now;
- }
+ itm.UpdateTime = DateTime.Now;
+ }
+ );
+ db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
+ #region 供应商确认要货状态完成
+ //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
+ //_pendingList.ForEach(itm => {
+ // itm.ITEM_STATE = (int)PENDING_STATE.COMPLETED;
+ // itm.ITEM_CONTENT = "要货看板已完成!";
+ //}
+ //);
+ //db.TB_PENING_ITEMS.AddOrUpdate(itm => itm.GUID, _pendingList.ToArray());
+ #endregion
+ }
);
- db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
- #region 供应商确认要货状态完成
- //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
- //_pendingList.ForEach(itm => {
- // itm.ITEM_STATE = (int)PENDING_STATE.COMPLETED;
- // itm.ITEM_CONTENT = "要货看板已完成!";
- //}
- //);
- //db.TB_PENING_ITEMS.AddOrUpdate(itm => itm.GUID, _pendingList.ToArray());
- #endregion
+ db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls2.ToArray());
}
- );
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录,有不是发布状态记录!";
- }
- }
- if (p_state == AskState.New)
- {
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
- int count = _ls.Count(p => p.State == (int)AskState.Release);
- if (count == _ls.Count && _ls.Count > 0)
- {
- _ls.ForEach(p =>
+ else
{
- p.State = (int)AskState.New;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm => itm.State = (int)AskState.New);
- db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录,有不是发布状态记录!";
}
- );
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录,有不是发布状态记录!";
- }
- }
- if (p_state == AskState.Release)
- {
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
- foreach (var mail in _ls)
- {
- TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL();
- mall.State = 0;
- mall.SupplicerCode = mail.VendId;
- mall.MailBody = "有新的要货订单" + mail.AskBillNum;
- mall.Email = mail.PoBillNum;
- db.TB_SUPPLIER_MAIL.Add(mall);
- }
- int count = _ls.Count(p => p.State == (int)AskState.New);
- if (count > 0)
- {
- _ls.ForEach(p =>
+ break;
+ case AskState.New:
+ var _ls3 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
+ int count3 = _ls3.Count(p => p.State == (int)AskState.Release);
+ if (count3 == _ls3.Count && _ls3.Count > 0)
{
- p.State = (int)AskState.Release;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm =>
+ _ls3.ForEach(p =>
{
- itm.State = (int)AskState.Release;
+ p.State = (int)AskState.New;
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm => itm.State = (int)AskState.New);
+ 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, _ls3.ToArray());
}
- );
-
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录,有不是新建状态记录!";
- }
- }
- if (p_state == AskState.Reject)
- {
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
- int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
- if (count == _ls.Count && _ls.Count > 0)
- {
- _ls.ForEach(p =>
+ else
{
- p.State = (int)AskState.Reject;
- p.IsDeleted = true;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm =>
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录,有不是发布状态记录!";
+ }
+ break;
+ case AskState.Release:
+ 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();
+ mall.State = 0;
+ mall.SupplicerCode = mail.VendId;
+ mall.MailBody = "有新的要货订单" + mail.AskBillNum;
+ mall.Email = mail.PoBillNum;
+ db.TB_SUPPLIER_MAIL.Add(mall);
+ }
+ int count4 = _ls4.Count(p => p.State == (int)AskState.New);
+ if (count4 > 0)
+ {
+ _ls4.ForEach(p =>
{
- itm.State = (int)AskState.Reject;
- itm.IsDeleted = true;
+ p.State = (int)AskState.Release;
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm =>
+ {
+ itm.State = (int)AskState.Release;
+ }
+ );
+ db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
);
- db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
- //#region 供应商要货代办作废
- //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
- //db.TB_PENING_ITEMS.RemoveRange(_pendingList);
- //#endregion
- }
- );
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录,有不是新建或发布状态记录!";
- }
- }
- if (p_state == AskState.CompleteForce)
- {
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
- 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 =>
+ db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls4.ToArray());
+ }
+ else
{
- if (p.State == (int)AskState.Complete)
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录,有不是新建状态记录!";
+ }
+ break;
+ case AskState.Reject:
+ var _ls5 = 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);
+ if (count5 == _ls5.Count && _ls5.Count > 0)
+ {
+ _ls5.ForEach(p =>
{
p.State = (int)AskState.Reject;
p.IsDeleted = true;
- }
- // p.State = (int)AskState.CompleteForce;
- #region 修改发货单
- var _asnList = db.TB_ASN.Where(itm => itm.IsDeleted == false && itm.AskBillNum == p.AskBillNum && itm.State == 0).ToList();
- _asnList.ForEach(itm =>
- {
- itm.State = (int)AsnState.Reject;
- itm.IsDeleted = true;
- var _asnDetailList = db.TB_ASN_DETAIL.Where(asn => asn.IsDeleted == false && asn.AsnBillNum == itm.AsnBillNum).ToList();
- _asnDetailList.ForEach(ad =>
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm =>
{
- itm.State = (int)AsnState.Reject;
- ad.IsDeleted = true;
+ itm.State = (int)AskState.Reject;
+ itm.IsDeleted = true;
}
);
- db.TB_ASN_DETAIL.AddOrUpdate(asndetail => asndetail.UID, _asnDetailList.ToArray());
- });
- db.TB_ASN.AddOrUpdate(_asnList.ToArray());
- #endregion
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum && itm.IsDeleted == false).ToList();
- _list.ForEach(itm =>
+ db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
+ //#region 供应商要货代办作废
+ //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
+ //db.TB_PENING_ITEMS.RemoveRange(_pendingList);
+ //#endregion
+ }
+ );
+ db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls5.ToArray());
+ }
+ else
+ {
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录,有不是新建或发布状态记录!";
+ }
+ break;
+ case 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);
+ if (count6 == _ls6.Count && _ls6.Count > 0)
+ {
+ _ls6.ForEach(p =>
{
- itm.AskQty = 0;
- var asn = db.V_TB_ASN_DETAIL.Where(ask => ask.AskBillNum == itm.AskBillNum && ask.IsDeleted == false && (ask.State == (int)AsnState.Ship || ask.State == (int)AsnState.Receive))
- .GroupBy(ask => new { ask.AskBillNum, ask.PoLine, ask.PartCode })
- .Select(ask => new { AsSum = ask.Sum(itm1 => itm1.Qty), PoLine = ask.Key.PoLine, AskBillNum = ask.Key.AskBillNum, PartCode = ask.Key.PartCode }).ToList();
-
- asn.ForEach(itm1 =>
+ if (p.State == (int)AskState.Complete)
{
- if (itm1.AskBillNum == itm.AskBillNum && itm1.PoLine == itm.PoLine && itm1.PartCode == itm.PartCode)
+ p.State = (int)AskState.Reject;
+ p.IsDeleted = true;
+ }
+ // p.State = (int)AskState.CompleteForce;
+ #region 修改发货单
+ var _asnList = db.TB_ASN.Where(itm => itm.IsDeleted == false && itm.AskBillNum == p.AskBillNum && itm.State == 0).ToList();
+ _asnList.ForEach(itm =>
+ {
+ itm.State = (int)AsnState.Reject;
+ itm.IsDeleted = true;
+ var _asnDetailList = db.TB_ASN_DETAIL.Where(asn => asn.IsDeleted == false && asn.AsnBillNum == itm.AsnBillNum).ToList();
+ _asnDetailList.ForEach(ad =>
{
- itm.AskQty = itm1.AsSum;
+ itm.State = (int)AsnState.Reject;
+ ad.IsDeleted = true;
}
+ );
+ db.TB_ASN_DETAIL.AddOrUpdate(asndetail => asndetail.UID, _asnDetailList.ToArray());
});
- //itm.State = (int)AskState.CompleteForce;
+ db.TB_ASN.AddOrUpdate(_asnList.ToArray());
+ #endregion
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum && itm.IsDeleted == false).ToList();
+ _list.ForEach(itm =>
+ {
+ itm.AskQty = 0;
+ var asn = db.V_TB_ASN_DETAIL.Where(ask => ask.AskBillNum == itm.AskBillNum && ask.IsDeleted == false && (ask.State == (int)AsnState.Ship || ask.State == (int)AsnState.Receive))
+ .GroupBy(ask => new { ask.AskBillNum, ask.PoLine, ask.PartCode })
+ .Select(ask => new { AsSum = ask.Sum(itm1 => itm1.Qty), PoLine = ask.Key.PoLine, AskBillNum = ask.Key.AskBillNum, PartCode = ask.Key.PartCode }).ToList();
+
+ asn.ForEach(itm1 =>
+ {
+ if (itm1.AskBillNum == itm.AskBillNum && itm1.PoLine == itm.PoLine && itm1.PartCode == itm.PartCode)
+ {
+ itm.AskQty = itm1.AsSum;
+ }
+ });
+ //itm.State = (int)AskState.CompleteForce;
+ }
+ );
+ 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, _ls6.ToArray());
}
- );
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!";
- }
-
- }
- if (p_state == AskState.Receive)
- {
- var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
- int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
- if (count > 0)
- {
- _ls.ForEach(p =>
+ else
{
- p.State = (int)AskState.Receive;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm =>
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!";
+ }
+ break;
+ case 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);
+ if (count7 > 0)
+ {
+ _ls7.ForEach(p =>
{
- itm.State = (int)AskState.Receive;
+ p.State = (int)AskState.Receive;
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm =>
+ {
+ itm.State = (int)AskState.Receive;
+ }
+ );
+ 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, _ls7.ToArray());
}
- );
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录,有不是新建或发布状态记录!";
- }
-
- }
- if (p_state == AskState.NoConfirm)
- {
- 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();
- _askList.ForEach(p =>
+ else
{
- p.State = (int)AskState.Release;
- var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
- _list.ForEach(itm =>
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录,有不是新建或发布状态记录!";
+ }
+ break;
+ case AskState.NoConfirm:
+ var _ls8 = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
+ if (_ls8.Count == 0)
+ {
+ var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
+ _askList.ForEach(p =>
{
- itm.State = (int)AskState.Release;
+ p.State = (int)AskState.Release;
+ var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
+ _list.ForEach(itm =>
+ {
+ itm.State = (int)AskState.Release;
+ }
+ );
+ 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, _askList.ToArray());
}
- );
- db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _askList.ToArray());
- }
- else
- {
- _ret.State = ReturnStatus.Failed;
- _ret.Result = false;
- _ret.Message = "选择的记录已经有发货单据不能取消!";
- }
+ else
+ {
+ _ret.State = ReturnStatus.Failed;
+ _ret.Result = false;
+ _ret.Message = "选择的记录已经有发货单据不能取消!";
+ }
+ break;
}
if (string.IsNullOrEmpty(_ret.Message))
{
diff --git a/SCP/Common/MailHelper.cs b/SCP/Common/MailHelper.cs
index a8cd960..c10e817 100644
--- a/SCP/Common/MailHelper.cs
+++ b/SCP/Common/MailHelper.cs
@@ -10,6 +10,7 @@ using System.Text;
using CK.SCP.Utils;
using System.Configuration;
using static CK.SCP.UniApi.Controller.MailController;
+using MailKit.Security;
namespace SCP.Common
{
@@ -59,6 +60,7 @@ namespace SCP.Common
{
mails = mails.Substring(0, mails.Length - 1);
}
+
string mailbody = "";
mailbody += "尊敬的供应商
";
mailbody += "你好!
";
@@ -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 result = new List();
+ 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(_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 += "尊敬的供应商
";
+ mailbody += "你好!
";
+ mailbody += "" + p_Content + " ," + ConfigurationManager.AppSettings["ResetPassWord"] + "
";
+ mailbody += "
日期:" + DateTime.Now;
+ List toList = new List();
+ 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;
+ }
+ }
+
}
}
\ No newline at end of file
diff --git a/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs b/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs
index b76df4b..7e94f05 100644
--- a/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs
+++ b/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs
@@ -253,61 +253,70 @@ namespace SCP.PlanData
{
var _ask = Session["Ask"] as V_TB_ASK;
var ret = SCP_ASK_CONTROLLER.Save_TB_ASK_STATE(new List() { _ask.AskBillNum }, p_state);
- if (ret.State == ReturnStatus.Succeed)
+ try
{
- switch (p_state)
+ if (ret.State == ReturnStatus.Succeed)
{
- case AskState.Release:
- if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
- {
- if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
+ switch (p_state)
+ {
+ case AskState.Release:
+ if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
{
- SCP.Common.MailManager.SendMail(_ask.VendId, string.Format("发布了新的要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
- //SCP.Common.MailManager.GetPoMailList();
+ 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());
+ //SCP.Common.MailManager.GetPoMailList();
+
+ }
}
- }
- Alert.Show(p_msg);
- GetV_TB_POData();
- BindDetail();
- break;
- case AskState.Receive:
- //SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
- break;
- case AskState.New:
-
- break;
- case AskState.Ship:
-
- // SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
- break;
- case AskState.Confirm:
-
- break;
- case AskState.CompleteForce:
- if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
- {
- if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
+ Alert.Show(p_msg);
+ GetV_TB_POData();
+ BindDetail();
+ break;
+ case AskState.Receive:
+ //SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
+ break;
+ case AskState.New:
+
+ break;
+ case AskState.Ship:
+
+ // SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
+ break;
+ case AskState.Confirm:
+
+ break;
+ case AskState.CompleteForce:
+ if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
{
- SCP.Common.MailManager.SendMail(_ask.VendId, string.Format("强制归档了的要货看板,要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
+ 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());
+ }
}
- }
- Alert.Show(p_msg);
- GetV_TB_POData();
- BindDetail();
- break;
- case AskState.Reject:
+ Alert.Show(p_msg);
+ GetV_TB_POData();
+ BindDetail();
+ break;
+ case AskState.Reject:
- break;
- default:
+ break;
+ default:
+
+ break;
+ }
- break;
}
-
+ else
+ {
+ Alert.Show(ret.Message);
+ }
}
- else
+ catch(Exception ex)
{
- Alert.Show(ret.Message);
+ Alert.Show(ex.Message);
}
+
}
}
diff --git a/SCP/Web.config b/SCP/Web.config
index a5c43b1..c622f3d 100644
--- a/SCP/Web.config
+++ b/SCP/Web.config
@@ -1,73 +1,67 @@
-
+
-
-
+
+
-
-
-
-
+
-
-
-
+
+
+
+
+
+
+
+
-
-
+ -->
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
@@ -115,28 +109,28 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -150,14 +144,14 @@
-
+
-
+
@@ -165,26 +159,26 @@
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
@@ -194,29 +188,29 @@
-->
-
+
-
+
-
-
+
+
-
+
-
-
+
+
diff --git a/SCP/packages.config b/SCP/packages.config
index 757fadc..f740700 100644
--- a/SCP/packages.config
+++ b/SCP/packages.config
@@ -13,6 +13,7 @@
+
@@ -32,9 +33,12 @@
+
+
+
\ No newline at end of file
diff --git a/UniApiGroup/App.config b/UniApiGroup/App.config
index 8e87a7c..9d156a4 100644
--- a/UniApiGroup/App.config
+++ b/UniApiGroup/App.config
@@ -1,38 +1,38 @@
-
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+