|
@ -30,6 +30,7 @@ using static CK.SCP.UniApi.Controller.PoBillNumcontroller; |
|
|
using static CK.SCP.UniApi.Controller.NetPriceController; |
|
|
using static CK.SCP.UniApi.Controller.NetPriceController; |
|
|
using System.Xml.Linq; |
|
|
using System.Xml.Linq; |
|
|
using System.Security.Principal; |
|
|
using System.Security.Principal; |
|
|
|
|
|
using System.Diagnostics; |
|
|
|
|
|
|
|
|
namespace CK.SCP.GrupUniApi.Controller |
|
|
namespace CK.SCP.GrupUniApi.Controller |
|
|
{ |
|
|
{ |
|
@ -1643,7 +1644,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
DateTime time = DateTime.Now.AddMonths(-12); |
|
|
DateTime time = DateTime.Now.AddMonths(-12); |
|
|
var hisList = idb.xxDiMaxes_Order.Where(q => q.CREATEDDATE > time).ToList(); |
|
|
var hisList = new List<xxDiMaxes_Order>(); |
|
|
|
|
|
hisList = idb.xxDiMaxes_Order.Where(q => q.CREATEDDATE > time).ToList(); |
|
|
// 读取一年内 所有审批完的一般材料订单
|
|
|
// 读取一年内 所有审批完的一般材料订单
|
|
|
DataTable b = GetGeneralMaterialOrder(); |
|
|
DataTable b = GetGeneralMaterialOrder(); |
|
|
List<GeneralMaterialOrder> orderlist = ChangKeTec.Utils.ListHelper.DataTableToList<GeneralMaterialOrder>(b); |
|
|
List<GeneralMaterialOrder> orderlist = ChangKeTec.Utils.ListHelper.DataTableToList<GeneralMaterialOrder>(b); |
|
@ -1669,27 +1671,76 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
var emails = new List<TS_Email>(); |
|
|
var emails = new List<TS_Email>(); |
|
|
var Dlist = list.Where(p => p.DI_OPERTYPE == "D").GroupBy(p => p.PURDOCNO).Distinct();// 按照订单号分组去重
|
|
|
var Dlist = list.Where(p => p.DI_OPERTYPE == "D").GroupBy(p => p.PURDOCNO).Distinct();// 按照订单号分组去重
|
|
|
var Ilist = list.Where(p => p.DI_OPERTYPE == "I").GroupBy(p => p.PURDOCNO).Distinct();// 按照订单号分组去重
|
|
|
var Ilist = list.Where(p => p.DI_OPERTYPE == "I").GroupBy(p => p.PURDOCNO).Distinct();// 按照订单号分组去重
|
|
|
string wwadres= sdb.TA_CONFIG.FirstOrDefault(q => q.ParamName == "接口邮件网址").ParamValue; |
|
|
string wwadres = ""; |
|
|
// 作废
|
|
|
var config = sdb.TA_CONFIG.FirstOrDefault(q => q.ParamName == "接口邮件网址"); |
|
|
foreach (var DeleteItem in Dlist) |
|
|
if (config != null) |
|
|
{ |
|
|
{ |
|
|
var _list = DeleteItem.ToList(); |
|
|
wwadres = config.ParamValue; |
|
|
var _entity = _list.First(); |
|
|
} |
|
|
var MATERIALORDERDETAILList = sdb.TB_MATERIALORDERS_DETAIL.Where(q => q.PurdocNO == _entity.PURDOCNO).ToList(); |
|
|
if (Dlist.Count()>0) |
|
|
foreach (var Ditem in _list) |
|
|
{ |
|
|
|
|
|
// 作废
|
|
|
|
|
|
#region
|
|
|
|
|
|
foreach (var DeleteItem in Dlist) |
|
|
{ |
|
|
{ |
|
|
if (MATERIALORDERDETAILList.Count() == 0) |
|
|
var _list = DeleteItem.ToList(); |
|
|
{ |
|
|
var _entity = _list.First(); |
|
|
continue; |
|
|
var MATERIALORDERDETAILList = sdb.TB_MATERIALORDERS_DETAIL.Where(q => q.PurdocNO == _entity.PURDOCNO).ToList(); |
|
|
} |
|
|
foreach (var Ditem in _list) |
|
|
// 根据行号 将子表数据变为作废状态
|
|
|
|
|
|
MATERIALORDERDETAILList.ForEach(p => |
|
|
|
|
|
{ |
|
|
{ |
|
|
if (p.PURDOCITEMNO == Ditem.PURDOCITEMNO) |
|
|
if (MATERIALORDERDETAILList.Count() == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
// 根据行号 将子表数据变为作废状态
|
|
|
|
|
|
MATERIALORDERDETAILList.ForEach(p => |
|
|
|
|
|
{ |
|
|
|
|
|
if (p.PURDOCITEMNO == Ditem.PURDOCITEMNO) |
|
|
|
|
|
{ |
|
|
|
|
|
p.Ctype = Ditem.CTYPE; |
|
|
|
|
|
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel; |
|
|
|
|
|
PoDetailList.Add(p); |
|
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
|
// 添加发邮件数据
|
|
|
|
|
|
TS_Email email = new TS_Email(); |
|
|
|
|
|
email.EmailToUser = Ditem.VENDORDESC; |
|
|
|
|
|
string mailbody = ""; |
|
|
|
|
|
mailbody += "尊敬的 供应商<br>"; |
|
|
|
|
|
mailbody += "你好!<br><br>"; |
|
|
|
|
|
mailbody += "一般材料订单 <b>" + Ditem.PURDOCNO + "</b>" + "<b> 行号" + p.PURDOCITEMNO + "</b> 进行了物料行作废的操作,请登录供应商协同网站进行订单查看。<br>"; |
|
|
|
|
|
mailbody += "登录账号:<b>" + Ditem.VENDORNO + "@W21" + "</b><br>"; |
|
|
|
|
|
mailbody += "登录地址:" + wwadres + "<br><br>"; |
|
|
|
|
|
mailbody += "<br><br><br><br>日期:" + DateTime.Now; |
|
|
|
|
|
email.EmailString = mailbody; |
|
|
|
|
|
var user = authdb.Users.FirstOrDefault(q => q.Name.Contains(Ditem.VENDORNO)); |
|
|
|
|
|
if (user == null) |
|
|
|
|
|
{ |
|
|
|
|
|
email.EmailSendState = 2; |
|
|
|
|
|
email.EmailSendFailReason = "该供应商邮箱未维护"; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
email.EmailAddress = user.Email; |
|
|
|
|
|
email.EmailSendState = 0; |
|
|
|
|
|
} |
|
|
|
|
|
emails.Add(email); |
|
|
|
|
|
#endregion
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
var valueType = MATERIALORDERDETAILList.Select(q => q.Ctype).Distinct().ToList(); |
|
|
|
|
|
var type = valueType.FirstOrDefault(); |
|
|
|
|
|
// 子表全是d并且唯一 更新主表
|
|
|
|
|
|
if (valueType.Count() == 1 && type == "D") |
|
|
{ |
|
|
{ |
|
|
p.Ctype = Ditem.CTYPE; |
|
|
var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList(); |
|
|
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel; |
|
|
MATERIALORDERList.ForEach(p => |
|
|
PoDetailList.Add(p); |
|
|
{ |
|
|
|
|
|
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel; |
|
|
|
|
|
p.Ctype = "D"; |
|
|
|
|
|
PoList.Add(p); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
#region
|
|
|
#region
|
|
|
// 添加发邮件数据
|
|
|
// 添加发邮件数据
|
|
@ -1698,7 +1749,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
string mailbody = ""; |
|
|
string mailbody = ""; |
|
|
mailbody += "尊敬的 供应商<br>"; |
|
|
mailbody += "尊敬的 供应商<br>"; |
|
|
mailbody += "你好!<br><br>"; |
|
|
mailbody += "你好!<br><br>"; |
|
|
mailbody += "一般材料订单 <b>" + Ditem.PURDOCNO +"</b>"+"<b> 行号"+p.PURDOCITEMNO+ "</b> 进行了物料行作废的操作,请登录供应商协同网站进行订单查看。<br>"; |
|
|
mailbody += "一般材料订单 <b>" + Ditem.PURDOCNO + "</b> 进行了物料行作废的操作,请登录供应商协同网站进行订单查看。<br>"; |
|
|
mailbody += "登录账号:<b>" + Ditem.VENDORNO + "@W21" + "</b><br>"; |
|
|
mailbody += "登录账号:<b>" + Ditem.VENDORNO + "@W21" + "</b><br>"; |
|
|
mailbody += "登录地址:" + wwadres + "<br><br>"; |
|
|
mailbody += "登录地址:" + wwadres + "<br><br>"; |
|
|
mailbody += "<br><br><br><br>日期:" + DateTime.Now; |
|
|
mailbody += "<br><br><br><br>日期:" + DateTime.Now; |
|
@ -1717,159 +1768,127 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
emails.Add(email); |
|
|
emails.Add(email); |
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
|
|
|
else //否则将主表变成新建状态
|
|
|
}); |
|
|
|
|
|
var valueType = MATERIALORDERDETAILList.Select(q => q.Ctype).Distinct().ToList(); |
|
|
|
|
|
var type = valueType.FirstOrDefault(); |
|
|
|
|
|
// 子表全是d并且唯一 更新主表
|
|
|
|
|
|
if (valueType.Count() == 1 && type =="D") |
|
|
|
|
|
{ |
|
|
|
|
|
var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList(); |
|
|
|
|
|
MATERIALORDERList.ForEach(p => |
|
|
|
|
|
{ |
|
|
{ |
|
|
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel; |
|
|
var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList(); |
|
|
p.Ctype = "D"; |
|
|
MATERIALORDERList.ForEach(p => |
|
|
PoList.Add(p); |
|
|
{ |
|
|
}); |
|
|
p.Ctype = "N"; |
|
|
|
|
|
p.AcceptStatus = (int)GeneralMaterialOrderState.New; |
|
|
#region
|
|
|
PoList.Add(p); |
|
|
// 添加发邮件数据
|
|
|
}); |
|
|
TS_Email email = new TS_Email(); |
|
|
|
|
|
email.EmailToUser = Ditem.VENDORDESC; |
|
|
|
|
|
string mailbody = ""; |
|
|
|
|
|
mailbody += "尊敬的 供应商<br>"; |
|
|
|
|
|
mailbody += "你好!<br><br>"; |
|
|
|
|
|
mailbody += "一般材料订单 <b>" + Ditem.PURDOCNO + "</b> 进行了物料行作废的操作,请登录供应商协同网站进行订单查看。<br>"; |
|
|
|
|
|
mailbody += "登录账号:<b>" + Ditem.VENDORNO + "@W21" + "</b><br>"; |
|
|
|
|
|
mailbody += "登录地址:" + wwadres + "<br><br>"; |
|
|
|
|
|
mailbody += "<br><br><br><br>日期:" + DateTime.Now; |
|
|
|
|
|
email.EmailString = mailbody; |
|
|
|
|
|
var user = authdb.Users.FirstOrDefault(q => q.Name.Contains(Ditem.VENDORNO)); |
|
|
|
|
|
if (user == null) |
|
|
|
|
|
{ |
|
|
|
|
|
email.EmailSendState = 2; |
|
|
|
|
|
email.EmailSendFailReason = "该供应商邮箱未维护"; |
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
var maxlist1 = new xxDiMaxes_Order |
|
|
{ |
|
|
{ |
|
|
email.EmailAddress = user.Email; |
|
|
DI_BATCHNO = Ditem.DI_BATCHNO, |
|
|
email.EmailSendState = 0; |
|
|
PURDOCNO = Ditem.PURDOCNO, |
|
|
} |
|
|
PURDOCITEMNO = Ditem.PURDOCITEMNO, |
|
|
emails.Add(email); |
|
|
CREATEDDATE = Ditem.CREATEDDATE, |
|
|
#endregion
|
|
|
}; |
|
|
|
|
|
xxMaxbath.Add(maxlist1); |
|
|
} |
|
|
} |
|
|
else //否则将主表变成新建状态
|
|
|
var itemnolist = _list.Select(q => q.PURDOCITEMNO).ToList(); |
|
|
|
|
|
foreach (var Mitem in MATERIALORDERDETAILList) |
|
|
{ |
|
|
{ |
|
|
var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList(); |
|
|
//子表不包含的变成新建状态
|
|
|
MATERIALORDERList.ForEach(p => |
|
|
if (!itemnolist.Contains(Mitem.PURDOCITEMNO)) |
|
|
{ |
|
|
{ |
|
|
p.Ctype = "N"; |
|
|
Mitem.Ctype = "N"; |
|
|
p.AcceptStatus = (int)GeneralMaterialOrderState.New; |
|
|
Mitem.AcceptStatus = (int)GeneralMaterialOrderState.New; |
|
|
PoList.Add(p); |
|
|
PoDetailList.Add(Mitem); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
var maxlist1 = new xxDiMaxes_Order |
|
|
|
|
|
{ |
|
|
|
|
|
DI_BATCHNO = Ditem.DI_BATCHNO, |
|
|
|
|
|
PURDOCNO = Ditem.PURDOCNO, |
|
|
|
|
|
PURDOCITEMNO = Ditem.PURDOCITEMNO, |
|
|
|
|
|
CREATEDDATE = Ditem.CREATEDDATE, |
|
|
|
|
|
}; |
|
|
|
|
|
xxMaxbath.Add(maxlist1); |
|
|
|
|
|
} |
|
|
|
|
|
var itemnolist = _list.Select(q => q.PURDOCITEMNO).ToList(); |
|
|
|
|
|
foreach (var Mitem in MATERIALORDERDETAILList) |
|
|
|
|
|
{ |
|
|
|
|
|
//子表不包含的变成新建状态
|
|
|
|
|
|
if (!itemnolist.Contains(Mitem.PURDOCITEMNO)) |
|
|
|
|
|
{ |
|
|
|
|
|
Mitem.Ctype = "N"; |
|
|
|
|
|
Mitem.AcceptStatus = (int)GeneralMaterialOrderState.New; |
|
|
|
|
|
PoDetailList.Add(Mitem); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
// 新增
|
|
|
if (Ilist.Count()>0) |
|
|
foreach (var InsertItem in Ilist) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var inlist = InsertItem.ToList(); |
|
|
// 新增
|
|
|
var inentity = inlist.First(); |
|
|
|
|
|
#region 添加主子表数据
|
|
|
|
|
|
TB_MATERIALORDERS order = new TB_MATERIALORDERS(); |
|
|
|
|
|
order.PurdocNO = inentity.PURDOCNO; |
|
|
|
|
|
order.BuyListStrdes = inentity.BUYLISTSTRDES; |
|
|
|
|
|
order.DocDate = inentity.DOCDATE != null? (DateTime)inentity.DOCDATE: DateTime.Now; |
|
|
|
|
|
order.VendorNO = inentity.VENDORNO; |
|
|
|
|
|
order.VendorDesc = inentity.VENDORDESC; |
|
|
|
|
|
order.PurgrpDesc = inentity.PURGRPDESC; |
|
|
|
|
|
order.ApprovalStatus = inentity.APPROVALSTATUS; |
|
|
|
|
|
order.ItemdeliveryDate = inentity.ITEMDELIVERYDATE != null?(DateTime)inentity.ITEMDELIVERYDATE:DateTime.Now; |
|
|
|
|
|
order.CreatedByDesc = inentity.CREATEDBYDESC; |
|
|
|
|
|
order.CreatedBy = inentity.CREATEDBY; |
|
|
|
|
|
order.Ctype = "new"; |
|
|
|
|
|
order.FIRSTTELNO = inentity.FIRSTTELNO; |
|
|
|
|
|
order.PHONE = inentity.PHONE; |
|
|
|
|
|
order.FAXNUM = inentity.FAXNUM; |
|
|
|
|
|
InPoList.Add(order); |
|
|
|
|
|
foreach (var initem in inlist) |
|
|
|
|
|
{ |
|
|
|
|
|
TB_MATERIALORDERS_DETAIL orderdetail = new TB_MATERIALORDERS_DETAIL(); |
|
|
|
|
|
orderdetail.PurdocNO = initem.PURDOCNO; |
|
|
|
|
|
orderdetail.PurchaseReqNO = initem.PURCHASEREQNO; |
|
|
|
|
|
orderdetail.ProposerDesc = initem.PROPOSERDESC; |
|
|
|
|
|
orderdetail.MtlNO = initem.MTLNO; |
|
|
|
|
|
orderdetail.ApprovalStatus = initem.APPROVALSTATUS; |
|
|
|
|
|
orderdetail.Shorttext = initem.SHORTTEXT; |
|
|
|
|
|
orderdetail.SizeCol = initem.SIZECOL; |
|
|
|
|
|
orderdetail.Matbrand = initem.MATBRAND; |
|
|
|
|
|
orderdetail.Unitdes = initem.UNITDES; |
|
|
|
|
|
orderdetail.Quantity = initem.QUANTITY!=null?(decimal)initem.QUANTITY:0.000000m; |
|
|
|
|
|
orderdetail.PRICE = initem.PRICE != null ?(decimal) initem.PRICE : 0.00000m; |
|
|
|
|
|
orderdetail.NetValue = initem.NETVALUE != null ? (decimal)initem.NETVALUE : 0.00000m; |
|
|
|
|
|
orderdetail.PurinfoReCord = initem.PURINFORECORD; |
|
|
|
|
|
orderdetail.ItemDeliveryDate = initem.ITEMDELIVERYDATE != null ? (DateTime)initem.ITEMDELIVERYDATE : DateTime.Now; |
|
|
|
|
|
orderdetail.Glaccnum = initem.GLACCNUM; |
|
|
|
|
|
orderdetail.Ctype = "N"; |
|
|
|
|
|
orderdetail.CostCenterDes = initem.COSTCENTERDES; |
|
|
|
|
|
orderdetail.StoreLocation = initem.STORELOCATION; |
|
|
|
|
|
orderdetail.PURDOCITEMNO = initem.PURDOCITEMNO; |
|
|
|
|
|
InPoDetailList.Add(orderdetail); |
|
|
|
|
|
var maxlist1 = new xxDiMaxes_Order |
|
|
|
|
|
{ |
|
|
|
|
|
DI_BATCHNO = initem.DI_BATCHNO, |
|
|
|
|
|
PURDOCNO = initem.PURDOCNO, |
|
|
|
|
|
PURDOCITEMNO = initem.PURDOCITEMNO, |
|
|
|
|
|
CREATEDDATE = initem.CREATEDDATE, |
|
|
|
|
|
}; |
|
|
|
|
|
xxMaxbath.Add(maxlist1); |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region
|
|
|
#region
|
|
|
// 添加发邮件数据
|
|
|
foreach (var InsertItem in Ilist) |
|
|
TS_Email email = new TS_Email(); |
|
|
|
|
|
email.EmailToUser = inentity.VENDORDESC; |
|
|
|
|
|
string mailbody = ""; |
|
|
|
|
|
mailbody += "尊敬的 供应商<br>"; |
|
|
|
|
|
mailbody += "你好!<br><br>"; |
|
|
|
|
|
mailbody += "一般材料订单 <b>" + inentity.PURDOCNO + "</b> 已经发布,请到供应商协同网站打开查看!<br>"; |
|
|
|
|
|
mailbody += "登录账号:<b>" + inentity.VENDORNO + "@W21" + "</b><br>"; |
|
|
|
|
|
mailbody += "登录地址:" + wwadres+ "<br><br>"; |
|
|
|
|
|
mailbody += "<br><br><br><br>日期:" + DateTime.Now; |
|
|
|
|
|
email.EmailString = mailbody; |
|
|
|
|
|
var user = authdb.Users.FirstOrDefault(q => q.Name.Contains(inentity.VENDORNO)); |
|
|
|
|
|
if (user == null) |
|
|
|
|
|
{ |
|
|
{ |
|
|
email.EmailSendState = 2; |
|
|
var inlist = InsertItem.ToList(); |
|
|
email.EmailSendFailReason = "该供应商邮箱未维护"; |
|
|
var inentity = inlist.First(); |
|
|
} |
|
|
#region 添加主子表数据
|
|
|
else |
|
|
TB_MATERIALORDERS order = new TB_MATERIALORDERS(); |
|
|
{ |
|
|
order.PurdocNO = inentity.PURDOCNO; |
|
|
email.EmailAddress = user.Email; |
|
|
order.BuyListStrdes = inentity.BUYLISTSTRDES; |
|
|
email.EmailSendState = 0; |
|
|
order.DocDate = inentity.DOCDATE != null ? (DateTime)inentity.DOCDATE : DateTime.Now; |
|
|
|
|
|
order.VendorNO = inentity.VENDORNO; |
|
|
|
|
|
order.VendorDesc = inentity.VENDORDESC; |
|
|
|
|
|
order.PurgrpDesc = inentity.PURGRPDESC; |
|
|
|
|
|
order.ApprovalStatus = inentity.APPROVALSTATUS; |
|
|
|
|
|
order.ItemdeliveryDate = inentity.ITEMDELIVERYDATE != null ? (DateTime)inentity.ITEMDELIVERYDATE : DateTime.Now; |
|
|
|
|
|
order.CreatedByDesc = inentity.CREATEDBYDESC; |
|
|
|
|
|
order.CreatedBy = inentity.CREATEDBY; |
|
|
|
|
|
order.Ctype = "new"; |
|
|
|
|
|
order.FIRSTTELNO = inentity.FIRSTTELNO; |
|
|
|
|
|
order.PHONE = inentity.PHONE; |
|
|
|
|
|
order.FAXNUM = inentity.FAXNUM; |
|
|
|
|
|
order.AcceptStatus = (int)GeneralMaterialOrderState.New; |
|
|
|
|
|
InPoList.Add(order); |
|
|
|
|
|
foreach (var initem in inlist) |
|
|
|
|
|
{ |
|
|
|
|
|
TB_MATERIALORDERS_DETAIL orderdetail = new TB_MATERIALORDERS_DETAIL(); |
|
|
|
|
|
orderdetail.PurdocNO = initem.PURDOCNO; |
|
|
|
|
|
orderdetail.AcceptStatus = (int)GeneralMaterialOrderState.New; |
|
|
|
|
|
orderdetail.PurchaseReqNO = initem.PURCHASEREQNO; |
|
|
|
|
|
orderdetail.ProposerDesc = initem.PROPOSERDESC; |
|
|
|
|
|
orderdetail.MtlNO = initem.MTLNO; |
|
|
|
|
|
orderdetail.ApprovalStatus = initem.APPROVALSTATUS; |
|
|
|
|
|
orderdetail.Shorttext = initem.SHORTTEXT; |
|
|
|
|
|
orderdetail.SizeCol = initem.SIZECOL; |
|
|
|
|
|
orderdetail.Matbrand = initem.MATBRAND; |
|
|
|
|
|
orderdetail.Unitdes = initem.UNITDES; |
|
|
|
|
|
orderdetail.Quantity = initem.QUANTITY != null ? (decimal)initem.QUANTITY : 0.000000m; |
|
|
|
|
|
orderdetail.PRICE = initem.PRICE != null ? (decimal)initem.PRICE : 0.00000m; |
|
|
|
|
|
orderdetail.NetValue = initem.NETVALUE != null ? (decimal)initem.NETVALUE : 0.00000m; |
|
|
|
|
|
orderdetail.PurinfoReCord = initem.PURINFORECORD; |
|
|
|
|
|
orderdetail.ItemDeliveryDate = initem.ITEMDELIVERYDATE != null ? (DateTime)initem.ITEMDELIVERYDATE : DateTime.Now; |
|
|
|
|
|
orderdetail.Glaccnum = initem.GLACCNUM; |
|
|
|
|
|
orderdetail.Ctype = "N"; |
|
|
|
|
|
orderdetail.CostCenterDes = initem.COSTCENTERDES; |
|
|
|
|
|
orderdetail.StoreLocation = initem.STORELOCATION; |
|
|
|
|
|
orderdetail.PURDOCITEMNO = initem.PURDOCITEMNO; |
|
|
|
|
|
InPoDetailList.Add(orderdetail); |
|
|
|
|
|
var maxlist1 = new xxDiMaxes_Order |
|
|
|
|
|
{ |
|
|
|
|
|
DI_BATCHNO = initem.DI_BATCHNO, |
|
|
|
|
|
PURDOCNO = initem.PURDOCNO, |
|
|
|
|
|
PURDOCITEMNO = initem.PURDOCITEMNO, |
|
|
|
|
|
CREATEDDATE = initem.CREATEDDATE, |
|
|
|
|
|
}; |
|
|
|
|
|
xxMaxbath.Add(maxlist1); |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region
|
|
|
|
|
|
// 添加发邮件数据
|
|
|
|
|
|
TS_Email email = new TS_Email(); |
|
|
|
|
|
email.EmailToUser = inentity.VENDORDESC; |
|
|
|
|
|
string mailbody = ""; |
|
|
|
|
|
mailbody += "尊敬的 供应商<br>"; |
|
|
|
|
|
mailbody += "你好!<br><br>"; |
|
|
|
|
|
mailbody += "一般材料订单 <b>" + inentity.PURDOCNO + "</b> 已经发布,请到供应商协同网站打开查看!<br>"; |
|
|
|
|
|
mailbody += "登录账号:<b>" + inentity.VENDORNO + "@W21" + "</b><br>"; |
|
|
|
|
|
mailbody += "登录地址:" + wwadres + "<br><br>"; |
|
|
|
|
|
mailbody += "<br><br><br><br>日期:" + DateTime.Now; |
|
|
|
|
|
email.EmailString = mailbody; |
|
|
|
|
|
var user = authdb.Users.FirstOrDefault(q => q.Name.Contains(inentity.VENDORNO)); |
|
|
|
|
|
if (user == null) |
|
|
|
|
|
{ |
|
|
|
|
|
email.EmailSendState = 2; |
|
|
|
|
|
email.EmailSendFailReason = "该供应商邮箱未维护"; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
email.EmailAddress = user.Email; |
|
|
|
|
|
email.EmailSendState = 0; |
|
|
|
|
|
} |
|
|
|
|
|
emails.Add(email); |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
emails.Add(email); |
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
sdb.BulkInsert(emails);// 添加一般材料订单的邮件
|
|
|
sdb.BulkInsert(emails);// 添加一般材料订单的邮件
|
|
|
sdb.BulkInsert(InPoList);// 添加插入的数据
|
|
|
sdb.BulkInsert(InPoList);// 添加插入的数据
|
|
@ -1887,7 +1906,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
Console.WriteLine(ex.Message); |
|
|
|
|
|
|
|
|
Console.WriteLine(ex.ToString()); |
|
|
if (ex.InnerException != null) |
|
|
if (ex.InnerException != null) |
|
|
{ |
|
|
{ |
|
|
Console.WriteLine(ex.InnerException.Message); |
|
|
Console.WriteLine(ex.InnerException.Message); |
|
|