|
@ -795,47 +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 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 && p.PartCode == _entity.mtlNO ).ToList(); |
|
|
var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO && p.PartCode == _entity.mtlNO).ToList(); |
|
|
askdetaill.ForEach(p => |
|
|
askdetaill.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = -1; |
|
|
p.State = -1; |
|
|
p.IsDeleted = true; |
|
|
p.IsDeleted = true; |
|
|
wmsAskDetailList.Add(p); |
|
|
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 |
|
|
{ |
|
|
{ |
|
@ -860,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; |
|
@ -883,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; |
|
|
} |
|
|
} |
|
@ -898,7 +878,7 @@ 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) |
|
|
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 |
|
@ -941,7 +921,7 @@ 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 |
|
@ -1248,8 +1228,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, |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
@ -1278,7 +1258,7 @@ 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}"); |
|
|
} |
|
|
} |
|
@ -1293,7 +1273,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>(); |
|
@ -1304,7 +1284,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); |
|
@ -1318,7 +1298,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); |
|
@ -1342,7 +1322,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); |
|
@ -1407,7 +1387,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>(); |
|
@ -1418,8 +1398,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, |
|
|
|
|
|
|
|
@ -1441,7 +1421,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; |
|
@ -1488,7 +1468,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}"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -1554,13 +1534,13 @@ 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>(); |
|
@ -1568,8 +1548,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 = qadData.DI_BATCHNO, |
|
|
Di_Batchno_part = qadData.DI_BATCHNO, |
|
|
Di_Batchno = 0 |
|
|
Di_Batchno = 0 |
|
|
|
|
|
|
|
@ -1610,4 +1590,4 @@ namespace CK.SCP.GrupUniApi.Controller |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|