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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
using HH.WMS.DAL.Basic;
using HH.WMS.Entitys.Algorithm;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HH.WMS.Entitys;
using System.Data;
 
namespace HH.WMS.BLL.Basic
{
    public class TN_WMS_ITEMBLL : BaseBLL
    {
        #region 根据物料编码获取物料实体信息(访问MongoDB)
        /// <summary>
        /// 根据物料编码获取物料实体信息(访问MongoDB)
        /// </summary>
        /// <param name="itemCode">物料编码</param>
        /// <returns></returns>
        /// <History>[Hanhe(DBS)] created 2018-5-5</History>
        public AutoBomItemEntity GetItem(string itemCode)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetItemEntity(itemCode);
        }
        public AutoBomItemEntityYS GetItemYS(string itemCode)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetItemEntityYS(itemCode);
        }
 
        public List<AutoBomItemEntity> GetItemByNameSpec(string itemName, string specification)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetItemByNameSpec(itemName, specification);
        }
        /// <summary>
        /// 根据物料编码返回物料实体
        /// </summary>
        /// <param name="itemCode"></param>
        /// <returns></returns>
        public List<AutoBomItemEntity> GetItemList(List<string> itemCodes)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetItemList(itemCodes);
        }
 
        /// <summary>
        /// 根据物料编码返回物料实体
        /// </summary>
        /// <param name="itemCode"></param>
        /// <returns></returns>
        public List<AutoBomItemEntity> GetAllItem(string itemCode)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetAllItem(itemCode);
        }
        /// <summary>
        /// 根据物料编码返回物料实体
        /// </summary>
        /// <param name="itemCode"></param>
        /// <returns></returns>
        ///  <history>[HanHe(LT)] CREATED 2018/11/26</history>
        public List<AutoBomItemEntity> GetListItemByCode(string itemCode, string itemName, string model, int pageIndex, int pageSize, out int total)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetListItemByCode(itemCode, itemName, model, pageIndex, pageSize, out total);
        }
        #endregion
 
        #region 物料列表
        /// <summary>
        /// 物料列表
        /// </summary>
        /// <returns></returns>
        public List<AutoBomItemEntity> GetItemList(SearchModel searchModel, out int total)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetItemList(searchModel, out total);
        }
        #endregion
 
        #region 模糊匹配top条
        /// <summary>
        /// 模糊匹配top条
        /// </summary>
        /// <param name="key"></param>
        /// <param name="top"></param>
        /// <returns></returns>
        public List<AutoBomItemEntity> GetMatchItem(string key, int top = 10)
        {
            return CreateDAL<TN_WMS_ITEMDAL>().GetMatchItem(key, top);
        }
        #endregion
 
        public TN_AB_B_ITEM_PRICEEntity GetItemPriceModel(string itemCode)
        {
            TN_AB_B_ITEM_PRICEEntity entity = CreateDAL<TN_WMS_ITEMDAL>().GetItemPriceModel(itemCode);
            //if (entity == null)
            //{
 
            //}
 
            return entity;
        }
 
        public OperateResult GetItemDetail(string scanCode, string codeType)
        {
            string sqlWhere = "";//where条件
            string itemCode = "";//物料编码
            MONGO_PRINT_BARCODE printEntity = new MONGO_PRINT_BARCODE();
            if (codeType == "0") //不限制
            {
                sqlWhere += "and CN_S_ITEM_CODE ='{0}' OR CN_S_SERIAL_NO='{0}' OR CN_S_PACKING_CODE='{0}'";
                printEntity = CreateDAL<MONGO_PRINT_BARCODEDAL>().GetLikeValue(scanCode);
 
            }
            else if (codeType == "1")
            {
                itemCode = scanCode;
            }
            else if (codeType == "2")
            {
                printEntity = CreateDAL<MONGO_PRINT_BARCODEDAL>().GetFieldValue("CN_S_SERIAL_NO", scanCode);
            }
            else if (codeType == "3")
            {
                printEntity = CreateDAL<MONGO_PRINT_BARCODEDAL>().GetFieldValue("CN_S_UNIQUE_CODE", scanCode);
            }
            if (codeType != "1" && !string.IsNullOrEmpty(codeType))
            {
                itemCode = printEntity.CN_S_ITEM_CODE;
            }
            AutoBomItemEntity itemEnity = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(itemCode);
            return OperateResult.Succeed("", itemEnity);
 
        }
    }
}