|
@ -84,8 +84,8 @@ namespace SettleAccount.Job.Services.Report |
|
|
} |
|
|
} |
|
|
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList(); |
|
|
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList(); |
|
|
|
|
|
|
|
|
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisBBAC>>(ediSeSaCompareDiffs); |
|
|
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisHBPO>>(ediSeSaCompareDiffs); |
|
|
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBAC>(items, businessTypeDisplayName); |
|
|
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPO>(items, businessTypeDisplayName); |
|
|
|
|
|
|
|
|
var result = excelExporter.ExportAppendDataAsByteArray(); |
|
|
var result = excelExporter.ExportAppendDataAsByteArray(); |
|
|
result.ShouldNotBeNull(); |
|
|
result.ShouldNotBeNull(); |
|
@ -104,12 +104,13 @@ namespace SettleAccount.Job.Services.Report |
|
|
//结算
|
|
|
//结算
|
|
|
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>() |
|
|
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_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), |
|
@ -117,59 +118,95 @@ namespace SettleAccount.Job.Services.Report |
|
|
//发运
|
|
|
//发运
|
|
|
var seGroup = from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>() |
|
|
var seGroup = from se in _settleAccountDbContext.Set<HBPO_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), |
|
|
ToLoc = groupItem.Max(t => t.ToLoc), |
|
|
ToLoc = groupItem.Max(t => t.ToLoc), |
|
|
ErpToLoc = groupItem.Max(t => t.ErpToLoc) |
|
|
ErpToLoc = groupItem.Max(t => t.ErpToLoc) |
|
|
}; |
|
|
}; |
|
|
|
|
|
//Edi
|
|
|
|
|
|
var ediGroup = from edi in _settleAccountDbContext.Set<HBPO_SE_EDI>() |
|
|
|
|
|
where edi.IsDeleted == false && edi.IsHaveSeData == true |
|
|
|
|
|
group edi by new { edi.PN, edi.LU } into groupItem |
|
|
|
|
|
select new |
|
|
|
|
|
{ |
|
|
|
|
|
groupItem.Key.PN, |
|
|
|
|
|
groupItem.Key.LU, |
|
|
|
|
|
Qty = groupItem.Sum(t => t.Qty) |
|
|
|
|
|
}; |
|
|
|
|
|
var seEdiGroup = from se in seGroup |
|
|
|
|
|
join edi in ediGroup |
|
|
|
|
|
on new { se.PN, se.CustomerPartCodeNoSpace } equals new { edi.PN, CustomerPartCodeNoSpace = edi.LU } |
|
|
|
|
|
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 |
|
|
|
|
|
}; |
|
|
var saSeCompareLeft = from sa in saGroup |
|
|
var saSeCompareLeft = from sa in saGroup |
|
|
join se in seGroup |
|
|
join seEdi in seEdiGroup |
|
|
on new { sa.PN, sa.LU } equals new { se.PN, se.LU } |
|
|
on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { seEdi.PN, seEdi.CustomerPartCodeNoSpace } |
|
|
into temp |
|
|
into temp |
|
|
from se in temp.DefaultIfEmpty() |
|
|
from seEdi in temp.DefaultIfEmpty() |
|
|
select new SaSeEdiCompareDiff() |
|
|
select new SaSeEdiCompareDiff() |
|
|
{ |
|
|
{ |
|
|
WmsBillNum = se.WmsBillNum, |
|
|
WmsBillNum = seEdi.WmsBillNum, |
|
|
ShippingDate = se.ShippingDate, |
|
|
ShippingDate = seEdi.ShippingDate, |
|
|
CustomerOfflineTime = sa.SettleDate, |
|
|
CustomerOfflineTime = sa.SettleDate, |
|
|
PN = sa.PN, |
|
|
PN = sa.PN, |
|
|
SAQty = sa.Qty, |
|
|
SAQty = sa.Qty, |
|
|
SEQty = se.Qty, |
|
|
SEQty = seEdi.Qty, |
|
|
|
|
|
EdiQty = seEdi.EdiQty, |
|
|
FixPrice = sa.Price, |
|
|
FixPrice = sa.Price, |
|
|
ToLocCode = se.ToLoc, |
|
|
ToLocCode = seEdi.ToLoc, |
|
|
ToErpLocCode = se.ErpToLoc, |
|
|
ToErpLocCode = seEdi.ErpToLoc, |
|
|
SeCustomerPartCode = se.LU, |
|
|
SeCustomerPartCode = seEdi.CustomerPartCodeNoSpace, |
|
|
SeFactoryPartCode = se.FactoryPartCode, |
|
|
SeFactoryPartCode = seEdi.FactoryPartCode, |
|
|
SaCustomerPartCode = sa.LU, |
|
|
SaCustomerPartCode = sa.CustomerPartCodeNoSpace, |
|
|
SaFactoryPartCode = sa.PartCode |
|
|
SaFactoryPartCode = sa.PartCode, |
|
|
|
|
|
EdiCustomerPartCode = seEdi.EdiCustomerPartCode, |
|
|
|
|
|
CustomerPartCode = sa.LU |
|
|
}; |
|
|
}; |
|
|
var saSeCompareRight = from se in seGroup |
|
|
var saSeCompareRight = from seEdi in seEdiGroup |
|
|
join sa in saGroup |
|
|
join sa in saGroup |
|
|
on new { se.PN, se.LU } equals new { sa.PN, sa.LU } |
|
|
on new { seEdi.PN, seEdi.CustomerPartCodeNoSpace } equals new { sa.PN, sa.CustomerPartCodeNoSpace } |
|
|
into temp |
|
|
into temp |
|
|
from sa in temp.DefaultIfEmpty() |
|
|
from sa in temp.DefaultIfEmpty() |
|
|
select new SaSeEdiCompareDiff() |
|
|
select new SaSeEdiCompareDiff() |
|
|
{ |
|
|
{ |
|
|
WmsBillNum = se.WmsBillNum, |
|
|
WmsBillNum = seEdi.WmsBillNum, |
|
|
ShippingDate = se.ShippingDate, |
|
|
ShippingDate = seEdi.ShippingDate, |
|
|
CustomerOfflineTime = sa.SettleDate, |
|
|
CustomerOfflineTime = sa.SettleDate, |
|
|
PN = se.PN, |
|
|
PN = seEdi.PN, |
|
|
SAQty = sa.Qty, |
|
|
SAQty = sa.Qty, |
|
|
SEQty = se.Qty, |
|
|
SEQty = seEdi.Qty, |
|
|
|
|
|
EdiQty = seEdi.EdiQty, |
|
|
FixPrice = sa.Price, |
|
|
FixPrice = sa.Price, |
|
|
ToLocCode = se.ToLoc, |
|
|
ToLocCode = seEdi.ToLoc, |
|
|
ToErpLocCode = se.ErpToLoc, |
|
|
ToErpLocCode = seEdi.ErpToLoc, |
|
|
SeCustomerPartCode = se.LU, |
|
|
SeCustomerPartCode = seEdi.CustomerPartCodeNoSpace, |
|
|
SeFactoryPartCode = se.FactoryPartCode, |
|
|
SeFactoryPartCode = seEdi.FactoryPartCode, |
|
|
SaCustomerPartCode = sa.LU, |
|
|
SaCustomerPartCode = sa.CustomerPartCodeNoSpace, |
|
|
SaFactoryPartCode = sa.PartCode |
|
|
SaFactoryPartCode = sa.PartCode, |
|
|
|
|
|
EdiCustomerPartCode = seEdi.EdiCustomerPartCode, |
|
|
|
|
|
CustomerPartCode = sa.LU ?? seEdi.LU |
|
|
}; |
|
|
}; |
|
|
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); |
|
|
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); |
|
|
return saSeCompareFullJoin; |
|
|
return saSeCompareFullJoin; |
|
|