|
|
@ -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; |
|
|
|