|
@ -59,12 +59,12 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
foreach (var qadCtrl in qadCtrlList) |
|
|
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": //物料
|
|
|
case "part": //物料
|
|
|
if (GlobalVar.ApiConfig.Qad零件) |
|
|
if (GlobalVar.ApiConfig.Qad零件) |
|
|
{ |
|
|
{ |
|
@ -145,42 +145,42 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
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(); |
|
|
error.ValidationErrors.ToList().ForEach(i => |
|
|
foreach (var error in dbEx.EntityValidationErrors.ToList()) |
|
|
|
|
|
{ |
|
|
{ |
|
|
error.ValidationErrors.ToList().ForEach(i => |
|
|
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); |
|
|
{ |
|
|
}); |
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
{ |
|
|
//qadCtrl.xxqad_rmks += " SCM:" + sb.ToString();
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + ex.Message+ex.InnerException.Message;
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
|
|
{ |
|
|
{ |
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
//qadCtrl.xxqad_scm = ((int)UniApiState.失败).ToString();
|
|
|
//qadCtrl.xxqad_rmks += " SCM:" + ex.Message + ex.InnerException.Message;
|
|
|
//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() |
|
|
private static void UpdatePlanToAsk() |
|
|
{ |
|
|
{ |
|
@ -782,7 +782,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
/// <param name="wdb"></param>
|
|
|
/// <param name="wdb"></param>
|
|
|
/// <param name="seq"></param>
|
|
|
/// <param name="seq"></param>
|
|
|
private static void UpdatePurchaseOrders(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) |
|
|
private static void UpdatePurchaseOrders(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item) |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
var max = idb.xxDiMaxes_Po.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); |
|
|
var max = idb.xxDiMaxes_Po.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); |
|
@ -795,46 +795,27 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
var wmsAskList = new List<TB_ASK>(); |
|
|
var wmsAskList = new List<TB_ASK>(); |
|
|
var wmsAskDetailList = new List<TB_ASK_DETAIL>(); |
|
|
var wmsAskDetailList = new List<TB_ASK_DETAIL>(); |
|
|
var xxMaxbath = new List<xxDiMaxes_Po>(); |
|
|
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 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) |
|
|
foreach (var _lii in _li) |
|
|
{ |
|
|
{ |
|
|
var _liii = _lii.ToList(); |
|
|
var _liii = _lii.ToList(); |
|
|
var _entity = _liii.First(); |
|
|
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(); |
|
|
p.State = -1; |
|
|
askdetaill.ForEach(p => |
|
|
p.IsDeleted = true; |
|
|
{ |
|
|
wmsAskDetailList.Add(p); |
|
|
p.State = -1; |
|
|
}); |
|
|
p.IsDeleted = true; |
|
|
|
|
|
wmsAskDetailList.Add(p); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
foreach (var qadPoNbr in Ilist) |
|
|
foreach (var qadPoNbr in Ilist) |
|
|
{ |
|
|
{ |
|
|
var qadDataList = wmsPoList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
var qadDataList = wmsPoList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
var wmsPo1 = wdb.TB_PO.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 |
|
|
TB_PO wmsPo = new TB_PO |
|
|
{ |
|
|
{ |
|
@ -859,7 +840,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
|
|
|
|
|
var qadAskList = wmsAskList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
var qadAskList = wmsAskList.Count(p => p.PoBillNum == qadPoNbr.purDocNO); |
|
|
var wmsAs1 = wdb.TB_ASK.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; |
|
|
int cnt = 1; |
|
@ -882,7 +863,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
ErpBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
ErpBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
SubSite = "W21", |
|
|
SubSite = "W21", |
|
|
}; |
|
|
}; |
|
|
if (qadPoNbr.returnsItem =="Y") |
|
|
if (qadPoNbr.returnsItem == "Y") |
|
|
{ |
|
|
{ |
|
|
wmsAs.State = -1; |
|
|
wmsAs.State = -1; |
|
|
} |
|
|
} |
|
@ -897,7 +878,9 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
|
|
|
|
|
var qadASKList = wmsAskDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
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); |
|
|
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"; |
|
|
String str = "k"; |
|
|
TB_ASK_DETAIL wmsAskDetail = new TB_ASK_DETAIL |
|
|
TB_ASK_DETAIL wmsAskDetail = new TB_ASK_DETAIL |
|
@ -914,7 +897,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
EndTime = qadPoNbr.itemDeliveryDate,//收货结束时间
|
|
|
EndTime = qadPoNbr.itemDeliveryDate,//收货结束时间
|
|
|
Price = 0, |
|
|
Price = 0, |
|
|
AskQty = qadPoNbr.quantity, |
|
|
AskQty = qadPoNbr.quantity, |
|
|
DockCode = "YC", |
|
|
DockCode = tapart.Count()>0 ? tapart.FirstOrDefault().PartGroup:"YC", |
|
|
PoUnit = qadPoNbr.baseUnitMeasure, |
|
|
PoUnit = qadPoNbr.baseUnitMeasure, |
|
|
Currency = qadPoNbr.sizecoL, |
|
|
Currency = qadPoNbr.sizecoL, |
|
|
}; |
|
|
}; |
|
@ -940,10 +923,10 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
var qadDataList1 = wmsPoDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
var qadDataList1 = wmsPoDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
var wmsPoDetail1 = |
|
|
var wmsPoDetail1 = |
|
|
wdb.TB_PO_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO); |
|
|
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,//订单号
|
|
|
PoBillNum = qadPoNbr.purDocNO,//订单号
|
|
|
PoLine = int.Parse(qadPoNbr.purDocItemNO), |
|
|
PoLine = int.Parse(qadPoNbr.purDocItemNO), |
|
@ -958,8 +941,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
SubSite = "W21", |
|
|
SubSite = "W21", |
|
|
CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期
|
|
|
CreateTime = qadPoNbr.createdDate == null ? DateTime.Now : (DateTime)qadPoNbr.createdDate,//创建日期
|
|
|
CreateUser = qadPoNbr.CREATEDBY,//创建用户
|
|
|
CreateUser = qadPoNbr.CREATEDBY,//创建用户
|
|
|
//if (wmsPoDetail.BillQty != 0 && wmsPoDetail.BillQty <= wmsPoDetail.ReceivedQty)
|
|
|
//if (wmsPoDetail.BillQty != 0 && wmsPoDetail.BillQty <= wmsPoDetail.ReceivedQty)
|
|
|
// wmsPoDetail.State = (int)FormState.关闭;
|
|
|
// wmsPoDetail.State = (int)FormState.关闭;
|
|
|
State = (int)FormState.开放, |
|
|
State = (int)FormState.开放, |
|
|
IsDeleted = false, |
|
|
IsDeleted = false, |
|
|
GUID = System.Guid.NewGuid(), |
|
|
GUID = System.Guid.NewGuid(), |
|
@ -983,14 +966,14 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
//item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
|
|
|
//item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
|
|
|
idb.xxDiMaxes_Po.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
idb.xxDiMaxes_Po.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
wdb.TB_PO.AddOrUpdate(wmsPoList.ToArray()); |
|
|
wdb.TB_PO.AddOrUpdate(wmsPoList.ToArray()); |
|
|
wdb.TB_ASK.AddOrUpdate(wmsAskList.ToArray()); |
|
|
wdb.TB_ASK.AddOrUpdate(wmsAskList.ToArray()); |
|
|
wdb.TB_PO_DETAIL.AddOrUpdate(wmsPoDetailList.ToArray()); |
|
|
wdb.TB_PO_DETAIL.AddOrUpdate(wmsPoDetailList.ToArray()); |
|
|
wdb.TB_ASK_DETAIL.AddOrUpdate(wmsAskDetailList.ToArray()); |
|
|
wdb.TB_ASK_DETAIL.AddOrUpdate(wmsAskDetailList.ToArray()); |
|
|
Console.WriteLine($"更新 采购订单 数据:{list.Count}"); |
|
|
Console.WriteLine($"更新 采购订单 数据:{list.Count}"); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@ -1247,8 +1230,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
var maxlist1 = new xxDiMaxes |
|
|
var maxlist1 = new xxDiMaxes |
|
|
{ |
|
|
{ |
|
|
Di_Batchno_part = 0, |
|
|
Di_Batchno_part = 0, |
|
|
Di_Batchno=0, |
|
|
Di_Batchno = 0, |
|
|
Di_Batchno_price=0, |
|
|
Di_Batchno_price = 0, |
|
|
Di_Batchno_NETprice = itm.DI_BATCHNO, |
|
|
Di_Batchno_NETprice = itm.DI_BATCHNO, |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
@ -1277,8 +1260,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
} |
|
|
} |
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
item.Remark = ((int) UniApiState.失败).ToString(); |
|
|
item.Remark = ((int)UniApiState.失败).ToString(); |
|
|
scpdb.TB_NetPrice.AddOrUpdate(PriceList.ToArray()); |
|
|
scpdb.TB_NetPrice.AddOrUpdate(PriceList.ToArray()); |
|
|
Console.WriteLine($"更新采购净价数据:{PriceList.Count}"); |
|
|
Console.WriteLine($"更新采购净价数据:{PriceList.Count}"); |
|
|
} |
|
|
} |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -1292,7 +1275,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_NETprice).FirstOrDefault(); |
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_NETprice).FirstOrDefault(); |
|
|
int a = max.Di_Batchno_price; |
|
|
int a = max.Di_Batchno_price; |
|
|
var FATCTORY = scpdb.TB_FACTORY.FirstOrDefault(); |
|
|
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); |
|
|
List<PURPriceDealMidTab> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURPriceDealMidTab>(b); |
|
|
var xxMaxbath = new List<xxDiMaxes>(); |
|
|
var xxMaxbath = new List<xxDiMaxes>(); |
|
|
var PriceList = new List<TB_PRICE>(); |
|
|
var PriceList = new List<TB_PRICE>(); |
|
@ -1303,7 +1286,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
Di_Batchno_part = 0, |
|
|
Di_Batchno_part = 0, |
|
|
Di_Batchno = 0, |
|
|
Di_Batchno = 0, |
|
|
Di_Batchno_price = itm.DI_BATCHNO, |
|
|
Di_Batchno_price = itm.DI_BATCHNO, |
|
|
Di_Batchno_NETprice =0, |
|
|
Di_Batchno_NETprice = 0, |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
xxMaxbath.Add(maxlist1); |
|
|
xxMaxbath.Add(maxlist1); |
|
@ -1317,7 +1300,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
Unit = itm.ordUnit, |
|
|
Unit = itm.ordUnit, |
|
|
PartCode = itm.MTLNO, |
|
|
PartCode = itm.MTLNO, |
|
|
Site = itm.plant, |
|
|
Site = itm.plant, |
|
|
StartTime =itm.validityStartPeriod, |
|
|
StartTime = itm.validityStartPeriod, |
|
|
EndTime = itm.validityEndPeriod, |
|
|
EndTime = itm.validityEndPeriod, |
|
|
}; |
|
|
}; |
|
|
_price.Amt = decimal.Parse(itm.purchasePrice); |
|
|
_price.Amt = decimal.Parse(itm.purchasePrice); |
|
@ -1341,7 +1324,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
/// <param name="idb"></param>
|
|
|
/// <param name="idb"></param>
|
|
|
/// <param name="wdb"></param>
|
|
|
/// <param name="wdb"></param>
|
|
|
/// <param name="seq"></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()); |
|
|
DataTable b = vendidpartcontroller.GetInvBatchStock(item.MaxdibatchNO.ToString()); |
|
|
List<PURVendorpartMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURVendorpartMid>(b); |
|
|
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.VendPackQty = qadData.xxqad_vp_comment;
|
|
|
//wmsData.TransportationTime = qadData.xxqad_vp_vend_lead;
|
|
|
//wmsData.TransportationTime = qadData.xxqad_vp_vend_lead;
|
|
|
wmsDataList.Add(wmsData); |
|
|
wmsDataList.Add(wmsData); |
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
item.Remark = ((int)UniApiState.成功).ToString(); |
|
|
item.MaxdibatchNO = Convert.ToInt32(qadData.DI_BATCHNO); |
|
|
item.MaxdibatchNO = Convert.ToInt32(qadData.DI_BATCHNO); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
@ -1406,7 +1389,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); |
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); |
|
|
int a = max.Di_Batchno; |
|
|
int a = max.Di_Batchno; |
|
|
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); |
|
|
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);
|
|
|
//DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO);
|
|
|
List<PURVendorMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURVendorMid>(b); |
|
|
List<PURVendorMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURVendorMid>(b); |
|
|
var wmsDataList = new List<TA_VENDER>(); |
|
|
var wmsDataList = new List<TA_VENDER>(); |
|
@ -1417,8 +1400,8 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
{ |
|
|
{ |
|
|
var maxlist1 = new xxDiMaxes |
|
|
var maxlist1 = new xxDiMaxes |
|
|
{ |
|
|
{ |
|
|
Di_Batchno_NETprice=0, |
|
|
Di_Batchno_NETprice = 0, |
|
|
Di_Batchno_price=0, |
|
|
Di_Batchno_price = 0, |
|
|
Di_Batchno_part = 0, |
|
|
Di_Batchno_part = 0, |
|
|
Di_Batchno = qadData.DI_BATCHNO, |
|
|
Di_Batchno = qadData.DI_BATCHNO, |
|
|
|
|
|
|
|
@ -1440,7 +1423,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); |
|
|
var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); |
|
|
var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == ScpCache.Config.QAD域).FirstOrDefault(); |
|
|
var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == ScpCache.Config.QAD域).FirstOrDefault(); |
|
|
//_first == null && _vend != null &&
|
|
|
//_first == null && _vend != null &&
|
|
|
if (_factory != null&& _first==null) |
|
|
if (_factory != null && _first == null) |
|
|
{ |
|
|
{ |
|
|
User _entity = new User(); |
|
|
User _entity = new User(); |
|
|
_entity.Name = vendname; |
|
|
_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(); |
|
|
TA_FACTORY f = authdb.Set<TA_FACTORY>().Local.Where(x => x.ID == _factory.ID).FirstOrDefault(); |
|
|
if (f == null) |
|
|
if (f == null) |
|
|
{ |
|
|
{ |
|
|
f = new TA_FACTORY { ID = _factory.ID }; |
|
|
f = new TA_FACTORY { ID = _factory.ID }; |
|
|
authdb.Set<TA_FACTORY>().Attach(f); |
|
|
authdb.Set<TA_FACTORY>().Attach(f); |
|
|
} |
|
|
} |
|
|
_entity.TA_FACTORY.Add(f); |
|
|
_entity.TA_FACTORY.Add(f); |
|
@ -1487,7 +1470,7 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
|
|
|
|
|
|
wdb.TA_VENDER.AddOrUpdate(p => new { p.VendId, p.Site }, wmsDataList.ToArray()); |
|
|
wdb.TA_VENDER.AddOrUpdate(p => new { p.VendId, p.Site }, wmsDataList.ToArray()); |
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
item.MaxdibatchNO = item.MaxdibatchNO +list.Count; |
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
Console.WriteLine($"更新 供应商 数据:{list.Count}"); |
|
|
Console.WriteLine($"更新 供应商 数据:{list.Count}"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -1553,22 +1536,22 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
/// <param name="idb"></param>
|
|
|
/// <param name="idb"></param>
|
|
|
/// <param name="wdb"></param>
|
|
|
/// <param name="wdb"></param>
|
|
|
/// <param name="seq"></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(); |
|
|
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_part).FirstOrDefault(); |
|
|
int a = max.Di_Batchno_part; |
|
|
int a = max.Di_Batchno_part; |
|
|
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); |
|
|
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault(); |
|
|
DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO,a, FATCTORY.FactoryId); |
|
|
DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO, a, FATCTORY.FactoryId); |
|
|
List<MMRSENDMTLDATA> list= ChangKeTec.Utils.ListHelper.DataTableToList<MMRSENDMTLDATA>(b); |
|
|
List<MMRSENDMTLDATA> list = ChangKeTec.Utils.ListHelper.DataTableToList<MMRSENDMTLDATA>(b); |
|
|
|
|
|
|
|
|
var wmsDataList = new List<TA_PART>(); |
|
|
var wmsDataList = new List<TA_PART>(); |
|
|
var xxMaxbath = new List<xxDiMaxes>(); |
|
|
var xxMaxbath = new List<xxDiMaxes>(); |
|
|
foreach (var qadData in list) |
|
|
foreach (var qadData in list) |
|
|
{ |
|
|
{ |
|
|
var maxlist1 = new xxDiMaxes |
|
|
var maxlist1 = new xxDiMaxes |
|
|
{ |
|
|
{ |
|
|
Di_Batchno_NETprice=0, |
|
|
Di_Batchno_NETprice = 0, |
|
|
Di_Batchno_price=0, |
|
|
Di_Batchno_price = 0, |
|
|
Di_Batchno_part = qadData.DI_BATCHNO, |
|
|
Di_Batchno_part = qadData.DI_BATCHNO, |
|
|
Di_Batchno = 0 |
|
|
Di_Batchno = 0 |
|
|
|
|
|
|
|
@ -1580,18 +1563,18 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
PartCode = qadData.MTLNO.ToString(), |
|
|
PartCode = qadData.MTLNO.ToString(), |
|
|
ErpPartCode = qadData.MTLNO.ToString(), |
|
|
ErpPartCode = qadData.MTLNO.ToString(), |
|
|
}; |
|
|
}; |
|
|
wmsData.PartDesc1 = qadData.MTLNODES.ToString(); |
|
|
wmsData.PartDesc1 = qadData.MTLNODES.ToString(); |
|
|
wmsData.PartDesc2 = qadData.sizes.ToString(); |
|
|
wmsData.PartDesc2 = qadData.sizes.ToString(); |
|
|
wmsData.ReceivePort = qadData.grossWeight.ToString(); |
|
|
wmsData.ReceivePort = qadData.grossWeight.ToString(); |
|
|
wmsData.PalletSize = qadData.netWeight.ToString(); |
|
|
wmsData.PalletSize = qadData.netWeight.ToString(); |
|
|
wmsData.PartGroup = qadData.MTLTYPE.ToString(); |
|
|
wmsData.PartGroup = qadData.MTLTYPE.ToString(); |
|
|
wmsData.ProjectId = qadData.MATBRAND; |
|
|
wmsData.ProjectId = qadData.MATBRAND; |
|
|
wmsData.Unit = !string.IsNullOrEmpty(qadData.MEASUREBASEUNIT) ? qadData.MEASUREBASEUNIT.ToUpper() : "EA"; |
|
|
wmsData.Unit = !string.IsNullOrEmpty(qadData.MEASUREBASEUNIT) ? qadData.MEASUREBASEUNIT.ToUpper() : "EA"; |
|
|
wmsData.Remark = qadData.stdPrice.ToString(); |
|
|
wmsData.Remark = qadData.stdPrice.ToString(); |
|
|
wmsData.ValidityDays = qadData.loadQuantity; |
|
|
wmsData.ValidityDays = qadData.loadQuantity; |
|
|
wmsData.State = !string.IsNullOrEmpty(qadData.SpMtlStatus) ? qadData.SpMtlStatus.ToUpper() : "A"; |
|
|
wmsData.State = !string.IsNullOrEmpty(qadData.SpMtlStatus) ? qadData.SpMtlStatus.ToUpper() : "A"; |
|
|
wmsData.Site = qadData.plant; |
|
|
wmsData.Site = qadData.plant; |
|
|
wmsDataList.Add(wmsData); |
|
|
wmsDataList.Add(wmsData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (wmsDataList.Count == 0) |
|
|
if (wmsDataList.Count == 0) |
|
@ -1603,10 +1586,10 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; |
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray()); |
|
|
wdb.TA_PART.AddOrUpdate(p => new { p.PartCode, p.Site }, wmsDataList.ToArray()); |
|
|
wdb.TA_PART.AddOrUpdate(p => new { p.PartCode, p.Site }, wmsDataList.ToArray()); |
|
|
Console.WriteLine($"更新 零件信息 数据:{list.Count}"); |
|
|
Console.WriteLine($"更新 零件信息 数据:{list.Count}"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|