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)