From be8149b672082130522b85e630895ed4e90288fe Mon Sep 17 00:00:00 2001 From: zhaoxinyu Date: Tue, 26 Dec 2023 17:15:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BQ/Syncs/PendingDeductionService.cs | 5 ++ .../Entities/BQ/Managers/INV_MNG.cs | 57 ++++++++++++++++++- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs index e06cc228..2a957550 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs @@ -14,6 +14,7 @@ using Volo.Abp.Emailing; using Volo.Abp.Uow; using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.CodeSettings; +using Win.Sfs.SettleAccount.MaterialRelationships; namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs { @@ -212,6 +213,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs foreach (var inv in invs) { var pdls= p_ls.Where(p => p.BillNum == inv.InvbillNum).ToList(); + + + + var query1 = from itm in pdls select new VmiLog() { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs index f4f75bc0..e2f28e5a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs @@ -15,6 +15,7 @@ using Volo.Abp.Uow; using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.CodeSettings; +using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Managers @@ -43,7 +44,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers private readonly INormalEfCoreRepository _notpubRepository; - + private readonly INormalEfCoreRepository _relationRepository; private readonly INormalEfCoreRepository _notRepository; private readonly INormalEfCoreRepository _adjRepository; protected readonly INormalEfCoreRepository _codesetRepository; @@ -58,6 +59,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers PUB_CAN_SA_MNG pubMng, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, + INormalEfCoreRepository relationRepository, INormalEfCoreRepository pdbbacRepository, INormalEfCoreRepository pdhbpoRepository, INormalEfCoreRepository pdpubRepository, @@ -87,6 +89,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers _codesetRepository = codesetRepository; _nothbpoRepository = nothbpoRepository; _notpubRepository = notpubRepository; + _relationRepository= relationRepository; } public INV_MNG() @@ -375,6 +378,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers /// public virtual async Task ReceivedAsync(List p_invs) { + var relationList=_relationRepository.ToList(); + + var invList = _repository.Where(p => p_invs.Contains(p.InvbillNum)).ToList();//所有提交发票信息 int count = invList.Select(p => p.InvGroupNum).Distinct().Count(); if (count > 1) @@ -526,6 +532,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers detail.Extend2 = itm.ErpLoc;//ERP库位 bbacDetail.Add(detail); } + foreach (var itm in bbacDetail) + { + if (string.IsNullOrEmpty(itm.RELU)) + { + if (itm.BusinessType==EnumBusinessType.None) + { + itm.BusinessType= EnumBusinessType.JisBBAC; + } + var relist = relationList.Where(p => p.BusinessType == itm.BusinessType).ToList(); + var material = relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU); + itm.RELU = material.ErpMaterialCode; + } + } await _repository.DbContext.BulkInsertAsync(bbacmainlist).ConfigureAwait(false); await _repository.DbContext.BulkInsertAsync(bbacDetail).ConfigureAwait(false); foreach (var itm in invList) @@ -627,6 +646,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers entityList.AddRange(entityDetail); } var bbacmainlist = new List(); + + + + + + + foreach (var itm in invList) { var bbac = new HBPO_PD( @@ -670,6 +696,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers bbacDetail.Add(entity ); } + foreach (var itm in bbacDetail) + { + if (string.IsNullOrEmpty(itm.RELU)) + { + if (itm.BusinessType == EnumBusinessType.None) + { + itm.BusinessType = EnumBusinessType.JisHBPO; + } + var relist = relationList.Where(p => p.BusinessType == itm.BusinessType).ToList(); + + + + var material = relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU); + itm.RELU = material.ErpMaterialCode; + } + } await _repository.DbContext.BulkInsertAsync(bbacmainlist).ConfigureAwait(false); await _repository.DbContext.BulkInsertAsync(bbacDetail).ConfigureAwait(false); foreach (var itm in invList) @@ -784,6 +826,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers state: SettleBillState.客户已收票, invGroupNum: itm.InvGroupNum, site: string.Empty + + ); bbacmainlist.Add(pub); @@ -818,6 +862,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers bbacDetail.Add(entity ); } + var main= invList.FirstOrDefault(); + foreach (var itm in bbacDetail) + { + if (string.IsNullOrEmpty(itm.RELU)) + { + var relist = relationList.Where(p => p.BusinessType == main.BusinessType).ToList(); + var material = relist.FirstOrDefault(p => p.SettleMaterialCode.Replace(" ","") == itm.LU.Replace(" ", "")); + itm.RELU = material.ErpMaterialCode; + itm.BusinessType= main.BusinessType; + } + } await _repository.DbContext.BulkInsertAsync(bbacmainlist); await _repository.DbContext.BulkInsertAsync(bbacDetail);