|
@ -276,53 +276,35 @@ namespace Win.Sfs.SettleAccount.Entities.Prices |
|
|
/// 修改实体
|
|
|
/// 修改实体
|
|
|
/// 修改作废状态
|
|
|
/// 修改作废状态
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
//[HttpPost]
|
|
|
[HttpPost] |
|
|
//public async Task<PriceListDto> UpdateListAsync(List<Guid> p_list)
|
|
|
public async Task<PriceListDto> UpdateListAsync(PriceListUpdateDto input) |
|
|
//{
|
|
|
{ |
|
|
// foreach (var itm in p_list)
|
|
|
List<PriceList> plist = new List<PriceList>(); |
|
|
// {
|
|
|
foreach (var itm in input.Guids) |
|
|
// var entity = await _settleAccountDbContext.Set<PriceList>().FindAsync(itm).ConfigureAwait(false);
|
|
|
{ |
|
|
// entity.IsCancel = input.IsCancel;
|
|
|
var entity = await _settleAccountDbContext.Set<PriceList>().FindAsync(itm).ConfigureAwait(false); |
|
|
// if (entity.IsCancel == false)
|
|
|
entity.IsCancel = input.IsCancel; |
|
|
// {
|
|
|
if (entity.IsCancel == false) |
|
|
// var existPriceList = _settleAccountDbContext.Set<PriceList>()
|
|
|
{ |
|
|
// .Where(t => t.LU == entity.LU)
|
|
|
var existPriceList = _settleAccountDbContext.Set<PriceList>() |
|
|
// .Where(t => t.IsCancel == false)
|
|
|
.Where(t => t.LU == entity.LU) |
|
|
// .Where(t => t.Id != entity.Id)
|
|
|
.Where(t => t.IsCancel == false) |
|
|
// .ToList();
|
|
|
.Where(t => t.Id != entity.Id) |
|
|
|
|
|
.ToList(); |
|
|
// var existPrice = existPriceList.Find(t => (entity.BeginTime >= t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime >= entity.BeginTime && t.BeginTime < entity.EndTime));
|
|
|
|
|
|
// if (existPrice != null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existPrice.BeginTime:yyyy-MM-dd}至{existPrice.EndTime:yyyy-MM-dd}】存在交集", "400");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// var entity = await _settleAccountDbContext.Set<PriceList>().FindAsync(input.Id).ConfigureAwait(false);
|
|
|
var existPrice = existPriceList.Find(t => (entity.BeginTime >= t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime >= entity.BeginTime && t.BeginTime < entity.EndTime)); |
|
|
// entity.IsCancel = input.IsCancel;
|
|
|
if (existPrice != null) |
|
|
// if (entity.IsCancel == false)
|
|
|
{ |
|
|
// {
|
|
|
throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existPrice.BeginTime:yyyy-MM-dd}至{existPrice.EndTime:yyyy-MM-dd}】存在交集", "400"); |
|
|
// var existPriceList = _settleAccountDbContext.Set<PriceList>()
|
|
|
} |
|
|
// .Where(t => t.LU == entity.LU)
|
|
|
} |
|
|
// .Where(t => t.IsCancel == false)
|
|
|
plist.Add(entity); |
|
|
// .Where(t => t.Id != entity.Id)
|
|
|
} |
|
|
// .ToList();
|
|
|
|
|
|
|
|
|
|
|
|
// var existPrice = existPriceList.Find(t => (entity.BeginTime >= t.BeginTime && entity.BeginTime < t.EndTime) || (t.BeginTime >= entity.BeginTime && t.BeginTime < entity.EndTime));
|
|
|
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false); |
|
|
// if (existPrice != null)
|
|
|
var dto = ObjectMapper.Map<PriceList, PriceListDto>(plist.FirstOrDefault()); |
|
|
// {
|
|
|
return dto; |
|
|
// throw new UserFriendlyException($"无法启用!此记录启用时间区间与区间【{existPrice.BeginTime:yyyy-MM-dd}至{existPrice.EndTime:yyyy-MM-dd}】存在交集", "400");
|
|
|
} |
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
|
|
|
|
|
|
// var dto = ObjectMapper.Map<PriceList, PriceListDto>(entity);
|
|
|
|
|
|
// return dto;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|