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