|
|
@ -55,16 +55,16 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
var tableNameList = EnumHelper.EnumToList<QadTableName>(); |
|
|
|
//DataTable b = QmStockController.GetInvBatchStock();
|
|
|
|
// var qadCtrlList = idb.xxqad_ctrl.Where(p => p.xxqad_domain == ScpCache.Config.QAD域 && p.xxqad_scm == "0").ToList();
|
|
|
|
var qadCtrlList = idb.xxerp_MaxbatchNO.ToList(); |
|
|
|
var qadCtrlList = idb.xxerp_MaxbatchNO.ToList(); |
|
|
|
foreach (var qadCtrl in qadCtrlList) |
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
ScpEntities wdb = EntitiesFactory.CreateScpInstance(); |
|
|
|
var authdb = EntitiesFactory.CreateAppBoxInstance(); |
|
|
|
switch (qadCtrl.tablename) |
|
|
|
{ |
|
|
|
ScpEntities wdb = EntitiesFactory.CreateScpInstance(); |
|
|
|
var authdb = EntitiesFactory.CreateAppBoxInstance(); |
|
|
|
switch (qadCtrl.tablename) |
|
|
|
{ |
|
|
|
case "part": //物料
|
|
|
|
if (GlobalVar.ApiConfig.Qad零件) |
|
|
|
{ |
|
|
@ -143,44 +143,44 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
continue; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
|
|
|
} |
|
|
|
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
|
|
|
{ |
|
|
|
var sb = new StringBuilder(); |
|
|
|
foreach (var error in dbEx.EntityValidationErrors.ToList()) |
|
|
|
{ |
|
|
|
var sb = new StringBuilder(); |
|
|
|
foreach (var error in dbEx.EntityValidationErrors.ToList()) |
|
|
|
error.ValidationErrors.ToList().ForEach(i => |
|
|
|
{ |
|
|
|
error.ValidationErrors.ToList().ForEach(i => |
|
|
|
{ |
|
|
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); |
|
|
|
}); |
|
|
|
} |
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + sb.ToString();
|
|
|
|
|
|
|
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); |
|
|
|
}); |
|
|
|
} |
|
|
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
|
|
|
{ |
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + ex.Message+ex.InnerException.Message;
|
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + sb.ToString();
|
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + ex.Message + ex.InnerException.Message;
|
|
|
|
} |
|
|
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
|
|
|
{ |
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + ex.Message+ex.InnerException.Message;
|
|
|
|
|
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
EntitiesFactory.SaveDb(idb); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + ex.Message + ex.InnerException.Message;
|
|
|
|
|
|
|
|
UpdatePlanToAsk(); |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
EntitiesFactory.SaveDb(idb); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UpdatePlanToAsk(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void UpdatePlanToAsk() |
|
|
|
{ |
|
|
@ -782,60 +782,41 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
/// <param name="wdb"></param>
|
|
|
|
/// <param name="seq"></param>
|
|
|
|
private static void UpdatePurchaseOrders(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var max = idb.xxDiMaxes_Po.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); |
|
|
|
int a = max.Di_Batchno; |
|
|
|
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); |
|
|
|
DataTable b = PoBillNumcontroller.GetInvBatchStock(a, FATCTORY.FactoryId); |
|
|
|
List<PURStockBill> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURStockBill>(b); |
|
|
|
List<PURStockBill> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURStockBill>(b); |
|
|
|
var wmsPoList = new List<TB_PO>(); |
|
|
|
var wmsPoDetailList = new List<TB_PO_DETAIL>(); |
|
|
|
var wmsAskList = new List<TB_ASK>(); |
|
|
|
var wmsAskDetailList = new List<TB_ASK_DETAIL>(); |
|
|
|
var xxMaxbath = new List<xxDiMaxes_Po>(); |
|
|
|
var Dlist = list.Where(p=>p.ctype=="D"); |
|
|
|
var Dlist = list.Where(p => p.ctype == "D"); |
|
|
|
var Ilist = list.Where(p => p.ctype != "D"); |
|
|
|
var _li = Dlist.GroupBy(p=>p.purDocNO); |
|
|
|
var _li = Dlist.GroupBy(p => p.purDocNO); |
|
|
|
foreach (var _lii in _li) |
|
|
|
{ |
|
|
|
var _liii = _lii.ToList(); |
|
|
|
var _entity = _liii.First(); |
|
|
|
var _askdetail = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == _entity.purDocNO && p.State > -1); |
|
|
|
if(_askdetail== _liii.Count()) |
|
|
|
// 根据 零件号作废
|
|
|
|
var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO && p.PartCode == _entity.mtlNO).ToList(); |
|
|
|
askdetaill.ForEach(p => |
|
|
|
{ |
|
|
|
var ask = wdb.TB_ASK.FirstOrDefault(p=>p.PoBillNum==_entity.purDocNO); |
|
|
|
ask.State = -1; |
|
|
|
ask.IsDeleted = true; |
|
|
|
wmsAskList.Add(ask); |
|
|
|
var askdetaill=wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO).ToList(); |
|
|
|
askdetaill.ForEach(p => |
|
|
|
{ |
|
|
|
p.State = -1; |
|
|
|
p.IsDeleted = true; |
|
|
|
wmsAskDetailList.Add(p); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO).ToList(); |
|
|
|
askdetaill.ForEach(p => |
|
|
|
{ |
|
|
|
p.State = -1; |
|
|
|
p.IsDeleted = true; |
|
|
|
wmsAskDetailList.Add(p); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
p.State = -1; |
|
|
|
p.IsDeleted = true; |
|
|
|
wmsAskDetailList.Add(p); |
|
|
|
}); |
|
|
|
} |
|
|
|
foreach (var qadPoNbr in Ilist) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var qadDataList = wmsPoList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
|
var wmsPo1 = wdb.TB_PO.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
|
if ( qadDataList == 0&& wmsPo1==0) |
|
|
|
{ |
|
|
|
if (qadDataList == 0 && wmsPo1 == 0) |
|
|
|
{ |
|
|
|
TB_PO wmsPo = new TB_PO |
|
|
|
{ |
|
|
|
PoBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
@ -859,9 +840,9 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
|
|
|
|
var qadAskList = wmsAskList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
|
var wmsAs1 = wdb.TB_ASK.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
|
if ( qadAskList == 0&& wmsAs1==0) |
|
|
|
if (qadAskList == 0 && wmsAs1 == 0) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
int cnt = 1; |
|
|
|
String str = "k"; |
|
|
|
TB_ASK wmsAs = new TB_ASK |
|
|
@ -869,8 +850,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
AskBillNum = str + qadPoNbr.purDocNO.Substring(2, 12), |
|
|
|
PoBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
|
VendId = qadPoNbr.vendorNO,//供应商编号
|
|
|
|
Site = "W21", |
|
|
|
|
|
|
|
Site = "W21", |
|
|
|
|
|
|
|
CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期
|
|
|
|
CreateUser = "W21-LIUST",//创建用户
|
|
|
|
GUID = System.Guid.NewGuid(), |
|
|
@ -882,7 +863,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
ErpBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
|
SubSite = "W21", |
|
|
|
}; |
|
|
|
if (qadPoNbr.returnsItem =="Y") |
|
|
|
if (qadPoNbr.returnsItem == "Y") |
|
|
|
{ |
|
|
|
wmsAs.State = -1; |
|
|
|
} |
|
|
@ -890,22 +871,24 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
{ |
|
|
|
wmsAs.State = 1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wmsAskList.Add(wmsAs); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var qadASKList = wmsAskDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
|
var wmsAskDetail1 = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
|
if (qadASKList == 0&& wmsAskDetail1==0) |
|
|
|
{ |
|
|
|
//
|
|
|
|
var tapart = wdb.TA_PART.Where(q => q.PartCode == qadPoNbr.mtlNO.Trim()).ToList(); |
|
|
|
if (qadASKList == 0 && wmsAskDetail1 == 0) |
|
|
|
{ |
|
|
|
String str = "k"; |
|
|
|
TB_ASK_DETAIL wmsAskDetail = new TB_ASK_DETAIL |
|
|
|
{ |
|
|
|
AskBillNum = str + qadPoNbr.purDocNO.Substring(2, 12), |
|
|
|
PoBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
|
PoLine = int.Parse(qadPoNbr.purDocItemNO), |
|
|
|
Site = "W21", |
|
|
|
Site = "W21", |
|
|
|
CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期
|
|
|
|
CreateUser = "W21-LIUST",//创建用户
|
|
|
|
GUID = System.Guid.NewGuid(), |
|
|
@ -914,7 +897,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
EndTime = qadPoNbr.itemDeliveryDate,//收货结束时间
|
|
|
|
Price = 0, |
|
|
|
AskQty = qadPoNbr.quantity, |
|
|
|
DockCode = "YC", |
|
|
|
DockCode = tapart.Count()>0 ? tapart.FirstOrDefault().PartGroup:"YC", |
|
|
|
PoUnit = qadPoNbr.baseUnitMeasure, |
|
|
|
Currency = qadPoNbr.sizecoL, |
|
|
|
}; |
|
|
@ -932,7 +915,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
|
|
|
|
var maxlist1 = new xxDiMaxes_Po |
|
|
|
{ |
|
|
|
Di_Batchno = qadPoNbr.DI_BATCHNO, |
|
|
|
Di_Batchno = qadPoNbr.DI_BATCHNO, |
|
|
|
|
|
|
|
}; |
|
|
|
xxMaxbath.Add(maxlist1); |
|
|
@ -940,10 +923,10 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
var qadDataList1 = wmsPoDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
|
var wmsPoDetail1 = |
|
|
|
wdb.TB_PO_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
|
if ( qadDataList1 == 0&& wmsPoDetail1==0) |
|
|
|
if (qadDataList1 == 0 && wmsPoDetail1 == 0) |
|
|
|
{ |
|
|
|
|
|
|
|
TB_PO_DETAIL wmsPoDetail = new TB_PO_DETAIL |
|
|
|
|
|
|
|
TB_PO_DETAIL wmsPoDetail = new TB_PO_DETAIL |
|
|
|
{ |
|
|
|
PoBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
|
PoLine = int.Parse(qadPoNbr.purDocItemNO), |
|
|
@ -958,8 +941,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
SubSite = "W21", |
|
|
|
CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期
|
|
|
|
CreateUser = qadPoNbr.CREATEDBY,//创建用户
|
|
|
|
//if (wmsPoDetail.BillQty != 0 && wmsPoDetail.BillQty <= wmsPoDetail.ReceivedQty)
|
|
|
|
// wmsPoDetail.State = (int)FormState.关闭;
|
|
|
|
//if (wmsPoDetail.BillQty != 0 && wmsPoDetail.BillQty <= wmsPoDetail.ReceivedQty)
|
|
|
|
// wmsPoDetail.State = (int)FormState.关闭;
|
|
|
|
State = (int)FormState.开放, |
|
|
|
IsDeleted = false, |
|
|
|
GUID = System.Guid.NewGuid(), |
|
|
@ -969,7 +952,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
//wmsPo.State = qadDataList.All(p => p.xxqad_pod_status == ((int)FormState.关闭).ToString())
|
|
|
@ -981,23 +964,23 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
Console.WriteLine("更新 ERP采购订单 数据:" + "无数据"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
|
//item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
|
|
|
|
idb.xxDiMaxes_Po.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
|
wdb.TB_PO.AddOrUpdate(wmsPoList.ToArray()); |
|
|
|
wdb.TB_ASK.AddOrUpdate(wmsAskList.ToArray()); |
|
|
|
wdb.TB_PO_DETAIL.AddOrUpdate(wmsPoDetailList.ToArray()); |
|
|
|
wdb.TB_ASK_DETAIL.AddOrUpdate(wmsAskDetailList.ToArray()); |
|
|
|
Console.WriteLine($"更新 采购订单 数据:{list.Count}"); |
|
|
|
|
|
|
|
|
|
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
|
//item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
|
|
|
|
idb.xxDiMaxes_Po.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
|
wdb.TB_PO.AddOrUpdate(wmsPoList.ToArray()); |
|
|
|
wdb.TB_ASK.AddOrUpdate(wmsAskList.ToArray()); |
|
|
|
wdb.TB_PO_DETAIL.AddOrUpdate(wmsPoDetailList.ToArray()); |
|
|
|
wdb.TB_ASK_DETAIL.AddOrUpdate(wmsAskDetailList.ToArray()); |
|
|
|
Console.WriteLine($"更新 采购订单 数据:{list.Count}"); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
Console.WriteLine(ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1239,7 +1222,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
DataTable b = NetPriceController.GetInvBatchNetPrice(a, FATCTORY.FactoryId); |
|
|
|
//DataTable b = NetPriceController.GetInvBatchNetPrice(item.MaxdibatchNO);
|
|
|
|
List<PURSubcontractorInfoRecMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURSubcontractorInfoRecMid>(b); |
|
|
|
|
|
|
|
|
|
|
|
var PriceList = new List<TB_NetPrice>(); |
|
|
|
var xxMaxbath = new List<xxDiMaxes>(); |
|
|
|
foreach (var itm in list) |
|
|
@ -1247,8 +1230,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
var maxlist1 = new xxDiMaxes |
|
|
|
{ |
|
|
|
Di_Batchno_part = 0, |
|
|
|
Di_Batchno=0, |
|
|
|
Di_Batchno_price=0, |
|
|
|
Di_Batchno = 0, |
|
|
|
Di_Batchno_price = 0, |
|
|
|
Di_Batchno_NETprice = itm.DI_BATCHNO, |
|
|
|
|
|
|
|
}; |
|
|
@ -1277,8 +1260,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
} |
|
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
|
item.Remark = ((int) UniApiState.失败).ToString(); |
|
|
|
scpdb.TB_NetPrice.AddOrUpdate(PriceList.ToArray()); |
|
|
|
item.Remark = ((int)UniApiState.失败).ToString(); |
|
|
|
scpdb.TB_NetPrice.AddOrUpdate(PriceList.ToArray()); |
|
|
|
Console.WriteLine($"更新采购净价数据:{PriceList.Count}"); |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
@ -1292,7 +1275,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_NETprice).FirstOrDefault(); |
|
|
|
int a = max.Di_Batchno_price; |
|
|
|
var FATCTORY = scpdb.TB_FACTORY.FirstOrDefault(); |
|
|
|
DataTable b = PriceController.GetInvBatchPrice(a,FATCTORY.FactoryId); |
|
|
|
DataTable b = PriceController.GetInvBatchPrice(a, FATCTORY.FactoryId); |
|
|
|
List<PURPriceDealMidTab> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURPriceDealMidTab>(b); |
|
|
|
var xxMaxbath = new List<xxDiMaxes>(); |
|
|
|
var PriceList = new List<TB_PRICE>(); |
|
|
@ -1303,7 +1286,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
Di_Batchno_part = 0, |
|
|
|
Di_Batchno = 0, |
|
|
|
Di_Batchno_price = itm.DI_BATCHNO, |
|
|
|
Di_Batchno_NETprice =0, |
|
|
|
Di_Batchno_NETprice = 0, |
|
|
|
|
|
|
|
}; |
|
|
|
xxMaxbath.Add(maxlist1); |
|
|
@ -1317,7 +1300,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
Unit = itm.ordUnit, |
|
|
|
PartCode = itm.MTLNO, |
|
|
|
Site = itm.plant, |
|
|
|
StartTime =itm.validityStartPeriod, |
|
|
|
StartTime = itm.validityStartPeriod, |
|
|
|
EndTime = itm.validityEndPeriod, |
|
|
|
}; |
|
|
|
_price.Amt = decimal.Parse(itm.purchasePrice); |
|
|
@ -1341,7 +1324,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
/// <param name="idb"></param>
|
|
|
|
/// <param name="wdb"></param>
|
|
|
|
/// <param name="seq"></param>
|
|
|
|
private static void UpdateVendParts(UniApiEntities idb, ScpEntities wdb,xxerp_MaxbatchNO item) |
|
|
|
private static void UpdateVendParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) |
|
|
|
{ |
|
|
|
DataTable b = vendidpartcontroller.GetInvBatchStock(item.MaxdibatchNO.ToString()); |
|
|
|
List<PURVendorpartMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURVendorpartMid>(b); |
|
|
@ -1380,7 +1363,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
//wmsData.VendPackQty = qadData.xxqad_vp_comment;
|
|
|
|
//wmsData.TransportationTime = qadData.xxqad_vp_vend_lead;
|
|
|
|
wmsDataList.Add(wmsData); |
|
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
|
item.MaxdibatchNO = Convert.ToInt32(qadData.DI_BATCHNO); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
@ -1406,7 +1389,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); |
|
|
|
int a = max.Di_Batchno; |
|
|
|
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); |
|
|
|
DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO, a,FATCTORY.FactoryId); |
|
|
|
DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO, a, FATCTORY.FactoryId); |
|
|
|
//DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO);
|
|
|
|
List<PURVendorMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURVendorMid>(b); |
|
|
|
var wmsDataList = new List<TA_VENDER>(); |
|
|
@ -1417,8 +1400,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
{ |
|
|
|
var maxlist1 = new xxDiMaxes |
|
|
|
{ |
|
|
|
Di_Batchno_NETprice=0, |
|
|
|
Di_Batchno_price=0, |
|
|
|
Di_Batchno_NETprice = 0, |
|
|
|
Di_Batchno_price = 0, |
|
|
|
Di_Batchno_part = 0, |
|
|
|
Di_Batchno = qadData.DI_BATCHNO, |
|
|
|
|
|
|
@ -1428,7 +1411,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
new TA_VENDER { VendId = qadData.VENDORNO.ToUpper(), VendAbbCode = "0", State = 1 }; |
|
|
|
wmsData.VendName = string.IsNullOrEmpty(qadData.NAME1) ? qadData.VENDORNO : qadData.NAME1; |
|
|
|
wmsData.VendType = qadData.providerType.ToUpper().ToString(); |
|
|
|
wmsData.Country = qadData.country; |
|
|
|
wmsData.Country = qadData.country; |
|
|
|
wmsData.Phone = qadData.firstTelNO; |
|
|
|
wmsData.Fax = qadData.FAXNUMBER; |
|
|
|
wmsData.Site = ScpCache.Config.QAD域; |
|
|
@ -1440,7 +1423,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); |
|
|
|
var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == ScpCache.Config.QAD域).FirstOrDefault(); |
|
|
|
//_first == null && _vend != null &&
|
|
|
|
if (_factory != null&& _first==null) |
|
|
|
if (_factory != null && _first == null) |
|
|
|
{ |
|
|
|
User _entity = new User(); |
|
|
|
_entity.Name = vendname; |
|
|
@ -1462,7 +1445,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
TA_FACTORY f = authdb.Set<TA_FACTORY>().Local.Where(x => x.ID == _factory.ID).FirstOrDefault(); |
|
|
|
if (f == null) |
|
|
|
{ |
|
|
|
f = new TA_FACTORY { ID = _factory.ID }; |
|
|
|
f = new TA_FACTORY { ID = _factory.ID }; |
|
|
|
authdb.Set<TA_FACTORY>().Attach(f); |
|
|
|
} |
|
|
|
_entity.TA_FACTORY.Add(f); |
|
|
@ -1484,12 +1467,12 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
Console.WriteLine("更新 供应商 数据:" + "无数据"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wdb.TA_VENDER.AddOrUpdate(p => new { p.VendId, p.Site }, wmsDataList.ToArray()); |
|
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
|
item.MaxdibatchNO = item.MaxdibatchNO +list.Count; |
|
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
|
Console.WriteLine($"更新 供应商 数据:{list.Count}"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1506,7 +1489,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
|
|
|
|
private static void UpdateVenderExtend(UniApiEntities idb, ScpEntities wdb, AppBoxContext authdb, List<TA_VENDER> qadDataList) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var _ls = new List<VenderUsers>(); |
|
|
|
|
|
|
|
foreach (var qadData in qadDataList) |
|
|
@ -1553,25 +1536,25 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
/// <param name="idb"></param>
|
|
|
|
/// <param name="wdb"></param>
|
|
|
|
/// <param name="seq"></param>
|
|
|
|
private static void UpdateParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item ) |
|
|
|
private static void UpdateParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) |
|
|
|
{ |
|
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_part).FirstOrDefault(); |
|
|
|
int a = max.Di_Batchno_part; |
|
|
|
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); |
|
|
|
DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO,a, FATCTORY.FactoryId); |
|
|
|
List<MMRSENDMTLDATA> list= ChangKeTec.Utils.ListHelper.DataTableToList<MMRSENDMTLDATA>(b); |
|
|
|
|
|
|
|
var wmsDataList = new List<TA_PART>(); |
|
|
|
DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO, a, FATCTORY.FactoryId); |
|
|
|
List<MMRSENDMTLDATA> list = ChangKeTec.Utils.ListHelper.DataTableToList<MMRSENDMTLDATA>(b); |
|
|
|
|
|
|
|
var wmsDataList = new List<TA_PART>(); |
|
|
|
var xxMaxbath = new List<xxDiMaxes>(); |
|
|
|
foreach (var qadData in list) |
|
|
|
{ |
|
|
|
var maxlist1 = new xxDiMaxes |
|
|
|
{ |
|
|
|
Di_Batchno_NETprice=0, |
|
|
|
Di_Batchno_price=0, |
|
|
|
Di_Batchno_NETprice = 0, |
|
|
|
Di_Batchno_price = 0, |
|
|
|
Di_Batchno_part = qadData.DI_BATCHNO, |
|
|
|
Di_Batchno = 0 |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
xxMaxbath.Add(maxlist1); |
|
|
|
var wmsData = wdb.TA_PART.SingleOrDefault(p => p.ErpPartCode == qadData.MTLNO.ToString() && p.Site == qadData.plant) ?? |
|
|
@ -1579,21 +1562,21 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
{ |
|
|
|
PartCode = qadData.MTLNO.ToString(), |
|
|
|
ErpPartCode = qadData.MTLNO.ToString(), |
|
|
|
}; |
|
|
|
wmsData.PartDesc1 = qadData.MTLNODES.ToString(); |
|
|
|
wmsData.PartDesc2 = qadData.sizes.ToString(); |
|
|
|
wmsData.ReceivePort = qadData.grossWeight.ToString(); |
|
|
|
wmsData.PalletSize = qadData.netWeight.ToString(); |
|
|
|
wmsData.PartGroup = qadData.MTLTYPE.ToString(); |
|
|
|
wmsData.ProjectId = qadData.MATBRAND; |
|
|
|
wmsData.Unit = !string.IsNullOrEmpty(qadData.MEASUREBASEUNIT) ? qadData.MEASUREBASEUNIT.ToUpper() : "EA"; |
|
|
|
wmsData.Remark = qadData.stdPrice.ToString(); |
|
|
|
wmsData.ValidityDays = qadData.loadQuantity; |
|
|
|
wmsData.State = !string.IsNullOrEmpty(qadData.SpMtlStatus) ? qadData.SpMtlStatus.ToUpper() : "A"; |
|
|
|
wmsData.Site = qadData.plant; |
|
|
|
wmsDataList.Add(wmsData); |
|
|
|
}; |
|
|
|
wmsData.PartDesc1 = qadData.MTLNODES.ToString(); |
|
|
|
wmsData.PartDesc2 = qadData.sizes.ToString(); |
|
|
|
wmsData.ReceivePort = qadData.grossWeight.ToString(); |
|
|
|
wmsData.PalletSize = qadData.netWeight.ToString(); |
|
|
|
wmsData.PartGroup = qadData.MTLTYPE.ToString(); |
|
|
|
wmsData.ProjectId = qadData.MATBRAND; |
|
|
|
wmsData.Unit = !string.IsNullOrEmpty(qadData.MEASUREBASEUNIT) ? qadData.MEASUREBASEUNIT.ToUpper() : "EA"; |
|
|
|
wmsData.Remark = qadData.stdPrice.ToString(); |
|
|
|
wmsData.ValidityDays = qadData.loadQuantity; |
|
|
|
wmsData.State = !string.IsNullOrEmpty(qadData.SpMtlStatus) ? qadData.SpMtlStatus.ToUpper() : "A"; |
|
|
|
wmsData.Site = qadData.plant; |
|
|
|
wmsDataList.Add(wmsData); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (wmsDataList.Count == 0) |
|
|
|
{ |
|
|
|
Console.WriteLine("更新 零件 数据:" + "无数据"); |
|
|
@ -1603,10 +1586,10 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
|
wdb.TA_PART.AddOrUpdate(p => new { p.PartCode, p.Site }, wmsDataList.ToArray()); |
|
|
|
Console.WriteLine($"更新 零件信息 数据:{list.Count}"); |
|
|
|
Console.WriteLine($"更新 零件信息 数据:{list.Count}"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|