Browse Source

优化接口

SCP_CYJ
qian 6 months ago
parent
commit
0c57de2029
  1. 26
      UniApiGroup/Controller/OdbcApiQadController.cs

26
UniApiGroup/Controller/OdbcApiQadController.cs

@ -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,8 +1671,16 @@ 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 == "½Ó¿ÚÓʼþÍøÖ·");
if (config != null)
{
wwadres = config.ParamValue;
}
if (Dlist.Count()>0)
{
// 作废 // 作废
#region
foreach (var DeleteItem in Dlist) foreach (var DeleteItem in Dlist)
{ {
var _list = DeleteItem.ToList(); var _list = DeleteItem.ToList();
@ -1789,7 +1799,12 @@ namespace CK.SCP.GrupUniApi.Controller
} }
} }
} }
#endregion
}
if (Ilist.Count()>0)
{
// 新增 // 新增
#region
foreach (var InsertItem in Ilist) foreach (var InsertItem in Ilist)
{ {
var inlist = InsertItem.ToList(); var inlist = InsertItem.ToList();
@ -1810,11 +1825,13 @@ namespace CK.SCP.GrupUniApi.Controller
order.FIRSTTELNO = inentity.FIRSTTELNO; order.FIRSTTELNO = inentity.FIRSTTELNO;
order.PHONE = inentity.PHONE; order.PHONE = inentity.PHONE;
order.FAXNUM = inentity.FAXNUM; order.FAXNUM = inentity.FAXNUM;
order.AcceptStatus = (int)GeneralMaterialOrderState.New;
InPoList.Add(order); InPoList.Add(order);
foreach (var initem in inlist) foreach (var initem in inlist)
{ {
TB_MATERIALORDERS_DETAIL orderdetail = new TB_MATERIALORDERS_DETAIL(); TB_MATERIALORDERS_DETAIL orderdetail = new TB_MATERIALORDERS_DETAIL();
orderdetail.PurdocNO = initem.PURDOCNO; orderdetail.PurdocNO = initem.PURDOCNO;
orderdetail.AcceptStatus = (int)GeneralMaterialOrderState.New;
orderdetail.PurchaseReqNO = initem.PURCHASEREQNO; orderdetail.PurchaseReqNO = initem.PURCHASEREQNO;
orderdetail.ProposerDesc = initem.PROPOSERDESC; orderdetail.ProposerDesc = initem.PROPOSERDESC;
orderdetail.MtlNO = initem.MTLNO; orderdetail.MtlNO = initem.MTLNO;
@ -1871,6 +1888,8 @@ namespace CK.SCP.GrupUniApi.Controller
#endregion #endregion
} }
#endregion
}
sdb.BulkInsert(emails);// 添加一般材料订单的邮件 sdb.BulkInsert(emails);// 添加一般材料订单的邮件
sdb.BulkInsert(InPoList);// 添加插入的数据 sdb.BulkInsert(InPoList);// 添加插入的数据
sdb.BulkInsert(InPoDetailList);// 添加明细 sdb.BulkInsert(InPoDetailList);// 添加明细
@ -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);

Loading…
Cancel
Save