schangxiang@126.com
2025-09-17 ff43ddf18764629ff875478e4e47a7281cbd230a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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()}!");
            }
 
        }
 
    }
 
 
}