Browse Source

更新批量价格修改

master
学 赵 1 year ago
parent
commit
c6d5d02dc8
  1. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  2. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  3. 40
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  4. 63
      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
} }

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

@ -372,35 +372,36 @@ 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(),
keyCode: itm.KeyCode, keyCode: itm.KeyCode,
version: itm.Version, version: itm.Version,
billNum: itm.InvGroupNum, billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum, settleBillNum: itm.SettleBillNum,
lU: itm.LU, lU: itm.LU,
pN: itm.PN, pN: itm.PN,
site: itm.Site, site: itm.Site,
qty: itm.Qty, qty: itm.Qty,
price: itm.Price, price: itm.Price,
category: inv.BusinessType, category: inv.BusinessType,
isReturn: itm.Qty > 0 ? false : true, isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate, settleDate: itm.SettleDate,
groupNum: itm.GroupNum, groupNum: itm.GroupNum,
invGroupNum: inv.InvGroupNum, invGroupNum: inv.InvGroupNum,
contactid: itm.Extend1,//生产号 contactid: itm.Extend1,//生产号
invbillnum: string.Empty, invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
)); ));
}
} }
} }
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据 var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据

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

@ -366,24 +366,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
itm.SetId(GuidGenerator.Create()); itm.SetId(GuidGenerator.Create());
hbpolist.Add(new HBPO_CAN_SA_DETAIL( if (itm.Qty > 0)
guid: GuidGenerator.Create(), {
keyCode: itm.KeyCode,
version: itm.Version, hbpolist.Add(new HBPO_CAN_SA_DETAIL(
billNum: itm.InvGroupNum, guid: GuidGenerator.Create(),
settleBillNum: itm.SettleBillNum, keyCode: itm.KeyCode,
lU: itm.LU, version: itm.Version,
pN: itm.PN, billNum: itm.InvGroupNum,
site: itm.Site, settleBillNum: itm.SettleBillNum,
qty: itm.Qty, lU: itm.LU,
price: itm.Price, pN: itm.PN,
businessType: inv.BusinessType, site: itm.Site,
settleDate: itm.SettleDate, qty: itm.Qty,
groupNum: itm.GroupNum, price: itm.Price,
invGroupNum: inv.InvGroupNum, businessType: inv.BusinessType,
invbillnum: string.Empty, settleDate: itm.SettleDate,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode groupNum: itm.GroupNum,
)); invGroupNum: inv.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
} }
} }
var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据 var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据

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

@ -304,36 +304,41 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
itm.SetId(GuidGenerator.Create()); itm.SetId(GuidGenerator.Create());
var entity = new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: dfirst.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: inv.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode,
pobillnum: string.Empty
);
entity.SetProperty("DeliveryNumber", ""); if (itm.Qty > 0)
entity.SetProperty("VendorCode", dfirst.GetProperty("VendorCode", string.Empty)); {
entity.SetProperty("VendorName", "");
entity.SetProperty("PO", ""); var entity = new PUB_CAN_SA_DETAIL(
entity.SetProperty("DeliveryIndexNumber", ""); guid: GuidGenerator.Create(),
entity.SetProperty("PartName", ""); keyCode: itm.KeyCode,
entity.SetProperty("PartGroup", "EXT"); version: itm.Version,
entity.SetProperty("PN", ""); billNum: itm.InvGroupNum,
entity.SetProperty("SettleDate", itm.SettleDate); settleBillNum: itm.SettleBillNum,
publist.Add(entity); lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: dfirst.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: inv.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode,
pobillnum: string.Empty
);
entity.SetProperty("DeliveryNumber", "");
entity.SetProperty("VendorCode", dfirst.GetProperty("VendorCode", string.Empty));
entity.SetProperty("VendorName", "");
entity.SetProperty("PO", "");
entity.SetProperty("DeliveryIndexNumber", "");
entity.SetProperty("PartName", "");
entity.SetProperty("PartGroup", "EXT");
entity.SetProperty("PN", "");
entity.SetProperty("SettleDate", itm.SettleDate);
publist.Add(entity);
}
} }
} }
else else

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