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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
using HH.WMS.DAL;
using HH.WMS.DAL.Basic;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Autobom;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Common;
using HH.WMS.Entitys.Entitys;
/********************************************************************************
 
** auth: DBS
 
** date: 2018/12/3 17:03:13
 
** desc: 尚未编写描述
 
** Ver.:  V1.0.0
 
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HH.WMS.BLL.Basic
{
    public class TN_WM_LOCATION_EXTBLL : DapperBaseBLL, ITN_WM_LOCATION_EXTBLL
    {
        #region 根据巷道获取巷道内的货位状态
 
        /// <summary>
        /// 根据巷道获取巷道内的货位状态
        /// </summary>
        /// <param name="stockCode">仓库号</param>
        /// <param name="areaCode">库区号</param>
        /// <param name="roadway">巷道号</param>
        /// <returns></returns>
        /// <History>[Hanhe(DBS)] created 2018/12/03</History>
        public DataTable ViewState(string stockCode, string areaCode, string roadway)
        {
            var dt = CreateDAL<TN_WM_LOCATION_EXTDAL>().ViewState(stockCode, areaCode, roadway);
            dt.Columns["VIEW_STATE"].ReadOnly = false;
            foreach (DataRow row in dt.Rows)
            {
                if (row["VIEW_STATE"].ToString().Equals("满"))
                {
                    var trayLocation = CreateDAL<DapperDAL<TN_WM_B_TRAY_LOCATIONEntity>>().GetSingleEntity(new { CN_S_LOCATION_CODE = row["CN_S_LOCATION_CODE"].ToString() });
                    if (trayLocation != null)
                    {
                        var trayInfo = CreateDAL<DapperDAL<TN_WM_B_TRAY_INFOEntity>>().GetSingleEntity(new { CN_S_TRAY_CODE = trayLocation.CN_S_TRAY_CODE });
                        if (trayInfo != null)
                        {
                            if (!string.IsNullOrEmpty(trayInfo.CN_S_USE_STATE) && trayInfo.CN_S_USE_STATE.Trim() != "空")
                                row["VIEW_STATE"] = trayInfo.CN_S_USE_STATE;
                        }
                    }
                }
            }
            return dt;
        }
 
        #endregion
 
        public List<TN_WM_LOCATION_EXTEntity> GetModel(string strWhere)
        {
            return CreateDAL<TN_WM_LOCATION_EXTDAL>().GetModel(strWhere);
        }
        public List<TN_WM_LOCATION_EXTEntity> GetModelByRow(string strRow, string strArea)
        {
            return CreateDAL<TN_WM_LOCATION_EXTDAL>().GetModelByRow(strRow, strArea);
        }
        public TN_WM_LOCATION_EXTEntity GetExtModel(string strWhere)
        {
            List<TN_WM_LOCATION_EXTEntity> lst = CreateDAL<TN_WM_LOCATION_EXTDAL>().GetModel(strWhere);
            if (!lst.Any())
            {
                return null;
            }
            return lst[0];
        }
 
        #region 删除
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="lstGuid">要删除的ID集合</param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public SqlExecuteResult Delete(string Where)
        {
            SqlExecuteResult result = new SqlExecuteResult();
            result = CreateDAL<TN_WM_LOCATION_EXTDAL>().Delete(Where, null);
            return result;
        }
        #endregion
 
        public SqlExecuteResult Add(TN_WM_LOCATION_EXTEntity Entity)
        {
            SqlExecuteResult result = new SqlExecuteResult();
            OperateResult Opresult = CreateDAL<DapperDAL<TN_WM_LOCATION_EXTEntity>>().Add(Entity, null);
            result.Success = Opresult.Success;
            result.Exception = new Exception(Opresult.Msg);
            return result;
        }
 
        public SqlExecuteResult UpdateSync(TN_WM_LOCATION_EXTEntity Entity)
        {
            SqlExecuteResult result = CreateDAL<TN_WM_LOCATION_EXTDAL>().UpdateSync(Entity, null);
            return result;
        }
 
        public SqlExecuteResult UpdateBFState(string where, string tableName)
        {
            SqlExecuteResult result = new SqlExecuteResult();
            result = CreateDAL<TN_WM_LOCATION_EXTDAL>().UpdateBFState(where, tableName, null);
            return result;
        }
 
        #region 更新状态
 
        public OperateResult UpdateState(string locationCode, string state, string bState)
        {
            var result = CreateDAL<TN_WM_LOCATION_EXTDAL>().UpdateLocationExtState(locationCode, state, bState, "", null);
            return result;
        }
 
        public OperateResult UpdateState(string locationCode, string state, string bState, IDbTransaction trans)
        {
            var result = CreateDAL<TN_WM_LOCATION_EXTDAL>().UpdateLocationExtState(locationCode, state, bState, "", trans);
            return result;
        }
 
        #endregion
 
        #region 更新状态根据托盘码
 
        public OperateResult UpdateStateByTrayCode(string trayCode, string locationState, string useState, IDbTransaction trans)
        {
            var result = CreateDAL<TN_WM_LOCATION_EXTDAL>().UpdateStateByTrayCode(trayCode, locationState, useState, trans);
            return result;
        }
 
        #endregion
 
        #region
 
        public OperateResult UpdateLocationExtState(string locationCode, string locationState, string locationUseState, string taskNo, IDbTransaction trans)
        {
            var result = CreateDAL<TN_WM_LOCATION_EXTDAL>().UpdateLocationExtState(locationCode, locationState, locationUseState, taskNo, trans);
            return result;
        }
 
        #endregion
 
        #region 查询货位拓展表
        /// <summary>
        /// 查询货位拓展表
        /// </summary>
        /// <param name="searchModel">实体</param>
        /// <returns></returns>
        /// <History>[HANHE(lt)] CREATED BY 2018-12-18</History>
        public OperateResult GetLocationExtList(SearchModel searchModel)
        {
            return CreateDAL<TN_WM_LOCATION_EXTDAL>().GetLocationExtList(searchModel);
        }
        #endregion
 
        /// <summary>
        /// 根据仓库获取存储情况
        /// </summary>
        /// <param name="stockCode">仓库号</param>
        /// <returns></returns>
        public DataTable GetAreaStorageInfo(string stockCode,string[] areas)
        {
            return CreateDAL<TN_WM_LOCATION_EXTDAL>().GetAreaStorageInfo(stockCode, areas);
        }
 
        #region 获取货位列表
 
        public List<TN_WM_LOCATION_EXTEntity> GetLocationList()
        {
            return CreateDAL<TN_WM_LOCATION_EXTDAL>().GetLocationList();
        }
 
        #endregion
 
        #region 获取货位状态数量
 
        public DataTable GetStateQty(string stockCode)
        {
            return CreateDAL<TN_WM_LOCATION_EXTDAL>().GetStateQty(stockCode);
        }
 
        #endregion
    }
}