jt
2021-06-10 5d0d028456874576560552f5a5c4e8b801786f11
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using HH.MData;
using HH.WMS.Entitys.Basic;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HH.WMS.DAL.Basic
{
   public class TN_AB_STOCK_LOCATIONDAL:BaseDAL
    {
        #region 根据货位编号查询货位实体(MongoDB)
        /// <summary>
        /// 根据货位编号查询货位实体(MongoDB)
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        /// <History>[Hanhe(XDL)] CREATED 2018-11-13</History>
        public AutoBomLocationEntity GetLocationModel(string CN_S_LOCATION_CODE)
        {
            IMongoQuery query = Query.And(Query.EQ("CN_S_LOCATION_CODE", CN_S_LOCATION_CODE));
            return MongoDBSingleton.Instance.FindOne<AutoBomLocationEntity>(query, "TN_AB_STOCK_LOCATION");
        }
        #endregion
 
        #region 根据货位编号查询货位实体(MongoDB)
        /// <summary>
        /// 根据货位编号查询货位实体(MongoDB)
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        /// <History>[Hanhe(DBS)] created 2018-3-31</History>
        public AutoBomLocationEntity GetModel(string location)
        {
            IMongoQuery query = Query.And(Query.EQ("CN_S_LOCATION_CODE", location));
            return MongoDBSingleton.Instance.FindOne<AutoBomLocationEntity>(query, "TN_AB_STOCK_LOCATION");
        }
        #endregion
 
        #region 根据货位编号查询货位实体重载(MongoDB)
        /// <summary>
        /// 根据货位编号查询货位实体(MongoDB)
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        /// <History>[Hanhe(zh)] created 2018-5-3</History>
        public AutoBomLocationEntity GetModel(string location, string stock)
        {
            IMongoQuery query = Query.And(Query.EQ("CN_S_LOCATION_CODE", location));
            if (!string.IsNullOrEmpty(stock))
            {
                query = Query.And(query, Query.EQ("CN_S_STOCK_CODE", stock));
            }
            return MongoDBSingleton.Instance.FindOne<AutoBomLocationEntity>(query, "TN_AB_STOCK_LOCATION");
        }
        #endregion
 
        #region 更新库区编号获取库区下的所有货位
        /// <summary>
        /// 更新库区编号获取库区下的所有货位
        /// </summary>
        /// <param name="areaCode">库区编号</param>
        /// <returns></returns>
        /// <History>[Hanhe(DBS)] CREATED 2018-11-29</History>
        public List<AutoBomLocationEntity> GetAreaLocations(string areaCode)
        {
            IMongoQuery query = Query.And(Query.EQ("CN_S_AREA_CODE", areaCode));
            return MongoDBSingleton.Instance.Find<AutoBomLocationEntity>(query,"TN_AB_STOCK_LOCATION");
        }
        #endregion
 
        #region 根据货位获取仓库库区实体(MongoDB)
        /// <summary>
        /// 根据货位获取仓库库区实体(MongoDB)
        /// </summary>
        /// <param name="areaCode">库区编号</param>
        /// <returns></returns>
        /// <History>[Hanhe(XDL)] created 2018-4-18</History>
        /// <History>[Hanhe(DBS)] created 2018-5-18</History>
        public AutoBomStockAreaEntity GetAreaModelByLocation(string locationCode)
        {
            AutoBomLocationEntity locationModel = GetModel(locationCode);
            if (locationModel == null)
                return null;
            IMongoQuery query = Query.And(Query.EQ("CN_S_AREA_CODE", locationModel.CN_S_AREA_CODE));
            return MongoDBSingleton.Instance.FindOne<AutoBomStockAreaEntity>(query, "TN_AB_B_STOCK_AREA");
        }
        #endregion
    }
}