|
|
@@ -7,6 +7,7 @@ using System.Web;
|
|
7
|
7
|
using System.Web.Mvc;
|
|
8
|
8
|
using RMYY_CallCenter_Api.Utility;
|
|
9
|
9
|
using RMYY_CallCenter_Api.Models.Dto;
|
|
|
10
|
+using RMYY_CallCenter_Api.Models;
|
|
10
|
11
|
|
|
11
|
12
|
namespace RMYY_CallCenter_Api.Controllers.WorkOrder
|
|
12
|
13
|
{
|
|
|
@@ -26,7 +27,7 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
|
|
26
|
27
|
/// <param name="pagesize"></param>
|
|
27
|
28
|
/// <param name="state"></param>
|
|
28
|
29
|
/// <returns></returns>
|
|
29
|
|
- public ActionResult GetList(string keyword,int type=0, string starttime = "", string endtime = "", int pageindex = 1, int pagesize = 10, int state = -1)
|
|
|
30
|
+ public ActionResult GetList(string keyword,int type=0, string starttime = "", string endtime = "", int pageindex = 1, int pagesize = 10, int state = -1, int isdc = 0)
|
|
30
|
31
|
{
|
|
31
|
32
|
if (User != null)
|
|
32
|
33
|
{
|
|
|
@@ -86,55 +87,73 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
|
|
86
|
87
|
sql += $" and F_Id in (0)";
|
|
87
|
88
|
}
|
|
88
|
89
|
}
|
|
89
|
|
- #endregion
|
|
90
|
|
- int recordCount = 0;
|
|
91
|
|
- if (!string.IsNullOrEmpty(sql))
|
|
|
90
|
+ if (isdc > 0)
|
|
92
|
91
|
{
|
|
93
|
|
- data = Bll.PagerBll.GetListPager
|
|
94
|
|
- (
|
|
95
|
|
- "T_Dis_WorkOrder aa",
|
|
96
|
|
- "F_Id",
|
|
97
|
|
- "*",
|
|
98
|
|
- sql,
|
|
99
|
|
- "ORDER BY F_Id desc",
|
|
100
|
|
- pagesize,
|
|
101
|
|
- pageindex,
|
|
102
|
|
- true,
|
|
103
|
|
- out recordCount
|
|
104
|
|
- );
|
|
|
92
|
+ if (GetListExpt(sql, type))
|
|
|
93
|
+ return Success("导出成功!");
|
|
|
94
|
+ else return Error("导出失败!");
|
|
105
|
95
|
}
|
|
106
|
|
- var modellist = orderbll.DataTableToList(data);
|
|
107
|
|
- if (modellist.Count > 0)
|
|
|
96
|
+ else
|
|
108
|
97
|
{
|
|
109
|
|
- //if (wokerlist.Count > 0 || User.F_UserCode== "ZYY")
|
|
110
|
|
- //{
|
|
111
|
|
- foreach (var item in modellist)
|
|
|
98
|
+ #endregion
|
|
|
99
|
+ int recordCount = 0;
|
|
|
100
|
+ if (!string.IsNullOrEmpty(sql))
|
|
112
|
101
|
{
|
|
113
|
|
- if (wokerlist.Count > 0 || User.F_RoleCode == "ZYY")
|
|
114
|
|
- {
|
|
115
|
|
- item.F_Wostate = GetWoStateName(item.F_Id, User.F_UserCode);
|
|
116
|
|
- }
|
|
117
|
|
- else
|
|
118
|
|
- {
|
|
119
|
|
- item.F_Wostate = EnumHelper.GetDescription((EnumDisWorkOrderState)item.F_State);
|
|
120
|
|
- }
|
|
121
|
|
- item.F_SitMan = item.F_ControlManName + '(' + item.F_ControlManCode + ')';
|
|
122
|
|
- if (type == (int)EnumWorkOrder.UrgDis)
|
|
|
102
|
+ data = Bll.PagerBll.GetListPager
|
|
|
103
|
+ (
|
|
|
104
|
+ "T_Dis_WorkOrder aa",
|
|
|
105
|
+ "F_Id",
|
|
|
106
|
+ "*",
|
|
|
107
|
+ sql,
|
|
|
108
|
+ "ORDER BY F_Id desc",
|
|
|
109
|
+ pagesize,
|
|
|
110
|
+ pageindex,
|
|
|
111
|
+ true,
|
|
|
112
|
+ out recordCount
|
|
|
113
|
+ );
|
|
|
114
|
+ }
|
|
|
115
|
+ var modellist = orderbll.DataTableToList(data);
|
|
|
116
|
+ if (modellist.Count > 0)
|
|
|
117
|
+ {
|
|
|
118
|
+ //if (wokerlist.Count > 0 || User.F_UserCode== "ZYY")
|
|
|
119
|
+ //{
|
|
|
120
|
+ foreach (var item in modellist)
|
|
123
|
121
|
{
|
|
124
|
|
- item.dislist = orderbll.GetModelList("datediff(second,F_CreateTime,'" + item.F_CreateTime + "')=0 and F_Id!=" + item.F_Id + "");
|
|
125
|
|
- }
|
|
126
|
|
- item.rolecode = User.F_RoleCode;
|
|
127
|
122
|
|
|
|
123
|
+ if (wokerlist.Count > 0 || User.F_RoleCode == "ZYY")
|
|
|
124
|
+ {
|
|
|
125
|
+ item.F_Wostate = GetWoStateName(item.F_Id, User.F_UserCode);
|
|
|
126
|
+ }
|
|
|
127
|
+ else
|
|
|
128
|
+ {
|
|
|
129
|
+ item.F_Wostate = EnumHelper.GetDescription((EnumDisWorkOrderState)item.F_State);
|
|
|
130
|
+ }
|
|
|
131
|
+ item.F_SitMan = item.F_ControlManName + '(' + item.F_ControlManCode + ')';
|
|
|
132
|
+ if (type == (int)EnumWorkOrder.UrgDis)
|
|
|
133
|
+ {
|
|
|
134
|
+ item.dislist = orderbll.GetModelList("datediff(second,F_CreateTime,'" + item.F_CreateTime + "')=0 and F_Id!=" + item.F_Id + "");
|
|
|
135
|
+ }
|
|
|
136
|
+ if (type == (int)EnumWorkOrder.RedDis)
|
|
|
137
|
+ {
|
|
|
138
|
+
|
|
|
139
|
+ item.RedPic = GetRedPics(item.F_ItemMessages);
|
|
|
140
|
+
|
|
|
141
|
+ }
|
|
|
142
|
+ item.rolecode = User.F_RoleCode;
|
|
|
143
|
+ item.F_TypeName = GetTypeName(type);
|
|
|
144
|
+ //var buttons = ButtonGroup.GetButtons(item.F_State, User.F_RoleCode, item.F_Type);
|
|
|
145
|
+
|
|
|
146
|
+ }
|
|
128
|
147
|
}
|
|
|
148
|
+ var obj = new
|
|
|
149
|
+ {
|
|
|
150
|
+ state = "success",
|
|
|
151
|
+ message = "成功",
|
|
|
152
|
+ rows = modellist,
|
|
|
153
|
+ total = recordCount
|
|
|
154
|
+ };
|
|
|
155
|
+ return Content(obj.ToJson());
|
|
129
|
156
|
}
|
|
130
|
|
- var obj = new
|
|
131
|
|
- {
|
|
132
|
|
- state = "success",
|
|
133
|
|
- message = "成功",
|
|
134
|
|
- rows = modellist,
|
|
135
|
|
- total = recordCount
|
|
136
|
|
- };
|
|
137
|
|
- return Content(obj.ToJson());
|
|
138
|
157
|
}
|
|
139
|
158
|
return Error("无操作权限!");
|
|
140
|
159
|
}
|
|
|
@@ -203,6 +222,55 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
|
|
203
|
222
|
|
|
204
|
223
|
|
|
205
|
224
|
/// <summary>
|
|
|
225
|
+ /// 获取工单类型名称
|
|
|
226
|
+ /// </summary>
|
|
|
227
|
+ /// <returns></returns>
|
|
|
228
|
+ public string GetTypeName(int type)
|
|
|
229
|
+ {
|
|
|
230
|
+ string name = "";
|
|
|
231
|
+ switch (type)
|
|
|
232
|
+ {
|
|
|
233
|
+ case (int)EnumWorkOrder.RedDis:
|
|
|
234
|
+ name= "红处方配送";
|
|
|
235
|
+ break;
|
|
|
236
|
+ case (int)EnumWorkOrder.OrtherDis:
|
|
|
237
|
+ name= "其他配送";
|
|
|
238
|
+ break;
|
|
|
239
|
+ case (int)EnumWorkOrder.UrgDis:
|
|
|
240
|
+ name= "急标本配送";
|
|
|
241
|
+ break;
|
|
|
242
|
+ case (int)EnumWorkOrder.BloodDis:
|
|
|
243
|
+ name= "血液制品配送";
|
|
|
244
|
+ break;
|
|
|
245
|
+ }
|
|
|
246
|
+ return name;
|
|
|
247
|
+ }
|
|
|
248
|
+
|
|
|
249
|
+ /// <summary>
|
|
|
250
|
+ /// 获取图片路径
|
|
|
251
|
+ /// </summary>
|
|
|
252
|
+ /// <param name="ids"></param>
|
|
|
253
|
+ /// <returns></returns>
|
|
|
254
|
+
|
|
|
255
|
+ public string GetRedPics(string ids)
|
|
|
256
|
+ {
|
|
|
257
|
+ string PicPath = "";
|
|
|
258
|
+ if (!string.IsNullOrEmpty(ids))
|
|
|
259
|
+ {
|
|
|
260
|
+ var modelist = new Bll.T_Sys_Accessories().GetModelList(" F_FileId in (" + ids.Trim(',') + ")");
|
|
|
261
|
+ if (modelist.Count > 0)
|
|
|
262
|
+ {
|
|
|
263
|
+ foreach (var item in modelist)
|
|
|
264
|
+ {
|
|
|
265
|
+ PicPath = PicPath + item.F_FileUrl + ",";
|
|
|
266
|
+ }
|
|
|
267
|
+ }
|
|
|
268
|
+ }
|
|
|
269
|
+ return PicPath.Trim(',');
|
|
|
270
|
+ }
|
|
|
271
|
+
|
|
|
272
|
+
|
|
|
273
|
+ /// <summary>
|
|
206
|
274
|
/// 获取工单详情
|
|
207
|
275
|
/// </summary>
|
|
208
|
276
|
/// <param name="id"></param>
|
|
|
@@ -222,6 +290,10 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
|
|
222
|
290
|
model.HosName = new Bll.T_Wowo_repairyqbll().GetModel(model.F_HosId??0).T_Woname;
|
|
223
|
291
|
model.dislist= orderbll.GetModelList("datediff(second,F_CreateTime,'" + model.F_CreateTime + "')=0 and F_Id!=" + model.F_Id + "");
|
|
224
|
292
|
model.F_Wostate = EnumHelper.GetDescription((EnumDisWorkOrderState)model.F_State);
|
|
|
293
|
+ if (model.F_Type == (int)EnumWorkOrder.RedDis)
|
|
|
294
|
+ {
|
|
|
295
|
+ model.RedPic = GetRedPics(model.F_ItemMessages);
|
|
|
296
|
+ }
|
|
225
|
297
|
var obj = new
|
|
226
|
298
|
{
|
|
227
|
299
|
state = "success",
|
|
|
@@ -242,38 +314,21 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
|
|
242
|
314
|
/// <param name="starttime"></param>
|
|
243
|
315
|
/// <param name="endtime"></param>
|
|
244
|
316
|
/// <returns></returns>
|
|
245
|
|
- public ActionResult GetListExpt(int type,string keyword, string starttime = "", string endtime = "", int state = -1)
|
|
|
317
|
+ public bool GetListExpt(string sql,int type)
|
|
246
|
318
|
{
|
|
247
|
|
- if (User != null)
|
|
248
|
|
- {
|
|
249
|
319
|
#region 查询条件
|
|
250
|
320
|
if (type != (int)EnumWorkOrder.OrtherDis && type != (int)EnumWorkOrder.UrgDis && type != (int)EnumWorkOrder.RedDis && type != (int)EnumWorkOrder.BloodDis)
|
|
251
|
|
- return Error("工单类型错误!");
|
|
252
|
|
- string sql = $" and F_IsDel=0 and F_Type=" + type;
|
|
253
|
|
- DataTable data = new DataTable();
|
|
254
|
|
- if (starttime.Trim() != "" && starttime != "undefined")
|
|
255
|
|
- sql += $" and datediff(day,F_CreateTime,'" + starttime + "') <=0 ";
|
|
256
|
|
- if (endtime.Trim() != "" && endtime != "undefined")
|
|
257
|
|
- sql += $" and datediff(day,F_CreateTime,'" + endtime + "')>=0";
|
|
258
|
|
- if (!string.IsNullOrEmpty(keyword))
|
|
259
|
|
- {
|
|
260
|
|
- sql += $"and (F_WorkOrderCode like '%" + keyword.Trim() + "%' or F_ProposerCode like '%" + keyword.Trim() + "%' or F_ProposerPhon like '%" + keyword.Trim() + "%')";
|
|
261
|
|
- }
|
|
262
|
|
- if (state >= 0)
|
|
263
|
|
- {
|
|
264
|
|
- sql += $"and F_State=" + state;
|
|
265
|
|
- }
|
|
|
321
|
+ return false;
|
|
|
322
|
+ DataTable data = new DataTable();
|
|
266
|
323
|
#endregion
|
|
267
|
324
|
|
|
268
|
325
|
NPOIHelper nopi = new NPOIHelper();
|
|
269
|
326
|
data = GetData(type,sql);
|
|
270
|
327
|
if (nopi.ExportToExcel(GetExportTitle(type), data, col(type)) == "")
|
|
271
|
328
|
{
|
|
272
|
|
- return Success("导出成功!");
|
|
|
329
|
+ return true;
|
|
273
|
330
|
}
|
|
274
|
|
- else return Error("导出失败!");
|
|
275
|
|
- }
|
|
276
|
|
- return Error("无操作权限!");
|
|
|
331
|
+ else return false;
|
|
277
|
332
|
}
|
|
278
|
333
|
|
|
279
|
334
|
|
|
|
@@ -525,8 +580,8 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
|
|
525
|
580
|
for (int i = 0; i < _list.Length; i++)
|
|
526
|
581
|
{
|
|
527
|
582
|
string[] _temp = _list[i].Split('-');
|
|
528
|
|
- string itemess = _temp[0];
|
|
529
|
|
- int sendeptid = Convert.ToInt32(_temp[1]);
|
|
|
583
|
+ int sendeptid = Convert.ToInt32(_temp[0]);
|
|
|
584
|
+ string itemess = _temp[1];
|
|
530
|
585
|
int num = Convert.ToInt32(_temp[2]);
|
|
531
|
586
|
string sendepatname = "";
|
|
532
|
587
|
try { sendepatname = dptbll.GetModel(sendeptid).F_DeptName; }
|