Browse Source

[177] 买单件比对逻辑变更

master
mahao 1 year ago
parent
commit
3b7325b612
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDiff.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs
  3. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
  4. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs
  5. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeCompareDiff.cs

@ -118,6 +118,10 @@ namespace Win.Sfs.SettleAccount.Reports
/// 是否是当期
/// </summary>
public bool IsCurrent { get; set; }
/// <summary>
/// 是否更新匹配类型
/// </summary>
public bool IsUpdateMappingType { get; set; } = true;
}
/// <summary>

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs

@ -128,6 +128,10 @@ namespace Win.Sfs.SettleAccount.Reports
/// 是否是当期
/// </summary>
public bool IsCurrent { get; set; }
/// <summary>
/// 是否更新匹配类型
/// </summary>
public bool IsUpdateMappingType { get; set; } = true;
}
/// <summary>

50
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs

@ -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;
}

10
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

@ -250,6 +250,7 @@ namespace SettleAccount.Job.Services.Report
on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode }
select new SaSeCompareDiff()
{
Version = haveSaNotHaveSe.Version,
WmsBillNum = notHaveSaHaveSe.WmsBillNum,
ShippingDate = notHaveSaHaveSe.ShippingDate,
SeqNumber = notHaveSaHaveSe.SeqNumber,
@ -268,7 +269,8 @@ namespace SettleAccount.Job.Services.Report
CustomerPartCode = haveSaNotHaveSe.CustomerPartCode,
PartCodeDesc = haveSaNotHaveSe.PartCodeDesc,
FactoryPartCode = haveSaNotHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode,
IsUpdateMappingType = false
}).ToList();
}
else
@ -279,6 +281,7 @@ namespace SettleAccount.Job.Services.Report
on new { notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.ReplaceFactoryPartCode }
select new SaSeCompareDiff()
{
Version = haveSaNotHaveSe.Version,
WmsBillNum = notHaveSaHaveSe.WmsBillNum,
ShippingDate = notHaveSaHaveSe.ShippingDate,
SeqNumber = notHaveSaHaveSe.SeqNumber,
@ -297,7 +300,8 @@ namespace SettleAccount.Job.Services.Report
CustomerPartCode = haveSaNotHaveSe.CustomerPartCode,
PartCodeDesc = haveSaNotHaveSe.PartCodeDesc,
FactoryPartCode = haveSaNotHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode,
IsUpdateMappingType = false
}).ToList();
}
return secondMatchHaveSaHaveSes;
@ -357,7 +361,7 @@ namespace SettleAccount.Job.Services.Report
/// </remarks>
public virtual void HandleSaDetailsMain<T>(List<SaSeCompareDiff> saSeCompareDiffs, EnumBusinessType businessType, int version) where T : SA_BASE
{
var haveSaHaveSes = saSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
var haveSaHaveSes = saSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe && t.IsUpdateMappingType == true);
if (haveSaHaveSes.Any())
{
//结算详情

6
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

@ -116,6 +116,7 @@ namespace SettleAccount.Job.Services.Report
on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode }
select new SaSeEdiCompareDiff()
{
Version = haveSaNotHaveSe.Version,
Category = EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi,
WmsBillNum = notHaveSaHaveSe.WmsBillNum,
ShippingDate = notHaveSaHaveSe.ShippingDate,
@ -138,7 +139,8 @@ namespace SettleAccount.Job.Services.Report
CustomerPartCode = haveSaNotHaveSe.CustomerPartCode,
PartCodeDesc = haveSaNotHaveSe.PartCodeDesc,
FactoryPartCode = haveSaNotHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode,
IsUpdateMappingType = false
}).ToList();
return secondMatchHaveSaHaveSes;
}
@ -197,7 +199,7 @@ namespace SettleAccount.Job.Services.Report
/// </remarks>
public virtual void HandleSaDetailsMain<T>(List<SaSeEdiCompareDiff> saSeEdiCompareDiff, EnumBusinessType businessType, int version) where T : SA_BASE
{
var haveSaHaveSes = saSeEdiCompareDiff.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi);
var haveSaHaveSes = saSeEdiCompareDiff.FindAll(t => (t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi) && t.IsUpdateMappingType == true);
if (haveSaHaveSes.Any())
{
//结算详情

Loading…
Cancel
Save