diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs index 471b7068a..459d2b6d4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs @@ -119,12 +119,6 @@ public class ProductRecycleRequestAppService : { detail.Status = balance.Status; } - // detail.Status = EnumInventoryStatus.OK; - - var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode) - .ConfigureAwait(false); - CheckLocation(locationDto, detail.LocationCode); - await SetDetailPropertiesAsync(detail).ConfigureAwait(false); } } @@ -132,6 +126,7 @@ public class ProductRecycleRequestAppService : return dictionary; } + #region 校验 private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) { @@ -148,6 +143,20 @@ public class ProductRecycleRequestAppService : throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); } } + private void CheckRawLocation(LocationDTO rawlocationDto, string locationCode) + { + if (rawlocationDto == null) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + else + { + if (rawlocationDto.Type != EnumLocationType.WIP) + { + throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); + } + } + } #endregion private async Task SetRequestAutoPropertiesAsync(ProductRecycleRequest entity) @@ -177,7 +186,7 @@ public class ProductRecycleRequestAppService : detail.Qty = detail.Qty; } - var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + var location = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); CheckLocation(location, detail.LocationCode); if (location != null) { @@ -187,8 +196,8 @@ public class ProductRecycleRequestAppService : detail.LocationArea = location.AreaCode; } - var rawLocation = await LocationAclService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); - CheckLocation(rawLocation, detail.RawLocationCode); + var rawLocation = await _locationAppService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); + CheckRawLocation(rawLocation, detail.RawLocationCode); if (rawLocation != null) { detail.RawLocationErpCode = rawLocation.ErpLocationCode;