From cef9572010496e42fa3b3025359c8c91a67a8b15 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 2 Jul 2024 15:43:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=8D=95=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/VmiAppService.cs | 20 +++++++++---------- .../Entities/Prices/PriceListAppService.cs | 17 +++++++++++++++- .../Entities/Prices/PriceListAppServiceBJ.cs | 18 ++++++++++++++++- .../Prices/PriceListAppServiceYinDu.cs | 18 ++++++++++++++++- 4 files changed, 60 insertions(+), 13 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs index 955affeb..596bbba8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs @@ -301,27 +301,27 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var dtos = _maper.Map, List>(entities); dtos = dtos.OrderByDescending(p => p.BillTime).ToList(); var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx"; - ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false); - result.ShouldNotBeNull(); - await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); + //ExportImporter _exportImporter = new ExportImporter(); + //var result = await _exportImporter.ExcelExporter(dtos).ConfigureAwait(false); + //result.ShouldNotBeNull(); + //await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false); - //ExtendExcel.BucketName = _cfg.GetValue("MinIO:BucketName", "default"); + ExtendExcel.BucketName = _cfg.GetValue("MinIO:BucketName", "default"); - //ExtendExcel.AccessKey = _cfg.GetValue("MinIO:AccessKey" , "g0GKnhRGEQHI0uiGBYre"); + ExtendExcel.AccessKey = _cfg.GetValue("MinIO:AccessKey", "g0GKnhRGEQHI0uiGBYre"); - //ExtendExcel.SecretKey = _cfg.GetValue("MinIO:SecretKey" , "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv"); + ExtendExcel.SecretKey = _cfg.GetValue("MinIO:SecretKey", "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv"); - //ExtendExcel.EndPoint = _cfg.GetValue("MinIO:EndPoint" , "localhost:10684"); + ExtendExcel.EndPoint = _cfg.GetValue("MinIO:EndPoint", "localhost:10684/host"); - //return await ExtendExcel.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false); + return await ExtendExcel.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false); - return fileName; + //return fileName; } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index c880296b..948ac471 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -140,11 +140,26 @@ namespace Win.Sfs.SettleAccount.Entities.Prices { item.Update(GuidGenerator.Create()); } + //销售零件号、价格、开始时间、结束时间、客户编码、合同签订时间和合同号都相同的数据,价格单数据重复时,导入的此条数据忽略 + List newPriceNoRepeat=new List(); + foreach (var item in newPrice) + { + var hasRepeat = oldPrices.FirstOrDefault(p=>p.LU==item.LU && p.Price==item.Price && p.BeginTime==item.BeginTime && p.EndTime==item.EndTime && p.ClientCode==item.ClientCode && p.Date==item.Date && p.ContractNo==item.ContractNo); + if(hasRepeat==null) + { + newPriceNoRepeat.Add(item); + } + else + { + hasRepeat.IsCancel = false; + } + } + using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false); try { await _settleAccountDbContext.BulkUpdateAsync(oldPrices).ConfigureAwait(false); - await _settleAccountDbContext.BulkInsertAsync(newPrice).ConfigureAwait(false); + await _settleAccountDbContext.BulkInsertAsync(newPriceNoRepeat).ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); } catch (Exception) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 8200506a..66e36a83 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -130,11 +130,27 @@ namespace Win.Sfs.SettleAccount.Entities.Prices { item.Update(GuidGenerator.Create()); } + + //销售零件号、价格、开始时间、结束时间、客户编码、合同签订时间和合同号都相同的数据,价格单数据重复时,导入的此条数据忽略 + List newPriceNoRepeat = new List(); + foreach (var item in newPrice) + { + var hasRepeat = oldPrices.FirstOrDefault(p => p.LU == item.LU && p.Price == item.Price && p.BeginDate == item.BeginDate && p.EndDate == item.EndDate && p.ClientCode == item.ClientCode && p.Date == item.Date && p.ContractNo == item.ContractNo); + if (hasRepeat == null) + { + newPriceNoRepeat.Add(item); + } + else + { + hasRepeat.IsCancel = false; + } + } + using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false); try { await _settleAccountDbContext.BulkUpdateAsync(oldPrices).ConfigureAwait(false); - await _settleAccountDbContext.BulkInsertAsync(newPrice).ConfigureAwait(false); + await _settleAccountDbContext.BulkInsertAsync(newPriceNoRepeat).ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); } catch (Exception) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs index 0be3a72e..708f692f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs @@ -125,11 +125,27 @@ namespace Win.Sfs.SettleAccount.Entities.Prices { item.Update(GuidGenerator.Create()); } + + //销售零件号、价格、开始时间、结束时间、客户编码、合同签订时间和合同号都相同的数据,价格单数据重复时,导入的此条数据忽略 + List newPriceNoRepeat = new List(); + foreach (var item in newPrice) + { + var hasRepeat = oldPrices.FirstOrDefault(p => p.LU == item.LU && p.Price == item.Price && p.BeginDate == item.BeginDate && p.EndDate == item.EndDate && p.ClientCode == item.ClientCode && p.Date == item.Date && p.ContractNo == item.ContractNo); + if (hasRepeat == null) + { + newPriceNoRepeat.Add(item); + } + else + { + hasRepeat.IsCancel = false; + } + } + using var transaction = await _settleAccountDbContext.Database.BeginTransactionAsync().ConfigureAwait(false); try { await _settleAccountDbContext.BulkUpdateAsync(oldPrices).ConfigureAwait(false); - await _settleAccountDbContext.BulkInsertAsync(newPrice).ConfigureAwait(false); + await _settleAccountDbContext.BulkInsertAsync(newPriceNoRepeat).ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); } catch (Exception)