Просмотр исходного кода

催单,记录日志,发送消息,工单类型修改,工单详情

liyuanyuan лет назад: 3
Родитель
Сommit
aaeabe8200

+ 1 - 1
RMYY_CallCenter_Api.Bll/AddLogBll.cs

@@ -13,7 +13,7 @@ namespace RMYY_CallCenter_Api.Bll
13 13
         /// <summary>
14 14
         /// 添加工单记录
15 15
         /// </summary>
16
-        public long AddLog(int woid, int wostate, int type, string content, int itemtype, int opttype, string nextuser, int nextdept, string usercode, int F_IsUsed = 0)
16
+        public long AddLog(int woid, int wostate, int type, string content, int itemtype, int opttype, string nextuser, int nextdept, string usercode,  int F_IsUsed = 0)
17 17
         {
18 18
 
19 19
             Model.T_Dis_WorkOrderItem itemModel = new Model.T_Dis_WorkOrderItem();

+ 24 - 11
RMYY_CallCenter_Api.Dal/T_Sys_GongDan.cs

@@ -38,9 +38,9 @@ namespace RMYY_CallCenter_Api.Dal
38 38
         {
39 39
             StringBuilder strSql = new StringBuilder();
40 40
             strSql.Append("insert into T_Sys_GongDan(");
41
-            strSql.Append("F_ParentID,F_Name,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl,F_TimeOut,F_RepairTimeLimit,F_Identification,F_AutoDept,F_CanReplayCount)");
41
+            strSql.Append("F_ParentID,F_Name,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl,F_TimeOut,F_RepairTimeLimit,F_Identification,F_AutoDept,F_CanReplayCount,F_CanUrgeCount)");
42 42
             strSql.Append(" values (");
43
-            strSql.Append("@F_ParentID,@F_Name,@F_Remark,@F_Sort,@F_CreateTime,@F_TypeId,@F_ImgUrl,@F_TimeOut,@F_RepairTimeLimit,@F_Identification,@F_AutoDept,@F_CanReplayCount)");
43
+            strSql.Append("@F_ParentID,@F_Name,@F_Remark,@F_Sort,@F_CreateTime,@F_TypeId,@F_ImgUrl,@F_TimeOut,@F_RepairTimeLimit,@F_Identification,@F_AutoDept,@F_CanReplayCount,@F_CanUrgeCount)");
44 44
             strSql.Append(";select @@IDENTITY");
45 45
             SqlParameter[] parameters = {
46 46
                     new SqlParameter("@F_ParentID", SqlDbType.Int,4),
@@ -54,7 +54,9 @@ namespace RMYY_CallCenter_Api.Dal
54 54
                         new SqlParameter("@F_RepairTimeLimit", SqlDbType.Int,4),
55 55
                           new SqlParameter("@F_Identification", SqlDbType.VarChar,50),
56 56
 new SqlParameter("@F_AutoDept", SqlDbType.Int,4),
57
-new SqlParameter("@F_CanReplayCount", SqlDbType.Int,4)
57
+new SqlParameter("@F_CanReplayCount", SqlDbType.Int,4),
58
+new SqlParameter("@F_CanUrgeCount", SqlDbType.Int,4),
59
+
58 60
 
59 61
 
60 62
 
@@ -72,7 +74,7 @@ new SqlParameter("@F_CanReplayCount", SqlDbType.Int,4)
72 74
 
73 75
             parameters[10].Value = model.F_AutoDept;
74 76
             parameters[11].Value = model.F_CanReplayCount;
75
-            
77
+            parameters[12].Value = model.F_CanUrgeCount;
76 78
             object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
77 79
             if (obj == null)
78 80
             {
@@ -104,10 +106,14 @@ new SqlParameter("@F_CanReplayCount", SqlDbType.Int,4)
104 106
             strSql.Append("F_AutoDept=@F_AutoDept,");
105 107
             strSql.Append("F_CanReplayCount=@F_CanReplayCount,");
106 108
 
107
-            strSql.Append("F_IsDelete=@F_IsDelete");
109
+
110
+            strSql.Append("F_IsDelete=@F_IsDelete,");
111
+            strSql.Append("F_CanUrgeCount=@F_CanUrgeCount");
108 112
             
109 113
 
110 114
 
115
+
116
+
111 117
             strSql.Append(" where F_GDId=@F_GDId");
112 118
             SqlParameter[] parameters = {
113 119
                     new SqlParameter("@F_ParentID", SqlDbType.Int,4),
@@ -137,8 +143,10 @@ new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
137 143
             parameters[9].Value = model.F_ImgUrl;
138 144
             parameters[10].Value = model.F_AutoDept;
139 145
             parameters[11].Value = model.F_CanReplayCount;
140
-            parameters[12].Value = model.F_IsDelete; 
141
-            parameters[13].Value = model.F_GDId;
146
+            parameters[12].Value = model.F_IsDelete;
147
+            parameters[13].Value = model.F_CanUrgeCount;
148
+            
149
+            parameters[14].Value = model.F_GDId;
142 150
 
143 151
             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
144 152
             if (rows > 0)
@@ -202,7 +210,7 @@ new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
202 210
         {
203 211
 
204 212
             StringBuilder strSql = new StringBuilder();
205
-            strSql.Append("select  top 1 F_GDId,F_ParentID,F_Identification,F_Name,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl ,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount from T_Sys_GongDan with(nolock)");
213
+            strSql.Append("select  top 1 F_GDId,F_ParentID,F_Identification,F_Name,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl ,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount,F_CanUrgeCount from T_Sys_GongDan with(nolock)");
206 214
             strSql.Append(" where F_GDId=@F_GDId");
207 215
             SqlParameter[] parameters = {
208 216
                     new SqlParameter("@F_GDId", SqlDbType.Int,4)
@@ -229,7 +237,7 @@ new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
229 237
         {
230 238
 
231 239
             StringBuilder strSql = new StringBuilder();
232
-            strSql.Append("select  top 1 F_GDId,F_ParentID,F_Identification,F_Name,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount  from T_Sys_GongDan with(nolock)");
240
+            strSql.Append("select  top 1 F_GDId,F_ParentID,F_Identification,F_Name,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount,F_CanUrgeCount  from T_Sys_GongDan with(nolock)");
233 241
             strSql.Append(" where F_Name=@F_Name");
234 242
             SqlParameter[] parameters = {
235 243
                     new SqlParameter("@F_Name", SqlDbType.VarChar,100)
@@ -287,6 +295,11 @@ new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
287 295
                 {
288 296
                     model.F_CanReplayCount = int.Parse(row["F_CanReplayCount"].ToString());
289 297
                 }
298
+                if (row["F_CanUrgeCount"] != null && row["F_CanUrgeCount"].ToString() != "")
299
+                {
300
+                    model.F_CanUrgeCount = int.Parse(row["F_CanUrgeCount"].ToString());
301
+                }
302
+                
290 303
                 if (row["F_TimeOut"] != null && row["F_TimeOut"].ToString() != "")
291 304
                 {
292 305
                     model.F_TimeOut = int.Parse(row["F_TimeOut"].ToString());
@@ -324,7 +337,7 @@ new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
324 337
         public DataSet GetList(string strWhere)
325 338
         {
326 339
             StringBuilder strSql = new StringBuilder();
327
-            strSql.Append("select F_GDId,F_ParentID,F_Name,F_Identification,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount ");
340
+            strSql.Append("select F_GDId,F_ParentID,F_Name,F_Identification,F_Remark,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount,F_CanUrgeCount ");
328 341
             strSql.Append(" FROM T_Sys_GongDan with(nolock)");
329 342
             if (strWhere.Trim() != "")
330 343
             {
@@ -344,7 +357,7 @@ new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
344 357
             {
345 358
                 strSql.Append(" top " + Top.ToString());
346 359
             }
347
-            strSql.Append(" F_GDId,F_ParentID,F_Name,F_Remark,F_Identification,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl ,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount");
360
+            strSql.Append(" F_GDId,F_ParentID,F_Name,F_Remark,F_Identification,F_Sort,F_CreateTime,F_TypeId,F_ImgUrl ,F_TimeOut,F_RepairTimeLimit,F_AutoDept,F_CanReplayCount,F_CanUrgeCount");
348 361
             strSql.Append(" FROM T_Sys_GongDan with(nolock)");
349 362
             if (strWhere.Trim() != "")
350 363
             {

+ 8 - 6
RMYY_CallCenter_Api.Dal/T_Wo_CommonBase.cs

@@ -75,7 +75,7 @@ namespace RMYY_CallCenter_Api.DAL
75 75
 		{
76 76
 			StringBuilder strSql=new StringBuilder();
77 77
 			strSql.Append("update T_Wo_CommonBase set ");
78
-			strSql.Append("F_WoCode=@F_WoCode,");
78
+		//	strSql.Append("F_WoCode=@F_WoCode,");
79 79
 			strSql.Append("F_CreateUser=@F_CreateUser,");
80 80
 			strSql.Append("F_Type=@F_Type,");
81 81
 			strSql.Append("F_SonType=@F_SonType,");
@@ -92,10 +92,11 @@ namespace RMYY_CallCenter_Api.DAL
92 92
 			strSql.Append("F_ExternalWorkOrderCode=@F_ExternalWorkOrderCode,");
93 93
 			strSql.Append("F_CreateTime=@F_CreateTime,");
94 94
 			strSql.Append("F_UpdateTime=@F_UpdateTime,");
95
-            strSql.Append("F_Phone=@F_Phone");
95
+            strSql.Append("F_Phone=@F_Phone,");
96
+            strSql.Append("F_UrgeCount=@F_UrgeCount");
96 97
             
97 98
 
98
-            strSql.Append(" where ");
99
+            strSql.Append(" where F_WoCode=@F_WoCode");
99 100
 			SqlParameter[] parameters = {
100 101
 					new SqlParameter("@F_WoCode", SqlDbType.VarChar,50),
101 102
 					new SqlParameter("@F_CreateUser", SqlDbType.Int,4),
@@ -114,7 +115,8 @@ namespace RMYY_CallCenter_Api.DAL
114 115
 					new SqlParameter("@F_ExternalWorkOrderCode", SqlDbType.VarChar,500),
115 116
 					new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
116 117
 					new SqlParameter("@F_UpdateTime", SqlDbType.DateTime),
117
-                    new SqlParameter("@F_Phone", SqlDbType.VarChar,50)
118
+                    new SqlParameter("@F_Phone", SqlDbType.VarChar,50),
119
+                                  new SqlParameter("@F_UrgeCount", SqlDbType.Int,4)
118 120
             };
119 121
 			parameters[0].Value = model.F_WoCode;
120 122
 			parameters[1].Value = model.F_CreateUser;
@@ -133,7 +135,7 @@ namespace RMYY_CallCenter_Api.DAL
133 135
 			parameters[14].Value = model.F_CreateTime;
134 136
 			parameters[15].Value = model.F_UpdateTime;
135 137
             parameters[16].Value = model.F_Phone;
136
-
138
+            parameters[17].Value = model.F_UrgeCount;
137 139
             int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
138 140
 			if (rows > 0)
139 141
 			{
@@ -182,7 +184,7 @@ namespace RMYY_CallCenter_Api.DAL
182 184
             SqlParameter[] parameters = {
183 185
                     new SqlParameter("@F_WoCode", SqlDbType.VarChar)
184 186
             };
185
-
187
+            parameters[0].Value = F_WoCode;
186 188
             RMYY_CallCenter_Api.Model.T_Wo_CommonBase model=new RMYY_CallCenter_Api.Model.T_Wo_CommonBase();
187 189
 			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
188 190
 			if(ds.Tables[0].Rows.Count>0)

+ 9 - 0
RMYY_CallCenter_Api.Model/T_Car_WorkOrder.cs

@@ -45,6 +45,8 @@ namespace RMYY_CallCenter_Api.Model
45 45
         private DateTime? _f_finishtime;
46 46
         private int? _f_carid;
47 47
         private string _f_assistmanname;
48
+
49
+        private int? _f_urgecount;
48 50
         /// <summary>
49 51
         /// 
50 52
         /// </summary>
@@ -286,6 +288,13 @@ namespace RMYY_CallCenter_Api.Model
286 288
             set { _f_carid = value; }
287 289
             get { return _f_carid; }
288 290
         }
291
+        public int? F_UrgeCount
292
+        {
293
+            set { _f_urgecount = value; }
294
+            get { return _f_urgecount; }
295
+        }
296
+        
297
+
289 298
         /// <summary>
290 299
         /// 协作人姓名
291 300
         /// </summary>

+ 15 - 0
RMYY_CallCenter_Api.Model/T_Sys_GongDan.cs

@@ -24,6 +24,21 @@ namespace RMYY_CallCenter_Api.Model
24 24
         private int? _f_autodept;
25 25
         private int _f_canreplaycount = 0;
26 26
 
27
+        private int _f_canurgecount = 0;
28
+
29
+
30
+
31
+        /// <summary>
32
+        /// 可以催单的次数,,=0不允许催办,=-1不限制催办次数,其他的=几就是可以催办几次
33
+        /// </summary>
34
+
35
+        public int F_CanUrgeCount
36
+        {
37
+            set { _f_canurgecount = value; }
38
+            get { return _f_canurgecount; }
39
+        }
40
+
41
+
27 42
         private int _f_isdelete = 0;
28 43
         public int F_IsDelete
29 44
         {

+ 7 - 1
RMYY_CallCenter_Api.Model/T_Wo_CommonBase.cs

@@ -28,13 +28,19 @@ namespace RMYY_CallCenter_Api.Model
28 28
 		private DateTime _f_createtime;
29 29
 		private DateTime _f_updatetime;
30 30
         private int f_replaycount = 0;
31
+        private int f_urgecount = 0;
31 32
 
32 33
         public int F_ReplayCount
33 34
         {
34 35
             set { f_replaycount = value; }
35 36
             get { return f_replaycount; }
36 37
         }
37
-
38
+        public int F_UrgeCount
39
+        {
40
+            set { f_urgecount = value; }
41
+            get { return f_urgecount; }
42
+        }
43
+        
38 44
         /// <summary>
39 45
         /// 
40 46
         /// </summary>

+ 9 - 7
RMYY_CallCenter_Api.QuartzWorker/PushWorkorder.cs

@@ -18,13 +18,15 @@ namespace RMYY_CallCenter_Api.QuartzWorker
18 18
 
19 19
         public void Push(object sender, EventArgs e)
20 20
         {
21
-             WebClient web = new WebClient();
22
-             web.Encoding = Encoding.UTF8;
23
-             string Dataurl = web.DownloadString("http://192.168.8.10:8033/FaultRepair/Evaluate" );
24
-             string Dataur2 = web.DownloadString("http://192.168.8.10:8033/FaultRepair/Automatic");
25
-             string Dataur3 = web.DownloadString("http://192.168.8.10:8033/T_Car_WorkOrder/Evaluate");
26
-             string Dataur4 = web.DownloadString("http://192.168.8.10:8033/InternalMessages/DingTalkGetMessage");
27
-           
21
+            // WebClient web = new WebClient();
22
+            // web.Encoding = Encoding.UTF8;
23
+            // string Dataurl = web.DownloadString("http://192.168.8.10:8033/FaultRepair/Evaluate" );
24
+            // string Dataur2 = web.DownloadString("http://192.168.8.10:8033/FaultRepair/Automatic");
25
+            // string Dataur3 = web.DownloadString("http://192.168.8.10:8033/T_Car_WorkOrder/Evaluate");
26
+            // string Dataur4 = web.DownloadString("http://192.168.8.10:8033/InternalMessages/DingTalkGetMessage");
27
+            //string Dataur5= web.DownloadString("http://192.168.8.10:8033/FaultRepair/AutoSendOverTimeMsg"); 
28
+
29
+
28 30
         }
29 31
     }
30 32
 }

+ 34 - 11
RMYY_CallCenter_Api/Common/WorkOrderBase.cs

@@ -265,7 +265,7 @@ namespace RMYY_CallCenter_Api
265 265
         public static DataTable SetOtherField(DataTable dt, MENUENUM menuName, int roleId = 0, int type = 0)
266 266
         {
267 267
             if (dt.Columns.Contains("Buttons") && dt.Columns.Contains("GapTime") && dt.Columns.Contains("StateName"))
268
-            { 
268
+            {
269 269
                 return dt;
270 270
             }
271 271
 
@@ -281,7 +281,7 @@ namespace RMYY_CallCenter_Api
281 281
                             {
282 282
                                 typeFieldName = dt.Columns[i].ColumnName;
283 283
                             }
284
-                        };break;
284
+                        }; break;
285 285
                     case "F_WorkOrderState":
286 286
                     case "F_Status":
287 287
                         {
@@ -344,7 +344,7 @@ namespace RMYY_CallCenter_Api
344 344
                 {
345 345
                     assistanceState = 0;
346 346
                 }
347
-                
347
+
348 348
 
349 349
                 var allButtons = WorkOrderButton.GetButtons(menuName, thisTypeId, int.Parse(dr[stateFieldName].ToString()), roleId, assistanceState);
350 350
 
@@ -354,18 +354,32 @@ namespace RMYY_CallCenter_Api
354 354
                 //接单人在接单之后,如果该工单类型上设置的“可延期次数”大于0显示“延期”按钮;点击延期按钮进行验证是否超过设定的延期次数,超过提醒“已超过规定延迟次数”
355 355
                 int categoryType = 0;
356 356
 
357
-                switch (type)
357
+                if (menuName == MENUENUM.工单列表 || menuName == MENUENUM.我的提交)
358 358
                 {
359
-                    case 3000:
360
-                        categoryType= Convert.ToInt32(dr["F_WorkOrderCategory"].ToString());                      
361
-
359
+                    categoryType = Convert.ToInt32(dr["F_SonType"].ToString());
360
+                }
361
+                else
362
+                {
363
+                    switch (thisTypeId)
364
+                    {
362 365
 
363
-                        break;
364
-                    case 1000:
365
-                        categoryType = Convert.ToInt32(dr["F_type2"].ToString());
366
-                        break;
366
+                        case 1000:
367
+                            categoryType = Convert.ToInt32(dr["F_type2"].ToString());
368
+                            break;
369
+                        case 2000:
370
+                            categoryType = Convert.ToInt32(dr["F_WorkOrderCategory"].ToString());
371
+                            break;
372
+                        case 3000:
373
+                            categoryType = Convert.ToInt32(dr["F_WorkOrderCategory"].ToString());
374
+                            break;
375
+                        case 4000:
376
+                            categoryType = Convert.ToInt32(dr["F_Type"].ToString());
377
+                            break;
378
+                    }
367 379
                 }
368 380
 
381
+
382
+
369 383
                 var gdmodel = dglist.Where(x => x.F_GDId ==categoryType).FirstOrDefault();
370 384
                 if (gdmodel==null
371 385
                     || gdmodel.F_CanReplayCount == 0)
@@ -375,6 +389,15 @@ namespace RMYY_CallCenter_Api
375 389
 
376 390
                     allButtons.Remove(hasButton);
377 391
                 }
392
+                //工单类型上增加可催办次数字段,=0不允许催办,=-1不限制催办次数,其他的=几就是可以催办几次 
393
+                if (gdmodel == null
394
+                    || gdmodel.F_CanUrgeCount == 0)
395
+                {
396
+                    //移除催单按钮                   
397
+                    var hasButton = allButtons.Where(p => p.value == "催单").FirstOrDefault();
398
+
399
+                    allButtons.Remove(hasButton);
400
+                }
378 401
 
379 402
                 if (type==3000 && dr["F_ConfirmEquip"].ToString() != "1")
380 403
                 {

+ 5 - 0
RMYY_CallCenter_Api/Controllers/CarManage/T_Car_WorkOrderController.cs

@@ -527,6 +527,11 @@ namespace RMYY_CallCenter_Api.Controllers.CarManage
527 527
                     model.F_ProposerName = new Bll.T_Sys_UserAccount().GetModel(model.F_ProposerCode.ToString())?.F_UserName ?? "";
528 528
                     model.F_CarName = new Bll.T_Sys_DictionaryValue().GetModel(model.F_CarType.Value)?.F_Name ?? "";
529 529
                     model.StateName = GetDescriptionOriginal(model.F_State.ToString());
530
+                   string urgecount=DbHelperSQL.GetSingle("select F_urgecount from[T_Wo_CommonBase] where F_WoCode ='"+ WorkOrderCode + "'").ToString();
531
+                    if (!string.IsNullOrEmpty(urgecount))
532
+                    {
533
+                        model.F_UrgeCount = Convert.ToInt32(urgecount);
534
+                    }
530 535
                     if (model != null)
531 536
                     {
532 537
                         var obj = new

+ 3 - 0
RMYY_CallCenter_Api/Controllers/DictionaryType/GongDanTypeController.cs

@@ -89,6 +89,7 @@ namespace RMYY_CallCenter_Api.Controllers
89 89
             //        return Error("该标识已存在");
90 90
             //}
91 91
             model.F_Identification = input.F_Identification;
92
+            model.F_CanUrgeCount = input.F_CanUrgeCount;
92 93
             if (gongdanBll.Add(model) > 0)
93 94
             {
94 95
                 return Success("类型添加成功!");
@@ -128,6 +129,7 @@ namespace RMYY_CallCenter_Api.Controllers
128 129
                     fxtime = entity_ModuleInfo.F_RepairTimeLimit,
129 130
                     autodept = entity_ModuleInfo.F_AutoDept,
130 131
                     canreplaycount=entity_ModuleInfo.F_CanReplayCount,
132
+                    canurgecount=entity_ModuleInfo.F_CanUrgeCount,
131 133
                     tid =entity_ModuleInfo.F_TypeId
132 134
                 });
133 135
             }
@@ -195,6 +197,7 @@ namespace RMYY_CallCenter_Api.Controllers
195 197
                 ModuleInfo.F_TimeOut = input.F_TimeOut;
196 198
                 ModuleInfo.F_AutoDept = input.F_AutoDept;
197 199
                 ModuleInfo.F_CanReplayCount = input.F_CanReplayCount;
200
+                ModuleInfo.F_CanUrgeCount = input.F_CanUrgeCount;
198 201
                 //if (!string.IsNullOrEmpty(input.F_Identification))
199 202
                 //{
200 203
                 //    if (GetIdentification(input.F_Identification) > 0&& input.F_Identification!= ModuleInfo.F_Identification)

+ 196 - 19
RMYY_CallCenter_Api/Controllers/FaultRepairController.cs

@@ -1,4 +1,5 @@
1 1
 using RMYY_CallCenter_Api.DB;
2
+using RMYY_CallCenter_Api.Model;
2 3
 using RMYY_CallCenter_Api.Models;
3 4
 using RMYY_CallCenter_Api.Models.Enum;
4 5
 using RMYY_CallCenter_Api.Models.Input;
@@ -10,6 +11,7 @@ using System.Data;
10 11
 using System.IO;
11 12
 using System.Linq;
12 13
 using System.Reflection;
14
+using System.Text;
13 15
 using System.Web;
14 16
 using System.Web.Mvc;
15 17
 
@@ -31,6 +33,8 @@ namespace RMYY_CallCenter_Api.Controllers
31 33
         private BLL.T_Wo_CommonBase cbbll = new BLL.T_Wo_CommonBase();
32 34
         private Bll.T_Con_WorkOrder cwbll = new Bll.T_Con_WorkOrder();
33 35
         private Bll.AddLogBll Addlogbll = new Bll.AddLogBll();
36
+
37
+        private static InternalMessagesController msg = new InternalMessagesController();
34 38
         public DataTable GetFileData(string ids, string prefix)
35 39
         {
36 40
             DataTable dt = DbHelperSQL.Query("select * from T_Sys_Accessories WITH(NOLOCK) where F_FileId in (" + ids + ")").Tables[0];
@@ -128,7 +132,13 @@ namespace RMYY_CallCenter_Api.Controllers
128 132
             model.F_PlaceOfRepair = input.PlaceOfRepair;
129 133
             model.F_File = input.File;
130 134
             model.F_WorkOrderCode = DateTime.Now.ToString("yyyyMMddHHmmssfff");//工单编号
131
-
135
+            string message = "";
136
+            var dicvalue = new Model.T_Sys_GongDan();
137
+            dicvalue = new Bll.T_Sys_GongDan().GetModel(Convert.ToInt32(model.F_WorkOrderCategory));
138
+            if (dicvalue != null)
139
+            {
140
+                message = ",工单类型:故障报修/" + dicvalue.F_Name;
141
+            }
132 142
             if (input.IsEnd == 1)
133 143
             {
134 144
                 model.F_WorkOrderState = (int)EnumFaultRepairWorkOrderState.finish;
@@ -149,6 +159,10 @@ namespace RMYY_CallCenter_Api.Controllers
149 159
                     List<Model.T_Sys_GongDan> listgd = gdbll.GetModelList(" F_GDId='" + model.F_WorkOrderCategory + "'");
150 160
                     int timeout = listgd.First().F_TimeOut;
151 161
                     model.F_Deadline = DateTime.Now.AddHours(timeout);
162
+                   
163
+
164
+                    msg.AddInternalMessagesInfo("您有新的工单请及时查收", "您有新的工单请及时查收" + "工单编号:" + model.F_WorkOrderCode + message, model.F_Maintenancer, User.F_UserCode, EnumSmsType.repair
165
+                       , 0, model.F_WorkOrderCode);
152 166
                 }
153 167
                 else
154 168
                 {
@@ -162,6 +176,9 @@ namespace RMYY_CallCenter_Api.Controllers
162 176
                         List<Model.T_Sys_GongDan> listgd = gdbll.GetModelList(" F_GDId='" + model.F_WorkOrderCategory + "'");
163 177
                         int timeout = listgd.First().F_TimeOut;
164 178
                         model.F_Deadline = DateTime.Now.AddHours(timeout);
179
+
180
+                        msg.AddInternalMessagesInfo("您有新的工单请及时查收", "您有新的工单请及时查收" + "工单编号:" + model.F_WorkOrderCode + message, model.F_Maintenancer, User.F_UserCode, EnumSmsType.repair
181
+                      , 0, model.F_WorkOrderCode);
165 182
                     }
166 183
                     else
167 184
                     {
@@ -232,6 +249,20 @@ namespace RMYY_CallCenter_Api.Controllers
232 249
             }
233 250
             model.F_ReplayCount = 0;
234 251
             int returnid = baseBll.Add(model);
252
+            if (User.F_RoleCode != "DDZX" && model.F_WorkOrderState == 0)
253
+            {
254
+                //新工单提醒发给调度中心值班的人
255
+                // 根据排班信息 获取当前调度中心值班的人
256
+                string tousercode = GetDDZXBeOnDuty();
257
+                if (!string.IsNullOrEmpty(tousercode))
258
+                {
259
+
260
+                    msg.AddInternalMessagesInfo("您有新的工单请及时查收", "您有新的工单请及时查收" + "工单编号:" + model.F_WorkOrderCode + message, tousercode, User.F_UserCode, EnumSmsType.repair
261
+                      , 0, model.F_WorkOrderCode);
262
+                }
263
+
264
+            }
265
+
235 266
             if (returnid > 0)
236 267
             {
237 268
                 AddAddlog(model.F_WorkOrderCode);
@@ -251,7 +282,23 @@ namespace RMYY_CallCenter_Api.Controllers
251 282
 
252 283
         }
253 284
 
285
+        private string GetDDZXBeOnDuty()
286
+        {
287
+            List<string> user = new List<string>();
288
+        
254 289
 
290
+            var GroupClass = new Bll.T_Sys_GroupClass().GetModelList("F_IsDelete=0   and datediff(day , F_Date , getdate())= 0 " +
291
+                       "and F_DeptId= ( select F_DeptId from T_Sys_Department where F_deptcode='ZHDDZX')  order by F_Id asc");
292
+            if (GroupClass != null && GroupClass.Count > 0)
293
+            {     
294
+                    return GroupClass[0].F_UserCode;
295
+            }
296
+            else
297
+            {
298
+                return "";
299
+            }
300
+      
301
+        }
255 302
 
256 303
 
257 304
         //综合保障中心编辑工单
@@ -383,7 +430,7 @@ namespace RMYY_CallCenter_Api.Controllers
383 430
             return Error("工单不存在!");
384 431
         }
385 432
 
386
-        //退单  
433
+        //处理人退单  
387 434
         public ActionResult BackWorkOrder(string WorkOrderCode, string BackReason)
388 435
         {
389 436
             Model.T_FaultRepair_Base model = baseBll.GetModel(WorkOrderCode);
@@ -391,6 +438,7 @@ namespace RMYY_CallCenter_Api.Controllers
391 438
             {
392 439
                 if (model.F_MaintenanceDept == User.F_DeptId.ToString())
393 440
                 {
441
+                    string assignuser = model.F_AssignUser;
394 442
                     model.F_WorkOrderState = (int)EnumFaultRepairWorkOrderState.neworder;
395 443
                     model.F_Maintenancer = "";
396 444
                     model.F_MaintenanceDept = "";
@@ -406,7 +454,9 @@ namespace RMYY_CallCenter_Api.Controllers
406 454
                         s += ",退回原因:" + BackReason;
407 455
                     }
408 456
                     AddOperatorLog("退回了工单" + s, (int)EnumOperatorType.back, model.F_WorkOrderCode);
409
-
457
+                    msg.AddInternalMessagesInfo("您有工单被退回", "您有工单被退回" + "工单编号:" + model.F_WorkOrderCode, assignuser
458
+                                 , User.F_UserCode, EnumSmsType.repair
459
+                   , 0, model.F_WorkOrderCode);
410 460
 
411 461
 
412 462
                     return Success(" 退回成功!");
@@ -445,8 +495,6 @@ namespace RMYY_CallCenter_Api.Controllers
445 495
                     //是返修的工单
446 496
                     if (dt != null && dt.Rows.Count > 0)
447 497
                     {
448
-
449
-
450 498
                         int procid = Convert.ToInt32(dt.Rows[0]["F_ProcessId"].ToString());
451 499
                         string updatesql = "UPDATE T_FaultRepair_Process set  F_ProcessingTime=GETDATE() ,F_Result='" + Result + "' ,F_File='" + File + "',F_Maintenancer='" + User.F_UserCode + "',F_MaintenanceDept='" + User.F_DeptId + "',F_DealType='" + (int)EnumFaultRepairDealType.normal + "', F_IsInvolvedEquip='" + IsInvolvedEquip + "'  where F_ProcessId='" + procid + "'";
452 500
                         int updateid = DbHelperSQL.ExecuteSql(updatesql);
@@ -468,6 +516,8 @@ namespace RMYY_CallCenter_Api.Controllers
468 516
 
469 517
                             model.F_ConfirmEquip = 1;
470 518
                             promodelnew.F_EquipDetail = ids.Substring(0, ids.LastIndexOf(','));
519
+
520
+                       
471 521
                             dealBll.Update(promodelnew);
472 522
 
473 523
                         }
@@ -476,7 +526,8 @@ namespace RMYY_CallCenter_Api.Controllers
476 526
                         if (updateid > 0)
477 527
                         {
478 528
                             baseBll.Update(model);
479
-
529
+                            msg.AddInternalMessagesInfo("您提交的工单已处理完毕,请及时进行评价", "您提交的工单已处理完毕,请及时进行评价" + "工单编号:" + model.F_WorkOrderCode, model.F_Applicant, User.F_UserCode, EnumSmsType.repair
530
+               , 0, model.F_WorkOrderCode);
480 531
                             AddOperatorLog("完结了工单", (int)EnumOperatorType.dealed, WorkOrderCode);
481 532
                             return Success("处理完成");
482 533
                         }
@@ -524,6 +575,8 @@ namespace RMYY_CallCenter_Api.Controllers
524 575
                     if (id > 0)
525 576
                     {
526 577
                         baseBll.Update(model);
578
+                        msg.AddInternalMessagesInfo("您提交的工单已处理完毕,请及时进行评价", "您提交的工单已处理完毕,请及时进行评价" + "工单编号:" + model.F_WorkOrderCode, model.F_Applicant, User.F_UserCode, EnumSmsType.repair
579
+               , 0, model.F_WorkOrderCode);
527 580
                         AddOperatorLog("完结了工单", (int)EnumOperatorType.dealed, WorkOrderCode);
528 581
                         return Success("处理完成");
529 582
                     }
@@ -1052,7 +1105,7 @@ namespace RMYY_CallCenter_Api.Controllers
1052 1105
                     case 0:
1053 1106
                         //基本信息
1054 1107
                         #region
1055
-                        string sql = "select *,[dbo].[GetUserName](F_Applicant) applicantname  from T_FaultRepair_Base where F_WorkOrderCode='" + strworkorderid + "'";
1108
+                        string sql = "select *,[dbo].[GetUserName](F_Applicant) applicantname , (select F_urgecount from [T_Wo_CommonBase] where F_WoCode='"+ strworkorderid + "') F_UrgeCount from T_FaultRepair_Base where F_WorkOrderCode='" + strworkorderid + "'";
1056 1109
                         DataTable dtbase = DbHelperSQL.Query(sql).Tables[0];
1057 1110
                         dtbase.Columns.Add("FileUrl", typeof(object));
1058 1111
                         dtbase.Columns.Add("StateName");
@@ -1290,6 +1343,8 @@ namespace RMYY_CallCenter_Api.Controllers
1290 1343
                     AddOperatorLog("转派工单给" + GetDeptModel(model.F_MaintenanceDept) + "部门" + GetUserModel(ToUserCode), (int)EnumOperatorType.transfer, WorkOrderCode);
1291 1344
 
1292 1345
                     baseBll.Update(model);
1346
+
1347
+
1293 1348
                     return Success("转派成功");
1294 1349
                 }
1295 1350
                 else
@@ -1328,6 +1383,14 @@ namespace RMYY_CallCenter_Api.Controllers
1328 1383
             if (model != null)// && !string.IsNullOrEmpty(ToUserCode) && !string.IsNullOrEmpty(ToDept))
1329 1384
             {
1330 1385
 
1386
+                string mes  = "";
1387
+                var dicvalue = new Model.T_Sys_GongDan();
1388
+                dicvalue = new Bll.T_Sys_GongDan().GetModel(Convert.ToInt32(model.F_WorkOrderCategory));
1389
+                if (dicvalue != null)
1390
+                {
1391
+                    mes = ",工单类型:故障报修/" + dicvalue.F_Name;
1392
+                }
1393
+
1331 1394
                 model.F_AssignUser = User.F_UserCode;
1332 1395
                 model.F_AssignTime = DateTime.Now;
1333 1396
 
@@ -1354,6 +1417,8 @@ namespace RMYY_CallCenter_Api.Controllers
1354 1417
                 {
1355 1418
                     model.F_Maintenancer = ToUserCode;
1356 1419
                     message = "转派工单给" + GetDeptModel(ToDept) + "部门" + GetUserModel(ToUserCode);
1420
+                    msg.AddInternalMessagesInfo("您有新的工单请及时查收", "您有新的工单请及时查收" + "工单编号:" + model.F_WorkOrderCode + mes, model.F_Maintenancer, User.F_UserCode,  EnumSmsType.repair
1421
+                   , 0, model.F_WorkOrderCode);
1357 1422
                 }
1358 1423
                 else
1359 1424
                 {
@@ -1373,7 +1438,10 @@ namespace RMYY_CallCenter_Api.Controllers
1373 1438
                     if (user != null && user.Count > 1)
1374 1439
                     {
1375 1440
                         model.F_Maintenancer = user[0];
1376
-                        message = user[1];
1441
+                        message = "转派工单给" + GetDeptModel(ToDept) + "部门" + GetUserModel(user[1]);
1442
+                        msg.AddInternalMessagesInfo("您有新的工单请及时查收", "您有新的工单请及时查收" + "工单编号:" + model.F_WorkOrderCode + mes, model.F_Maintenancer, User.F_UserCode, EnumSmsType.repair
1443
+                   , 0, model.F_WorkOrderCode);
1444
+
1377 1445
                     }
1378 1446
                     else
1379 1447
                     {
@@ -1740,12 +1808,19 @@ namespace RMYY_CallCenter_Api.Controllers
1740 1808
                             model.F_Maintenancer = usercode;
1741 1809
                         }
1742 1810
 
1743
-
1811
+                        string s = "";
1812
+                        if (!string.IsNullOrEmpty(ReturnReason))
1813
+                        {
1814
+                            s = ",返修原因:" + ReturnReason;
1815
+                        }
1744 1816
 
1745 1817
                         model.F_WorkOrderState = (int)EnumFaultRepairWorkOrderState.dealing;
1746 1818
                         model.F_ReturnNum += model.F_ReturnNum + 1;
1747 1819
                         model.F_UpdateTime = DateTime.Now;
1748 1820
                         baseBll.Update(model);
1821
+
1822
+                        msg.AddInternalMessagesInfo("您有需要返修的工单,请及时处理", "您有需要返修的工单,请及时处理" + "工单编号:" + model.F_WorkOrderCode+s, model.F_Maintenancer, User.F_UserCode, EnumSmsType.repair
1823
+            , 0, model.F_WorkOrderCode);
1749 1824
                         return Success("返工成功");
1750 1825
                     }
1751 1826
                     return Error("返工失败");
@@ -1789,6 +1864,12 @@ namespace RMYY_CallCenter_Api.Controllers
1789 1864
                         baseBll.Update(model);
1790 1865
                         AddOperatorLog("评价了工单", (int)EnumOperatorType.evaluate, model.F_WorkOrderCode);
1791 1866
 
1867
+                        if (model.F_Score <= 3)
1868
+                        {
1869
+                            msg.AddInternalMessagesInfo("您有工单被差评", "您有工单被差评" + "工单编号:" + model.F_WorkOrderCode + "差评原因:" + EvaluateContent, model.F_Maintenancer, User.F_UserCode, EnumSmsType.repair
1870
+                       , 0, model.F_WorkOrderCode);
1871
+                        }
1872
+
1792 1873
                         #region 评价的时候如果有协作工单,协作工单评价数据和主工单保持一致,同时需要记录操作流程
1793 1874
                         if (!string.IsNullOrEmpty(model.F_InternalWorkOrderCode))
1794 1875
                         {
@@ -1796,10 +1877,17 @@ namespace RMYY_CallCenter_Api.Controllers
1796 1877
                             string[] codes = model.F_InternalWorkOrderCode.Split(',');
1797 1878
                             foreach (string item in codes)
1798 1879
                             {
1880
+                                var intermodel = baseBll.GetModel(item);
1799 1881
                                 Model.T_FaultRepair_Evaluate evamodel1 = new Model.T_FaultRepair_Evaluate();
1800 1882
                                 evamodel1 = evamodel;
1801 1883
                                 evamodel.F_WorkOrderCode = item;
1802 1884
                                 evabll.Add(evamodel1);
1885
+                                if (model.F_Score <= 3)
1886
+                                {
1887
+                                    msg.AddInternalMessagesInfo("您有工单被差评", "您有工单被差评" + "工单编号:" + item + "差评原因:" + EvaluateContent, intermodel.F_Maintenancer, User.F_UserCode, EnumSmsType.repair
1888
+                   , 0, item);
1889
+                                }
1890
+
1803 1891
                                 AddOperatorLog("评价了工单", (int)EnumOperatorType.evaluate, item);
1804 1892
                             }
1805 1893
                         }
@@ -1809,10 +1897,16 @@ namespace RMYY_CallCenter_Api.Controllers
1809 1897
                             string[] codes = model.F_ExternalWorkOrderCode.Split(',');
1810 1898
                             foreach (string item in codes)
1811 1899
                             {
1900
+                                var extmodel = baseBll.GetModel(item);
1812 1901
                                 Model.T_FaultRepair_Evaluate evamodel1 = new Model.T_FaultRepair_Evaluate();
1813 1902
                                 evamodel1 = evamodel;
1814 1903
                                 evamodel.F_WorkOrderCode = item;
1815 1904
                                 evabll.Add(evamodel1);
1905
+                                if (model.F_Score <= 3)
1906
+                                {
1907
+                                    msg.AddInternalMessagesInfo("您有工单被差评", "您有工单被差评" + "工单编号:" + item + "差评原因:" + EvaluateContent, extmodel.F_Maintenancer, User.F_UserCode, EnumSmsType.repair
1908
+                   , 0, item);
1909
+                                }
1816 1910
                                 AddOperatorLog("评价了工单", (int)EnumOperatorType.evaluate, item);
1817 1911
                             }
1818 1912
                         }
@@ -2141,7 +2235,7 @@ namespace RMYY_CallCenter_Api.Controllers
2141 2235
         }
2142 2236
 
2143 2237
         //调度中心 退回到提交人(工单状态gai为“待提交”)
2144
-        public ActionResult ReBack(string workordercode)
2238
+        public ActionResult ReBack(string workordercode, string BackReason)
2145 2239
         {
2146 2240
 
2147 2241
             Model.T_FaultRepair_Base model = baseBll.GetModel(workordercode);
@@ -2152,15 +2246,23 @@ namespace RMYY_CallCenter_Api.Controllers
2152 2246
             model.F_WorkOrderState = (int)EnumFaultRepairWorkOrderState.waitsubmit;
2153 2247
 
2154 2248
 
2155
-
2249
+            string s = "";
2250
+            if (!string.IsNullOrEmpty(BackReason))
2251
+            {
2252
+                s += ",退回原因:" + BackReason;
2253
+            }
2156 2254
             baseBll.Update(model);
2157
-            AddOperatorLog(User.F_UserName + "退回了工单", (int)EnumOperatorType.reback, model.F_WorkOrderCode);
2255
+            msg.AddInternalMessagesInfo("您有工单被退回", "您有工单被退回" + "工单编号:" + model.F_WorkOrderCode, model.F_Applicant
2256
+      , User.F_UserCode, EnumSmsType.repair
2257
+, 0, model.F_WorkOrderCode);
2258
+
2259
+            AddOperatorLog(User.F_UserName + "退回了工单"+s, (int)EnumOperatorType.reback, model.F_WorkOrderCode);
2158 2260
             return Success("退回操作成功");
2159 2261
         }
2262
+         
2160 2263
 
2161
-
2162
-        // 撤回(已指派未接单的可进行撤回,工单状态为“待指派”)
2163
-        public ActionResult Retract(string workordercode)
2264
+        // 撤回(已指派未接单的可进行撤回,工单状态为“新工单0”)
2265
+        public ActionResult Retract(string workordercode, string BackReason)
2164 2266
         {
2165 2267
 
2166 2268
             Model.T_FaultRepair_Base model = baseBll.GetModel(workordercode);
@@ -2168,7 +2270,11 @@ namespace RMYY_CallCenter_Api.Controllers
2168 2270
             {
2169 2271
                 return Error("没有获取到工单号");
2170 2272
             }
2171
-      
2273
+            string s = "";
2274
+            if (!string.IsNullOrEmpty(BackReason))
2275
+            {
2276
+                s += ",撤回原因:" + BackReason;
2277
+            }
2172 2278
             model.F_WorkOrderState = (int)EnumFaultRepairWorkOrderState.neworder;
2173 2279
             model.F_Maintenancer = "";
2174 2280
             model.F_MaintenanceDept = "";
@@ -2178,7 +2284,7 @@ namespace RMYY_CallCenter_Api.Controllers
2178 2284
             model.F_Deadline = null;
2179 2285
 
2180 2286
             baseBll.Update(model);
2181
-            AddOperatorLog(User.F_UserName + "撤回了工单", (int)EnumOperatorType.retract, model.F_WorkOrderCode);
2287
+            AddOperatorLog(User.F_UserName + "撤回了工单"+s, (int)EnumOperatorType.retract, model.F_WorkOrderCode);
2182 2288
             return Success("撤回操作成功");
2183 2289
         }
2184 2290
 
@@ -2226,7 +2332,7 @@ namespace RMYY_CallCenter_Api.Controllers
2226 2332
         #region 我的提交页面的操作
2227 2333
 
2228 2334
         //申请人撤回(未指派的工单可撤回,工单状态“待提交”)
2229
-        public ActionResult MyRetract(string workordercode)
2335
+        public ActionResult MyRetract(string workordercode,string BackReason)
2230 2336
         {
2231 2337
 
2232 2338
             Model.T_FaultRepair_Base model = baseBll.GetModel(workordercode);
@@ -2236,9 +2342,14 @@ namespace RMYY_CallCenter_Api.Controllers
2236 2342
             }
2237 2343
             if (model.F_WorkOrderState == 0)
2238 2344
             {
2345
+                string s = "";
2346
+                if (!string.IsNullOrEmpty(BackReason))
2347
+                {
2348
+                    s += ",撤回原因:" + BackReason;
2349
+                }
2239 2350
                 model.F_WorkOrderState = (int)EnumFaultRepairWorkOrderState.waitsubmit;
2240 2351
                 baseBll.Update(model);
2241
-                AddOperatorLog(User.F_UserName + "撤回了工单", (int)EnumOperatorType.myretract, model.F_WorkOrderCode);
2352
+                AddOperatorLog(User.F_UserName + "撤回了工单"+s, (int)EnumOperatorType.myretract, model.F_WorkOrderCode);
2242 2353
                 return Success("撤回操作成功");
2243 2354
 
2244 2355
             }
@@ -2364,6 +2475,72 @@ namespace RMYY_CallCenter_Api.Controllers
2364 2475
         }
2365 2476
 
2366 2477
 
2478
+        //发送超时未接单的消
2479
+        //20222031更正为:即将超时 距离截止日期还有十分钟 还未接单的发消息给组长
2480
+        public ActionResult AutoSendOverTimeMsg()
2481
+        {
2482
+            string sql = "  select F_Deadline,F_WorkOrderState, * from T_FaultRepair_Base where F_WorkOrderState=1  and DATEDIFF(mi, GETDATE(), F_Deadline)< 10 and DATEDIFF(mi, GETDATE(), F_Deadline)> 0";
2483
+            DataTable dt = DbHelperSQL.Query(sql).Tables[0];
2484
+            if (dt != null && dt.Rows.Count > 0)
2485
+            {
2486
+                foreach (DataRow item in dt.Rows)
2487
+                {
2488
+                    //根据处理部门获取班组长 WXBZZ
2489
+                    var dtuser = DbHelperSQL.Query(" select  top 1 F_usercode from T_Sys_UserAccount where F_DeptId='' and   F_RoleId=(select F_roleid from T_Sys_Role where F_RoleCode='WXBZZ')").Tables[0];
2490
+
2491
+                    if (dtuser != null && dtuser.Rows.Count > 0)
2492
+                    {
2493
+                        string message = "";
2494
+                        var dicvalue = new Model.T_Sys_GongDan();
2495
+                        dicvalue = new Bll.T_Sys_GongDan().GetModel(Convert.ToInt32(item["F_WorkOrderCategory"].ToString()));
2496
+                        if (dicvalue != null)
2497
+                        {
2498
+                            message = ",工单类型:故障报修/" + dicvalue.F_Name;
2499
+                        }
2500
+                        message += ",报修科室:" + GetParentDeptName(Convert.ToInt32( item["F_ApplicationDept"].ToString()));
2501
+                        message += ",工单内容:" + item["F_Content"].ToString();
2502
+                        message += ",相关人员:" + GetUserModel(item["F_Maintenancer"].ToString());
2503
+
2504
+                        msg.AddInternalMessagesInfo("您部门下有工单即将超时未接单", "您部门下有工单即将超时未接单" + "工单编号:" + item["F_WorkOrderCode"].ToString(), dtuser.Rows[0]["F_usercode"].ToString(), User.F_UserCode, EnumSmsType.repair
2505
+                 , 0, item["F_WorkOrderCode"].ToString());
2506
+                    }
2507
+               }
2508
+
2509
+
2510
+
2511
+            }
2512
+
2513
+            return Success("发送超时未接单的消息成功");
2514
+        }
2515
+ 
2516
+
2517
+        StringBuilder returnname = new StringBuilder();
2518
+     
2519
+        [AllowAnonymous]
2520
+      
2521
+        public string GetParentDeptName(int deptid)
2522
+        {
2523
+            var model = departmentBLL.GetModel(deptid);
2524
+            if (model != null)
2525
+            {
2526
+                returnname.Insert(0, model.F_DeptName);
2527
+                returnname.Insert(0, "/");
2528
+                if (model.F_ParentId != 0)
2529
+                {
2530
+                    GetParentDeptName(model.F_ParentId.Value);
2531
+                }
2532
+                if (model.F_ParentId == 0)
2533
+                {
2534
+                    string sql = " select T_Woname from T_Wowo_repairyq where T_Woid='" + model.T_Woid + "'";
2535
+                  string yqname=  DbHelperSQL.GetSingle(sql).ToString();
2536
+                    returnname.Insert(0, yqname);                   
2537
+                }
2538
+
2539
+
2540
+            }
2541
+            return returnname.ToString();
2542
+        }
2367 2543
 
2544
+      
2368 2545
     }
2369 2546
 }

+ 1 - 1
RMYY_CallCenter_Api/Controllers/SchedulingController.cs

@@ -60,7 +60,7 @@ namespace RMYY_CallCenter_Api.Controllers
60 60
                     case 0:
61 61
                         //基本信息
62 62
                         #region
63
-                        string sql = "select *,[dbo].[GetUserName](F_Applicant) applicantname ,[dbo].[GetUserName](F_CreateUser) createname from T_IntegratedScheduling_Base where F_WorkOrderCode='" + strworkorderid + "'";
63
+                        string sql = "select *,[dbo].[GetUserName](F_Applicant) applicantname ,[dbo].[GetUserName](F_CreateUser) createname,(select F_urgecount from [T_Wo_CommonBase] where F_WoCode='" + strworkorderid + "') F_UrgeCount from T_IntegratedScheduling_Base where F_WorkOrderCode='" + strworkorderid + "'";
64 64
                         DataTable dtbase = DbHelperSQL.Query(sql).Tables[0];
65 65
 
66 66
                    

+ 1 - 1
RMYY_CallCenter_Api/Controllers/WorkOrder/Con_WorkOrderController.cs

@@ -40,7 +40,7 @@ namespace RMYY_CallCenter_Api.Controllers
40 40
                 {
41 41
                     case 0:
42 42
                         //基本信息
43
-                        string sql = "select *, dbo.GetDepName(F_ComplaintDept) ComplaintDept,[dbo].[GetUserName](F_CreateUser) F_CreateUserName,[dbo].[GetUserName](F_HandleBy) F_DealUserName " +
43
+                        string sql = "select *, dbo.GetDepName(F_ComplaintDept) ComplaintDept,[dbo].[GetUserName](F_CreateUser) F_CreateUserName,(select F_urgecount from [T_Wo_CommonBase] where F_WoCode='" + strworkorderid + "') F_UrgeCount,[dbo].[GetUserName](F_HandleBy) F_DealUserName " +
44 44
                             "  from T_Con_WorkOrder where F_WorkOrderCode='" + strworkorderid + "'";
45 45
                         DataTable dtbase = DbHelperSQL.Query(sql).Tables[0];
46 46
                        

+ 106 - 3
RMYY_CallCenter_Api/Controllers/WorkOrder/WorkCommonController.cs

@@ -1,4 +1,6 @@
1
-using RMYY_CallCenter_Api.DB;
1
+using RMYY_CallCenter_Api.Controllers.CarManage;
2
+using RMYY_CallCenter_Api.DB;
3
+using RMYY_CallCenter_Api.Model;
2 4
 using RMYY_CallCenter_Api.Models.Dto;
3 5
 using RMYY_CallCenter_Api.Models.Enum;
4 6
 using RMYY_CallCenter_Api.Utility;
@@ -12,7 +14,10 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
12 14
 {
13 15
     public class WorkCommonController : BaseController
14 16
     {
15
- 
17
+        private BLL.T_Wo_CommonBase basebll = new BLL.T_Wo_CommonBase();
18
+        private Bll.T_Sys_GongDan gdbll = new Bll.T_Sys_GongDan();
19
+        private Bll.AddLogBll logbll = new Bll.AddLogBll();
20
+        private static InternalMessagesController msg = new InternalMessagesController();
16 21
 
17 22
         /// <summary>
18 23
         /// 我的提交
@@ -163,7 +168,105 @@ namespace RMYY_CallCenter_Api.Controllers.WorkOrder
163 168
             return Error("无操作权限!");
164 169
         }
165 170
 
166
- 
171
+
172
+        //催单按钮  urge 类型 1是调度员催单 2 是申请人催单
173
+        //        申请人:提交完工单只要工单未完成都可催单
174
+        //调度人:已派单,没有完成状态能催单;   催单按钮在添加的时候 汉字写  催单
175
+        public ActionResult UrgeWorkOrder(string workordercode,string reason, int urgetype = 0)
176
+        {
177
+
178
+            if (urgetype ==0)
179
+            {
180
+                return Error("需要传urgetype参数");
181
+            }
182
+
183
+            Model.T_Wo_CommonBase ordermodel=  basebll.GetModel(workordercode);
184
+
185
+            //工单类型上增加可催办次数字段,=0不允许催办,=-1不限制催办次数,
186
+            //其他的 =几就是可以催办几次
187
+            
188
+            Model.T_Sys_GongDan gdmodel = gdbll.GetModel(ordermodel.F_SonType);
189
+
190
+            if (gdmodel.F_CanUrgeCount == 0)
191
+            {
192
+                return Error("该工单类型不允许催办");
193
+            }
194
+            int nowcount = ordermodel.F_UrgeCount + 1;
195
+            if (gdmodel.F_CanUrgeCount != -1 && nowcount > gdmodel.F_CanUrgeCount)
196
+            {
197
+                return Error("催办次数已经用光了");
198
+            }
199
+
200
+            ordermodel.F_UrgeCount = nowcount;
201
+            ordermodel.F_UpdateTime = DateTime.Now;
202
+            basebll.Update(ordermodel);
203
+            string content = "催办了工单,催单原因"+reason;
204
+          //  string touser = "";
205
+            EnumSmsType smytype = new EnumSmsType();
206
+            List<string> touserlist = new List<string>();
207
+            //获取调度中心值班人员       
208
+
209
+            // 添加日志
210
+            switch (ordermodel.F_Type)
211
+            {
212
+                case 1000:
213
+                    Bll.T_Con_WorkOrder conbll = new Bll.T_Con_WorkOrder();
214
+                Model.T_Con_WorkOrder conmodel=    conbll.GetModelByCode(workordercode);
215
+                    logbll.AddLog(conmodel.F_ID, conmodel.F_State.Value, (int)conmodel.F_type1, content, (int)EnumItemType.urge, 0, User.F_UserCode, 0, User.F_UserCode);
216
+                    smytype = EnumSmsType.consulting;
217
+                    break;
218
+                case 2000:
219
+                    SchedulingController sc = new SchedulingController();
220
+                    sc.AddOperatorLog(content, (int)EnumOperatorType.urge, workordercode);
221
+                    smytype = EnumSmsType.comprehensive ;                 
222
+
223
+
224
+                    break;
225
+                case 3000:
226
+                    FaultRepairController cc = new FaultRepairController();
227
+                    cc.AddOperatorLog(content, (int)EnumOperatorType.urge, workordercode);                  
228
+                    smytype = EnumSmsType.repair;
229
+                    break;
230
+                case 4000:
231
+                    T_Car_WorkOrderController car = new T_Car_WorkOrderController();
232
+                    car.AddOperation(content, User.F_UserCode, ordermodel.F_Status, workordercode, 0);
233
+                    smytype = EnumSmsType.car;
234
+                    break;
235
+            }
236
+
237
+            //发送消息
238
+            //  点击催单给对应人发消息,如果单子在调度中心,调度中心当日值班人员都可收到消息
239
+
240
+            if (urgetype == 1)
241
+            {
242
+                touserlist.Add(ordermodel.F_DealUser.Value.ToString());
243
+            }
244
+            else if (urgetype == 2)
245
+            {
246
+                if (ordermodel.F_Status == 0)
247
+                {
248
+                    //调度中心当天的值班人员
249
+                    var GroupClass = new Bll.T_Sys_GroupClass().GetModelList("F_IsDelete=0   and datediff(day , F_Date , getdate())= 0 " +
250
+              "and F_DeptId= ( select F_DeptId from T_Sys_Department where F_deptcode='ZHDDZX')  order by F_Id asc");
251
+                    touserlist = GroupClass.Select(x => x.F_UserCode).ToList();
252
+                }
253
+                else
254
+                {
255
+                    touserlist.Add(ordermodel.F_DealUser.Value.ToString());
256
+                }
257
+            }
258
+            if (touserlist != null && touserlist.Count > 0)
259
+            {
260
+                foreach (var item in touserlist)
261
+                {
262
+                    msg.AddInternalMessagesInfo("催单", "催单" + "工单编号:" + workordercode + "," + content, item, User.F_UserCode, smytype, 0, workordercode);
263
+                }
264
+            }
265
+           
266
+
267
+         
268
+            return Success("成功催办");
269
+        }
167 270
 
168 271
     }
169 272
 }

+ 4 - 1
RMYY_CallCenter_Api/Models/Enum/EnumOperatorType.cs

@@ -52,7 +52,10 @@ namespace RMYY_CallCenter_Api.Models.Enum
52 52
         replay,
53 53
 
54 54
         [Description("确认耗材")]
55
-        confirm
55
+        confirm,
56
+        [Description("催单")]
57
+        urge,
58
+
56 59
 
57 60
 
58 61
     }