Explorar el Código

工单地区报表接口修改

machenyang %!s(int64=8) %!d(string=hace) años
padre
commit
089d4b733a

+ 34 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/GDPosController.cs

@@ -29,7 +29,33 @@ namespace CallCenterApi.Interface.Controllers.report
29 29
             ActionResult res = NoToken("未知错误,请重新登录");
30 30
             DataTable dtNew = new DataTable();
31 31
             dtNew = getData(stime, endtime);
32
-            res = Success("获取工单地区数据成功", dtNew);
32
+            #region 获取表头
33
+            DataTable dt = new DataTable();
34
+            string sql = "select b.f_province from [dbo].[T_Wo_WorkOrder] a,T_Cus_CustomerBase b where a.CustomerID = b.F_CustomerId";
35
+            dt = DbHelperSQL.Query(sql).Tables[0];
36
+            List<string> colnames = new List<string>();
37
+            colnames.Add("省份");
38
+
39
+            DataTable dtnew = new DataTable();
40
+            string sqlnew = "select * from T_Sys_UserAccount where 1=1 and F_DeleteFlag=0";
41
+            dtnew = DbHelperSQL.Query(sqlnew).Tables[0];
42
+            for (int j = 0; j < dtnew.Rows.Count; j++)
43
+            {
44
+                string f_ucode = "";
45
+                if (dtnew.Rows[j]["F_UserCode"] != null)
46
+                {
47
+                    f_ucode = dtnew.Rows[j]["F_UserCode"].ToString();
48
+                    colnames.Add(f_ucode);
49
+                }
50
+            }
51
+            colnames.Add("总计");
52
+            #endregion
53
+            var obj = new
54
+            {
55
+                dt = dtNew,
56
+                colname = colnames
57
+            };
58
+            res = Success("获取工单地区数据成功", obj);
33 59
 
34 60
             return res;
35 61
         }
@@ -59,6 +85,7 @@ namespace CallCenterApi.Interface.Controllers.report
59 85
                 string colname = modelList[i].F_UserCode;
60 86
                 dtNew.Columns.Add(new DataColumn(colname));
61 87
             }
88
+            dtNew.Columns.Add("总计");
62 89
             #endregion
63 90
 
64 91
             string sqltimeCallRecords = "";
@@ -92,16 +119,18 @@ namespace CallCenterApi.Interface.Controllers.report
92 119
                 DataTable dtnew = new DataTable();
93 120
                 string sqlnew = "select * from T_Sys_UserAccount where 1=1 and F_DeleteFlag=0";
94 121
                 dtnew = DbHelperSQL.Query(sqlnew).Tables[0];
122
+                int sum = 0;
95 123
                 for (int j = 0; j < dtnew.Rows.Count; j++)
96 124
                 {
97 125
                     string f_ucode = "";
98
-                    if (dtnew.Rows[i]["F_UserCode"] != null)
99
-                        f_ucode = dt.Rows[i]["F_UserCode"].ToString();
100
-                    string str = "select count(*) from [dbo].[T_Wo_WorkOrder] a,T_Cus_CustomerBase b where a.CustomerID = b.F_CustomerId and b.F_Province = '"+ f_prov + "' and a.createuser = '"+ f_ucode + "' where b.IsDel=0 " + sqltimeCallRecords;
126
+                    if (dtnew.Rows[j]["F_UserCode"] != null)
127
+                        f_ucode = dtnew.Rows[j]["F_UserCode"].ToString();
128
+                    string str = "select count(*) from [dbo].[T_Wo_WorkOrder] a,T_Cus_CustomerBase b where a.CustomerID = b.F_CustomerId and b.F_Province = '" + f_prov + "' and a.createuser = '" + f_ucode + "' and a.IsDel=0 " + sqltimeCallRecords;
101 129
                     int ecount = int.Parse(DbHelperSQL.GetSingle(str).ToString());
102 130
                     drNew[j + 1] = ecount.ToString();
131
+                    sum += ecount;
103 132
                 }
104
-
133
+                drNew[dtnew.Rows.Count + 1] = sum.ToString();
105 134
                 dtNew.Rows.Add(drNew);
106 135
             }
107 136