Browse Source

判断来源库位与目标库位类型不一致

集成Redis
马昊 2 years ago
parent
commit
3a37437e61
  1. 18
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs
  2. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs

18
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, var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode,
detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); 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); CheckLocation(toLocationDto, detail);
CheckFromLocation(fromLocationDto, detail);
if (toLocationDto.Type == fromLocationDto.Type)
{
throw new UserFriendlyException($"来源库位与目标库位类型不一致");
}
detail.OnTheWayLocationCode = bool.FalseString; detail.OnTheWayLocationCode = bool.FalseString;
detail.ItemCode=balanceDto.ItemCode; detail.ItemCode=balanceDto.ItemCode;
@ -91,7 +98,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
detail.FromLot = balanceDto.Lot; detail.FromLot = balanceDto.Lot;
detail.ToLocationArea = toLocationDto.AreaCode; detail.ToLocationArea = toLocationDto.AreaCode;
detail.ToLocationErpCode = toLocationDto.LocationGroupCode; detail.ToLocationErpCode = toLocationDto.ErpLocationCode;
detail.ToLocationGroup = toLocationDto.LocationGroupCode; detail.ToLocationGroup = toLocationDto.LocationGroupCode;
detail.ToWarehouseCode = toLocationDto.WarehouseCode; detail.ToWarehouseCode = toLocationDto.WarehouseCode;
detail.ToContainerCode = balanceDto.ContainerCode; detail.ToContainerCode = balanceDto.ContainerCode;
@ -126,6 +133,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase
throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在"); throw new UserFriendlyException($"库位代码为【{detail.ToLocationCode}】不存在");
} }
} }
private void CheckFromLocation(LocationDTO locationDto, TransferNoteDetail detail)
{
if (locationDto == null)
{
throw new UserFriendlyException($"库位代码为【{detail.FromLocationCode}】不存在");
}
}
#endregion #endregion
/// <summary> /// <summary>

8
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); detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false);
var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode)
.ConfigureAwait(false); .ConfigureAwait(false);
var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode)
.ConfigureAwait(false);
CheckLocation(toLocationDto, detail.ToLocationCode); CheckLocation(toLocationDto, detail.ToLocationCode);
CheckLocation(fromLocationDto, detail.FromLocationCode);
if (toLocationDto.Type == fromLocationDto.Type)
{
throw new UserFriendlyException($"来源库位与目标库位类型不一致");
}
detail.ItemCode = balanceDto.ItemCode; detail.ItemCode = balanceDto.ItemCode;
detail.ArriveDate = balanceDto.ArriveDate; detail.ArriveDate = balanceDto.ArriveDate;

Loading…
Cancel
Save