From 3a37437e61c87b730208b58e4ac9423cff9c72e4 Mon Sep 17 00:00:00 2001 From: mahao Date: Thu, 11 May 2023 17:28:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=A5=E6=BA=90=E5=BA=93?= =?UTF-8?q?=E4=BD=8D=E4=B8=8E=E7=9B=AE=E6=A0=87=E5=BA=93=E4=BD=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransferNotes/TransferNoteAppService.cs | 18 ++++++++++++++++-- .../TransferRequestAppService.cs | 8 ++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index abffc111b..f2b747fa7 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -64,8 +64,15 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase { var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); - var toLocationDto= await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + CheckLocation(toLocationDto, detail); + CheckFromLocation(fromLocationDto, detail); + if (toLocationDto.Type == fromLocationDto.Type) + { + throw new UserFriendlyException($"来源库位与目标库位类型不一致"); + } detail.OnTheWayLocationCode = bool.FalseString; detail.ItemCode=balanceDto.ItemCode; @@ -91,7 +98,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase detail.FromLot = balanceDto.Lot; detail.ToLocationArea = toLocationDto.AreaCode; - detail.ToLocationErpCode = toLocationDto.LocationGroupCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; detail.ToLocationGroup = toLocationDto.LocationGroupCode; detail.ToWarehouseCode = toLocationDto.WarehouseCode; detail.ToContainerCode = balanceDto.ContainerCode; @@ -126,6 +133,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在"); } } + private void CheckFromLocation(LocationDTO locationDto, TransferNoteDetail detail) + { + if (locationDto == null) + { + throw new UserFriendlyException($"库位代码为【{detail.FromLocationCode}】不存在"); + } + } #endregion /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs index 950a6768b..363f234d2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs @@ -110,7 +110,15 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) .ConfigureAwait(false); + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) + .ConfigureAwait(false); + CheckLocation(toLocationDto, detail.ToLocationCode); + CheckLocation(fromLocationDto, detail.FromLocationCode); + if (toLocationDto.Type == fromLocationDto.Type) + { + throw new UserFriendlyException($"来源库位与目标库位类型不一致"); + } detail.ItemCode = balanceDto.ItemCode; detail.ArriveDate = balanceDto.ArriveDate;