Bladeren bron

工单列表导出

liyuanyuan 3 jaren geleden
bovenliggende
commit
73e80b2b7a

File diff suppressed because it is too large
+ 1 - 1
RMYY_CallCenter_Api.Dal/T_Car_WorkOrder.cs


+ 84 - 1
RMYY_CallCenter_Api/Controllers/WorkOrder/WorkCommonController.cs

@@ -177,7 +177,7 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
177 177
                                            );
178 178
 
179 179
                 datatable = WorkOrderBase.SetOtherField(datatable, MENUENUM.工单列表,User.F_UserCode, User.F_RoleId);
180
-
180
+              
181 181
                 var obj = new
182 182
                 {
183 183
                     state = "success",
@@ -191,6 +191,89 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
191 191
             return Error("无操作权限!");
192 192
         }
193 193
 
194
+       //工单列表导出
195
+        public ActionResult ExportGetComList(int? myd, string starttime = "", string phone = "", string endtime = "", string keyword = "", int pageindex = 1, int pagesize = 10, int state = -1, int type = 0, int loweltype = 0, string wocode = "", int isdc = 0)
196
+        {
197
+            if (User != null)
198
+            {
199
+                int recordCount = 0;
200
+                string sql = $" and F_IsDelete = 0 and F_Status>=0 ";
201
+                if (!string.IsNullOrEmpty(wocode))
202
+                {
203
+                    sql += $" and  F_WoCode like'%{wocode}%'";
204
+                }
205
+                if (type > 0)
206
+                {
207
+                    sql += $" and  F_Type={type}";
208
+                }
209
+                if (myd != null)
210
+                {
211
+                    sql += $" and  MYD={myd}";
212
+                }
213
+                sql += "and F_Type !=4000";
214
+                if (loweltype > 0)
215
+                {
216
+                    sql += $" and  F_SonType={loweltype}";
217
+                }
218
+                if (state >= 0)
219
+                {
220
+                    sql += $" and  F_IsDone={state}";
221
+                }
222
+                if (!string.IsNullOrEmpty(starttime))
223
+                {
224
+                    sql += $" and F_CreateTime>='{starttime}'";
225
+                }
226
+                if (!string.IsNullOrEmpty(endtime))
227
+                {
228
+                    sql += $" and F_CreateTime<'{endtime}'";
229
+                }
230
+                if (!string.IsNullOrEmpty(keyword))
231
+                {
232
+                    sql += $" and F_Content like '%{keyword}%'";
233
+                }
234
+                if (!string.IsNullOrEmpty(phone))
235
+                {
236
+                    sql += $" and F_Phone = '{phone}'";
237
+                }
238
+
239
+                
240
+
241
+
242
+                DataTable datatable = Bll.PagerBll.GetListPager
243
+                                           ("T_Wo_CommonBase ",
244
+                                             "F_WoCode",
245
+                                             "*,[dbo].[GetUserName](F_Proposer) F_ProposerName,[dbo].[GetUserName](F_DealUser) F_DealUserName, (case when MYD =0 then '满意' when  MYD =1 then '基本满意' when  MYD =2 then '不满意' else '' end )  MYDName, dbo.GetGongDanNameByID(F_SonType) gdtype ",
246
+                                             sql,
247
+                                             "order by F_CreateTime desc",
248
+                                             100000,
249
+                                             pageindex,
250
+                                             true,
251
+                                             out recordCount
252
+                                           );
253
+
254
+                datatable = WorkOrderBase.SetOtherField(datatable, MENUENUM.工单列表, User.F_UserCode, User.F_RoleId);
255
+               
256
+                DataTable newTable = datatable.DefaultView.ToTable(false, new string[]{ "F_WoCode", "F_ProposerName", "gdtype", "F_Content" , "StateName", "MYDName" , "F_CreateTime" });
257
+
258
+
259
+         
260
+                
261
+               var msg = new NPOIHelper().ExportToExcel("工单列表", newTable, new string[] { "工单编号", "姓名", "工单类别", "工单内容", "工单状态", "满意度", "创建时间"});
262
+                    if (msg == "")
263
+                    {
264
+                        return Success("导出成功");
265
+                    }
266
+                    else
267
+                    {
268
+                        return Error("导出失败");
269
+                    }
270
+               
271
+ 
272
+            }
273
+            return Error("无操作权限!");
274
+        }
275
+
276
+
194 277
 
195 278
         //催单按钮  urge 类型 1是调度员催单 2 是申请人催单
196 279
         //        申请人:提交完工单只要工单未完成都可催单