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;