zhao
2021-07-19 8347f2fbddbd25369359dcb2da1233ac48a19fdc
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
using HH.WMS.Common;
using HH.WMS.Entitys;
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;
 
namespace HH.WMS.DAL.Pda
{
    public class GlDAL : DapperBaseDAL
    {
        #region 根据库区取占用的货位
        /// <summary>
        /// 根据库区取占用的货位
        /// </summary>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public List<TN_WM_LOCATION_EXTEntity> GetUsedLocationByArea(string areaCode)
        {
            string sql = @"SELECT * FROM TN_WM_B_LOCATION_EXT WHERE CN_S_AREA_CODE=@CN_S_AREA_CODE AND (CN_S_LOCATION_STATE!='正常' OR CN_S_USE_STATE='满')";
            return ExecuteQuery<TN_WM_LOCATION_EXTEntity>(sql, new
            {
                CN_S_AREA_CODE = areaCode
            });
        }
        #endregion
 
        #region 服务执行记录日志分页
        /// <summary>
        /// 服务执行记录日志分页
        /// </summary>
        /// <param name="sm"></param>
        /// <returns></returns>
        public OperateResult GetServiceExecList(SearchModel sm)
        {
            string taskType = Util.ToStringInput(sm.SearchCondition.taskType);
            string taskNo = Util.ToStringInput(sm.SearchCondition.taskNo);
            string isComplete = Util.ToStringInput(sm.SearchCondition.isComplete);
            string isSendMes = Util.ToStringInput(sm.SearchCondition.isSendMes);
 
            string strWhere = " WHERE 1=1 ";
            if (!string.IsNullOrEmpty(taskType))
            {
                strWhere += " AND CN_S_TASK_TYPE='" + taskType + "'";
            }
            if (!string.IsNullOrEmpty(taskNo))
            {
                strWhere += " AND CN_S_TASK_NO LIKE '%" + taskNo + "%'";
            }
            if (!string.IsNullOrEmpty(isComplete))
            {
                strWhere += " AND CN_C_COMPLETE='" + isComplete + "'";
            }
            if (!string.IsNullOrEmpty(isSendMes))
            {
                strWhere += " AND CN_C_SEND_MES='" + isSendMes + "'";
            }
 
            string orderBy = " ORDER BY CN_T_CREATE DESC";
 
            string sql = @"(SELECT * FROM TN_WM_SERVICE_EXEC " + strWhere + ") as t ";
            long total;
            var dt = ExecutePagingData(sql, sm.PageIndex, sm.PageSize, out total, orderBy, "");
            return OperateResult.Succeed("", new
            {
                total = total,
                rows = dt
            });
        }
        #endregion
 
    }
 
}