mahao 1 year ago
parent
commit
e2afc4b4bc
  1. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  2. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

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

@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shouldly;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
@ -255,11 +256,17 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
entity.IsCancel = input.IsCancel;
if (entity.IsCancel == false)
{
var ddd = _settleAccountDbContext.Set<PriceList>()
var existsPriceList = _settleAccountDbContext.Set<PriceList>()
.Where(t => t.LU == entity.LU)
.Where(t => t.IsCancel == false)
.Where(t => t.Id != entity.Id)
.ToList();
var existsPrice = existsPriceList.Find(t => (entity.BeginTime > t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime > entity.BeginTime && t.BeginTime < entity.EndTime));
if (existsPrice != null)
{
throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existsPrice.BeginTime:yyyy-MM-dd}至{existsPrice.EndTime:yyyy-MM-dd}】存在交集", "400");
}
}
_settleAccountDbContext.Set<PriceList>().Update(entity);
var dto = ObjectMapper.Map<PriceList, PriceListDto>(entity);

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

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shouldly;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
@ -211,6 +212,20 @@ public class PriceListAppServiceBJ : SettleAccountApplicationBase<PriceListBJ>
{
var entity = await _settleAccountDbContext.Set<PriceListBJ>().FindAsync(input.Id).ConfigureAwait(false);
entity.IsCancel = input.IsCancel;
if (entity.IsCancel == false)
{
var existsPriceBjList = _settleAccountDbContext.Set<PriceListBJ>()
.Where(t => t.LU == entity.LU)
.Where(t => t.IsCancel == false)
.Where(t => t.Id != entity.Id)
.ToList();
var existsPriceBj = existsPriceBjList.Find(t => (entity.BeginDate >= t.BeginDate && entity.BeginDate < t.EndDate) || (t.BeginDate >= entity.BeginDate && t.BeginDate < entity.EndDate));
if (existsPriceBj != null)
{
throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existsPrice.BeginTime:yyyy-MM-dd}至{existsPrice.EndTime:yyyy-MM-dd}】存在交集", "400");
}
}
_settleAccountDbContext.Set<PriceListBJ>().Update(entity);
var dto = ObjectMapper.Map<PriceListBJ, PriceListBJDto>(entity);
return dto;

Loading…
Cancel
Save