Browse Source

价格单重复数据不导入

master
zhouhongjun 5 months ago
parent
commit
cef9572010
  1. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  2. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  3. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  4. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs

20
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<VmiBalanceSumDetail>, List<VmiBalanceSumDetailDto>>(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<VmiBalanceSumDetailDto>.BucketName = _cfg.GetValue("MinIO:BucketName", "default");
ExtendExcel<VmiBalanceSumDetailDto>.BucketName = _cfg.GetValue("MinIO:BucketName", "default");
//ExtendExcel<VmiBalanceSumDetailDto>.AccessKey = _cfg.GetValue("MinIO:AccessKey" , "g0GKnhRGEQHI0uiGBYre");
ExtendExcel<VmiBalanceSumDetailDto>.AccessKey = _cfg.GetValue("MinIO:AccessKey", "g0GKnhRGEQHI0uiGBYre");
//ExtendExcel<VmiBalanceSumDetailDto>.SecretKey = _cfg.GetValue("MinIO:SecretKey" , "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv");
ExtendExcel<VmiBalanceSumDetailDto>.SecretKey = _cfg.GetValue("MinIO:SecretKey", "iKGlLz6UBzci3xrERw5Zz1gI77enT5u9agFemHPv");
//ExtendExcel<VmiBalanceSumDetailDto>.EndPoint = _cfg.GetValue("MinIO:EndPoint" , "localhost:10684");
ExtendExcel<VmiBalanceSumDetailDto>.EndPoint = _cfg.GetValue("MinIO:EndPoint", "localhost:10684/host");
//return await ExtendExcel<VmiBalanceSumDetailDto>.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false);
return await ExtendExcel<VmiBalanceSumDetailDto>.WriteDataToExcelInParallel("库存余额", dtos, 500000).ConfigureAwait(false);
return fileName;
//return fileName;
}
/// <summary>

17
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<PriceList> newPriceNoRepeat=new List<PriceList>();
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<PriceList>(oldPrices).ConfigureAwait(false);
await _settleAccountDbContext.BulkInsertAsync<PriceList>(newPrice).ConfigureAwait(false);
await _settleAccountDbContext.BulkInsertAsync<PriceList>(newPriceNoRepeat).ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
}
catch (Exception)

18
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<PriceListBJ> newPriceNoRepeat = new List<PriceListBJ>();
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<PriceListBJ>(oldPrices).ConfigureAwait(false);
await _settleAccountDbContext.BulkInsertAsync<PriceListBJ>(newPrice).ConfigureAwait(false);
await _settleAccountDbContext.BulkInsertAsync<PriceListBJ>(newPriceNoRepeat).ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
}
catch (Exception)

18
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<PriceListYinDu> newPriceNoRepeat = new List<PriceListYinDu>();
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<PriceListYinDu>(oldPrices).ConfigureAwait(false);
await _settleAccountDbContext.BulkInsertAsync<PriceListYinDu>(newPrice).ConfigureAwait(false);
await _settleAccountDbContext.BulkInsertAsync<PriceListYinDu>(newPriceNoRepeat).ConfigureAwait(false);
await transaction.CommitAsync().ConfigureAwait(false);
}
catch (Exception)

Loading…
Cancel
Save