Browse Source

更新批量价格修改

master
学 赵 1 year ago
parent
commit
c6d5d02dc8
  1. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  2. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  3. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  4. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  5. 72
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  6. 37
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  7. 38
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs

9
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -209,6 +209,11 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[Display(Name = "是否作废")] [Display(Name = "是否作废")]
public bool IsCancel { get; set; } public bool IsCancel { get; set; }
public List<Guid> Guids { set; get; }
} }
#region 备件价格 #region 备件价格
@ -412,6 +417,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[Display(Name = "是否作废")] [Display(Name = "是否作废")]
public bool IsCancel { get; set; } public bool IsCancel { get; set; }
public List<Guid> Guids { get; set; }
} }
#endregion #endregion
@ -616,6 +622,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[Display(Name = "是否作废")] [Display(Name = "是否作废")]
public bool IsCancel { get; set; } public bool IsCancel { get; set; }
public List<Guid> Guids { get; set; }
} }
#endregion #endregion
} }

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -372,13 +372,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var relist= relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); var relist= relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
foreach (var itm in adjlist) foreach (var itm in adjlist)
{ {
itm.SetId(GuidGenerator.Create()); itm.SetId(GuidGenerator.Create());
itm.BusinessType= inv.BusinessType;
if (itm.Qty > 0)
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL( bbaclist.Add(new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: GuidGenerator.Create(),
@ -403,6 +403,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
)); ));
} }
} }
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs

@ -366,6 +366,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
itm.SetId(GuidGenerator.Create()); itm.SetId(GuidGenerator.Create());
if (itm.Qty > 0)
{
hbpolist.Add(new HBPO_CAN_SA_DETAIL( hbpolist.Add(new HBPO_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: GuidGenerator.Create(),
keyCode: itm.KeyCode, keyCode: itm.KeyCode,
@ -386,6 +389,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
)); ));
} }
} }
}
var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据 var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs

@ -304,6 +304,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
itm.SetId(GuidGenerator.Create()); itm.SetId(GuidGenerator.Create());
if (itm.Qty > 0)
{
var entity = new PUB_CAN_SA_DETAIL( var entity = new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: GuidGenerator.Create(),
keyCode: itm.KeyCode, keyCode: itm.KeyCode,
@ -336,6 +340,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
publist.Add(entity); publist.Add(entity);
} }
} }
}
else else
{ {
var dfirst = publist.FirstOrDefault(); var dfirst = publist.FirstOrDefault();

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

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

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

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

38
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs

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

Loading…
Cancel
Save