|
|
@ -226,12 +226,13 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
//结算
|
|
|
|
var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>() |
|
|
|
where sa.BusinessType == businessType && sa.Version == version |
|
|
|
group sa by new { sa.PN, sa.LU } into groupItem |
|
|
|
group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem |
|
|
|
select new |
|
|
|
{ |
|
|
|
groupItem.Key.PN, |
|
|
|
groupItem.Key.LU, |
|
|
|
groupItem.Key.CustomerPartCodeNoSpace, |
|
|
|
Qty = groupItem.Sum(t => t.Qty), |
|
|
|
LU = groupItem.Max(t => t.LU), |
|
|
|
Price = groupItem.Max(t => t.Price), |
|
|
|
SettleDate = groupItem.Max(t => t.SettleDate), |
|
|
|
PartCode = groupItem.Max(t => t.PartCode), |
|
|
@ -239,12 +240,13 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
//发运
|
|
|
|
var seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>() |
|
|
|
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime |
|
|
|
group se by new { se.PN, se.LU } into groupItem |
|
|
|
group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem |
|
|
|
select new |
|
|
|
{ |
|
|
|
groupItem.Key.PN, |
|
|
|
groupItem.Key.LU, |
|
|
|
groupItem.Key.CustomerPartCodeNoSpace, |
|
|
|
Qty = groupItem.Sum(t => t.Qty), |
|
|
|
LU = groupItem.Max(t => t.LU), |
|
|
|
WmsBillNum = groupItem.Max(t => t.WmsBillNum), |
|
|
|
ShippingDate = groupItem.Max(t => t.ShippingDate), |
|
|
|
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), |
|
|
@ -253,7 +255,7 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
}; |
|
|
|
var saSeCompareLeft = from sa in saGroup |
|
|
|
join se in seGroup |
|
|
|
on new { sa.PN, sa.LU } equals new { se.PN, se.LU } |
|
|
|
on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace } |
|
|
|
into temp |
|
|
|
from se in temp.DefaultIfEmpty() |
|
|
|
select new PubSaSeCompareDiff() |
|
|
@ -267,14 +269,15 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
FixPrice = sa.Price, |
|
|
|
ToLocCode = se.ToLocCode, |
|
|
|
ToErpLocCode = se.ToErpLocCode, |
|
|
|
SeCustomerPartCode = se.LU, |
|
|
|
SeCustomerPartCode = se.CustomerPartCodeNoSpace, |
|
|
|
SeFactoryPartCode = se.FactoryPartCode, |
|
|
|
SaCustomerPartCode = sa.LU, |
|
|
|
SaFactoryPartCode = sa.PartCode |
|
|
|
SaCustomerPartCode = sa.CustomerPartCodeNoSpace, |
|
|
|
SaFactoryPartCode = sa.PartCode, |
|
|
|
CustomerPartCode = sa.LU |
|
|
|
}; |
|
|
|
var saSeCompareRight = from se in seGroup |
|
|
|
join sa in saGroup |
|
|
|
on new { se.PN, se.LU } equals new { sa.PN, sa.LU } |
|
|
|
on new { se.PN, se.CustomerPartCodeNoSpace } equals new { sa.PN, sa.CustomerPartCodeNoSpace } |
|
|
|
into temp |
|
|
|
from sa in temp.DefaultIfEmpty() |
|
|
|
select new PubSaSeCompareDiff() |
|
|
@ -288,10 +291,11 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
FixPrice = sa.Price, |
|
|
|
ToLocCode = se.ToLocCode, |
|
|
|
ToErpLocCode = se.ToErpLocCode, |
|
|
|
SeCustomerPartCode = se.LU, |
|
|
|
SeCustomerPartCode = se.CustomerPartCodeNoSpace, |
|
|
|
SeFactoryPartCode = se.FactoryPartCode, |
|
|
|
SaCustomerPartCode = sa.LU, |
|
|
|
SaFactoryPartCode = sa.PartCode |
|
|
|
SaCustomerPartCode = sa.CustomerPartCodeNoSpace, |
|
|
|
SaFactoryPartCode = sa.PartCode, |
|
|
|
CustomerPartCode = sa.LU ?? se.LU |
|
|
|
}; |
|
|
|
|
|
|
|
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); |
|
|
@ -305,22 +309,24 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
{ |
|
|
|
var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>() |
|
|
|
where sa.BusinessType == EnumBusinessType.YinDuJian && sa.Version == version |
|
|
|
group sa by new { sa.LU } into groupItem |
|
|
|
group sa by new { sa.CustomerPartCodeNoSpace } into groupItem |
|
|
|
select new |
|
|
|
{ |
|
|
|
groupItem.Key.LU, |
|
|
|
groupItem.Key.CustomerPartCodeNoSpace, |
|
|
|
Qty = groupItem.Sum(t => t.Qty), |
|
|
|
LU = groupItem.Max(t => t.LU), |
|
|
|
Price = groupItem.Max(t => t.Price), |
|
|
|
SettleDate = groupItem.Max(t => t.SettleDate), |
|
|
|
PartCode = groupItem.Max(t => t.PartCode), |
|
|
|
}; |
|
|
|
var seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>() |
|
|
|
where se.BusinessType == EnumBusinessType.YinDuJian && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime |
|
|
|
group se by new { se.LU } into groupItem |
|
|
|
group se by new { se.CustomerPartCodeNoSpace } into groupItem |
|
|
|
select new |
|
|
|
{ |
|
|
|
groupItem.Key.LU, |
|
|
|
groupItem.Key.CustomerPartCodeNoSpace, |
|
|
|
Qty = groupItem.Sum(t => t.Qty), |
|
|
|
LU = groupItem.Max(t => t.LU), |
|
|
|
WmsBillNum = groupItem.Max(t => t.WmsBillNum), |
|
|
|
ShippingDate = groupItem.Max(t => t.ShippingDate), |
|
|
|
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), |
|
|
@ -330,7 +336,7 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
|
|
|
|
var saSeCompareLeft = from sa in saGroup |
|
|
|
join se in seGroup |
|
|
|
on sa.LU equals se.LU |
|
|
|
on sa.CustomerPartCodeNoSpace equals se.CustomerPartCodeNoSpace |
|
|
|
into temp |
|
|
|
from se in temp.DefaultIfEmpty() |
|
|
|
select new PubSaSeCompareDiff() |
|
|
@ -343,14 +349,15 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
FixPrice = sa.Price, |
|
|
|
ToLocCode = se.ToLocCode, |
|
|
|
ToErpLocCode = se.ToErpLocCode, |
|
|
|
SeCustomerPartCode = se.LU, |
|
|
|
SeCustomerPartCode = se.CustomerPartCodeNoSpace, |
|
|
|
SeFactoryPartCode = se.FactoryPartCode, |
|
|
|
SaCustomerPartCode = sa.LU, |
|
|
|
SaFactoryPartCode = sa.PartCode |
|
|
|
SaCustomerPartCode = sa.CustomerPartCodeNoSpace, |
|
|
|
SaFactoryPartCode = sa.PartCode, |
|
|
|
CustomerPartCode = sa.LU |
|
|
|
}; |
|
|
|
var saSeCompareRight = from se in seGroup |
|
|
|
join sa in saGroup |
|
|
|
on se.LU equals sa.LU |
|
|
|
on se.CustomerPartCodeNoSpace equals sa.CustomerPartCodeNoSpace |
|
|
|
into temp |
|
|
|
from sa in temp.DefaultIfEmpty() |
|
|
|
select new PubSaSeCompareDiff() |
|
|
@ -363,10 +370,11 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
FixPrice = sa.Price, |
|
|
|
ToLocCode = se.ToLocCode, |
|
|
|
ToErpLocCode = se.ToErpLocCode, |
|
|
|
SeCustomerPartCode = se.LU, |
|
|
|
SeCustomerPartCode = se.CustomerPartCodeNoSpace, |
|
|
|
SeFactoryPartCode = se.FactoryPartCode, |
|
|
|
SaCustomerPartCode = sa.LU, |
|
|
|
SaFactoryPartCode = sa.PartCode |
|
|
|
SaCustomerPartCode = sa.CustomerPartCodeNoSpace, |
|
|
|
SaFactoryPartCode = sa.PartCode, |
|
|
|
CustomerPartCode = sa.LU ?? se.LU |
|
|
|
}; |
|
|
|
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); |
|
|
|
return saSeCompareFullJoin; |
|
|
|