|
|
@ -95,7 +95,7 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes); |
|
|
|
//二次对比比对上的数据入库
|
|
|
|
var pubSeCDetailEntitys = _objectMapper.Map<List<SaSeCompareDiff>, List<PUB_SEC_DETAIL>>(secondMatchHaveSaHaveSes); |
|
|
|
//_settleAccountDbContext.Set<PUB_SEC_DETAIL>().AddRange(pubSeCDetailEntitys);
|
|
|
|
_settleAccountDbContext.Set<PUB_SEC_DETAIL>().AddRange(pubSeCDetailEntitys); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
@ -134,14 +134,16 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
/// 三次比对
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// 不同PN下客户零件号、数量、相同为有结算有发运数据
|
|
|
|
/// 不同PN下客户零件号、数量相同的数据为有结算有发运
|
|
|
|
/// 获取有结算无发运、无结算有发运同时存在的零件号
|
|
|
|
/// 遍历零件号
|
|
|
|
/// 判断结算无发运和无结算有发运数据 客户零件号、数量是否完全匹配
|
|
|
|
/// 完全匹配修改有结算无发运的数据类型为有结算有发运,去掉无结算有发运的数据
|
|
|
|
/// 有结算无发运的数据三次比对上的数据修改类型为有结算有发运
|
|
|
|
/// 无结算有发运的数据三次比对上的数据过滤掉
|
|
|
|
/// </remarks>
|
|
|
|
public List<SaSeCompareDiff> ThreeCompare(List<SaSeCompareDiff> saSeCompareDiffs) |
|
|
|
{ |
|
|
|
var threeMatchHaveSaHaveSes = new List<SaSeCompareDiff>(); |
|
|
|
//有结算无发运
|
|
|
|
var haveSaNotHaveSes = saSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe); |
|
|
|
//无结算有发运
|
|
|
@ -174,15 +176,43 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
foreach ((var key, var value) in matchPNs) |
|
|
|
{ |
|
|
|
//获取二次比对上的数据
|
|
|
|
var threeMatchHaveSaHaveSesItem = (from notHaveSaHaveSe in notHaveSaHaveSes.Where(t => t.PN == key) |
|
|
|
join haveSaNotHaveSe in haveSaNotHaveSes.Where(t => t.PN == value) |
|
|
|
on new { notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.ReplaceFactoryPartCode } |
|
|
|
select new SaSeCompareDiff() |
|
|
|
{ |
|
|
|
Version = haveSaNotHaveSe.Version, |
|
|
|
WmsBillNum = notHaveSaHaveSe.WmsBillNum, |
|
|
|
ShippingDate = notHaveSaHaveSe.ShippingDate, |
|
|
|
SeqNumber = notHaveSaHaveSe.SeqNumber, |
|
|
|
PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber, |
|
|
|
CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime, |
|
|
|
SAQty = haveSaNotHaveSe.SAQty, |
|
|
|
SEQty = notHaveSaHaveSe.SEQty, |
|
|
|
PN = haveSaNotHaveSe.PN, |
|
|
|
ToLocCode = notHaveSaHaveSe.ToLocCode, |
|
|
|
ToErpLocCode = notHaveSaHaveSe.ToErpLocCode, |
|
|
|
Category = EnumPubSaSeCompareCategory.HaveSaHaveSe, |
|
|
|
SeCustomerPartCode = notHaveSaHaveSe.SeCustomerPartCode, |
|
|
|
SeFactoryPartCode = notHaveSaHaveSe.SeFactoryPartCode, |
|
|
|
SaCustomerPartCode = haveSaNotHaveSe.SaCustomerPartCode, |
|
|
|
SaFactoryPartCode = haveSaNotHaveSe.SaFactoryPartCode, |
|
|
|
CustomerPartCode = haveSaNotHaveSe.CustomerPartCode, |
|
|
|
PartCodeDesc = haveSaNotHaveSe.PartCodeDesc, |
|
|
|
FactoryPartCode = haveSaNotHaveSe.FactoryPartCode, |
|
|
|
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode, |
|
|
|
IsUpdateMappingType = false |
|
|
|
}).ToList(); |
|
|
|
threeMatchHaveSaHaveSes.AddRange(threeMatchHaveSaHaveSesItem); |
|
|
|
} |
|
|
|
|
|
|
|
saSeCompareDiffs.RemoveAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe && matchPNs.ContainsKey(t.PN)); |
|
|
|
saSeCompareDiffs.RemoveAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe && matchPNs.ContainsValue(t.PN)); |
|
|
|
|
|
|
|
saSeCompareDiffs.Where(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe) |
|
|
|
.Where(t => matchPNs.ContainsValue(t.PN)).ToList() |
|
|
|
.ForEach(t => |
|
|
|
{ |
|
|
|
t.Category = EnumPubSaSeCompareCategory.HaveSaHaveSe; |
|
|
|
t.SEQty = t.SAQty; |
|
|
|
}); |
|
|
|
saSeCompareDiffs.AddRange(threeMatchHaveSaHaveSes); |
|
|
|
|
|
|
|
return saSeCompareDiffs; |
|
|
|
} |
|
|
|