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>
[Display(Name = "是否作废")]
public bool IsCancel { get; set; }
public List<Guid> Guids { set; get; }
}
#region 备件价格
@ -412,6 +417,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[Display(Name = "是否作废")]
public bool IsCancel { get; set; }
public List<Guid> Guids { get; set; }
}
#endregion
@ -616,6 +622,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[Display(Name = "是否作废")]
public bool IsCancel { get; set; }
public List<Guid> Guids { get; set; }
}
#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();
foreach (var itm in adjlist)
{
itm.SetId(GuidGenerator.Create());
itm.BusinessType= inv.BusinessType;
if (itm.Qty > 0)
{
bbaclist.Add(new BBAC_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,
category: inv.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: inv.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
bbaclist.Add(new BBAC_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,
category: inv.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: inv.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}
}
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());
hbpolist.Add(new HBPO_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: inv.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: inv.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
if (itm.Qty > 0)
{
hbpolist.Add(new HBPO_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: inv.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: inv.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}
}
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());
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", "");
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);
if (itm.Qty > 0)
{
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", "");
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

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

@ -276,53 +276,35 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// 修改实体
/// 修改作废状态
/// </summary>
//[HttpPost]
//public async Task<PriceListDto> UpdateListAsync(List<Guid> p_list)
//{
// foreach (var itm in p_list)
// {
// var entity = await _settleAccountDbContext.Set<PriceList>().FindAsync(itm).ConfigureAwait(false);
// entity.IsCancel = input.IsCancel;
// if (entity.IsCancel == false)
// {
// var existPriceList = _settleAccountDbContext.Set<PriceList>()
// .Where(t => t.LU == entity.LU)
// .Where(t => t.IsCancel == false)
// .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");
// }
// }
// }
[HttpPost]
public async Task<PriceListDto> UpdateListAsync(PriceListUpdateDto input)
{
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;
if (entity.IsCancel == false)
{
var existPriceList = _settleAccountDbContext.Set<PriceList>()
.Where(t => t.LU == entity.LU)
.Where(t => t.IsCancel == false)
.Where(t => t.Id != entity.Id)
.ToList();
// var entity = await _settleAccountDbContext.Set<PriceList>().FindAsync(input.Id).ConfigureAwait(false);
// entity.IsCancel = input.IsCancel;
// if (entity.IsCancel == false)
// {
// var existPriceList = _settleAccountDbContext.Set<PriceList>()
// .Where(t => t.LU == entity.LU)
// .Where(t => t.IsCancel == false)
// .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");
}
}
plist.Add(entity);
}
// 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");
// }
// }
// await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
// var dto = ObjectMapper.Map<PriceList, PriceListDto>(entity);
// return dto;
//}
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
var dto = ObjectMapper.Map<PriceList, PriceListDto>(plist.FirstOrDefault());
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);
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
}
}

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);
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
}
}

Loading…
Cancel
Save