From 257eb0b3c1b98ca69fae09133f58b1d4cbfa2d84 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Mon, 22 Jan 2024 13:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=96=B9=E6=AF=94=E5=AF=B9=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../JisBBACSaSeEdiCompareExportService.cs | 36 +++++++++++-------- .../JisHBPOSaSeEdiCompareExportService.cs | 24 ++++++------- .../Report/SaSeEdiCompareExportBaseService.cs | 2 ++ 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs index 9a310e1c..56d714ab 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs @@ -76,19 +76,25 @@ namespace SettleAccount.Job.Services.Report HandleSaSeEdiCompareDiffList(saSeEdiCompareDiffs); + //var sa1 = saSeEdiCompareDiffs.FindAll(t => t.PN == "3819841").ToList(); + //var sa2 = sa1.FindAll(t => t.SaCustomerPartCode == "A2068808405").ToList(); + + //saSeEdiCompareDiffs = saSeEdiCompareDiffs.FindAll(t => t.PN == "3819841").ToList(); + + #region 二次对比 //二次匹配上的记录 - var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); - if (secondMatchHaveSaHaveSes.Any()) - { - //二次匹配 匹配上的厂内零件号、PN - var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); - saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); - saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); - //二次对比比对上的数据入库 - var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); - _settleAccountDbContext.Set().AddRange(seCDetailEntitys); - } + //var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); + //if (secondMatchHaveSaHaveSes.Any()) + //{ + // //二次匹配 匹配上的厂内零件号、PN + // var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); + // saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); + // saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); + // //二次对比比对上的数据入库 + // var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); + // _settleAccountDbContext.Set().AddRange(seCDetailEntitys); + //} #endregion #region 结算数据处理 @@ -155,7 +161,7 @@ namespace SettleAccount.Job.Services.Report // Site = groupItem.Max(t => t.Site), // Price = groupItem.Max(t => t.Price), // }; - var saGroup = from sa in _settleAccountDbContext.Set() + var saGroup = from sa in _settleAccountDbContext.Set() where sa.BusinessType == businessType group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem select new @@ -186,8 +192,8 @@ namespace SettleAccount.Job.Services.Report // ToLoc = groupItem.Max(t => t.ToLoc), // ErpToLoc = groupItem.Max(t => t.ErpToLoc) // }).Where(t => t.Qty != 0M); - var seGroup = (from se in _settleAccountDbContext.Set() - where se.BusinessType == businessType + var seGroup = (from se in _settleAccountDbContext.Set() + where se.BusinessType == businessType group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem select new { @@ -200,7 +206,7 @@ namespace SettleAccount.Job.Services.Report FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), ToLoc = groupItem.Max(t => t.ToLoc), ErpToLoc = groupItem.Max(t => t.ErpToLoc) - }).Where(t => t.Qty != 0M); + }).Where(t => t.Qty > 0M); //Edi //var ediGroup = from edi in _settleAccountDbContext.Set() // where edi.IsDeleted == false && edi.IsHaveSeData == true && edi.State == 0 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs index a87a70c9..0997ee53 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs @@ -78,17 +78,17 @@ namespace SettleAccount.Job.Services.Report #region 二次对比 //二次匹配上的记录 - var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); - if (secondMatchHaveSaHaveSes.Any()) - { - //二次匹配 匹配上的厂内零件号、PN - var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); - saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); - saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); - //二次对比比对上的数据入库 - var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); - _settleAccountDbContext.Set().AddRange(seCDetailEntitys); - } + //var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType); + //if (secondMatchHaveSaHaveSes.Any()) + //{ + // //二次匹配 匹配上的厂内零件号、PN + // var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN }); + // saSeEdiCompareDiffs.RemoveAll(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN })); + // saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes); + // //二次对比比对上的数据入库 + // var seCDetailEntitys = _objectMapper.Map, List>(secondMatchHaveSaHaveSes); + // _settleAccountDbContext.Set().AddRange(seCDetailEntitys); + //} #endregion #region 结算数据处理 @@ -198,7 +198,7 @@ namespace SettleAccount.Job.Services.Report FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), ToLoc = groupItem.Max(t => t.ToLoc), ErpToLoc = groupItem.Max(t => t.ErpToLoc) - }).Where(t => t.Qty != 0M); + }).Where(t => t.Qty > 0M); //Edi //var ediGroup = from edi in _settleAccountDbContext.Set() diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs index f6df0838..11673601 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs @@ -264,6 +264,8 @@ namespace SettleAccount.Job.Services.Report //有结算有发运 var haveSaHaveSeExports = saSeEdiCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi }.Contains(t.Category)); + + //有结算有发运汇总 var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumReport() {