From d012d72d5983d5175daa4c67695d2d6864bbce7a Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 12 Apr 2024 09:25:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=BA=93=E5=BA=93=E7=A7=BB?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTOs/ThirdLocationRequestDTO.cs | 31 +--- .../DTOs/ThirdLocationRequestDetailDTO.cs | 24 +++ .../ThirdLocationRequestAppService.cs | 24 +++ .../ThirdLocationRequestDetail.cs | 10 +- ...RequestDbContextModelCreatingExtensions.cs | 1 + .../ThirdLocationRequestAutoMapperProfile.cs | 24 +++ .../Jobs/ThirdLocationJobEventHandler.cs | 9 + .../ThirdLocationRequestEventHandler.cs | 125 +++++++++++++- .../ThirdLocationNoteEventHandler.cs | 157 ++++++++++++++++++ 9 files changed, 373 insertions(+), 32 deletions(-) create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDTO.cs index 6d2ed2559..93fe43f89 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDTO.cs @@ -5,41 +5,22 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public class ThirdLocationRequestDTO : SfsStoreRequestDTOBase, IHasNumber { /// - /// 叫料类型 + /// 类型 /// - [Display(Name = "叫料类型")] + [Display(Name = "类型")] public string Type { get; set; } /// - /// 生产线 + /// 生产线 /// [Display(Name = "生产线")] public string ProdLine { get; set; } /// - /// 是否使用在途库 + /// 是否使用在途库 /// [Display(Name = "是否使用在途库")] - public bool IsUseOnTheWayLocation { get; set; } + public bool IsUseOnTheWayLocation { get; set; } - /// - /// 可用来源库位Json集合 - /// - public string FromLocationCodeJsonList { get; set; } - - /// - /// 叫料库位 - /// - public string ToLocationCode { get; set; } - - /// - /// 目标ERP储位 - /// - [Display(Name = "目标ERP储位")] - public string ToLocationErpCode { get; set; } - - /// - /// 来源库区 - /// - public string FromLocationArea { get; set; } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDetailDTO.cs index bd0610ac6..92b149911 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/DTOs/ThirdLocationRequestDetailDTO.cs @@ -8,6 +8,30 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public class ThirdLocationRequestDetailDTO : SfsStoreDetailWithQtyDTOBase { + /// + /// 目标库位 + /// + [Display(Name = "目标库位")] + public string ToLocationCode { get; set; } + + /// + /// 目标ERP储位 + /// + [Display(Name = "目标ERP储位")] + public string ToLocationErpCode { get; set; } + + /// + /// 来源库位 + /// + [Display(Name = "来源库位")] + public string FromLocationCode { get; set; } + + /// + /// 来源库区 + /// + [Display(Name = "来源库区")] + public string FromLocationArea { get; set; } + /// /// 已发数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs index 11983f745..27aa94ea5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs @@ -20,6 +20,7 @@ using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -44,6 +45,8 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase realityBalance) + { + throw new UserFriendlyException($"{detailInput.ItemCode} 物品的库存为 {realityBalance} ,库存不够"); + } detailInput.ProdLine = detailInput.ToLocationCode; detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestDetail.cs index c8e5b798b..f3f221923 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestDetail.cs @@ -44,13 +44,13 @@ public class ThirdLocationRequestDetail : SfsStoreDetailWithQtyEntityBase, IHasT /// 来源库区 /// public string FromLocationArea { get; set; } - - // /// - // /// 在途库库位 - // /// - // public string OnTheWayLocationCode { get; set; } + + /// + /// 在途库库位 + /// + public string OnTheWayLocationCode { get; set; } /// /// 生产线 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ThirdLocationRequests/ThirdLocationRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ThirdLocationRequests/ThirdLocationRequestDbContextModelCreatingExtensions.cs index 087829cc1..f6a4a922f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ThirdLocationRequests/ThirdLocationRequestDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ThirdLocationRequests/ThirdLocationRequestDbContextModelCreatingExtensions.cs @@ -48,6 +48,7 @@ public static class ThirdLocationRequestDbContextModelCreatingExtensions b.Property(q => q.ToLocationGroup).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.FromLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.FromLocationArea).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.OnTheWayLocationCode).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ExpiredTime).IsRequired(); b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.WorkStation).HasMaxLength(SfsPropertyConst.CodeLength); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs index b336d5613..1dcf048bb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs @@ -11,6 +11,30 @@ public partial class StoreEventAutoMapperProfile : Profile { private void ThirdLocationRequestAutoMapperProfile() { + 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) + .Ignore(x => x.FromPackingCode) + .Ignore(x => x.ToPackingCode) + .Ignore(x => x.FromLot) + .Ignore(x => x.FromStatus) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromLocationErpCode) + .Ignore(x => x.FromContainerCode) + .Ignore(x => x.ToLot) + .Ignore(x => x.SupplierBatch) + .Ignore(x => x.ArriveDate) + .Ignore(x => x.ProduceDate) + .Ignore(x => x.ExpireDate) + .Ignore(x => x.ToStatus) + .Ignore(x => x.ToContainerCode) + ; + CreateMap() .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number)) .ForMember(x => x.RequestType, y => y.MapFrom(d => d.Type)) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index 1e19d26bc..23151e7ad 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs @@ -37,6 +37,15 @@ public class ThirdLocationJobEventHandler : public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { var entity = eventData.Entity; + + entity.CompleteTime = Clock.Now; + entity.JobStatus = EnumJobStatus.Done; + + foreach (var detail in eventData.Entity.Details) + { + detail.SetHandledFromRecommend(); + } + var thirdLocationNote = await BuildThirdLocationNoteAsync(entity).ConfigureAwait(false); await _thirdLocationNoteAppService.CreateAsync(thirdLocationNote).ConfigureAwait(false); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs index ca4800d8d..ec4586e0c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs @@ -1,8 +1,10 @@ +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FluentValidation.Validators; +using IdentityServer4.Models; using Volo.Abp; using Volo.Abp.EventBus; using Volo.Abp.SettingManagement; @@ -13,6 +15,7 @@ using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; +using Win_in.Sfs.Wms.Store.Event.Transactions; namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; @@ -30,11 +33,16 @@ public class ThirdLocationRequestEventHandler private readonly ILocationAppService _locationAppService; private readonly IBalanceAppService _balanceAppService; + private const EnumTransType TransType = EnumTransType.TransferLib; + + private readonly ITransferLogAppService _transferLogAppService; + public ThirdLocationRequestEventHandler( IThirdLocationJobAppService thirdLocationJobAppService , IProductionLineAppService productionLineAppService , IThirdLocationRequestManager thirdLocationRequestManager , ILocationAppService locationAppService + , ITransferLogAppService transferLogAppService , IBalanceAppService balanceAppService) { _thirdLocationJobAppService = thirdLocationJobAppService; @@ -42,6 +50,7 @@ public class ThirdLocationRequestEventHandler _thirdLocationRequestManager = thirdLocationRequestManager; _locationAppService = locationAppService; _balanceAppService = balanceAppService; + _transferLogAppService = transferLogAppService; } /// @@ -88,8 +97,108 @@ public class ThirdLocationRequestEventHandler { await _thirdLocationJobAppService.CreateManyAsync(thirdLocationJobs).ConfigureAwait(false); } + + //来源库位更新为在途库位 + var transferLogs = new List(); + var route = entity.UseOnTheWayLocation + ? EnumTransferRoute.SourceToOnTheWay + : EnumTransferRoute.SourceToDestination; + transferLogs.AddRange(await BuildTransferLogsAsync(entity, route).ConfigureAwait(false)); + + + await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + + } + + private async Task> BuildTransferLogsAsync(ThirdLocationRequest thirdLocationRequest, EnumTransferRoute route) + { + var transferLogs = new List(); + foreach (var detail in thirdLocationRequest.Details.Where(detail => detail.Qty != 0)) + { + var transferLog = ObjectMapper.Map(detail); + + LocationDTO fromLocationDTO = null; + LocationDTO toLocationDTO = null; + var transportLocation = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + if (transportLocation != null) + { + detail.OnTheWayLocationCode = transportLocation.Code; + } + else + { + throw new UserFriendlyException($"未获取到在途库代码"); + } + + + if (thirdLocationRequest.UseOnTheWayLocation) + { + var location = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + switch (route) + { + case EnumTransferRoute.SourceToOnTheWay: + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + break; + case EnumTransferRoute.OnTheWayToDestination: + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + + await RemovePackingCodeAndContainerCodeAndLotAsync(transferLog).ConfigureAwait(false); + break; + case EnumTransferRoute.SourceToDestination: + default: + throw new ArgumentOutOfRangeException(nameof(route), route, null); + } + } + else + { + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + } + + transferLog.FromLocationCode = fromLocationDTO.Code; + transferLog.FromLocationArea = fromLocationDTO.AreaCode; + transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode; + transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode; + transferLog.FromWarehouseCode = fromLocationDTO.WarehouseCode; + + transferLog.ToLocationCode = toLocationDTO.Code; + transferLog.ToLocationArea = toLocationDTO.AreaCode; + transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode; + transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode; + transferLog.ToWarehouseCode = toLocationDTO.WarehouseCode; + transferLog.TransSubType = Enum.Parse(thirdLocationRequest.Type); + transferLog.TransType = TransType; + transferLog.DocNumber = thirdLocationRequest.Number; + transferLog.JobNumber = ""; + + transferLog.FromPackingCode = ""; + transferLog.FromLot = ""; + transferLog.ToPackingCode = ""; + transferLog.ToLot = ""; + transferLog.FromStatus = EnumInventoryStatus.OK; + transferLog.ToStatus = EnumInventoryStatus.OK; + transferLogs.Add(transferLog); + } + + return transferLogs; + } + + private async Task RemovePackingCodeAndContainerCodeAndLotAsync(TransferLogEditInput transferLogCreateInput) + { + transferLogCreateInput.ToPackingCode = ""; + transferLogCreateInput.ToLot = ""; + transferLogCreateInput.ToContainerCode = ""; + + transferLogCreateInput.FromPackingCode = ""; + transferLogCreateInput.FromLot = ""; + transferLogCreateInput.FromContainerCode = ""; + } + /// /// 驳回后 /// @@ -245,7 +354,7 @@ public class ThirdLocationRequestEventHandler //ProductionLineDTO prodLine = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationGroupCode).ConfigureAwait(false); var detail = ObjectMapper.Map(balance); - detail.FromLocationCode = thirdLocationRequestDetail.FromLocationCode; + detail.WorkStation = thirdLocationRequestDetail.WorkStation; detail.ExpiredTime = thirdLocationRequestDetail.ExpiredTime; detail.PositionCode = thirdLocationRequestDetail.PositionCode; @@ -271,7 +380,19 @@ public class ThirdLocationRequestEventHandler detail.ToLocationErpCode = thirdLocationRequestDetail.ToLocationErpCode; detail.ToLocationArea = thirdLocationRequestDetail.ToLocationArea; detail.ToWarehouseCode = thirdLocationRequestDetail.ToWarehouseCode; - detail.FromLocationArea = thirdLocationRequestDetail.FromLocationArea; + + var transportLocation = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + if (transportLocation != null) + { + detail.FromLocationCode = transportLocation.Code; + detail.FromLocationArea = transportLocation.AreaCode; + } + else + { + throw new UserFriendlyException($"未获取到在途库代码"); + } + + //detail.ProdLine = prodLine == null ? toLocationGroupCode : prodLine.Code; detail.ProdLine = toLocationGroupCode; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs new file mode 100644 index 000000000..2199cfc75 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs @@ -0,0 +1,157 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Event.Transaction; + +namespace Win_in.Sfs.Wms.Store.Event.Transactions; + +public class ThirdLocationNoteEventHandler + : StoreInventoryEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + , ILocalEventHandler> +{ + private const EnumTransType TransType = EnumTransType.TransferLib; + + private readonly ILocationAppService _locationAppService; + + public ThirdLocationNoteEventHandler(ILocationAppService locationAppService) + { + _locationAppService = locationAppService; + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + var transferLogs = new List(); + var route = EnumTransferRoute.OnTheWayToDestination; + + transferLogs.AddRange(await BuildTransferLogsAsync(entity, route).ConfigureAwait(false)); + + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + var transferLogs = new List(); + //如果要做库存事务汇总,可以修改此处 + foreach (var thirdLocationNote in entities) + { + var route = EnumTransferRoute.OnTheWayToDestination; + + transferLogs.AddRange(await BuildTransferLogsAsync(thirdLocationNote, route).ConfigureAwait(false)); + } + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + [UnitOfWork] + + public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) + { + var entity = eventData.Entity; + + var inputList = await BuildTransferLogsAsync(entity, EnumTransferRoute.OnTheWayToDestination).ConfigureAwait(false); + await AddTransferLogsAsync(inputList).ConfigureAwait(false); + } + + private async Task AddTransferLogsAsync(List inputList) + { + var transferLogs = new List(); + + transferLogs.AddRange(inputList); + + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + + } + + private async Task> BuildTransferLogsAsync(ThirdLocationNote thirdLocationNote, EnumTransferRoute route) + { + var transferLogs = new List(); + foreach (var detail in thirdLocationNote.Details.Where(detail => detail.Qty != 0)) + { + var transferLog = ObjectMapper.Map(detail); + + LocationDTO fromLocationDTO = null; + LocationDTO toLocationDTO = null; + + if (thirdLocationNote.UseOnTheWayLocation) + { + var location = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + switch (route) + { + case EnumTransferRoute.SourceToOnTheWay: + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + break; + case EnumTransferRoute.OnTheWayToDestination: + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.OnTheWayLocationCode).ConfigureAwait(false); + + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + + await RemovePackingCodeAndContainerCodeAndLotAsync(transferLog).ConfigureAwait(false); + break; + case EnumTransferRoute.SourceToDestination: + default: + throw new ArgumentOutOfRangeException(nameof(route), route, null); + } + } + else + { + fromLocationDTO = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + toLocationDTO = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + } + + transferLog.FromLocationCode = fromLocationDTO.Code; + transferLog.FromLocationArea = fromLocationDTO.AreaCode; + transferLog.FromLocationErpCode = fromLocationDTO.ErpLocationCode; + transferLog.FromLocationGroup = fromLocationDTO.LocationGroupCode; + + transferLog.ToLocationCode = toLocationDTO.Code; + transferLog.ToLocationArea = toLocationDTO.AreaCode; + transferLog.ToLocationErpCode = toLocationDTO.ErpLocationCode; + transferLog.ToLocationGroup = toLocationDTO.LocationGroupCode; + transferLog.TransSubType = Enum.Parse(thirdLocationNote.RequestType); + transferLog.TransType = TransType; + transferLog.DocNumber = thirdLocationNote.Number; + transferLog.JobNumber = thirdLocationNote.JobNumber; + + transferLog.FromPackingCode = ""; + transferLog.FromLot = ""; + transferLog.ToPackingCode = ""; + transferLog.ToLot = ""; + transferLog.FromStatus = EnumInventoryStatus.OK; + transferLog.ToStatus = EnumInventoryStatus.OK; + + transferLogs.Add(transferLog); + } + + return transferLogs; + } + + private async Task RemovePackingCodeAndContainerCodeAndLotAsync(TransferLogEditInput transferLogCreateInput) + { + transferLogCreateInput.ToPackingCode = ""; + transferLogCreateInput.ToLot = ""; + transferLogCreateInput.ToContainerCode = ""; + + transferLogCreateInput.FromPackingCode = ""; + transferLogCreateInput.FromLot = ""; + transferLogCreateInput.FromContainerCode = ""; + + } + +}