From c6d5d02dc87b118b4dc341b88b77dfc807a00c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 1 Nov 2023 16:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=89=B9=E9=87=8F=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Prices/PriceListDtoBase.cs | 9 +++ .../Entities/BQ/BBAC_BA_SERVICE.cs | 49 ++++++------- .../Entities/BQ/HBPO_BA_SERVICE.cs | 40 ++++++----- .../Entities/BQ/PUB_BA_SERVICE.cs | 63 ++++++++-------- .../Entities/Prices/PriceListAppService.cs | 72 +++++++------------ .../Entities/Prices/PriceListAppServiceBJ.cs | 37 ++++++++++ .../Prices/PriceListAppServiceYinDu.cs | 38 ++++++++++ 7 files changed, 192 insertions(+), 116 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs index 7eddfbfb..00f5cfde 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs @@ -209,6 +209,11 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// [Display(Name = "是否作废")] public bool IsCancel { get; set; } + + + public List Guids { set; get; } + + } #region 备件价格 @@ -412,6 +417,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// [Display(Name = "是否作废")] public bool IsCancel { get; set; } + public List Guids { get; set; } } #endregion @@ -616,6 +622,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// [Display(Name = "是否作废")] public bool IsCancel { get; set; } + + public List Guids { get; set; } + } #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs index 026893ad..71505790 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs +++ b/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;//合并库存调整单和就发票可结算明细数据 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs index 0180ebdf..e9ba9952 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs +++ b/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;//合并库存调整单和就发票可结算明细数据 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs index 29bf0b18..67f7c6e5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs +++ b/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 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index 8d2a3849..40d36706 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -276,53 +276,35 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// 修改实体 /// 修改作废状态 /// - //[HttpPost] - //public async Task UpdateListAsync(List p_list) - //{ - // foreach (var itm in p_list) - // { - // var entity = await _settleAccountDbContext.Set().FindAsync(itm).ConfigureAwait(false); - // entity.IsCancel = input.IsCancel; - // if (entity.IsCancel == false) - // { - // var existPriceList = _settleAccountDbContext.Set() - // .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 UpdateListAsync(PriceListUpdateDto input) + { + List plist = new List(); + foreach (var itm in input.Guids) + { + var entity = await _settleAccountDbContext.Set().FindAsync(itm).ConfigureAwait(false); + entity.IsCancel = input.IsCancel; + if (entity.IsCancel == false) + { + var existPriceList = _settleAccountDbContext.Set() + .Where(t => t.LU == entity.LU) + .Where(t => t.IsCancel == false) + .Where(t => t.Id != entity.Id) + .ToList(); - // var entity = await _settleAccountDbContext.Set().FindAsync(input.Id).ConfigureAwait(false); - // entity.IsCancel = input.IsCancel; - // if (entity.IsCancel == false) - // { - // var existPriceList = _settleAccountDbContext.Set() - // .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(entity); - // return dto; - //} + await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false); + var dto = ObjectMapper.Map(plist.FirstOrDefault()); + return dto; + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index e2c56dc6..161cf39b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/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(entity); return dto; } + + /// + /// 修改实体 + /// 修改作废状态 + /// + [HttpPost] + public async Task UpdateListAsync(PriceListBJUpdateDto input) + { + List plist = new List(); + foreach (var itm in input.Guids) + { + var entity = await _settleAccountDbContext.Set().FindAsync(itm).ConfigureAwait(false); + entity.IsCancel = input.IsCancel; + if (entity.IsCancel == false) + { + var existPriceList = _settleAccountDbContext.Set() + .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(plist.FirstOrDefault()); + return dto; + } + + + #endregion } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs index 75c6cd05..02194e6f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs +++ b/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(entity); return dto; } + + /// + /// 修改实体 + /// 修改作废状态 + /// + [HttpPost] + public async Task UpdateListAsync(PriceListYinDuUpdateDto input) + { + List plist = new List(); + foreach (var itm in input.Guids) + { + var entity = await _settleAccountDbContext.Set().FindAsync(itm).ConfigureAwait(false); + entity.IsCancel = input.IsCancel; + if (entity.IsCancel == false) + { + var existPriceList = _settleAccountDbContext.Set() + .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(plist.FirstOrDefault()); + return dto; + } + + + + #endregion } }