|
@ -1,3 +1,5 @@ |
|
|
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
using SettleAccount.Bases; |
|
|
using SettleAccount.Bases; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
@ -39,9 +41,9 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices |
|
|
INormalEfCoreRepository<Bom, Guid> bomshipRepository, |
|
|
INormalEfCoreRepository<Bom, Guid> bomshipRepository, |
|
|
INormalEfCoreRepository<PriceList, Guid> priceRepository, |
|
|
INormalEfCoreRepository<PriceList, Guid> priceRepository, |
|
|
INormalEfCoreRepository<PriceListBJ, Guid> pricebjRepository |
|
|
INormalEfCoreRepository<PriceListBJ, Guid> pricebjRepository |
|
|
//IExcelImportAppService excelImportService,
|
|
|
//IExcelImportAppService excelImportService,
|
|
|
//ISnowflakeIdGenerator snowflakeIdGenerator,
|
|
|
//ISnowflakeIdGenerator snowflakeIdGenerator,
|
|
|
//ICommonManager commonManager
|
|
|
//ICommonManager commonManager
|
|
|
) |
|
|
) |
|
|
{ |
|
|
{ |
|
|
_priceRepository = priceRepository; |
|
|
_priceRepository = priceRepository; |
|
@ -52,6 +54,31 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async Task DoWorkBulkWithTransaction(DbContext dbContext, Action p_dowork) |
|
|
|
|
|
{ |
|
|
|
|
|
using (var transaction = await dbContext.Database.BeginTransactionAsync()) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
// 执行批量数据操作
|
|
|
|
|
|
p_dowork(); |
|
|
|
|
|
// 提交事务
|
|
|
|
|
|
await transaction.CommitAsync(); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) |
|
|
|
|
|
{ |
|
|
|
|
|
// 回滚事务
|
|
|
|
|
|
await transaction.RollbackAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<List<string>> CheckBase(List<string> p_list, BASE_CONF p_config) |
|
|
public async Task<List<string>> CheckBase(List<string> p_list, BASE_CONF p_config) |
|
|
{ |
|
|
{ |
|
@ -67,7 +94,6 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices |
|
|
from tm in temp.DefaultIfEmpty() |
|
|
from tm in temp.DefaultIfEmpty() |
|
|
where tm == null |
|
|
where tm == null |
|
|
select itm; |
|
|
select itm; |
|
|
|
|
|
|
|
|
foreach (var itm1 in query.ToList()) |
|
|
foreach (var itm1 in query.ToList()) |
|
|
{ |
|
|
{ |
|
|
errorList.Add(itm1); |
|
|
errorList.Add(itm1); |
|
@ -75,7 +101,6 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices |
|
|
} |
|
|
} |
|
|
if (p_config.IsMaterial == true) |
|
|
if (p_config.IsMaterial == true) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
var materialList = await _materialRepository.ToListAsync(); |
|
|
var materialList = await _materialRepository.ToListAsync(); |
|
|
var query = from itm in partList |
|
|
var query = from itm in partList |
|
|
join itm1 in materialList on itm equals itm1.MaterialCode |
|
|
join itm1 in materialList on itm equals itm1.MaterialCode |
|
|