From 4f4faeae3bec87bdc8b85aad7733ffe92f3b55b7 Mon Sep 17 00:00:00 2001 From: Zheng Date: Fri, 7 Jun 2024 14:20:35 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8F=91=E6=96=99?= =?UTF-8?q?=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssembleIssueRequests/AssembleIssueRequestManager.cs | 2 +- .../CoatingIssuelRequests/CoatingIssueRequestManager.cs | 2 +- .../InjectionIssueRequests/InjectionIssueRequestManager.cs | 2 +- .../SparePartIssueRequests/SparePartIssueRequestManager.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/AssembleIssueRequests/AssembleIssueRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/AssembleIssueRequests/AssembleIssueRequestManager.cs index 8ac47efbc..d0b199762 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/AssembleIssueRequests/AssembleIssueRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/AssembleIssueRequests/AssembleIssueRequestManager.cs @@ -36,7 +36,7 @@ public class AssembleIssueRequestManager entity.Submit(); entity.Agree(); entity.RequestStatus = EnumRequestStatus.Partial; - await _repository.InsertAsync(entity).ConfigureAwait(false); + await _repository.InsertAsync(entity,true).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false) .ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/CoatingIssuelRequests/CoatingIssueRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/CoatingIssuelRequests/CoatingIssueRequestManager.cs index 9c4c47cc6..9b094e6cf 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/CoatingIssuelRequests/CoatingIssueRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/CoatingIssuelRequests/CoatingIssueRequestManager.cs @@ -33,7 +33,7 @@ public class CoatingIssueRequestManager entity.Submit(); entity.Agree(); entity.RequestStatus = EnumRequestStatus.Partial; - await _repository.InsertAsync(entity).ConfigureAwait(false); + await _repository.InsertAsync(entity, true).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false) .ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/InjectionIssueRequests/InjectionIssueRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/InjectionIssueRequests/InjectionIssueRequestManager.cs index 1028f74b3..a4bf09bbe 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/InjectionIssueRequests/InjectionIssueRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/InjectionIssueRequests/InjectionIssueRequestManager.cs @@ -33,7 +33,7 @@ public class InjectionIssueRequestManager entity.Submit(); entity.Agree(); entity.RequestStatus = EnumRequestStatus.Partial; - await _repository.InsertAsync(entity).ConfigureAwait(false); + await _repository.InsertAsync(entity, true).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false) .ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/SparePartIssueRequests/SparePartIssueRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/SparePartIssueRequests/SparePartIssueRequestManager.cs index c835fe79b..1bf835f9e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/SparePartIssueRequests/SparePartIssueRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/IssueRequests/SparePartIssueRequests/SparePartIssueRequestManager.cs @@ -33,7 +33,7 @@ public class SparePartIssueRequestManager entity.Submit(); entity.Agree(); entity.RequestStatus = EnumRequestStatus.Partial; - await _repository.InsertAsync(entity).ConfigureAwait(false); + await _repository.InsertAsync(entity, true).ConfigureAwait(false); await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity),false) .ConfigureAwait(false); return entity; From 1a3a67b5797183d92443acb5a642af3bdb2c3713 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Fri, 7 Jun 2024 16:43:14 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=AF=BC=E5=85=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InventoryInitialNoteAppService.cs | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs index bdc8d97bf..bbcb5d6be 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryInitialNotes/InventoryInitialNoteAppService.cs @@ -13,10 +13,15 @@ namespace Win_in.Sfs.Wms.Store.Application; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; +using System.Linq; +using Volo.Abp; using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Basedata.Application.Contracts; /// -/// 计划外入库记录 +/// 库存初始化记录 /// [Authorize] [Route($"{StoreConsts.RootPath}inventory-initial-note")] @@ -26,15 +31,54 @@ public class InventoryInitialNoteAppService : { private readonly IInventoryInitialNoteManager _inventoryInitialNoteManager; private readonly IInventoryLabelAppService _inventoryLabelService; + private readonly IItemBasicAppService _itemBasicAppService; public InventoryInitialNoteAppService( IInventoryInitialNoteRepository repository , IInventoryInitialNoteManager inventoryInitialNoteManager - , IInventoryLabelAppService inventoryLabelService + , IInventoryLabelAppService inventoryLabelService, + IItemBasicAppService itemBasicAppService ) : base(repository) { _inventoryInitialNoteManager = inventoryInitialNoteManager; _inventoryLabelService = inventoryLabelService; + _itemBasicAppService = itemBasicAppService; + } + /// + /// 数据加工 + /// + /// + /// + + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + foreach (var request in addList) + { + request.Worker = CurrentUser.GetUserName(); + request.CreatorId = CurrentUser.Id; + request.Remark = "库存初始化"; + request.ActiveDate = DateTime.Now; + foreach (var detail in request.Details) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + CheckItemBasic(itemBasicDto, detail.ItemCode); + detail.ItemDesc1 = itemBasicDto.Desc1; + detail.ItemDesc2 = itemBasicDto.Desc2; + detail.ItemName = itemBasicDto.Name; + detail.Uom = itemBasicDto.BasicUom; + detail.StdPackQty = itemBasicDto.StdPackQty; + } + } + return dictionary; + } + + private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, string itemCode) + { + if (itemcBasicDto == null) + { + throw new UserFriendlyException($"ERP料号为【{itemCode}】不存在"); + } } [HttpPost("")] @@ -49,6 +93,7 @@ public class InventoryInitialNoteAppService : return dto; } + protected virtual async Task ImportDataAsync(List entites, List deleteEntities) { await _inventoryInitialNoteManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); From f44115e381c4b51df62731ec70feb3fdd3305a8d Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 7 Jun 2024 17:12:42 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E5=BA=93=E7=A7=BB?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransferLibJobAppService.cs | 5 ++++ .../Jobs/TransferLibJobEventHandler.cs | 14 +++++++++++ .../TransferLibRequestEventHandler.cs | 25 ++++++++++++++++++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs index e4286437b..edeb8f883 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/TransferLibJobs/TransferLibJobAppService.cs @@ -219,6 +219,11 @@ public class TransferLibJobAppService var balanceDto=await _balanceAppService.GetByPackingCodeAsync(detail.HandledToPackingCode).ConfigureAwait(false); + if (balanceDto == null) + { + throw new UserFriendlyException($"箱码{detail.HandledToPackingCode}没有找到库存"); + } + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.HandledFromLocationCode) .ConfigureAwait(false); var toLocationDto = diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs index 3b1e5b52a..0e6c3e2d4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/TransferLibJobEventHandler.cs @@ -61,6 +61,20 @@ public class TransferLibJobEventHandler : { var createInput = ObjectMapper.Map(entity); + createInput.Confirmed = true; + createInput.ConfirmTime = Clock.Now; + foreach(var item in createInput.Details) + { + if(string.IsNullOrEmpty(item.HandledFromLot)) + { + item.HandledFromLot = ""; + } + if (string.IsNullOrEmpty(item.HandledToLot)) + { + item.HandledToLot = ""; + } + } + return createInput; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs index 8179741c4..fec8d1ddc 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/TransferLibRequestEventHandler.cs @@ -26,18 +26,20 @@ public class TransferLibRequestEventHandler { private readonly ITransferLibNoteManager _transferLibNoteManager; private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; private readonly ITransferLibRequestManager _transferLibRequestManager; private readonly ITransferLibJobManager _transferLibJobManager; protected ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService(); public TransferLibRequestEventHandler( - ITransferLibNoteManager transferLibNoteManager, ILocationAppService locationAppService, ITransferLibRequestManager transferLibRequestManager, ITransferLibJobManager transferLibJobManager) + ITransferLibNoteManager transferLibNoteManager, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService, ITransferLibRequestManager transferLibRequestManager, ITransferLibJobManager transferLibJobManager) { _transferLibNoteManager = transferLibNoteManager; _locationAppService = locationAppService; _transferLibRequestManager = transferLibRequestManager; _transferLibJobManager = transferLibJobManager; + _itemBasicAppService = itemBasicAppService; } @@ -81,6 +83,27 @@ public class TransferLibRequestEventHandler var locationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT) .ConfigureAwait(false); + foreach(var item in input.Details) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(item.ItemCode).ConfigureAwait(false); + + if(itemBasicDto!=null) + { + item.ItemDesc1 = itemBasicDto.Desc1; + item.ItemDesc2 = itemBasicDto.Desc2; + item.ItemName = itemBasicDto.Name; + item.Uom = itemBasicDto.BasicUom; + item.StdPackQty = itemBasicDto.StdPackQty; + } + else + { + throw new UserFriendlyException($"未找到此物品{item.ItemCode}的信息"); + } + + } + + + //var transferOnTheWayLocation = // await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.TransferOnTheWayLocation) // .ConfigureAwait(false); From af5f739091ff7f87c7e6d051438f0b376b97eb33 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Tue, 11 Jun 2024 09:13:02 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=88=90=E5=93=81=E5=8F=91=E8=BF=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeliverNotes/IDeliverNoteAppService.cs | 2 + .../DeliverNotes/DeliverNoteAppService.cs | 14 ++ .../DeliverRequestAppService.cs | 8 +- .../Requests/DeliverRequestEventHandler.cs | 142 +++++++++--------- 4 files changed, 90 insertions(+), 76 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs index b0aab9524..03fee92c8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -35,4 +36,5 @@ public interface IDeliverNoteAppService : Task ExportForRAWAsync(SfsExportRequestInput requestInput); Task SumPrintAsync(string number); + Task> CreateManyAsync(List inputs); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs index c50a174bb..03ab41c6e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs @@ -13,6 +13,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -50,7 +51,20 @@ public class DeliverNoteAppService : var dto = ObjectMapper.Map(entity); return dto; } + /// + /// 新增接口 + /// + /// + /// + [HttpPost("create-many")] + public async Task> CreateManyAsync(List inputs) + { + var entitys = ObjectMapper.Map, List>(inputs); + await _deliverNoteManager.CreateManyAsync(entitys).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entitys); + return dtos; + } /// /// 新增接口 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index 8d712414e..2146cf2d2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -163,10 +163,10 @@ IItemBasicAppService itemBasicAppService) public virtual async Task> HandleListAsync(List ids) { var entitys = await _repository.GetListAsync(r=> ids.Contains(r.Id),true).ConfigureAwait(false); - if (entitys.Select(r => r.CustomerCode).Distinct().Count()>1) - { - throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!"); - } + //if (entitys.Select(r => r.CustomerCode).Distinct().Count()>1) + //{ + // throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!"); + //} Check.NotNull(entitys, typeof(DeliverRequest).Name); var result = await _deliverRequestManager.HandleListAsync(entitys).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entitys); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs index 68af62e6e..669794694 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs @@ -119,98 +119,96 @@ public class DeliverRequestEventHandler //东阳特殊逻辑 if (entitys.First().DirectCreateNote) { - var noteCreateInput = await BuildDeliverNoteAsync(entitys).ConfigureAwait(false); - await _deliverNoteApp.CreateAsync(noteCreateInput).ConfigureAwait(false); + var noteCreateInputs = await BuildDeliverNotesAsync(entitys).ConfigureAwait(false); + await _deliverNoteApp.CreateManyAsync(noteCreateInputs).ConfigureAwait(false); } } #region 私有 - private async Task BuildDeliverNoteAsync(List requests) + private async Task> BuildDeliverNotesAsync(List requests) { - var transactionType = await TransactionTypeAclService - .GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false); - - if (requests.First().DeliverRequestType == EnumDeliverRequestType.Normal) - { - transactionType = await TransactionTypeAclService.GetByTransTypeAsync( - EnumTransType.Deliver, - EnumTransSubType.Deliver_Standard).ConfigureAwait(false); - } - else if (requests.First().DeliverRequestType == EnumDeliverRequestType.FIS) + List createInputs = new List(); + var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false); + foreach (var request in requests) { - transactionType = await TransactionTypeAclService.GetByTransTypeAsync( - EnumTransType.Deliver, - EnumTransSubType.Deliver_FIS).ConfigureAwait(false); - } - - var createInput = ObjectMapper.Map(requests.First()); - - var customerAddress = - (await _customerAddressApp.GetByCustomerCodeAsync(createInput.CustomerCode).ConfigureAwait(false)) - .FirstOrDefault(); - - LocationDTO toLocation = null; - if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) - { - toLocation = await LocationAclService.GetByCodeAsync(customerAddress.LocationCode).ConfigureAwait(false); - - Check.NotNull(toLocation, $"客户库位 {customerAddress.LocationCode} 不存在"); - } - - createInput.Details = new List(); - List oldBalances = new List(); - foreach (var detail in requests.SelectMany(r=>r.Details)) - { - var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false); - if (locations.Count <= 0) + if (request.DeliverRequestType == EnumDeliverRequestType.Normal) { - throw new UserFriendlyException($"储位 {detail.AreaCode} 未找到对应的成品库和半成品库。"); + transactionType = await TransactionTypeAclService.GetByTransTypeAsync( + EnumTransType.Deliver, + EnumTransSubType.Deliver_Standard).ConfigureAwait(false); } - - var balances = await _balanceAppService.GetRecommendBalancesByLocationsExpectOldBalancesAsync( - new RecommendBalanceRequestInput - { - ItemCode = detail.ItemCode, - Qty = detail.Qty, - Locations = locations.Select(r => r.Code).ToList(), - Statuses = transactionType.OutInventoryStatuses, - OldBalances=oldBalances, - }).ConfigureAwait(false); - - var sumQty = balances.Sum(t => t.Qty); - - if (sumQty < detail.Qty) + else if (request.DeliverRequestType == EnumDeliverRequestType.FIS) { - throw new UserFriendlyException($"ERP料号 {detail.ItemCode} 库存余额 {sumQty} 小于 {detail.Qty}。"); + transactionType = await TransactionTypeAclService.GetByTransTypeAsync( + EnumTransType.Deliver, + EnumTransSubType.Deliver_FIS).ConfigureAwait(false); } - oldBalances.AddRange(balances); - foreach (var balance in balances) + var createInput = ObjectMapper.Map(request); + var customerAddress = (await _customerAddressApp.GetByCustomerCodeAsync(createInput.CustomerCode).ConfigureAwait(false)).FirstOrDefault(); + LocationDTO toLocation = null; + if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) { - var inputDetail = ObjectMapper.Map(balance); - - var item = await ItemBasicAclService.GetByCodeAsync(balance.ItemCode).ConfigureAwait(false); + toLocation = await LocationAclService.GetByCodeAsync(customerAddress.LocationCode).ConfigureAwait(false); - if (item != null) + Check.NotNull(toLocation, $"客户库位 {customerAddress.LocationCode} 不存在"); + } + createInput.Details = new List(); + List oldBalances = new List(); + foreach (var detail in request.Details) + { + var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false); + if (locations.Count <= 0) { - inputDetail.StdPackQty = item.StdPackQty; + throw new UserFriendlyException($"储位 {detail.AreaCode} 未找到对应的成品库和半成品库。"); } - if (toLocation != null) - { - inputDetail.ToLocationCode = toLocation.Code; + var balances = await _balanceAppService.GetRecommendBalancesByLocationsExpectOldBalancesAsync( + new RecommendBalanceRequestInput + { + ItemCode = detail.ItemCode, + Qty = detail.Qty, + Locations = locations.Select(r => r.Code).ToList(), + Statuses = transactionType.OutInventoryStatuses, + OldBalances = oldBalances, + }).ConfigureAwait(false); - inputDetail.ToLocationErpCode = toLocation.ErpLocationCode; + var sumQty = balances.Sum(t => t.Qty); + + if (sumQty < detail.Qty) + { + throw new UserFriendlyException($"ERP料号 {detail.ItemCode} 库存余额 {sumQty} 小于 {detail.Qty}。"); } + oldBalances.AddRange(balances); + foreach (var balance in balances) + { + var inputDetail = ObjectMapper.Map(balance); - inputDetail.ExtraProperties = detail.ExtraProperties; - inputDetail.MesDeliveryNo = detail.MesDeliveryNo; - inputDetail.IdentityNo = detail.IdentityNo; - inputDetail.MesDeliveryPlan = detail.MesDeliveryPlan; - createInput.Details.Add(inputDetail); + var item = await ItemBasicAclService.GetByCodeAsync(balance.ItemCode).ConfigureAwait(false); + + if (item != null) + { + inputDetail.StdPackQty = item.StdPackQty; + } + + if (toLocation != null) + { + inputDetail.ToLocationCode = toLocation.Code; + + inputDetail.ToLocationErpCode = toLocation.ErpLocationCode; + } + + inputDetail.ExtraProperties = detail.ExtraProperties; + inputDetail.MesDeliveryNo = detail.MesDeliveryNo; + inputDetail.IdentityNo = detail.IdentityNo; + inputDetail.MesDeliveryPlan = detail.MesDeliveryPlan; + createInput.Details.Add(inputDetail); + } } + + createInputs.Add(createInput); } - return createInput; - } + return createInputs; + } private async Task BuildDeliverNoteAsync(DeliverRequest request) { var transactionType = await TransactionTypeAclService From c1ed622212ac3bb29790a5ad243fc6bd7c8908e0 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Tue, 11 Jun 2024 10:49:47 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=A0=A1=E9=AA=8C=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseOrders/PurchaseOrderAppService.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs index 71ebb7c44..809db3d71 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs @@ -32,6 +32,7 @@ public class PurchaseOrderAppService : private readonly IItemBasicAppService _itemBasicAppService; private readonly ILocationAppService _locationAppService; public readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService; + public readonly ISupplierItemAppService _supplierItemAppService; public PurchaseOrderAppService( IPurchaseOrderRepository repository, @@ -39,7 +40,8 @@ public class PurchaseOrderAppService : ISupplierAppService supplierAppService, IItemBasicAppService itemBasicAppService , ILocationAppService locationAppService, -IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository) +IPurchasePriceSheetAppService purchasePriceSheetAppService, +ISupplierItemAppService supplierItemAppService) : base(repository) { _repository = repository; _purchaseOrderManager = purchaseOrderManager; @@ -50,6 +52,7 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository) base.UpdatePolicyName = PurchaseOrderPermissions.Update; base.DeletePolicyName = PurchaseOrderPermissions.Delete; _purchasePriceSheetAppService = purchasePriceSheetAppService; + _supplierItemAppService = supplierItemAppService; } #region 东阳使用 @@ -126,8 +129,20 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository) return dictionary; } - - + /// + /// 检验重写 + /// + /// + /// + /// + protected override async Task ValidateImportModelAsync(PurchaseOrderImportInput model, List validationRresult) + { + var item = await _supplierItemAppService.GetBySupplierCodeAndItemCodeAsync(model.SupplierCode,model.ItemCode).ConfigureAwait(false); + if (item == null) + { + validationRresult.Add(new ValidationResult($"供应商代码【{model.SupplierCode}】与明细-ERP料号【{model.ItemCode}】对应关系不存在")); + } + } /// /// 【创建】采购订单 @@ -232,7 +247,7 @@ IPurchasePriceSheetAppService purchasePriceSheetAppService) : base(repository) var isprice = await _purchasePriceSheetAppService.CheckPurPriceAsync(supplierCode, itemCode).ConfigureAwait(false); if (isprice) { - throw new UserFriendlyException($"供应商【{supplierCode}】物品名称【{itemCode}】无采购价格无法执行采购上架!"); + throw new UserFriendlyException($"供应商【{supplierCode}】物品名称【{itemCode}】无采购价格无法导入采购订单!"); } } private async Task> CheckErpLocationCodeAsync(List erpLocationCodes) From d9324a7472e6186669b8f8fd6619c3e92dd1da8b Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 11 Jun 2024 11:23:30 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=A3=85=E9=85=8DTYRP=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssembleIssueNoteAutoMapperProfile.cs | 105 ++++++++++++++++++ .../Notes/AssembleNoteAutoMapperProfile.cs | 51 --------- .../AssembleIssueNoteEventHandler.cs | 65 +++++------ 3 files changed, 138 insertions(+), 83 deletions(-) create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs delete mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs new file mode 100644 index 000000000..f69dfb3f2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleIssueNoteAutoMapperProfile.cs @@ -0,0 +1,105 @@ +using AutoMapper; +using Microsoft.OpenApi.Extensions; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event; + +public partial class StoreEventAutoMapperProfile : Profile +{ + private void AssembleIssueNoteAutoMapperProfile() + { + CreateMap() + .Ignore(x => x.DocNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Worker) + .Ignore(x => x.TransType) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.TransSubType) + + .ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate)) + + .ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode)) + + .ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot)) + .ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status)) + + .ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode)) + .ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup)) + .ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea)) + .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode)) + .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode)) + + .ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot)) + .ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status)) + .ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode)) + + .ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode)) + .ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup)) + .ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea)) + .ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode)) + .ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode)) + + ; + CreateMap() + .ForMember(x => x.RequestType, y => y.MapFrom(t => t.IssueRequestType.GetDisplayName())) + .Ignore(x => x.Workshop) + + ; + CreateMap() + .ForMember(x => x.IssueTime, y => y.MapFrom(t => t.CreationTime)) + .ForMember(x => x.WorkStation, y => y.MapFrom(t => t.ProdLine)) + .ForMember(x => x.RecommendQty, y => y.MapFrom(t => t.RecommendFromQty)) + .ForMember(x => x.RecommendContainerCode, y => y.MapFrom(t => t.RecommendFromContainerCode)) + .ForMember(x => x.RecommendPackingCode, y => y.MapFrom(t => t.RecommendFromPackingCode)) + .ForMember(x => x.RecommendSupplierBatch, y => y.MapFrom(t => t.RecommendFromSupplierBatch)) + .ForMember(x => x.RecommendArriveDate, y => y.MapFrom(t => t.RecommendFromArriveDate)) + .ForMember(x => x.RecommendProduceDate, y => y.MapFrom(t => t.RecommendFromProduceDate)) + .ForMember(x => x.RecommendExpireDate, y => y.MapFrom(t => t.RecommendFromExpireDate)) + .ForMember(x => x.RecommendLot, y => y.MapFrom(t => t.RecommendFromLot)) + .ForMember(x => x.HandledContainerCode, y => y.MapFrom(t => t.HandledToContainerCode)) + .ForMember(x => x.HandledPackingCode, y => y.MapFrom(t => t.HandledToPackingCode)) + .ForMember(x => x.HandledSupplierBatch, y => y.MapFrom(t => t.HandledToSupplierBatch)) + .ForMember(x => x.HandledArriveDate, y => y.MapFrom(t => t.HandledToArriveDate)) + .ForMember(x => x.HandledProduceDate, y => y.MapFrom(t => t.HandledToProduceDate)) + .ForMember(x => x.HandledExpireDate, y => y.MapFrom(t => t.HandledToExpireDate)) + .ForMember(x => x.HandledLot, y => y.MapFrom(t => t.HandledToLot)) + .ForMember(x => x.HandledQty, y => y.MapFrom(t => t.HandledToQty)) + .ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode)) + .ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode)) + .ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot)) + .ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledToSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledToArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledToProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledToExpireDate)) + .ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode)) + .ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea)) + .ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup)) + .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode)) + .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode)) + .ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode)) + .ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea)) + .ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup)) + .ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode)) + .ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode)) + .ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status)) + .ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status)) + .ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty)) + .ForMember(x => x.ItemCode, y => y.MapFrom(t => t.ItemCode)) + .Ignore(x => x.ExpiredTime) + + ; + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs deleted file mode 100644 index b4b816da9..000000000 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/AssembleNoteAutoMapperProfile.cs +++ /dev/null @@ -1,51 +0,0 @@ -using AutoMapper; -using Volo.Abp.AutoMapper; -using Win_in.Sfs.Wms.Inventory.Application.Contracts; -using Win_in.Sfs.Wms.Store.Domain; - -namespace Win_in.Sfs.Wms.Store.Event; - -public partial class StoreEventAutoMapperProfile : Profile -{ - private void AssembleIssueNoteAutoMapperProfile() - { - CreateMap() - .Ignore(x => x.DocNumber) - .Ignore(x => x.JobNumber) - .Ignore(x => x.Worker) - .Ignore(x => x.TransType) - .Ignore(x => x.ExtraProperties) - .Ignore(x => x.TransSubType) - - .ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledToQty)) - .ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledFromSupplierBatch)) - .ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledFromArriveDate)) - .ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledFromProduceDate)) - .ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.HandledFromExpireDate)) - - .ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledFromPackingCode)) - .ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledFromContainerCode)) - - .ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledFromLot)) - .ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status)) - - .ForMember(x => x.FromLocationCode, y => y.MapFrom(t => t.HandledFromLocationCode)) - .ForMember(x => x.FromLocationGroup, y => y.MapFrom(t => t.HandledFromLocationGroup)) - .ForMember(x => x.FromLocationArea, y => y.MapFrom(t => t.HandledFromLocationArea)) - .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(t => t.HandledFromLocationErpCode)) - .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(t => t.HandledFromWarehouseCode)) - - .ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledToLot)) - .ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status)) - .ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledToPackingCode)) - .ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledToContainerCode)) - - .ForMember(x => x.ToLocationCode, y => y.MapFrom(t => t.HandledToLocationCode)) - .ForMember(x => x.ToLocationGroup, y => y.MapFrom(t => t.HandledToLocationGroup)) - .ForMember(x => x.ToLocationArea, y => y.MapFrom(t => t.HandledToLocationArea)) - .ForMember(x => x.ToLocationErpCode, y => y.MapFrom(t => t.HandledToLocationErpCode)) - .ForMember(x => x.ToWarehouseCode, y => y.MapFrom(t => t.HandledToWarehouseCode)) - - ; - } -} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs index dc316c85f..841238749 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/AssembleIssueNoteEventHandler.cs @@ -37,44 +37,45 @@ public class AssembleIssueNoteEventHandler protected override async Task AddExchangeDataAsync(List entities) { - var dtos = ObjectMapper.Map, List>(entities); + var dtos = ObjectMapper.Map, List>(entities); foreach (var detail in dtos.SelectMany(dto => dto.Details)) { - if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) - { - var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); - if (location != null) - { - detail.HandledFromLocationErpCode = location.ErpLocationCode; - detail.HandledFromLocationGroup = location.LocationGroupCode; - detail.HandledFromLocationArea = location.AreaCode; + await detail.TrySetLocationAsync(LocationAclService).ConfigureAwait(false); + //if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledFromLocationErpCode = location.ErpLocationCode; + // detail.HandledFromLocationGroup = location.LocationGroupCode; + // detail.HandledFromLocationArea = location.AreaCode; - if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) - { - detail.HandledFromWarehouseCode = location.WarehouseCode; - } - } - } + // if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + // { + // detail.HandledFromWarehouseCode = location.WarehouseCode; + // } + // } + //} - if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) - { - var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); - if (location != null) - { - detail.HandledToLocationErpCode = location.ErpLocationCode; - detail.HandledToLocationGroup = location.LocationGroupCode; - detail.HandledToLocationArea = location.AreaCode; + //if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + //{ + // var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + // if (location != null) + // { + // detail.HandledToLocationErpCode = location.ErpLocationCode; + // detail.HandledToLocationGroup = location.LocationGroupCode; + // detail.HandledToLocationArea = location.AreaCode; - if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) - { - detail.HandledToWarehouseCode = location.WarehouseCode; - } - } - } + // if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + // { + // detail.HandledToWarehouseCode = location.WarehouseCode; + // } + // } + //} } - var toErpDto = new List(); + var toErpDto = new List(); foreach (var item in dtos) { if (item.Details != null && item.Details.Count != 0) @@ -84,10 +85,10 @@ public class AssembleIssueNoteEventHandler } //2023-12-6要求同储位不传入接口 按历史规则 - var result = new List(); + var result = new List(); foreach (var assembleIssueNoteDto in toErpDto) { - assembleIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); + assembleIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.ToLocationErpCode); if (assembleIssueNoteDto.Details.Count > 0) { result.Add(assembleIssueNoteDto);