wanggang 1 year ago
parent
commit
1a7e235c07
  1. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -256,16 +256,16 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
entity.IsCancel = input.IsCancel; entity.IsCancel = input.IsCancel;
if (entity.IsCancel == false) if (entity.IsCancel == false)
{ {
var existsPriceList = _settleAccountDbContext.Set<PriceList>() var existPriceList = _settleAccountDbContext.Set<PriceList>()
.Where(t => t.LU == entity.LU) .Where(t => t.LU == entity.LU)
.Where(t => t.IsCancel == false) .Where(t => t.IsCancel == false)
.Where(t => t.Id != entity.Id) .Where(t => t.Id != entity.Id)
.ToList(); .ToList();
var existsPrice = existsPriceList.Find(t => (entity.BeginTime >= t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime >= entity.BeginTime && t.BeginTime < entity.EndTime)); var existPrice = existPriceList.Find(t => (entity.BeginTime >= t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime >= entity.BeginTime && t.BeginTime < entity.EndTime));
if (existsPrice != null) if (existPrice != null)
{ {
throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existsPrice.BeginTime:yyyy-MM-dd}至{existsPrice.EndTime:yyyy-MM-dd}】存在交集", "400"); throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existPrice.BeginTime:yyyy-MM-dd}至{existPrice.EndTime:yyyy-MM-dd}】存在交集", "400");
} }
} }
_settleAccountDbContext.Set<PriceList>().Update(entity); _settleAccountDbContext.Set<PriceList>().Update(entity);

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -214,16 +214,16 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase<PriceListBJ>
entity.IsCancel = input.IsCancel; entity.IsCancel = input.IsCancel;
if (entity.IsCancel == false) if (entity.IsCancel == false)
{ {
var existsPriceBjList = _settleAccountDbContext.Set<PriceListBJ>() var existPriceBjList = _settleAccountDbContext.Set<PriceListBJ>()
.Where(t => t.LU == entity.LU) .Where(t => t.LU == entity.LU)
.Where(t => t.IsCancel == false) .Where(t => t.IsCancel == false)
.Where(t => t.Id != entity.Id) .Where(t => t.Id != entity.Id)
.ToList(); .ToList();
var existsPriceBj = existsPriceBjList.Find(t => (entity.BeginDate >= t.BeginDate && entity.BeginDate < t.EndDate) || (t.BeginDate >= entity.BeginDate && t.BeginDate < entity.EndDate)); var existPriceBj = existPriceBjList.Find(t => (entity.BeginDate >= t.BeginDate && entity.BeginDate < t.EndDate) || (t.BeginDate >= entity.BeginDate && t.BeginDate < entity.EndDate));
if (existsPriceBj != null) if (existPriceBj != null)
{ {
throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existsPriceBj.BeginDate:yyyy-MM-dd}至{existsPriceBj.EndDate:yyyy-MM-dd}】存在交集", "400"); throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existPriceBj.BeginDate:yyyy-MM-dd}至{existPriceBj.EndDate:yyyy-MM-dd}】存在交集", "400");
} }
} }
_settleAccountDbContext.Set<PriceListBJ>().Update(entity); _settleAccountDbContext.Set<PriceListBJ>().Update(entity);

Loading…
Cancel
Save