diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs index 76ad8b84..f2bd8ee8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs @@ -227,7 +227,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs _dbcontext.BulkInsert(billDetails);//插入可结主表 _dbcontext.BulkInsert(billList);//插入可结明细 issucess = true; - transaction.Commit(); + } var flaglist = _dbcontext.Set().Where(p => p.IsReturn == true).ToList(); foreach (var flag in flaglist) @@ -235,6 +235,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs flag.IsReturn = false; } _dbcontext.BulkUpdate(flaglist);//插入可结明细 + transaction.Commit(); } catch (Exception) { @@ -371,48 +372,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs _dbcontext.BulkDelete(p_list);//删除不可结数据 _dbcontext.BulkInsert(billDetails);//插入可结明细 _dbcontext.BulkInsert(billList);//插入可结主表 - var result = from a in _dbcontext.Set() - join b in _dbcontext.Set() on new { a.KeyCode, a.BusinessType } equals new { b.KeyCode, b.BusinessType } - where a.Price == 0 - select new - { - a, - b.Price - }; - foreach (var item in result) + + var flaglist = _dbcontext.Set().Where(p => p.IsReturn == true).ToList(); + foreach (var flag in flaglist) { - item.a.Price = item.Price; + flag.IsReturn = false; } - var salist = result.Select(p => p.a).ToList(); - _dbcontext.BulkUpdate(salist);//更新结算数据 + _dbcontext.BulkUpdate(flaglist);//插入可结明细 + transaction.Commit(); } - else - { - issucess = false;// 回滚事务 - transaction.Rollback(); - } - var flaglist = _dbcontext.Set().Where(p => p.IsReturn == true).ToList(); - foreach (var flag in flaglist) - { - flag.IsReturn = false; - } - _dbcontext.BulkUpdate(flaglist);//插入可结明细 + + } catch (Exception) { - var flaglist = _dbcontext.Set().Where(p => p.IsReturn == true).ToList(); - foreach (var flag in flaglist) - { - flag.IsReturn = false; - } - _dbcontext.BulkUpdate(flaglist);//插入可结明细 + issucess = false;// 回滚事务 transaction.Rollback(); } } if (issucess == true) { + + + var result = from a in _dbcontext.Set() join b in _dbcontext.Set() on new { a.KeyCode, a.BusinessType } equals new { b.KeyCode, b.BusinessType } where a.Price == 0