|
@ -66,373 +66,118 @@ namespace SettleAccount.Job.Services.Report |
|
|
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; |
|
|
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; |
|
|
var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; |
|
|
var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; |
|
|
var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; |
|
|
var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; |
|
|
var seStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; |
|
|
var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; |
|
|
var seEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value; |
|
|
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value; |
|
|
|
|
|
|
|
|
|
|
|
var seStartDateTime = DateTime.Parse(strSeStartDateTime); |
|
|
|
|
|
var seEndDateTime = DateTime.Parse(strSeEndDateTime); |
|
|
var filename = exportName.FirstOrDefault(); |
|
|
var filename = exportName.FirstOrDefault(); |
|
|
|
|
|
|
|
|
//有EDI无发运
|
|
|
//有EDI无发运
|
|
|
var haveEdiNotHaveSe = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false) |
|
|
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false) |
|
|
.GroupBy(t => new { t.LU, t.PN }) |
|
|
.GroupBy(t => new { t.LU, t.PN }) |
|
|
.Select(t => new JisBBACEidSeCompareExport() |
|
|
.Select(t => new JisBBACEidSeCompareExport() |
|
|
{ |
|
|
{ |
|
|
Category = "JIS", |
|
|
Category = "JIS", |
|
|
WmsBillNum = default, |
|
|
|
|
|
CarModeCode = default, |
|
|
CarModeCode = default, |
|
|
LineStationcode = default, |
|
|
LineStationcode = default, |
|
|
SequenceNumber = default, |
|
|
SequenceNumber = t.Max(t => t.SeqNumber), |
|
|
ParType = default, |
|
|
ParType = "01", |
|
|
MESConfigCode = default, |
|
|
EdiQty = t.Sum(t => t.Qty), |
|
|
ShippingDate = null, |
|
|
AssemblyDate = default, |
|
|
PN = default, |
|
|
|
|
|
序列号 = default, |
|
|
|
|
|
PJIS日顺序号 = default, |
|
|
|
|
|
MaterialNumber = default, |
|
|
|
|
|
MaterialDes = default, |
|
|
|
|
|
SEQty = default, |
|
|
|
|
|
EdiQty = default, |
|
|
|
|
|
DiffQty = default, |
|
|
|
|
|
AssemblyDate = null, |
|
|
|
|
|
MatchNumber = default, |
|
|
MatchNumber = default, |
|
|
InjectionCode = default, |
|
|
MateType = "否", |
|
|
MateType = default, |
|
|
DiffDesc = "WMS漏发货EDI有订单" |
|
|
DiffDesc = default |
|
|
|
|
|
}).ToList(); |
|
|
}).ToList(); |
|
|
//无EDI有发运
|
|
|
//无EDI有发运
|
|
|
var notHaveEdiHaveSe = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false) |
|
|
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false) |
|
|
.GroupBy(t => new { t.LU, t.PN }) |
|
|
.GroupBy(t => new { t.LU, t.PN }) |
|
|
.Select(t => new JisBBACEidSeCompareExport() |
|
|
.Select(t => new JisBBACEidSeCompareExport() |
|
|
{ |
|
|
{ |
|
|
Category = default, |
|
|
Category = "JIS", |
|
|
WmsBillNum = default, |
|
|
WmsBillNum = t.Max(t => t.BillNum), |
|
|
|
|
|
MESConfigCode = t.Max(t => t.MESConfigCode), |
|
|
|
|
|
ShippingDate = t.Max(t => t.BillTime), |
|
|
|
|
|
PN = t.Max(t => t.PN), |
|
|
|
|
|
Seq = t.Max(t => t.Seq), |
|
|
|
|
|
PjsNum = t.Max(t => t.PjsNum), |
|
|
|
|
|
MaterialNumber = t.Max(t => t.CustPartCode), |
|
|
|
|
|
MaterialDes = t.Max(t => t.PartDesc), |
|
|
|
|
|
SEQty = t.Sum(t => t.Qty), |
|
|
|
|
|
InjectionCode = t.Max(t => t.InjectionCode), |
|
|
|
|
|
MateType = "否", |
|
|
|
|
|
DiffDesc = "WMS有发货EDI无订单" |
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
//有EDI有发运
|
|
|
|
|
|
var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_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), |
|
|
|
|
|
SeqNumber = groupItem.Max(t => t.SeqNumber) |
|
|
|
|
|
}; |
|
|
|
|
|
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>() |
|
|
|
|
|
where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime |
|
|
|
|
|
group se by new { se.PN, se.LU } into groupItem |
|
|
|
|
|
select new |
|
|
|
|
|
{ |
|
|
|
|
|
groupItem.Key.PN, |
|
|
|
|
|
groupItem.Key.LU, |
|
|
|
|
|
Qty = groupItem.Sum(t => t.Qty), |
|
|
|
|
|
BillNum = groupItem.Max(t => t.BillNum), |
|
|
|
|
|
MESConfigCode = groupItem.Max(t => t.MESConfigCode), |
|
|
|
|
|
BillTime = groupItem.Max(t => t.BillTime), |
|
|
|
|
|
Seq = groupItem.Max(t => t.Seq), |
|
|
|
|
|
PjsNum = groupItem.Max(t => t.PjsNum), |
|
|
|
|
|
CustPartCode = groupItem.Max(t => t.CustPartCode), |
|
|
|
|
|
PartDesc = groupItem.Max(t => t.PartDesc), |
|
|
|
|
|
InjectionCode = groupItem.Max(t => t.InjectionCode) |
|
|
|
|
|
}; |
|
|
|
|
|
var haveEdiHaveSeList = (from edi in ediGroup |
|
|
|
|
|
join se in seGroup |
|
|
|
|
|
on new { edi.PN, edi.LU } equals new { se.PN, se.LU } |
|
|
|
|
|
//where edi.IsDeleted == false && edi.IsHaveSeData == true && se.IsHaveEdiData == true
|
|
|
|
|
|
select new JisBBACEidSeCompareExport() |
|
|
|
|
|
{ |
|
|
|
|
|
Category = "JIS", |
|
|
|
|
|
WmsBillNum = se.BillNum, |
|
|
CarModeCode = default, |
|
|
CarModeCode = default, |
|
|
LineStationcode = default, |
|
|
LineStationcode = default, |
|
|
SequenceNumber = default, |
|
|
SequenceNumber = edi.SeqNumber, |
|
|
ParType = default, |
|
|
ParType = "01", |
|
|
MESConfigCode = default, |
|
|
MESConfigCode = se.MESConfigCode, |
|
|
ShippingDate = null, |
|
|
ShippingDate = se.BillTime, |
|
|
PN = default, |
|
|
PN = se.PN, |
|
|
序列号 = default, |
|
|
Seq = se.Seq, |
|
|
PJIS日顺序号 = default, |
|
|
PjsNum = se.PjsNum, |
|
|
MaterialNumber = default, |
|
|
MaterialNumber = se.CustPartCode, |
|
|
MaterialDes = default, |
|
|
MaterialDes = se.PartDesc, |
|
|
SEQty = default, |
|
|
SEQty = se.Qty, |
|
|
EdiQty = default, |
|
|
EdiQty = edi.Qty, |
|
|
DiffQty = default, |
|
|
AssemblyDate = default, |
|
|
AssemblyDate = null, |
|
|
|
|
|
MatchNumber = default, |
|
|
MatchNumber = default, |
|
|
InjectionCode = default, |
|
|
InjectionCode = se.InjectionCode, |
|
|
MateType = default, |
|
|
MateType = se.Qty == edi.Qty ? "是" : "否", |
|
|
DiffDesc = default |
|
|
DiffDesc = "WMS有发货EDI有订单" |
|
|
}).ToList(); |
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList); |
|
|
// //有EDI的发运数据
|
|
|
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList); |
|
|
// //var haveEidSesGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t =>
|
|
|
|
|
|
// //t.First().SetQty(t.Sum(q => q.Qty))).ToList();
|
|
|
|
|
|
// var seDetailGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
// // var haveEidSesGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t =>
|
|
|
|
|
|
// //t.FirstOrDefault()).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
// var dddd = new JisBBACEidSeCompareExport()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Category = default,
|
|
|
|
|
|
// WmsBillNum = default,
|
|
|
|
|
|
// CarModeCode = default,
|
|
|
|
|
|
// LineStationcode = default,
|
|
|
|
|
|
// SequenceNumber = default,
|
|
|
|
|
|
// ParType = default,
|
|
|
|
|
|
// MESConfigCode = default,
|
|
|
|
|
|
// ShippingDate = default,
|
|
|
|
|
|
// PN = default,
|
|
|
|
|
|
// 序列号 = default,
|
|
|
|
|
|
// PJIS日顺序号 = default,
|
|
|
|
|
|
// MaterialNumber = default,
|
|
|
|
|
|
// MaterialDes = default,
|
|
|
|
|
|
// SEQty = default,
|
|
|
|
|
|
// EdiQty = default,
|
|
|
|
|
|
// DiffQty = default,
|
|
|
|
|
|
// AssemblyDate = default,
|
|
|
|
|
|
// MatchNumber = default,
|
|
|
|
|
|
// InjectionCode = default,
|
|
|
|
|
|
// MateType = default,
|
|
|
|
|
|
// DiffDesc = default
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
// var haveEidSesGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new JisBBACEidSeCompareExport()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Category = default,
|
|
|
|
|
|
// WmsBillNum = default,
|
|
|
|
|
|
// CarModeCode = default,
|
|
|
|
|
|
// LineStationcode = default,
|
|
|
|
|
|
// SequenceNumber = default,
|
|
|
|
|
|
// ParType = default,
|
|
|
|
|
|
// MESConfigCode = default,
|
|
|
|
|
|
// ShippingDate = default,
|
|
|
|
|
|
// PN = default,
|
|
|
|
|
|
// 序列号 = default,
|
|
|
|
|
|
// PJIS日顺序号 = default,
|
|
|
|
|
|
// MaterialNumber = default,
|
|
|
|
|
|
// MaterialDes = default,
|
|
|
|
|
|
// SEQty = default,
|
|
|
|
|
|
// EdiQty = default,
|
|
|
|
|
|
// DiffQty = default,
|
|
|
|
|
|
// AssemblyDate = default,
|
|
|
|
|
|
// MatchNumber = default,
|
|
|
|
|
|
// InjectionCode = default,
|
|
|
|
|
|
// MateType = default,
|
|
|
|
|
|
// DiffDesc = default
|
|
|
|
|
|
// }).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
// var haveEidSesGroup22 = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true)?.GroupBy(t => new { t.PN, t.LU }).Select(t =>
|
|
|
|
|
|
//t.FirstOrDefault()).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//有发运的EDI数据
|
|
|
|
|
|
//var haveSeEidsGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => t.First().SetQty(t.Sum(q => q.Qty))).ToList();
|
|
|
|
|
|
//var haveSeEidsGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => t.First()).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//var haveEidHaveSes = from se in haveEidSesGroup
|
|
|
|
|
|
// join edi in haveSeEidsGroup
|
|
|
|
|
|
// on new { se.PN, se.LU } equals new { edi.PN, edi.LU }
|
|
|
|
|
|
// select new JisBBACEidSeCompareExport()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Category = default,
|
|
|
|
|
|
// WmsBillNum = default,
|
|
|
|
|
|
// CarModeCode = default,
|
|
|
|
|
|
// LineStationcode = default,
|
|
|
|
|
|
// SequenceNumber = default,
|
|
|
|
|
|
// ParType = default,
|
|
|
|
|
|
// MESConfigCode = default,
|
|
|
|
|
|
// ShippingDate = default,
|
|
|
|
|
|
// PN = default,
|
|
|
|
|
|
// 序列号 = default,
|
|
|
|
|
|
// PJIS日顺序号 = default,
|
|
|
|
|
|
// MaterialNumber = default,
|
|
|
|
|
|
// MaterialDes = default,
|
|
|
|
|
|
// SEQty = default,
|
|
|
|
|
|
// EdiQty = default,
|
|
|
|
|
|
// DiffQty = default,
|
|
|
|
|
|
// AssemblyDate = default,
|
|
|
|
|
|
// MatchNumber = default,
|
|
|
|
|
|
// InjectionCode = default,
|
|
|
|
|
|
// MateType = default,
|
|
|
|
|
|
// DiffDesc = default
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
////无EDI的发运数据
|
|
|
|
|
|
//var notHaveEidSes = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false);
|
|
|
|
|
|
////无发运的EDI数据
|
|
|
|
|
|
//var notHaveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false);
|
|
|
|
|
|
|
|
|
|
|
|
//var jisBBACEidSeCompareExports = new List<JisBBACEidSeCompareExport>();
|
|
|
|
|
|
////有EDI无发运
|
|
|
|
|
|
//var haveEdiNotHaveSeCompareExports = haveEidHaveSes.ToList();
|
|
|
|
|
|
////无EDI有发运
|
|
|
|
|
|
//var notHaveEdiHaveSeCompareExports = haveEidHaveSes.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
ExcelExporter excelExporter = new ExcelExporter(); |
|
|
ExcelExporter excelExporter = new ExcelExporter(); |
|
|
excelExporter |
|
|
excelExporter |
|
|
.Append(haveEdiNotHaveSe.ToList(), $"BBACEDI数据和发货对比") |
|
|
.Append(haveEdiNotHaveSeList, $"BBACEDI数据和发货对比") |
|
|
.SeparateBySheet() |
|
|
.SeparateBySheet() |
|
|
.Append(notHaveEdiHaveSe.ToList(), $"BBAC发货和EDI数据对比") |
|
|
.Append(notHaveEdiHaveSeList, $"BBAC发货和EDI数据对比"); |
|
|
.SeparateBySheet(); |
|
|
|
|
|
|
|
|
|
|
|
var result = excelExporter.ExportAppendDataAsByteArray(); |
|
|
var result = excelExporter.ExportAppendDataAsByteArray(); |
|
|
result.ShouldNotBeNull(); |
|
|
result.ShouldNotBeNull(); |
|
|
_fileContainer.SaveAsync(filename, result.Result, true); |
|
|
_fileContainer.SaveAsync(filename, result.Result, true); |
|
|
|
|
|
|
|
|
//Notify();
|
|
|
Notify(); |
|
|
return id.ToString(); |
|
|
|
|
|
|
|
|
|
|
|
var ids = id.ToString(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var seDetailGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
|
|
|
|
|
|
//var ediDetailGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
|
|
|
|
|
|
//var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se.PN, se.LU });
|
|
|
|
|
|
//var seDetails = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
|
|
|
|
|
|
//var ediDetails = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////有EDI有发运
|
|
|
|
|
|
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
|
|
|
|
|
|
////有EDI无发运
|
|
|
|
|
|
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
|
|
|
|
|
|
////无EDI有发运
|
|
|
|
|
|
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//seDetails.ForEach(t => t.IsHaveEdiData = true);
|
|
|
|
|
|
//ediDetails.ForEach(t => t.IsHaveSeData = true);
|
|
|
|
|
|
//db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails);
|
|
|
|
|
|
//db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails);
|
|
|
|
|
|
//await db.SaveChangesAsync().ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
//EnumBusinessType businessType = (EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), strBusinessType);
|
|
|
|
|
|
//var businessTypeDisplayName = businessType.ToString();
|
|
|
|
|
|
//DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
|
|
|
|
|
|
//if (attributeOfType != null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// businessTypeDisplayName = attributeOfType.Name;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//var filename = exportName.FirstOrDefault();
|
|
|
|
|
|
//var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
|
|
|
|
|
|
|
|
|
|
|
|
//pubSaSeCompareDiffs.ForEach(p =>
|
|
|
|
|
|
//{
|
|
|
|
|
|
// p.Category = (string.IsNullOrEmpty(p.SaLU), string.IsNullOrEmpty(p.SeLU)) switch
|
|
|
|
|
|
// {
|
|
|
|
|
|
// (false, false) => EnumPubSaSeCompareCategory.HaveSaHaveSe,
|
|
|
|
|
|
// (false, true) => EnumPubSaSeCompareCategory.HaveSaNotHaveSe,
|
|
|
|
|
|
// (true, false) => EnumPubSaSeCompareCategory.NotHaveSaHaveSe,
|
|
|
|
|
|
// _ => EnumPubSaSeCompareCategory.None,
|
|
|
|
|
|
// };
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
////有结算有发运
|
|
|
|
|
|
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
|
|
|
|
|
|
////有结算无发运
|
|
|
|
|
|
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
|
|
|
|
|
|
////无结算有发运
|
|
|
|
|
|
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
|
|
|
|
|
|
////二次匹配上的记录
|
|
|
|
|
|
//var secondMatchHaveSaHaveSes = new List<PubSaSeCompareDiff>();
|
|
|
|
|
|
|
|
|
|
|
|
//haveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
|
|
|
|
|
|
//haveSaNotHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
|
|
|
|
|
|
//notHaveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SeLU);
|
|
|
|
|
|
|
|
|
|
|
|
//#region 二次对比
|
|
|
|
|
|
////二次对比(替换零件号)
|
|
|
|
|
|
//var repLUs = notHaveSaHaveSes.Select(t => t.SeLU).Distinct().ToList();
|
|
|
|
|
|
//var tbRePartsRelationships = _tbRePartsRelationshipRepository.GetListAsync(t => repLUs.Contains(t.RepLU) && t.BusinessType == businessType).Result;
|
|
|
|
|
|
|
|
|
|
|
|
//tbRePartsRelationships.ForEach(tbRePartsRelationship =>
|
|
|
|
|
|
//{
|
|
|
|
|
|
// notHaveSaHaveSes.FindAll(t => t.SeLU == tbRePartsRelationship.RepLU).ForEach(t =>
|
|
|
|
|
|
// {
|
|
|
|
|
|
// t.ReplaceLU = tbRePartsRelationship.LU;
|
|
|
|
|
|
// });
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
//var haveSaNotHaveSeLUPNs = haveSaNotHaveSes.Select(t => new { t.ReplaceLU, t.PN });
|
|
|
|
|
|
//var notHaveSaHaveSeLUPNs = notHaveSaHaveSes.Select(t => new { t.ReplaceLU, t.PN });
|
|
|
|
|
|
////二次匹配 匹配上的零件号
|
|
|
|
|
|
//var secondMatchLUPNs = haveSaNotHaveSeLUPNs.Intersect(notHaveSaHaveSeLUPNs);
|
|
|
|
|
|
//if (secondMatchLUPNs.Any() == true)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pubSaSeCompareDiffs.RemoveAll<PubSaSeCompareDiff>(t => secondMatchLUPNs.Contains(new { t.ReplaceLU, t.PN }));
|
|
|
|
|
|
|
|
|
|
|
|
// foreach (var secondMatchLUPN in secondMatchLUPNs)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var haveSaNotHaveSe = haveSaNotHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
|
|
|
|
|
|
// var notHaveSaHaveSe = notHaveSaHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
|
|
|
|
|
|
// secondMatchHaveSaHaveSes.Add(new PubSaSeCompareDiff()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// WmsBillNum = notHaveSaHaveSe.WmsBillNum,
|
|
|
|
|
|
// ShippingDate = notHaveSaHaveSe.ShippingDate,
|
|
|
|
|
|
// SeqNumber = notHaveSaHaveSe.SeqNumber,
|
|
|
|
|
|
// PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
|
|
|
|
|
|
// MaterialNumber = haveSaNotHaveSe.MaterialNumber,
|
|
|
|
|
|
// MaterialDes = haveSaNotHaveSe.MaterialDes,
|
|
|
|
|
|
// CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
|
|
|
|
|
|
// SAQty = haveSaNotHaveSe.SAQty,
|
|
|
|
|
|
// SEQty = notHaveSaHaveSe.SEQty,
|
|
|
|
|
|
// MateType = haveSaNotHaveSe.MateType,
|
|
|
|
|
|
// FixPrice = haveSaNotHaveSe.FixPrice,
|
|
|
|
|
|
// PrimitiveLU = haveSaNotHaveSe.PrimitiveLU,
|
|
|
|
|
|
// ReplaceLU = haveSaNotHaveSe.ReplaceLU,
|
|
|
|
|
|
// SeLU = notHaveSaHaveSe.SeLU,
|
|
|
|
|
|
// SaLU = haveSaNotHaveSe.SaLU,
|
|
|
|
|
|
// PN = haveSaNotHaveSe.PN,
|
|
|
|
|
|
// Category = EnumPubSaSeCompareCategory.HaveSaHaveSe,
|
|
|
|
|
|
// IsRemove = false
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
////二次对比比对上的数据入库
|
|
|
|
|
|
//if (secondMatchHaveSaHaveSes.Count > 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
|
|
|
|
|
|
|
|
|
|
|
|
// var pubSeCDetailEntitys = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PUB_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
|
|
|
|
|
|
// _pubSeCDetailRepository.InsertManyAsync(pubSeCDetailEntitys);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//if (string.IsNullOrEmpty(lu) == false)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.SaLU == lu || p.SeLU == lu);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//if (string.IsNullOrEmpty(pn) == false)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//var pubSaSeCompareDetailExports = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExport>>(pubSaSeCompareDiffs);
|
|
|
|
|
|
|
|
|
|
|
|
////结算核对汇总
|
|
|
|
|
|
//var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// LU = p.Key,
|
|
|
|
|
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
|
|
|
|
|
// SAQty = p.Sum(t => t.SAQty),
|
|
|
|
|
|
// SEQty = p.Sum(t => t.SEQty)
|
|
|
|
|
|
//}).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
////有结算有发运
|
|
|
|
|
|
//var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
|
|
|
|
|
|
////有结算有发运汇总
|
|
|
|
|
|
//var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// LU = p.Key,
|
|
|
|
|
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
|
|
|
|
|
// SAQty = p.Sum(t => t.SAQty),
|
|
|
|
|
|
// SEQty = p.Sum(t => t.SEQty)
|
|
|
|
|
|
//}).ToList();
|
|
|
|
|
|
////有结算无发运
|
|
|
|
|
|
//var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
|
|
|
|
|
|
////有结算无发运
|
|
|
|
|
|
//var haveSaNotHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// LU = p.Key,
|
|
|
|
|
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
|
|
|
|
|
// SAQty = p.Sum(t => t.SAQty),
|
|
|
|
|
|
// SEQty = p.Sum(t => t.SEQty)
|
|
|
|
|
|
//}).ToList();
|
|
|
|
|
|
////无结算有发运
|
|
|
|
|
|
//var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
|
|
|
|
|
|
////无结算有发运
|
|
|
|
|
|
//var notHaveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// LU = p.Key,
|
|
|
|
|
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
|
|
|
|
|
// SAQty = p.Sum(t => t.SAQty),
|
|
|
|
|
|
// SEQty = p.Sum(t => t.SEQty)
|
|
|
|
|
|
//}).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//ExcelExporter excelExporter = new ExcelExporter();
|
|
|
|
|
|
//excelExporter
|
|
|
|
|
|
// .Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
|
|
|
|
|
|
// .SeparateBySheet()
|
|
|
|
|
|
// .Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
|
|
|
|
|
|
// .SeparateBySheet()
|
|
|
|
|
|
|
|
|
|
|
|
// .Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
|
|
|
|
|
|
// .SeparateBySheet()
|
|
|
|
|
|
// .Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
|
|
|
|
|
|
// .SeparateBySheet()
|
|
|
|
|
|
|
|
|
|
|
|
// .Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
|
|
|
|
|
|
// .SeparateBySheet()
|
|
|
|
|
|
// .Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出")
|
|
|
|
|
|
// .SeparateBySheet();
|
|
|
|
|
|
|
|
|
|
|
|
//var result = excelExporter.ExportAppendDataAsByteArray();
|
|
|
|
|
|
//result.ShouldNotBeNull();
|
|
|
|
|
|
//_fileContainer.SaveAsync(filename, result.Result, true);
|
|
|
|
|
|
|
|
|
|
|
|
//Notify();
|
|
|
|
|
|
return id.ToString(); |
|
|
return id.ToString(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|