|
|
@ -114,6 +114,7 @@ public class ProductRecycleRequestAppService : |
|
|
|
|
|
|
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
CheckLocation(locationDto, detail.LocationCode); |
|
|
|
|
|
|
|
await SetDetailPropertiesAsync(detail).ConfigureAwait(false); |
|
|
|
} |
|
|
@ -122,6 +123,24 @@ public class ProductRecycleRequestAppService : |
|
|
|
return dictionary; |
|
|
|
} |
|
|
|
|
|
|
|
#region 校验
|
|
|
|
private void CheckItemBasic(ItemBasicDTO itemBasicDto, string itemCode) |
|
|
|
{ |
|
|
|
if (itemBasicDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"物品代码为【{itemCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void CheckLocation(LocationDTO locationDTO, string locationCode) |
|
|
|
{ |
|
|
|
if (locationDTO == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"库位代码为【{locationCode}】不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
private async Task SetRequestAutoPropertiesAsync(ProductRecycleRequest entity) |
|
|
|
{ |
|
|
|
var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.ProductRecycle, EnumTransSubType.None).ConfigureAwait(false); |
|
|
@ -139,7 +158,7 @@ public class ProductRecycleRequestAppService : |
|
|
|
ProductRecycleRequestDetail detail) |
|
|
|
{ |
|
|
|
var item = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
CheckItemBasic(item, detail.ItemCode); |
|
|
|
if (item != null) |
|
|
|
{ |
|
|
|
detail.ItemName = item.Name; |
|
|
@ -150,7 +169,7 @@ public class ProductRecycleRequestAppService : |
|
|
|
} |
|
|
|
|
|
|
|
var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
CheckLocation(location, detail.LocationCode); |
|
|
|
if (location != null) |
|
|
|
{ |
|
|
|
detail.LocationErpCode = location.ErpLocationCode; |
|
|
@ -160,7 +179,7 @@ public class ProductRecycleRequestAppService : |
|
|
|
} |
|
|
|
|
|
|
|
var rawLocation = await LocationAclService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
CheckLocation(rawLocation, detail.RawLocationCode); |
|
|
|
if (rawLocation != null) |
|
|
|
{ |
|
|
|
detail.RawLocationErpCode = rawLocation.ErpLocationCode; |
|
|
|