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
using HH.WMS.BLL;
using HH.WMS.BLL.AllQuery;
using HH.WMS.Common;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Common;
using HH.WMS.WebApi.Areas.Common.Controllers;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
 
namespace HH.WMS.WebApi.Areas.AllQuery.Controllers
{
    public class ReportController : BaseController
    {
        #region 获取KPI报表
        /// <summary>
        /// 获取KPI报表
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        /// <History>[Hanhe(DBS)] created by 2019/1/3</History>
        [HttpPost]
        public OperateResult GetKpiList(SearchModel searchModel)
        {
            return ValidateToken(searchModel.TokenId, x =>
            {
                try
                {
                    OperateResult result;
                    result = BLLCreator.Create<ReportBll>().GetKpiList(searchModel);
                    return result;
                }
                catch (Exception ex)
                {
                    return OperateResult.Error(ex.Message.ToString());
                }
            });
        }
        #endregion
 
        #region 新增U8对比数据
        /// <summary>
        /// 新增U8对比数据
        /// </summary>
        /// <param name="compareList"></param>
        /// <returns></returns>
        [HttpPost]
        public OperateResult AddU8CompareData(List<TN_WM_STOCKQTY_COMPAREEntity> compareList)
        {
            try
            {
                OperateResult result;
                result = BLLCreator.CreateDapper<TN_WM_STOCKQTY_COMPAREEntity>().AddRange(compareList);
                return result;
            }
            catch (Exception ex)
            {
                return OperateResult.Error(ex.Message.ToString());
            }
 
        }
        #endregion
 
        #region 库存对比统计
        /// <summary>
        /// 物流公司统计
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        [HttpPost]
        public string GetStockCompareReport(SearchModel searchModel)
        {
            return ValidateToken(searchModel.TokenId, t =>
            {
                long total;
                var dt = BLLCreator.Create<ReportBll>().GetStockCompareReport(searchModel, out total);
                OperateResult pagingList = OperateResult.Succeed(null, new
                {
                    rows = dt,
                    total = total
                });
 
                IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
                timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
 
                return JsonConvert.SerializeObject(pagingList, timeFormat);
            });
        }
        #endregion
 
        #region 物流公司统计
        /// <summary>
        /// 物流公司统计
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        [HttpPost]
        public OperateResult GetLogisticsReport(SearchModel searchModel)
        {
            return ValidateToken(searchModel.TokenId, t =>
            {
                long total;
                var dt = BLLCreator.Create<ReportBll>().GetLogisticsReport(searchModel, out total);
                return OperateResult.Succeed(null, new
                {
                    rows = dt,
                    total = total
                });
            });
        }
        #endregion
 
        #region 物流出库详情
        /// <summary>
        /// 物流出库详情
        /// </summary>
        /// <param name="searchModel"></param>
        /// <returns></returns>
        [HttpPost]
        public string GetLogisticsDetail(SearchModel searchModel)
        {
            return ValidateToken(searchModel.TokenId, t =>
            {
                var dt = BLLCreator.Create<ReportBll>().GetLogisticsDetail(searchModel);
 
                IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
                timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                return JsonConvert.SerializeObject(OperateResult.Succeed(null, dt), timeFormat);
            });
        }
        #endregion
    }
}