From 7ba3010e20d0e50c672da5636ec4e01d59d7c69a Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 16 Jan 2024 11:00:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0RealPN=E5=92=8C=E9=80=80?= =?UTF-8?q?=E8=B4=A7=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/BBAC_SA_SERVICE.cs | 2 ++ .../BQ/Syncs/JisBBACSeEdiCompareAppService.cs | 16 ++++++++++++++++ .../src/SettleAccount.Domain/Bases/EntityBase.cs | 12 ++++++++++++ .../Report/JisBBACSaSeEdiCompareExportService.cs | 2 +- .../Report/JisHBPOSaSeEdiCompareExportService.cs | 2 +- .../Report/SeEdiCompareExportBaseService.cs | 5 +++-- 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs index e379bdd8..40885a68 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs @@ -160,6 +160,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ importBBACSaDetail.Version = Version; importBBACSaDetail.Site = Site; importBBACSaDetail.BusinessType = importBBACSaDetail.PN.Contains("R0") ? EnumBusinessType.MaiDanJianBBAC : EnumBusinessType.JisBBAC; + importBBACSaDetail.RealPN = importBBACSaDetail.PN; }); var jisSaDetails = importBBACSaDetails.FindAll(t => t.BusinessType == EnumBusinessType.JisBBAC); @@ -171,6 +172,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ */ maiDanSaDetails.ForEach(maiDanSaDetail => { + //maiDanSaDetail.RealPN = maiDanSaDetail.PN; maiDanSaDetail.ProductionCodeType = maiDanSaDetail.PN[^2..]; maiDanSaDetail.PN = maiDanSaDetail.PN[..7]; }); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs index ffbfc794..b92abe84 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs @@ -124,6 +124,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs await db.BulkUpdateAsync(ediFlagErrEntities).ConfigureAwait(false); } } + + var seReturnUpdateQuery = db.Set().FromSqlRaw("select distinct b.* from (select * FROM [BQ_SA].[dbo].[Set_BBAC_SE_DETAIL] where TransType=-1 and Remark is null and BusinessType=1) a left join [BQ_SA].[dbo].[Set_BBAC_SE_DETAIL] b on a.PN=b.PN and a.LU=b.LU where b.TransType=1 and b.BusinessType=1 and b.ProType in (3,7,0) and b.IsDeleted=0"); + var seReturnUpdateEntities = seReturnUpdateQuery.ToList(); + if (seReturnUpdateEntities.Count > 0) + { + seReturnUpdateEntities.ForEach(t => t.IsDeleted = true); + await db.BulkUpdateAsync(seReturnUpdateEntities).ConfigureAwait(false); + } + + var hbpoReturnUpdateQuery = db.Set().FromSqlRaw("select distinct b.* from (select * FROM [BQ_SA].[dbo].[Set_HBPO_SE_DETAIL] where TransType=-1 and Remark is null and BusinessType=2) a left join [BQ_SA].[dbo].[Set_HBPO_SE_DETAIL] b on a.PN=b.PN and a.LU=b.LU where b.TransType=1 and b.BusinessType=2 and b.ProType in (3,7,0) and b.IsDeleted=0"); + var hbpoReturnUpdateEntities = hbpoReturnUpdateQuery.ToList(); + if (hbpoReturnUpdateEntities.Count > 0) + { + hbpoReturnUpdateEntities.ForEach(t => t.IsDeleted = true); + await db.BulkUpdateAsync(hbpoReturnUpdateEntities).ConfigureAwait(false); + } } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs index 430f2947..7ef977d0 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs @@ -342,6 +342,10 @@ namespace SettleAccount.Bases /// public virtual string PN { get; set; } /// + /// 真实生產號 + /// + public virtual string RealPN { get; set; } + /// /// 組合鍵值(LU+PN) /// public virtual string KeyCode { get; set; } @@ -408,6 +412,10 @@ namespace SettleAccount.Bases /// public string PN { get; set; } /// + /// 真实生產號 + /// + public virtual string RealPN { get; set; } + /// /// 組合鍵值(LU+PN) /// public string KeyCode { get; set; } @@ -486,6 +494,10 @@ namespace SettleAccount.Bases /// public string PN { get; set; } /// + /// 真实生產號 + /// + public virtual string RealPN { get; set; } + /// /// 組合鍵值(LU+PN) /// public string KeyCode { get; set; } 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 ec4cdc0d..3e1d66d6 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 @@ -157,7 +157,7 @@ namespace SettleAccount.Job.Services.Report }; //发运 var seGroup = (from se in _settleAccountDbContext.Set() - where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 + where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 && se.IsDeleted == false group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem select new { 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 2702a544..28be044e 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 @@ -152,7 +152,7 @@ namespace SettleAccount.Job.Services.Report }; //发运 var seGroup = (from se in _settleAccountDbContext.Set() - where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State == 0 + where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State == 0 && se.IsDeleted == false group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem select new { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs index c728ad17..56536446 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs @@ -97,10 +97,11 @@ namespace SettleAccount.Job.Services.Report //无EDI有发运 var notHaveEdiHaveSeList = _settleAccountDbContext.Set() - .Where(t => t.BusinessType == businessType && t.BillTime >= seStartDateTime && t.BillTime <= seEndDateTime) + .Where(t => t.BusinessType == businessType && t.BillTime >= seStartDateTime && t.BillTime <= seEndDateTime && t.TransType == EnumDelTransType.发货) .Where(t=>t.State==0) .Where(t => proType.Contains(t.ProType)) .Where(t => t.IsHaveEdiData == false) + .Where(t => t.IsDeleted == false) .GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace }) .Select(t => new TCompareReport() { @@ -135,7 +136,7 @@ namespace SettleAccount.Job.Services.Report LineStationCode = groupItem.Max(t => t.LineStationCode) }; var seGroup = from se in _settleAccountDbContext.Set() - where se.BusinessType == businessType && se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 && proType.Contains(se.ProType) + where se.BusinessType == businessType && se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime && se.State==0 && proType.Contains(se.ProType) && se.IsDeleted == false && se.TransType == EnumDelTransType.发货 group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem select new {