Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
1042d0e8d5
  1. 33
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
  2. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs

33
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs

@ -38,8 +38,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
public PendingDeductionService( public PendingDeductionService(
SettleAccountDbContext dbcontext, SettleAccountDbContext dbcontext,
IEmailSender emailSender IEmailSender emailSender
) )
{ {
@ -55,19 +53,11 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
var type = property.Where(p => p.Name == "Type").FirstOrDefault().Value; var type = property.Where(p => p.Name == "Type").FirstOrDefault().Value;
var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value; var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value;
var email = string.Empty; var email = string.Empty;
// property.Where(p => p.Name == "CurrentUserEmail").FirstOrDefault().Value; // property.Where(p => p.Name == "CurrentUserEmail").FirstOrDefault().Value;
var list = billList.Split(","); var list = billList.Split(",");
var projectList = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "库位"); var projectList = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "库位");
//JisBBAC
//JisHBPO
//ZhiGongJianBBAC
//ZhiGongJianHBPO
//MaiDanJianBBAC
//MaiDanJianHBPO
//BeiJian
//YinDuJian
if (type == "JisBBAC" || type == "ZhiGongJianBBAC" || type == "MaiDanJianBBAC" || type == "BeiJian") if (type == "JisBBAC" || type == "ZhiGongJianBBAC" || type == "MaiDanJianBBAC" || type == "BeiJian")
{ {
var jisdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis var jisdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.JisBBAC);//jis
@ -178,7 +168,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
} }
Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, email, isout == "out" ? true : false); Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, email, isout == "out" ? true : false);
} }
return id.ToString(); return id.ToString();
} }
//public List<T> GetPagedData<T>(List<T> dataList, int pageNumber, int pageSize) //public List<T> GetPagedData<T>(List<T> dataList, int pageNumber, int pageSize)
@ -227,6 +216,9 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.SetId(GuidGenerator.Create()); itm.SetId(GuidGenerator.Create());
} }
var _first = p_ls.FirstOrDefault(); var _first = p_ls.FirstOrDefault();
bool issucess = true;
using (var transaction = _dbcontext.Database.BeginTransaction()) using (var transaction = _dbcontext.Database.BeginTransaction())
{ {
try try
@ -296,16 +288,21 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
_dbcontext.BulkUpdate(hbpoList); _dbcontext.BulkUpdate(hbpoList);
} }
} }
// _emailSender.SendAsync(e) // _emailSender.SendAsync(e)
// 提交事务 // 提交事务
transaction.Commit(); transaction.Commit();
} }
catch (Exception) catch (Exception)
{ {
issucess = false;
// 回滚事务
transaction.Rollback();
}
}
if (issucess = false)
{
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList(); var billList = p_ls.Select(p => p.BillNum).Distinct().ToList();
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList(); var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
if (pdList.Count > 0) if (pdList.Count > 0)
@ -359,10 +356,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
} }
_dbcontext.BulkUpdate(hbpoList); _dbcontext.BulkUpdate(hbpoList);
} }
// 回滚事务
transaction.Rollback();
throw;
}
} }
} }

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs

@ -20,9 +20,6 @@ public class PD_MNG<TEntity,TEntityDetail>:DomainService
private readonly INormalEfCoreRepository<TEntity, Guid> _repository; private readonly INormalEfCoreRepository<TEntity, Guid> _repository;
private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository; private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
protected PD_MNG( protected PD_MNG(
INormalEfCoreRepository<TEntity, Guid> repository, INormalEfCoreRepository<TEntity, Guid> repository,
@ -30,11 +27,8 @@ public class PD_MNG<TEntity,TEntityDetail>:DomainService
) )
{ {
_repository = repository; _repository = repository;
_detailRepository = detailRepository; _detailRepository = detailRepository;
} }
public PD_MNG() public PD_MNG()

Loading…
Cancel
Save