using Admin.NET.Application.Entity;
|
|
namespace Admin.NET.Application
|
{
|
/// <summary>
|
/// 库位帮助类
|
/// </summary>
|
public class PlaceHelper
|
{
|
|
/// <summary>
|
/// 验证绑定容器数
|
/// </summary>
|
/// <param name="_wmsContainerPlaceRep"></param>
|
/// <param name="place"></param>
|
/// <returns></returns>
|
public static async Task ValidateBindContainerCount(SqlSugarRepository<WmsContainerPlace> _wmsContainerPlaceRep,
|
WmsBasePlace place
|
)
|
{
|
if (place.BindContainerCount == null) return;
|
|
var containerPlaceList = await _wmsContainerPlaceRep.GetListAsync(x => x.PlaceCode == place.PlaceCode);
|
|
ValidateBindContainerCount(containerPlaceList, place);
|
}
|
|
|
/// <summary>
|
/// 验证绑定容器数
|
/// </summary>
|
/// <param name="containerPlaceList"></param>
|
/// <param name="place"></param>
|
/// <returns></returns>
|
public static void ValidateBindContainerCount(List<WmsContainerPlace> containerPlaceList,
|
WmsBasePlace place
|
)
|
{
|
if (place.BindContainerCount == null) return;
|
|
if (containerPlaceList == null && containerPlaceList.Count() >= (int)place.BindContainerCount)
|
{
|
throw Oops.Oh($"库位号{place.PlaceCode}配置的绑定容器数为{(int)place.BindContainerCount},已经大于等于当前已经绑定容器数为{containerPlaceList.Count()}!");
|
}
|
|
}
|
|
}
|
|
|
}
|