Browse Source

EDI数据处理

master
zhouhongjun 8 months ago
parent
commit
d666163420
  1. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  2. 64
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs

18
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs

@ -219,7 +219,7 @@ namespace SettleAccount.Job.Services.Report
// LU = groupItem.Max(t => t.LU)
// };
var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == true
where edi.IsDeleted == false
group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem
select new
{
@ -300,6 +300,22 @@ namespace SettleAccount.Job.Services.Report
Price = sa.Price
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
var ediCheck = ediGroup.ToList();
foreach (var item in saSeCompareFullJoin.Where(p => p.SaCustomerPartCode != null && p.SeCustomerPartCode == null))
{
if (!string.IsNullOrEmpty(item.SaCustomerPartCode) && string.IsNullOrEmpty(item.SeCustomerPartCode))
{
var ediEntity = ediCheck.FirstOrDefault(p => p.PN == item.PN && p.CustomerPartCodeNoSpace == item.SaCustomerPartCode);
if (ediEntity != null)
{
item.EdiCustomerPartCode = item.SaCustomerPartCode;
item.EdiQty = ediEntity.Qty;
}
}
}
return saSeCompareFullJoin;
}
#endregion

64
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs

@ -212,7 +212,7 @@ namespace SettleAccount.Job.Services.Report
// LU = groupItem.Max(t => t.LU)
// };
var ediGroup = from edi in _settleAccountDbContext.Set<HBPO_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == true
where edi.IsDeleted == false
group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem
select new
{
@ -222,11 +222,31 @@ namespace SettleAccount.Job.Services.Report
LU = groupItem.Max(t => t.LU)
};
//var seEdiGroup = from se in seGroup
// join edi in ediGroup
// on new { se.PN, se.CustomerPartCodeNoSpace } equals new { edi.PN, edi.CustomerPartCodeNoSpace }
// into ediTemp
// from edi in ediTemp.DefaultIfEmpty()
// select new
// {
// se.PN,
// se.CustomerPartCodeNoSpace,
// se.Qty,
// se.LU,
// se.WmsBillNum,
// se.ShippingDate,
// se.FactoryPartCode,
// se.ToLoc,
// se.ErpToLoc,
// EdiQty = edi.Qty,
// EdiCustomerPartCode = edi.LU
// };
//发运和EDI正反比对20240327
var seEdiGroup = from se in seGroup
join edi in ediGroup
on new { se.PN, se.CustomerPartCodeNoSpace } equals new { edi.PN, edi.CustomerPartCodeNoSpace }
into ediTemp
from edi in ediTemp.DefaultIfEmpty()
into Temp
from edi in Temp.DefaultIfEmpty()
select new
{
se.PN,
@ -241,6 +261,30 @@ namespace SettleAccount.Job.Services.Report
EdiQty = edi.Qty,
EdiCustomerPartCode = edi.LU
};
//var ediSeGroup = from edi in ediGroup
// join se in seGroup
// on new { edi.PN, edi.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace }
// into Temp
// from se in Temp.DefaultIfEmpty()
// select new
// {
// edi.PN,
// edi.CustomerPartCodeNoSpace,
// edi.Qty,
// edi.LU,
// se.WmsBillNum,
// se.ShippingDate,
// se.FactoryPartCode,
// se.ToLoc,
// se.ErpToLoc,
// EdiQty = edi.Qty,
// EdiCustomerPartCode = edi.LU
// };
var saSeCompareLeft = from sa in saGroup
join seEdi in seEdiGroup
on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { seEdi.PN, seEdi.CustomerPartCodeNoSpace }
@ -294,6 +338,20 @@ namespace SettleAccount.Job.Services.Report
Price = sa.Price
};
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
var ediCheck= ediGroup.ToList();
foreach (var item in saSeCompareFullJoin.Where(p=>p.SaCustomerPartCode!=null && p.SeCustomerPartCode==null))
{
if(!string.IsNullOrEmpty(item.SaCustomerPartCode)&& string.IsNullOrEmpty(item.SeCustomerPartCode))
{
var ediEntity= ediCheck.FirstOrDefault(p=>p.PN== item.PN &&p.CustomerPartCodeNoSpace== item.SaCustomerPartCode);
if(ediEntity!=null)
{
item.EdiCustomerPartCode = item.SaCustomerPartCode;
item.EdiQty = ediEntity.Qty;
}
}
}
return saSeCompareFullJoin;
}
#endregion

Loading…
Cancel
Save