using Admin.NET.Application.Entity; namespace Admin.NET.Application { /// /// 库位帮助类 /// public class PlaceHelper { /// /// 验证绑定容器数 /// /// /// /// public static async Task ValidateBindContainerCount(SqlSugarRepository _wmsContainerPlaceRep, WmsBasePlace place ) { if (place.BindContainerCount == null) return; var containerPlaceList = await _wmsContainerPlaceRep.GetListAsync(x => x.PlaceCode == place.PlaceCode); ValidateBindContainerCount(containerPlaceList, place); } /// /// 验证绑定容器数 /// /// /// /// public static void ValidateBindContainerCount(List 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()}!"); } } } }