Kaynağa Gözat

用户,转派修改

duhongyu 6 yıl önce
ebeveyn
işleme
876b14cf3f

+ 7 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Sys_UserAccount.cs

@@ -96,6 +96,13 @@ namespace CallCenterApi.BLL
96 96
             return dal.GetworkModel(F_WorkNumber);
97 97
         }
98 98
         /// <summary>
99
+        /// 得到一个对象实体
100
+        /// </summary>
101
+        public Model.T_Sys_UserAccount GetName(string F_Name)
102
+        {
103
+            return dal.GetName(F_Name);
104
+        }
105
+        /// <summary>
99 106
         /// 根据Openid 获取用户
100 107
         /// </summary>
101 108
         /// <param name="openid"></param>

+ 25 - 0
codegit/CallCenterApi/CallCenterApi.DAL/T_Sys_UserAccount.cs

@@ -371,6 +371,31 @@ namespace CallCenterApi.DAL
371 371
         /// <summary>
372 372
         /// 得到一个对象实体
373 373
         /// </summary>
374
+        public Model.T_Sys_UserAccount GetName(string F_WorkNumber)
375
+        {
376
+
377
+            StringBuilder strSql = new StringBuilder();
378
+            strSql.Append("select  top 1 F_UserId,F_UserCode,F_Password,F_ExtensionNumber,F_UserName,F_DeptId,F_RoleId,F_GroupId,F_SeatFlag,F_SeatRight,F_SeatLevel,F_SexFlag,F_RemindFlag,F_Remark,F_Telephone,F_Mobile,F_HomePhone,F_Birthday,F_CreateOn,F_CancelOn,F_DeleteFlag,F_APPOnFlag,F_LastActiveTime,F_See,F_HJType,F_PId,F_TmId,F_WorkNumber,F_DeptCode,F_WXNo,F_SeartGroupID,F_SeartGroup,F_WxOpenId,RegionId from T_Sys_UserAccount ");
379
+            strSql.Append(" where F_UserName=@F_UserName");
380
+            SqlParameter[] parameters = {
381
+                    new SqlParameter("@F_UserName", SqlDbType.VarChar,50)
382
+            };
383
+            parameters[0].Value = F_WorkNumber;
384
+
385
+            Model.T_Sys_UserAccount model = new Model.T_Sys_UserAccount();
386
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
387
+            if (ds.Tables[0].Rows.Count > 0)
388
+            {
389
+                return DataRowToModel(ds.Tables[0].Rows[0]);
390
+            }
391
+            else
392
+            {
393
+                return null;
394
+            }
395
+        }
396
+        /// <summary>
397
+        /// 得到一个对象实体
398
+        /// </summary>
374 399
         public Model.T_Sys_UserAccount GetworkModel(string F_WorkNumber)
375 400
         {
376 401
 

+ 37 - 33
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SMSController.cs

@@ -202,32 +202,35 @@ namespace CallCenterApi.Interface.Controllers
202 202
         /// <param name="cont"></param>
203 203
         public SmsSingleSenderResult SMSSingleshot(string  phone,string  cont)
204 204
         {
205
-            try
206
-            {
207
-             
208
-
209
-               SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
210
-                  var result = ssender.send(0, "86", phone,
211
-                cont, "", "");
212
-                   Console.WriteLine(result);
213
-                return result;
214
-
215
-            }
216
-            catch (JSONException e)
217
-            {
218
-                Console.WriteLine(e);
219
-                return null;
220
-            }
221
-            catch (HTTPException e)
205
+            string sms = Configs.GetValue("sms");
206
+            if (sms == "1")
222 207
             {
223
-                Console.WriteLine(e);
224
-                return null;
208
+                try
209
+                {
210
+                    SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
211
+                    var result = ssender.send(0, "86", phone,
212
+                  cont, "", "");
213
+                    Console.WriteLine(result);
214
+                    return result;
215
+                }
216
+                catch (JSONException e)
217
+                {
218
+                    Console.WriteLine(e);
219
+                    return null;
220
+                }
221
+                catch (HTTPException e)
222
+                {
223
+                    Console.WriteLine(e);
224
+                    return null;
225
+                }
226
+                catch (Exception e)
227
+                {
228
+                    Console.WriteLine(e);
229
+                    return null;
230
+                }
225 231
             }
226
-            catch (Exception e)
227
-            {
228
-                Console.WriteLine(e);
232
+            else
229 233
                 return null;
230
-            }
231 234
         }
232 235
         /// <summary>
233 236
         /// 单发短信
@@ -236,19 +239,16 @@ namespace CallCenterApi.Interface.Controllers
236 239
         /// <param name="cont"></param>
237 240
         public SmsSingleSenderResult SMSSingleshot(int templateId, string [] msg,string cusphone)
238 241
         {
242
+            string sms = Configs.GetValue("sms");
243
+            if (sms == "1")
244
+            {
239 245
                 try
240 246
                 {
241
-                SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
242
-                var result = ssender.sendWithParam("86", cusphone,
243
-                    templateId, msg, smsSign, "", "");
244
-              
245
-             //   SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
246
-               //     var result = ssender.send(0, "86", phone,
247
-                 //    cont, "", "");
248
-              //      Console.WriteLine(result);
247
+                    SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
248
+                    var result = ssender.sendWithParam("86", cusphone,
249
+                        templateId, msg, smsSign, "", "");
249 250
                     return result;
250
-               
251
-            }
251
+                }
252 252
                 catch (JSONException e)
253 253
                 {
254 254
                     Console.WriteLine(e);
@@ -264,6 +264,10 @@ namespace CallCenterApi.Interface.Controllers
264 264
                     Console.WriteLine(e);
265 265
                     return null;
266 266
                 }
267
+            }
268
+            else
269
+                return null;
270
+           
267 271
         }
268 272
         /// <summary>
269 273
         /// 群发短信

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/UserAccountController.cs

@@ -275,6 +275,7 @@ namespace CallCenterApi.Interface.Controllers
275 275
                     }
276 276
                    
277 277
                 }
278
+              
278 279
              
279 280
                 if (input.Username != null)
280 281
                     userAccountModel.F_UserName = input.Username.Trim();

+ 62 - 29
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

@@ -63,6 +63,7 @@ namespace CallCenterApi.Interface.Controllers.report
63 63
             public string salejiujiang;
64 64
             public string salexinjiang;
65 65
             public string saledongbei;
66
+            public string cheyong;
66 67
             public string total;
67 68
         }
68 69
 
@@ -73,6 +74,7 @@ namespace CallCenterApi.Interface.Controllers.report
73 74
             public int salejiujiang;
74 75
             public int salexinjiang;
75 76
             public int saledongbei;
77
+            public int cheyongniaosu;
76 78
             public int total;
77 79
             public string immediate;
78 80
             public int overdue;
@@ -97,13 +99,18 @@ namespace CallCenterApi.Interface.Controllers.report
97 99
             {
98 100
                 sql += " and CONVERT(varchar , F_CreateOn, 120)<=CONVERT(varchar , '" + endtime.Trim() + " 23:59:59', 120) ";
99 101
             }
100
-          //  sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
101
-            // var depts = new BLL.T_Wo_WorkOrder().GetModelList(sql);
102
+            var dicv = dicvalueBll.GetList(" F_DictionaryFlag='" + "XSJD" + "' and F_State=1 ").Tables[0];
103
+            List<Brand> list = new List<Brand>();
104
+            List<Model.T_Sys_DictionaryValue> dicval = new List<Model.T_Sys_DictionaryValue>();
105
+            if (dicv != null)
106
+            {
107
+                dicval = dicvalueBll.DataTableToList(dicv);
108
+            }
102 109
             dt.Columns.Add("反馈类型");
103
-            dt.Columns.Add("新乡");
104
-            dt.Columns.Add("九江");
105
-            dt.Columns.Add("新疆");
106
-            dt.Columns.Add("东北");
110
+            foreach (var it in dicval)
111
+            {
112
+                dt.Columns.Add(it.F_Name );
113
+            }
107 114
             dt.Columns.Add("合计");
108 115
             dt.Columns.Add("即时办结率");
109 116
            
@@ -146,7 +153,7 @@ namespace CallCenterApi.Interface.Controllers.report
146 153
                 {
147 154
                     if (i ==5)
148 155
                     {
149
-                        nsg = "and F_Type !=3  and F_IsOver=" + 1 ;
156
+                        nsg = " and F_IsOver=" + 1 ;
150 157
                     }
151 158
                    else  if (i == 6)
152 159
                     {
@@ -157,10 +164,10 @@ namespace CallCenterApi.Interface.Controllers.report
157 164
                         nsg = "and F_VisitResult='不满意'";
158 165
                     }
159 166
                 }
160
-                drNew["新乡"] = woBLL.GetModelList(sql + "and F_SalesBase='新乡'" + nsg).Count.ToString();
161
-                drNew["九江"] = woBLL.GetModelList(sql + "and F_SalesBase='九江'" + nsg).Count.ToString(); ;
162
-                drNew["新疆"] = woBLL.GetModelList(sql + "and F_SalesBase='新疆' " + nsg).Count.ToString();
163
-                drNew["东北"] = woBLL.GetModelList(sql + "and F_SalesBase='东北'" + nsg).Count.ToString();
167
+                foreach (var it in dicval)
168
+                {
169
+                    drNew[it.F_Name ] = woBLL.GetModelList(sql + "and F_SalesBase='"+ it.F_Name+"'" + nsg).Count.ToString();
170
+                }
164 171
                 drNew["合计"] = woBLL.GetModelList(sql + nsg).Count.ToString();
165 172
                 int a = woBLL.GetModelList(sql + "and F_DealType='当即办理'" + nsg).Count;
166 173
                 int b = woBLL.GetModelList(sql + nsg).Count;
@@ -204,7 +211,7 @@ namespace CallCenterApi.Interface.Controllers.report
204 211
             {
205 212
                 sql += " and CONVERT(varchar , F_CreateOn, 120)<=CONVERT(varchar , '" + endtime.Trim() + " 23:59:59', 120) ";
206 213
             }
207
-          //  sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
214
+         
208 215
             List<marketList> markets = new List<marketList>();
209 216
 
210 217
 
@@ -247,7 +254,7 @@ namespace CallCenterApi.Interface.Controllers.report
247 254
                 {
248 255
                     if (i == 5)
249 256
                     {
250
-                        nsg = "and F_Type !=3 and F_IsOver=" + 1;
257
+                        nsg = " and F_IsOver=" + 1;
251 258
                     }
252 259
                     else if (i == 6)
253 260
                     {
@@ -258,11 +265,11 @@ namespace CallCenterApi.Interface.Controllers.report
258 265
                         nsg = "and F_VisitResult='不满意'";
259 266
                     }
260 267
                 }
261
-
262 268
                 brand.salexinxinag = woBLL.GetModelList(sql + "and F_SalesBase='新乡'" + nsg).Count;
263 269
                 brand.salejiujiang = woBLL.GetModelList(sql + "and F_SalesBase='九江'" + nsg).Count;
264 270
                 brand.salexinjiang = woBLL.GetModelList(sql + "and F_SalesBase='新疆'" + nsg).Count;
265 271
                 brand.saledongbei = woBLL.GetModelList(sql + "and F_SalesBase='东北'" + nsg).Count;
272
+                brand.cheyongniaosu = woBLL.GetModelList(sql + "and F_SalesBase='车用尿素'" + nsg).Count;
266 273
                 brand.total = woBLL.GetModelList(sql + nsg).Count;
267 274
                 int a = woBLL.GetModelList(sql + "and F_DealType='当即办理'" + nsg).Count;
268 275
                 int b = woBLL.GetModelList(sql + nsg).Count;
@@ -309,12 +316,14 @@ namespace CallCenterApi.Interface.Controllers.report
309 316
             List<Model.T_Wo_WorkOrder> workerjiujiang = woBLL.GetModelList(sql + "and F_SalesBase='九江'");
310 317
             List<Model.T_Wo_WorkOrder> workerxinjiang = woBLL.GetModelList(sql + "and F_SalesBase='新疆'");
311 318
             List<Model.T_Wo_WorkOrder> workerxinxiang = woBLL.GetModelList(sql + "and F_SalesBase='新乡'");
319
+            List<Model.T_Wo_WorkOrder> workercheyong = woBLL.GetModelList(sql + "and F_SalesBase='车用尿素'");
312 320
             List<Model.T_Wo_WorkOrder> workertotal = woBLL.GetModelList(sql);
313 321
             dt.Columns.Add("类型");
314 322
             dt.Columns.Add("新乡");
315 323
             dt.Columns.Add("九江");
316 324
             dt.Columns.Add("新疆");
317 325
             dt.Columns.Add("东北");
326
+            dt.Columns.Add("车用尿素");
318 327
             dt.Columns.Add("合计");
319 328
             for (int i = 0; i < ConsultingNeedslist.Count + Complaintlist.Count + SpotChecklist.Count + 5; i++)
320 329
             {
@@ -323,11 +332,13 @@ namespace CallCenterApi.Interface.Controllers.report
323 332
                 int salejiujiang = 0;
324 333
                 int salexinjiang = 0;
325 334
                 int salexinxiang = 0;
335
+                int cheyongniaosu = 0;
326 336
                 int total = 0;
327 337
                 saledongbei = workercount(i, workerdongbei, ConsultingNeedslist, Complaintlist, SpotChecklist);
328 338
                 salejiujiang = workercount(i, workerjiujiang, ConsultingNeedslist, Complaintlist, SpotChecklist);
329 339
                 salexinjiang = workercount(i, workerxinjiang, ConsultingNeedslist, Complaintlist, SpotChecklist);
330 340
                 salexinxiang = workercount(i, workerxinxiang, ConsultingNeedslist, Complaintlist, SpotChecklist);
341
+                cheyongniaosu= workercount(i, workercheyong, ConsultingNeedslist, Complaintlist, SpotChecklist);
331 342
                 total = workercount(i, workertotal, ConsultingNeedslist, Complaintlist, SpotChecklist);
332 343
                 market brand = new market();
333 344
                 switch (i)
@@ -370,6 +381,7 @@ namespace CallCenterApi.Interface.Controllers.report
370 381
                         drNew["九江"] = string.Format("{0:f2}%", salejiujiang / total * 100);
371 382
                         drNew["新疆"] = string.Format("{0:f2}%", salexinjiang / total * 100);
372 383
                         drNew["新乡"] = string.Format("{0:f2}%", salexinxiang / total * 100);
384
+                        drNew["车用尿素"] = string.Format("{0:f2}%", cheyongniaosu / total * 100);
373 385
                         drNew["合计"] = string.Format("{0:f2}%", 100);
374 386
                     }
375 387
                     else
@@ -378,6 +390,7 @@ namespace CallCenterApi.Interface.Controllers.report
378 390
                         drNew["九江"] = "0.00%";
379 391
                         drNew["新疆"] = "0.00%";
380 392
                         drNew["新乡"] = "0.00%";
393
+                        drNew["车用尿素"] = "0.00%";
381 394
                         drNew["合计"] = "0.00%";
382 395
                     }
383 396
                 }
@@ -387,6 +400,7 @@ namespace CallCenterApi.Interface.Controllers.report
387 400
                     drNew["九江"] = salejiujiang.ToString();
388 401
                     drNew["新疆"] = salexinjiang.ToString();
389 402
                     drNew["新乡"] = salexinxiang.ToString();
403
+                    drNew["车用尿素"] = cheyongniaosu.ToString();
390 404
                     drNew["合计"] = total.ToString();
391 405
                 }
392 406
                 dt.Rows.Add(drNew);
@@ -431,6 +445,7 @@ namespace CallCenterApi.Interface.Controllers.report
431 445
             List<Model.T_Wo_WorkOrder> workerjiujiang = woBLL.GetModelList(sql + "and F_SalesBase='九江'");
432 446
             List<Model.T_Wo_WorkOrder> workerxinjiang = woBLL.GetModelList(sql + "and F_SalesBase='新疆'");
433 447
             List<Model.T_Wo_WorkOrder> workerxinxiang = woBLL.GetModelList(sql + "and F_SalesBase='新乡'");
448
+            List<Model.T_Wo_WorkOrder> workerniaosu = woBLL.GetModelList(sql + "and F_SalesBase='车用尿素'");
434 449
             List<Model.T_Wo_WorkOrder> workertotal = woBLL.GetModelList(sql);
435 450
             List<market> markets = new List<market>();
436 451
 
@@ -441,11 +456,13 @@ namespace CallCenterApi.Interface.Controllers.report
441 456
                 int salejiujiang = 0;
442 457
                 int salexinjiang = 0;
443 458
                 int salexinxiang = 0;
459
+                int cheyong = 0;
444 460
                 int total = 0;
445 461
                 saledongbei = workercount(i, workerdongbei, ConsultingNeedslist, Complaintlist, SpotChecklist);
446 462
                 salejiujiang = workercount(i, workerjiujiang, ConsultingNeedslist, Complaintlist, SpotChecklist);
447 463
                 salexinjiang = workercount(i, workerxinjiang, ConsultingNeedslist, Complaintlist, SpotChecklist);
448 464
                 salexinxiang = workercount(i, workerxinxiang, ConsultingNeedslist, Complaintlist, SpotChecklist);
465
+                cheyong = workercount(i, workerniaosu, ConsultingNeedslist, Complaintlist, SpotChecklist);
449 466
                 total = workercount(i, workertotal, ConsultingNeedslist, Complaintlist, SpotChecklist);
450 467
                 market brand = new market();
451 468
                 switch (i)
@@ -488,6 +505,7 @@ namespace CallCenterApi.Interface.Controllers.report
488 505
                         brand.salejiujiang = string.Format("{0:f2}%", salejiujiang / total * 100);
489 506
                         brand.salexinjiang = string.Format("{0:f2}%", salexinjiang / total * 100);
490 507
                         brand.salexinxiang = string.Format("{0:f2}%", salexinxiang / total * 100);
508
+                        brand.cheyong = string.Format("{0:f2}%", cheyong / total * 100);
491 509
                         brand.total = string.Format("{0:f2}%", 100);
492 510
                     }
493 511
                     else
@@ -496,6 +514,7 @@ namespace CallCenterApi.Interface.Controllers.report
496 514
                         brand.salejiujiang = "0.00%";
497 515
                         brand.salexinjiang = "0.00%";
498 516
                         brand.salexinxiang = "0.00%";
517
+                        brand.cheyong  = "0.00%";
499 518
                         brand.total = "0.00%";
500 519
                     }
501 520
                 }
@@ -505,6 +524,7 @@ namespace CallCenterApi.Interface.Controllers.report
505 524
                     brand.salejiujiang = salejiujiang.ToString();
506 525
                     brand.salexinjiang = salexinjiang.ToString();
507 526
                     brand.salexinxiang = salexinxiang.ToString();
527
+                    brand.cheyong = cheyong.ToString();
508 528
                     brand.total = total.ToString();
509 529
                 }
510 530
                 markets.Add(brand);
@@ -909,13 +929,13 @@ namespace CallCenterApi.Interface.Controllers.report
909 929
                     if (it.F_IsUsed == 0 && it.F_OptType == 1)
910 930
                     {
911 931
                         pending++;
912
-                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1  and F_Type !=3 and F_ID=" + it.F_WoID);
932
+                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1   and F_ID=" + it.F_WoID);
913 933
                         Overdue++;
914 934
                     }
915 935
                     if (it.F_OptType == 2 && it.F_IsUsed == 0)
916 936
                     {
917 937
                         beprocessed++;
918
-                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1 and F_Type !=3 and F_ID=" + it.F_WoID);
938
+                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1  and F_ID=" + it.F_WoID);
919 939
                         Overdue++;
920 940
                     }
921 941
                 }
@@ -997,13 +1017,13 @@ namespace CallCenterApi.Interface.Controllers.report
997 1017
                     if (it .F_IsUsed ==0&&it .F_OptType ==1)
998 1018
                     {
999 1019
                         pending++;
1000
-                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1 and F_Type !=3 and F_ID=" + it.F_WoID );
1020
+                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1  and F_ID=" + it.F_WoID );
1001 1021
                         Overdue++;
1002 1022
                     }
1003 1023
                     if (it .F_OptType ==2&& it.F_IsUsed == 0)
1004 1024
                     {
1005 1025
                         beprocessed++;
1006
-                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1 and F_Type !=3 and F_ID=" + it.F_WoID);
1026
+                        var Overworkorder = woBLL.GetModelList(sql + "and F_IsOver=1  and F_ID=" + it.F_WoID);
1007 1027
                         Overdue++;
1008 1028
                     }
1009 1029
                 }
@@ -1057,8 +1077,12 @@ namespace CallCenterApi.Interface.Controllers.report
1057 1077
             public int visit;
1058 1078
             public int Overdue;
1059 1079
             public int visitcont;
1080
+            public int verysatisfied;
1060 1081
             public int satisfied;
1082
+            public int commonly;
1061 1083
             public int dissatisfied;
1084
+            public int other;
1085
+           
1062 1086
         }
1063 1087
         /// <summary>
1064 1088
         /// 导出客户回访数量表
@@ -1153,24 +1177,34 @@ namespace CallCenterApi.Interface.Controllers.report
1153 1177
             List<Returnvisit> returnvisits = new List<Returnvisit>();
1154 1178
             Returnvisit model = new Returnvisit();
1155 1179
             var workordewr = woBLL.GetModelList(sql + "and F_State in(10,11) and F_IsVisit =1");
1156
-            model. name ="客户回访"; int bevisit = 0, visit = 0, Overdue = 0, satisfied = 0, dissatisfied = 0;int visitcont = 0;
1180
+            model. name ="客户回访"; int bevisit = 0, visit = 0, Overdue = 0, verysatisfied = 0, satisfied=0, commonly=0, dissatisfied = 0;int visitcont = 0, other=0;
1157 1181
             var workorder = woBLL.GetModelList(sql + "and F_State in(10,11)");
1158 1182
             visitcont = workorder.Count;
1159 1183
             foreach (var it in workordewr)
1160 1184
             {
1161 1185
                 if (it.F_State == 10)
1162 1186
                     bevisit++;
1187
+                if (it.F_IsOver == 1)
1188
+                    Overdue++;
1163 1189
                 if (it.F_State == 11)
1190
+                {
1164 1191
                     visit++;
1165
-                if (it.F_IsOver == 1&&it .F_Type !="3")
1166
-                    Overdue++;
1167
-                if (it.F_VisitResult == "满意" || it.F_VisitResult == "非常满意")
1168
-                    satisfied++;
1169
-                if (it.F_VisitResult == "不满意")
1170
-                    dissatisfied++;
1192
+                    if (it.F_VisitResult == "非常满意")
1193
+                        verysatisfied++;
1194
+                    if (it.F_VisitResult == "满意")
1195
+                        satisfied++;
1196
+                    if (it.F_VisitResult == "一般")
1197
+                        commonly++;
1198
+                    if (it.F_VisitResult == "不满意")
1199
+                        dissatisfied++;
1200
+                    if (it.F_VisitResult == "其他" || it.F_VisitResult == "")
1201
+                        other++;
1202
+                }
1203
+                   
1171 1204
             }
1172 1205
             model.bevisit = bevisit; model.visit = visit; model.visitcont = visitcont; model.Overdue = Overdue;
1173
-            model.satisfied = satisfied; model.dissatisfied = dissatisfied;
1206
+            model.satisfied = satisfied; model.dissatisfied = dissatisfied; model.verysatisfied = verysatisfied;
1207
+            model.commonly = commonly;model.other = other;
1174 1208
             returnvisits.Add(model);
1175 1209
             return Success("获取成功", returnvisits
1176 1210
            );
@@ -2382,7 +2416,6 @@ question, int page = 1, int limit = 10)
2382 2416
                     case 4:
2383 2417
                         template.name = "东北";
2384 2418
                         break;
2385
-                   
2386 2419
                 }
2387 2420
                 if (i > 0)
2388 2421
                 {
@@ -2535,7 +2568,7 @@ question, int page = 1, int limit = 10)
2535 2568
             model.overdue = new List<Template>();
2536 2569
             string sqloverdue = "";
2537 2570
             sqloverdue += "";
2538
-            var modlelist = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1 and F_Type !=3 " + time);
2571
+            var modlelist = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1  " + time);
2539 2572
             Template templatee = new Template();
2540 2573
             templatee.name = "合计";
2541 2574
             templatee.number =0;
@@ -2682,7 +2715,7 @@ question, int page = 1, int limit = 10)
2682 2715
         private bool Refresh()
2683 2716
         {
2684 2717
             int type = 0;
2685
-            var modlelist = workOrder.GetModelList(" F_IsDelete=0 and F_Type !=3" + "and F_IsOver=0" + " and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
2718
+            var modlelist = workOrder.GetModelList(" F_IsDelete=0 " + "and F_IsOver=0" + " and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
2686 2719
                 (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "," + (int)EnumWorkOrderState.finish + ")");
2687 2720
             if (modlelist.Count > 0)
2688 2721
             {

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/ZuoXiManYiDuController.cs

@@ -102,7 +102,7 @@ namespace CallCenterApi.Interface.Controllers.report
102 102
             Dictionary<string, List<List<string>>> body = new Dictionary<string, List<List<string>>>();
103 103
             //坐席
104 104
             //  DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_RoleId in (1,4,28,29) and F_DeleteFlag=0").Tables[0];//客服坐席、班长坐席、售前坐席、投诉坐席
105
-            DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_DeleteFlag=0 and F_SeatFlag=1  ").Tables[0];
105
+            DataTable dtable = new BLL.T_Sys_UserAccount().GetList("F_DeleteFlag=0 and F_SeatFlag=1   and  F_DeptId = 2").Tables[0];
106 106
             int allcount = dtable.Rows.Count;
107 107
             for (int i = 0; i < allcount; i++)
108 108
             {

+ 220 - 44
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -1697,25 +1697,30 @@ namespace CallCenterApi.Interface.Controllers.weixin
1697 1697
                 dapt = deptmodel1.F_ParentId;
1698 1698
                 deptname = deptmodel1.F_DeptName;
1699 1699
             }
1700
+            int isbl = 0;
1700 1701
             if (dapt != 0)
1701 1702
             {
1702 1703
                 if (dapt == 11)
1703 1704
                 {
1705
+                    isbl = 1;
1704 1706
                     nextda = 37;
1705 1707
                     opt = "流转市场管理科";
1706 1708
                 }
1707 1709
                 else if (dapt == 14)
1708 1710
                 {
1711
+                    isbl = 1;
1709 1712
                     nextda = 57;
1710 1713
                     opt = "流转营销管理处";
1711 1714
                 }
1712 1715
                 else if (dapt == 15)
1713 1716
                 {
1717
+                    isbl = 1;
1714 1718
                     nextda = 74;
1715 1719
                     opt = "流转策划推广";
1716 1720
                 }
1717 1721
                 else if (dapt == 16)
1718 1722
                 {
1723
+                    isbl = 1;
1719 1724
                     nextda = 88;
1720 1725
                     opt = "流转销售部";
1721 1726
                 }
@@ -1726,6 +1731,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1726 1731
                 //}
1727 1732
                 else if (ua.F_DeptId == 17 || ua.F_DeptId == 18 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
1728 1733
                 {
1734
+                    isbl = 1;
1729 1735
                     nextda = ua.F_DeptId;
1730 1736
                     opt = "流转" + deptname;
1731 1737
                 }
@@ -1741,7 +1747,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1741 1747
             }
1742 1748
             if (nextda != 0)
1743 1749
             {
1744
-                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, model .F_limit , sms, 0, 0, 0, time.ToString());
1750
+                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, model .F_limit , sms, 0, 0, 0, time.ToString(), isbl);
1745 1751
                 return res;
1746 1752
             }
1747 1753
             else
@@ -2334,7 +2340,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2334 2340
                     {
2335 2341
                         model.F_AuditState = "";
2336 2342
                     }
2337
-
2343
+                   
2338 2344
                     model.F_AuditBy = model1[i].F_AuditBy;//审核人
2339 2345
                     model.F_AuditOn = model1[i].F_AuditOn;//审核时间
2340 2346
                     model.F_AuditCont = model1[i].F_AuditCont;//审核内容
@@ -2716,6 +2722,18 @@ namespace CallCenterApi.Interface.Controllers.weixin
2716 2722
             ;
2717 2723
             return str;
2718 2724
         }
2725
+        private bool IsCustomerBaseNew(WorkOrderNewInput input)
2726
+        {
2727
+            bool n = false;
2728
+            if (!string.IsNullOrEmpty(input.F_CustomerID) || !string.IsNullOrEmpty(input.F_CompanyName)
2729
+               || !string.IsNullOrEmpty(input.F_AreaName) || !string.IsNullOrEmpty(input.F_BranchName)
2730
+                || !string.IsNullOrEmpty(input.F_Salesman) || !string.IsNullOrEmpty(input.F_SalesPhone)
2731
+              || !string.IsNullOrEmpty(input.F_Brands) )
2732
+            {
2733
+                n = true;
2734
+            }
2735
+            return n;
2736
+        }
2719 2737
         /// <summary>
2720 2738
         /// 添加客户
2721 2739
         /// </summary>
@@ -2852,14 +2870,74 @@ namespace CallCenterApi.Interface.Controllers.weixin
2852 2870
                             Customer.F_Salesman = input.F_Salesman;
2853 2871
                         if (!string.IsNullOrEmpty(input.F_SalesPhone))
2854 2872
                             Customer.F_SalesPhone = input.F_SalesPhone;
2873
+
2874
+
2855 2875
                         if (!string.IsNullOrEmpty(input.F_Brands))
2856
-                            Customer.F_Brands = input.F_Brands;
2876
+                            Customer.F_SalesPhone = input.F_Brands;
2857 2877
                         if (!string.IsNullOrEmpty(input.F_AreaName))
2858
-                            Customer.F_AreaID = input.F_AreaName.Trim();
2878
+                        {
2879
+                            Model.T_Sys_Department pdModel = new Model.T_Sys_Department();
2880
+                            try
2881
+                            {
2882
+                                pdModel = departmentBLL.GetModel(int.Parse(input.F_AreaName));
2883
+                            }
2884
+                            catch
2885
+                            {
2886
+                                pdModel = departmentBLL.GetModel(input.F_AreaName);
2887
+                            }
2888
+                            Customer.F_AreaID = pdModel.F_DeptId.ToString();
2889
+                        }
2890
+
2859 2891
                         if (!string.IsNullOrEmpty(input.F_BranchName))
2860
-                            Customer.F_BranchID = input.F_BranchName.Trim();
2892
+                        {
2893
+                            Model.T_Sys_Department pdModel = new Model.T_Sys_Department();
2894
+                            try
2895
+                            {
2896
+                                pdModel = departmentBLL.GetModel(int.Parse(input.F_BranchName));
2897
+                            }
2898
+                            catch
2899
+                            {
2900
+                                pdModel = departmentBLL.GetModel(input.F_BranchName);
2901
+                            }
2902
+                            Customer.F_BranchID = pdModel.F_DeptId.ToString();
2903
+                        }
2904
+                        if (!string.IsNullOrEmpty(input.F_CompanyName ))
2905
+                            Customer.F_CompanyName = input.F_CompanyName;
2861 2906
                         customerBaseBLL.Update(Customer);
2862 2907
                     }
2908
+                    else
2909
+                    {
2910
+                        if (IsCustomerBaseNew(input))
2911
+                        {
2912
+                            
2913
+                            if (string.IsNullOrEmpty(input.F_CustomerID))
2914
+                            {
2915
+                                while (true)
2916
+                                {
2917
+                                    int i = 0;
2918
+                                    while (true)
2919
+                                    {
2920
+                                        if (!getunique(0, GetCusCode(i)))
2921
+                                        {
2922
+                                            input.F_CustomerID = GetCusCode(i);
2923
+                                            break;
2924
+                                        }
2925
+                                        else
2926
+                                        {
2927
+                                            i++;
2928
+                                        }
2929
+                                    }
2930
+                                }
2931
+                            }
2932
+                            var CustomerBaseNewmodel = new Model.T_Cus_CustomerBaseNew();
2933
+                            CustomerBaseNewmodel.F_CustomerCode = input.F_CustomerID;
2934
+                            CustomerBaseNewmodel.F_CreateBy = usercode;
2935
+                            CustomerBaseNewmodel.F_CreateOn = DateTime.Now;
2936
+                            CustomerBaseNewmodel.F_IsDelete = 0;
2937
+                            customerBaseBLL.Add(inputtooCustomer(CustomerBaseNewmodel, input));
2938
+                        }
2939
+                    }
2940
+
2863 2941
                 }
2864 2942
                 else
2865 2943
                 {
@@ -2872,39 +2950,50 @@ namespace CallCenterApi.Interface.Controllers.weixin
2872 2950
                             Customer.F_SalesPhone = input.F_SalesPhone;
2873 2951
                         if (!string.IsNullOrEmpty(input.F_Brands))
2874 2952
                             Customer.F_Brands = input.F_Brands;
2953
+                        if (!string.IsNullOrEmpty(input.F_CompanyName))
2954
+                            Customer.F_CompanyName = input.F_CompanyName.Trim();
2875 2955
                         if (!string.IsNullOrEmpty(input.F_AreaName))
2876
-                            Customer.F_AreaID = input.F_AreaName.Trim();
2877
-                        if (!string.IsNullOrEmpty(input.F_BranchName))
2878
-                            Customer.F_BranchID = input.F_BranchName.Trim();
2879
-                        customerBaseBLL.Update(Customer);
2880
-                    }
2881
-
2882
-                }
2883
-                if (IsMaterial(input))
2884
-                {
2885
-                    if (string.IsNullOrEmpty(input.F_MaterialID))
2886
-                    {
2887
-                        while (true)
2888 2956
                         {
2889
-                            if (!gematerque(0, GetIntCode()))
2957
+                            Model.T_Sys_Department pdModel = new Model.T_Sys_Department();
2958
+                            try
2890 2959
                             {
2891
-                                input.F_MaterialID = GetIntCode();
2892
-                                AddMait(input, usercode);
2893
-                                break;
2960
+                                pdModel = departmentBLL.GetModel(int.Parse(input.F_AreaName));
2894 2961
                             }
2962
+                            catch
2963
+                            {
2964
+                                pdModel = departmentBLL.GetModel(input.F_AreaName);
2965
+                            }
2966
+                            Customer.F_AreaID = pdModel.F_DeptId.ToString();
2895 2967
                         }
2896
-                    }
2897
-                    else
2898
-                    {
2899
-                        if (!gematerque(0, input.F_MaterialID))
2968
+
2969
+                        if (!string.IsNullOrEmpty(input.F_BranchName))
2900 2970
                         {
2901
-                            AddMait(input, usercode);
2971
+                            {
2972
+                                Model.T_Sys_Department pdModel = new Model.T_Sys_Department();
2973
+                                try
2974
+                                {
2975
+                                    pdModel = departmentBLL.GetModel(int.Parse(input.F_BranchName));
2976
+                                }
2977
+                                catch
2978
+                                {
2979
+                                    pdModel = departmentBLL.GetModel(input.F_BranchName);
2980
+                                }
2981
+                                Customer.F_BranchID = pdModel.F_DeptId.ToString();
2982
+                            }
2902 2983
                         }
2984
+                        if (!string.IsNullOrEmpty(input.F_CompanyName))
2985
+                            Customer.F_CompanyName = input.F_CompanyName;
2986
+                        customerBaseBLL  .Update(Customer);
2903 2987
                     }
2904 2988
                 }
2989
+
2905 2990
             }
2906 2991
 
2907 2992
             #region 基本字段
2993
+            if (!string.IsNullOrEmpty(input.F_MaterialID))
2994
+            {
2995
+                model.F_MaterialID = input.F_MaterialID.ToString();//物料编码为11为纯数字
2996
+            }
2908 2997
             model.F_Source = input.F_Source.ToString();//工单来源
2909 2998
             model.F_WxOpenId = input.F_WxOpenId;
2910 2999
             model.F_Type = input.F_Type.ToString();//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
@@ -2972,6 +3061,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2972 3061
                 model.F_CreateBy = model.F_CreateBy;//添加人
2973 3062
                 model.F_UpdateBy = usercode;//修改人工号
2974 3063
                 model.F_UpdateOn = DateTime.Now;//修改人工号
3064
+              
2975 3065
                 if (input.F_UpdateCount != null)
2976 3066
                 {
2977 3067
                     model.F_UpdateCount = model.F_UpdateCount + 1;//修改次数
@@ -3038,6 +3128,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3038 3128
 
3039 3129
             return count > 0;
3040 3130
         }
3131
+      
3041 3132
         /// <summary>
3042 3133
         /// 添加工单
3043 3134
         /// </summary>
@@ -3052,7 +3143,16 @@ namespace CallCenterApi.Interface.Controllers.weixin
3052 3143
                     return Error("请输入客户姓名!");
3053 3144
                 if (string.IsNullOrEmpty(input.F_CusPhone))
3054 3145
                     return Error("请输入客户电话!");
3055
-                var model = new Model.T_Wo_WorkOrder();
3146
+            
3147
+            if (input.F_Type == 3)
3148
+            {
3149
+                if (string.IsNullOrEmpty(input.F_Files))
3150
+                    return Error("请上传抽检单");
3151
+                if (string.IsNullOrEmpty(input.F_CJ_Time.ToString()))
3152
+                    return Error("请选择抽检时间");
3153
+            }
3154
+
3155
+            var model = new Model.T_Wo_WorkOrder();
3056 3156
                 #region 保存客户基本信息
3057 3157
                 model = inputtoobj(null , model, input, 2);
3058 3158
                 model.F_State = (int)EnumWorkOrderState.customers;
@@ -3089,11 +3189,22 @@ namespace CallCenterApi.Interface.Controllers.weixin
3089 3189
                 if (ua == null && input.F_Source != 3)
3090 3190
                 {
3091 3191
                     return Error("无操作权限!");
3192
+                   
3193
+                }
3194
+                if (input .F_Source !=3& input.F_Type  == 2)
3195
+                {
3196
+                    if (string.IsNullOrEmpty(input.F_SalesBase))
3197
+                        return Error("请输入基地!");
3198
+                    if (string.IsNullOrEmpty(input.F_QuestionType))
3199
+                        return Error("请选择问题类别!");
3092 3200
                 }
3201
+
3202
+
3093 3203
                 if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
3094 3204
                 {
3095 3205
                     return Error("请输入正确的生产批次号!");
3096 3206
                 }
3207
+
3097 3208
                 else
3098 3209
                 {
3099 3210
                     if (!string.IsNullOrEmpty(input.F_BatchNumber))
@@ -3124,16 +3235,26 @@ namespace CallCenterApi.Interface.Controllers.weixin
3124 3235
                     return Error("请输入客户姓名!");
3125 3236
                 if (string.IsNullOrEmpty(input.F_CusPhone))
3126 3237
                     return Error("请输入客户电话!");
3127
-                //if (input.F_Type == 2 || input.F_Type == 3)
3128
-                //{
3129
-                //    if (string.IsNullOrEmpty(input.F_CustomerID))
3130
-                //    {
3131
-                //        if (string.IsNullOrEmpty(input.F_LegalPhone))
3132
-                //            return Error("请输入客户电话");
3133
-                //        if (getunphone(0, input.F_LegalPhone))
3134
-                //            return Error("已存在该客户请勿重复添加");
3135
-                //    }
3136
-                //}
3238
+              
3239
+                if (!string.IsNullOrEmpty(input.F_CustomerID))
3240
+                {
3241
+                    var Customer = customerBaseBLL.GetModel(input.F_CustomerID.Trim());
3242
+                    if (Customer == null)
3243
+                        return Error("无此客户编码!");
3244
+                }
3245
+                if (!string.IsNullOrWhiteSpace(input.F_MaterialID))
3246
+                {
3247
+                    var Customer = mmBLL.GetModel(input.F_MaterialID.Trim());
3248
+                    if (Customer == null)
3249
+                        return Error("无此物料编码!");
3250
+                }
3251
+                if (input.F_Type == 3)
3252
+                {
3253
+                    if (string.IsNullOrEmpty(input.F_Files))
3254
+                        return Error("请上传抽检单");
3255
+                    if (string.IsNullOrEmpty(input.F_CJ_Time.ToString()))
3256
+                        return Error("请选择抽检时间");
3257
+                }
3137 3258
                 var model = new Model.T_Wo_WorkOrder();
3138 3259
                 #region 保存客户基本信息
3139 3260
                 model = inputtoobj(ua, model, input, 2);
@@ -3223,7 +3344,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3223 3344
                                 }
3224 3345
                                 if (nextda != 0)
3225 3346
                                 {
3226
-                                    var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, overtime, sms);
3347
+                                    var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, overtime, sms,0,0,0,"",1);
3227 3348
                                     if (res)
3228 3349
                                         return Success("添加成功");
3229 3350
                                     else
@@ -3440,7 +3561,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3440 3561
         /// <summary>
3441 3562
         /// 转派工单
3442 3563
         /// </summary>
3443
-        public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int clbm = 0, int clid = 0, int overtime = 0, int sms = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, string creat = "")
3564
+        public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int clbm = 0, int clid = 0, int overtime = 0, int sms = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, string creat = "",int  isbl=0)
3444 3565
         {
3445 3566
 
3446 3567
             string smscont = "";
@@ -3489,7 +3610,12 @@ namespace CallCenterApi.Interface.Controllers.weixin
3489 3610
             {
3490 3611
                 string users = string.Empty;
3491 3612
                 deptid = clbm;
3492
-                var list = userAccountBLL.GetModelList(" F_DeptId='" + clbm + "'");
3613
+                string sql = "";
3614
+                if  (isbl>0)
3615
+                {
3616
+                    sql = " and F_RoleId=59";
3617
+                }
3618
+                var list = userAccountBLL.GetModelList(" F_DeptId='" + clbm + "'"+ sql);
3493 3619
                 foreach (var l in list)
3494 3620
                 {
3495 3621
                     if (string.IsNullOrEmpty(users))
@@ -3644,7 +3770,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3644 3770
                     return Error("查询失败");
3645 3771
                 }
3646 3772
                 string sql = $" and F_IsDelete=0";
3647
-                sql += "and F_Type !=3";
3773
+              //  sql += "and F_Type !=3";
3648 3774
                 DataTable dt = new DataTable();
3649 3775
                 #region 筛选条件
3650 3776
                 if (type > 0 && type < 5)//工单类型
@@ -4025,6 +4151,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
4025 4151
         {
4026 4152
             if (!string.IsNullOrEmpty(OpenId))
4027 4153
             {
4154
+                if (string.IsNullOrEmpty(cont))
4155
+                    return Error("请输入处理内容");
4028 4156
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
4029 4157
                 WorkOrderNewInput input = new WorkOrderNewInput();
4030 4158
                 if (ua != null)
@@ -4116,7 +4244,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
4116 4244
         private bool Refresh()
4117 4245
         {
4118 4246
             int type = 0;
4119
-            var modlelist = woBLL.GetModelList("  F_Type != 3  and F_IsDelete=0" + "and F_IsOver=0" + " and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
4247
+            var modlelist = woBLL.GetModelList(" F_IsDelete=0" + "and F_IsOver=0" + " and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
4120 4248
                 (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "," + (int)EnumWorkOrderState.finish + ")");
4121 4249
             if (modlelist.Count > 0)
4122 4250
             {
@@ -4305,6 +4433,34 @@ namespace CallCenterApi.Interface.Controllers.weixin
4305 4433
             var itemid = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, touser, deptid, nowUser, model.F_limit, sms);
4306 4434
             if (itemid > 0)
4307 4435
             {
4436
+                string smscont = "";
4437
+                if (model.F_Type == "1")
4438
+                {
4439
+                    smscont = "咨询";
4440
+                }
4441
+                else if (model.F_Type == "2")
4442
+                {
4443
+                    smscont = "投诉";
4444
+                }
4445
+                else if (model.F_Type == "3")
4446
+                {
4447
+                    smscont = "抽检";
4448
+                }
4449
+                else
4450
+                {
4451
+                    smscont = "建议";
4452
+                }
4453
+                string[] mag = { smscont };
4454
+                string smsmsg = "您好,您有一条新的" + smscont + "工单,请及时接单处理!";
4455
+                var tousermodel = new BLL.T_Sys_UserAccount().GetModel(touser);
4456
+                if (tousermodel != null)
4457
+                {
4458
+                    if (!string.IsNullOrEmpty(tousermodel.F_Mobile))
4459
+                    {
4460
+                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(445305, mag, tousermodel.F_Mobile.Trim());
4461
+                        bool n = new SMSController().AddSmS(tousermodel.F_Mobile.Trim(), smsmsg, nowUser.F_UserId);
4462
+                    }
4463
+                }
4308 4464
                 #region 处理工单
4309 4465
                 if (deptid == 2)
4310 4466
                 {
@@ -4357,6 +4513,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
4357 4513
 
4358 4514
             if (isover == 1)
4359 4515
             {
4516
+
4360 4517
                 model.F_DealResult = "已处理";//处理结果
4361 4518
                 opt = "处理完结";
4362 4519
                 optbut = (int)EnumItemOpt.end;
@@ -4510,11 +4667,30 @@ namespace CallCenterApi.Interface.Controllers.weixin
4510 4667
                     return Error("请输入客户姓名!");
4511 4668
                 if (string.IsNullOrEmpty(input.F_CusPhone))
4512 4669
                     return Error("请输入客户电话!");
4670
+                if(input.F_Type == 2)
4671
+                {
4672
+                    if (string.IsNullOrEmpty(input.F_SalesBase))
4673
+                        return Error("请输入基地!");
4674
+                    if (string.IsNullOrEmpty(input.F_QuestionType))
4675
+                        return Error("请选择问题类别!");
4676
+                }
4677
+               
4513 4678
                 if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
4514 4679
                 {
4515 4680
                     return Error("请输入正确的生产批次号!");
4516 4681
                 }
4517
-
4682
+                if (!string.IsNullOrEmpty(input.F_CustomerID))
4683
+                {
4684
+                    var Customer = customerBaseBLL.GetModel(input.F_CustomerID.Trim());
4685
+                    if (Customer == null)
4686
+                        return Error("无此客户编码!");
4687
+                }
4688
+                if (!string.IsNullOrWhiteSpace(input.F_MaterialID))
4689
+                {
4690
+                    var Customer = mmBLL.GetModel(input.F_MaterialID.Trim());
4691
+                    if (Customer == null)
4692
+                        return Error("无此物料编码!");
4693
+                }
4518 4694
                 else
4519 4695
                 {
4520 4696
                     if (!string.IsNullOrEmpty(input.F_BatchNumber))
@@ -4638,7 +4814,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
4638 4814
                         }
4639 4815
                         if (nextda != 0)
4640 4816
                         {
4641
-                            var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, sms );
4817
+                            var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, sms,0,0,0,"",1 );
4642 4818
                             if (res)
4643 4819
                                 return Success("保存成功");
4644 4820
                             else

+ 255 - 57
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -52,7 +52,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
52 52
                 if (source > 0)//工单来源
53 53
                 {
54 54
                     if (source==1)
55
-                        sql += $" and F_Source in (1,'')";
55
+                        sql += $"( and F_Source in (1,'') or F_Source is null)";
56 56
                     else 
57 57
                     sql += $" and F_Source='" + source + "'";
58 58
                 }
@@ -79,11 +79,19 @@ namespace CallCenterApi.Interface.Controllers.workorder
79 79
                 if (!string.IsNullOrWhiteSpace(createby))//创建人
80 80
                 {
81 81
                     string F_WorkNumber = "";
82
+
82 83
                     Model.T_Sys_UserAccount user = sysUserAccountBll.GetworkModel(createby);
84
+                  
83 85
                     if (user != null)
84 86
                     {
85 87
                         F_WorkNumber = user.F_UserCode;
86 88
                     }
89
+                    else
90
+                    {
91
+                        Model.T_Sys_UserAccount userer = sysUserAccountBll.GetName (createby);
92
+                        if (userer!=null )
93
+                             F_WorkNumber = user.F_UserCode;
94
+                    }
87 95
                     if (!string.IsNullOrEmpty(F_WorkNumber))
88 96
                     {
89 97
                         sql += $"and F_CreateBy  in(" + createby + "," + F_WorkNumber + ") ";
@@ -1410,30 +1418,36 @@ namespace CallCenterApi.Interface.Controllers.workorder
1410 1418
                 dapt = deptmodel1.F_ParentId;
1411 1419
                 deptname = deptmodel1.F_DeptName;
1412 1420
             }
1421
+            int isbl = 0;
1413 1422
             if (dapt != 0)
1414 1423
             {
1415 1424
                 if (dapt == 11)
1416 1425
                 {
1426
+                    isbl = 1;
1417 1427
                     nextda = 37;
1418 1428
                     opt = "流转市场管理科";
1419 1429
                 }
1420 1430
                 else if (dapt == 14)
1421 1431
                 {
1432
+                    isbl = 1;
1422 1433
                     nextda = 57;
1423 1434
                     opt = "流转营销管理处";
1424 1435
                 }
1425 1436
                 else if (dapt == 15)
1426 1437
                 {
1438
+                    isbl = 1;
1427 1439
                     nextda = 74;
1428 1440
                     opt = "流转策划推广";
1429 1441
                 }
1430 1442
                 else if (dapt == 16)
1431 1443
                 {
1444
+                    isbl = 1;
1432 1445
                     nextda = 88;
1433 1446
                     opt = "流转销售部";
1434 1447
                 }
1435 1448
                 else if (ua.F_DeptId==17|| ua.F_DeptId == 18 || ua.F_DeptId == 19 || ua.F_DeptId == 20 || ua.F_DeptId == 21)
1436 1449
                 {
1450
+                    isbl = 1;
1437 1451
                       nextda = ua.F_DeptId;
1438 1452
                       opt = "流转"+ deptname;
1439 1453
                 }
@@ -1454,7 +1468,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1454 1468
             }
1455 1469
             if (nextda != 0)
1456 1470
             {
1457
-                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, model .F_limit , sms, 0, 0, 0, time.ToString());
1471
+                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, model .F_limit , sms, 0, 0, 0, time.ToString(), isbl);
1458 1472
                 return res;
1459 1473
             }
1460 1474
             else
@@ -2767,7 +2781,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2767 2781
                     return Error("查询失败");
2768 2782
                 }
2769 2783
                 string sql = $" and F_IsDelete=0";
2770
-                sql += "and F_Type !=3";
2784
+             //   sql += "and F_Type !=3";
2771 2785
                 DataTable dt = new DataTable();
2772 2786
                 #region 筛选条件
2773 2787
                 if (type > 0 && type < 5)//工单类型
@@ -3392,7 +3406,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
3392 3406
         private bool  Refresh()
3393 3407
         {
3394 3408
             int type = 0;
3395
-            var modlelist = workOrder .GetModelList(" F_Type != 3  and F_IsDelete=0" + "and F_IsOver=0" + " and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," + 
3409
+            var modlelist = workOrder .GetModelList("  F_IsDelete=0" + "and F_IsOver=0" + " and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," + 
3396 3410
                 (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + "," + (int)EnumWorkOrderState.finish  + ")");
3397 3411
             if (modlelist.Count >0)
3398 3412
             {
@@ -3655,6 +3669,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
3655 3669
                     return Error("工单类型错误!");
3656 3670
                 if(string .IsNullOrEmpty (input.F_CusName))
3657 3671
                     return Error("请输入客户姓名!");
3672
+                if (input.F_Type == 2)
3673
+                {
3674
+                    if (string.IsNullOrEmpty(input.F_SalesBase))
3675
+                        return Error("请输入基地!");
3676
+                    if (string.IsNullOrEmpty(input.F_QuestionType))
3677
+                        return Error("请选择问题类别!");
3678
+                }
3679
+                
3658 3680
                 if (string.IsNullOrEmpty(input.F_CusPhone))
3659 3681
                     return Error("请输入客户电话!");
3660 3682
                 if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber.Trim ()))
@@ -3686,18 +3708,27 @@ namespace CallCenterApi.Interface.Controllers.workorder
3686 3708
 
3687 3709
                 if (!string.IsNullOrEmpty (input.F_MaterialID)  && !valcode(input.F_MaterialID.ToString(), 11))
3688 3710
                     return Error("物料编码为11为纯数字!");
3689
-                //if (input.F_Type == 2 || input.F_Type == 3)
3690
-                //{
3691
-                //    if (string.IsNullOrEmpty(input.F_CustomerID))
3692
-                //    {
3693
-                //        if (string.IsNullOrEmpty(input.F_LegalPhone))
3694
-                //            return Error("请输入客户电话");
3695
-                //        if (getunphone(0, input.F_LegalPhone))
3696
-                //            return Error("已存在该客户请勿重复添加");
3697
-                //    }
3698
-                //}
3711
+                if (!string.IsNullOrEmpty(input.F_CustomerID))
3712
+                {
3713
+                    var Customer = cusbll.GetModel(input.F_CustomerID.Trim());
3714
+                    if (Customer == null)
3715
+                        return Error("无此客户编码!");
3716
+                }
3717
+                if (!string.IsNullOrWhiteSpace(input.F_MaterialID))
3718
+                {
3719
+                    var Customer = mmBLL.GetModel(input.F_MaterialID.Trim());
3720
+                    if (Customer == null)
3721
+                        return Error("无此物料编码!");
3722
+                }
3723
+                if (input.F_Type == 3)
3724
+                {
3725
+                    if (string.IsNullOrEmpty(input.F_Files))
3726
+                        return Error("请上传抽检单");
3727
+                    if (string.IsNullOrEmpty(input.F_CJ_Time.ToString()))
3728
+                        return Error("请选择抽检时间");
3729
+                }
3699 3730
 
3700
-                        var model = new Model.T_Wo_WorkOrder();
3731
+                var model = new Model.T_Wo_WorkOrder();
3701 3732
                 #region 保存客户基本信息
3702 3733
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
3703 3734
                 model = inputtoobj(model, input, 2);
@@ -3782,7 +3813,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
3782 3813
                             }
3783 3814
                             if (nextda != 0)
3784 3815
                             {
3785
-                                var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, 0, 0);
3816
+                                var res = AssignWO(ua, modlelist, input, opt, "", nextda, 0, 0, 0,0,0,0,"",1);
3786 3817
                                 if (res)
3787 3818
                                     return Success("添加成功");
3788 3819
                                 else
@@ -3957,6 +3988,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
3957 3988
                     return Error("请输入客户姓名!");
3958 3989
                 if (string.IsNullOrEmpty(input.F_CusPhone))
3959 3990
                     return Error("请输入客户电话!");
3991
+                if (input.F_Type == 2)
3992
+                {
3993
+                    if (string.IsNullOrEmpty(input.F_SalesBase))
3994
+                        return Error("请输入基地!");
3995
+                    if (string.IsNullOrEmpty(input.F_QuestionType))
3996
+                        return Error("请选择问题类别!");
3997
+                }
3998
+                   
3960 3999
                 if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber.Trim()))
3961 4000
                 {
3962 4001
                     return Error("请输入正确的生产批次号!");
@@ -4009,7 +4048,18 @@ namespace CallCenterApi.Interface.Controllers.workorder
4009 4048
                 {
4010 4049
                     return Error("此工单已处理不能修改!");
4011 4050
                 }
4012
-
4051
+                if (!string.IsNullOrEmpty(input.F_CustomerID))
4052
+                {
4053
+                    var Customer = cusbll.GetModel(input.F_CustomerID.Trim());
4054
+                    if (Customer == null)
4055
+                        return Error("无此客户编码!");
4056
+                }
4057
+                if (!string.IsNullOrWhiteSpace(input.F_MaterialID))
4058
+                {
4059
+                    var Customer = mmBLL.GetModel(input.F_MaterialID.Trim());
4060
+                    if (Customer == null)
4061
+                        return Error("无此物料编码!");
4062
+                }
4013 4063
                 #region 保存客户基本信息
4014 4064
                 model = inputtoobj(model, input,1);
4015 4065
                 #endregion
@@ -4089,7 +4139,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4089 4139
                                 }
4090 4140
                                 if (nextda != 0)
4091 4141
                                 {
4092
-                                    var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, 0);
4142
+                                    var res = AssignWO(ua, model, input, opt, "", nextda, 0, model.F_limit, 0,0,0,0,"",1);
4093 4143
                                     if (res)
4094 4144
                                         return Success("保存成功");
4095 4145
                                     else
@@ -4219,7 +4269,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4219 4269
                         model.F_AddressFull = cuModel.F_AddressFull;
4220 4270
                         model.F_Brands = cuModel.F_Brands;
4221 4271
                         model.F_Channel = cuModel.F_Channel;
4222
-                        model.F_Channel = cuModel.F_CompanyName;
4272
+                        model.F_CompanyName = cuModel.F_CompanyName;
4223 4273
                         model.F_IsRunXLX = cuModel.F_IsRunXLX;
4224 4274
                         model.F_AnnualSales = cuModel.F_AnnualSales;
4225 4275
                         model.F_Formula = cuModel.F_Formula;
@@ -4771,9 +4821,20 @@ namespace CallCenterApi.Interface.Controllers.workorder
4771 4821
             }
4772 4822
             return true;
4773 4823
         }
4774
-      
4775 4824
 
4776
-      
4825
+        private bool IsCustomerBaseNew(WorkOrderNewInput input)
4826
+        {
4827
+            bool n = false;
4828
+            if (!string.IsNullOrEmpty(input.F_CustomerID) || !string.IsNullOrEmpty(input.F_CompanyName)
4829
+               || !string.IsNullOrEmpty(input.F_AreaName) || !string.IsNullOrEmpty(input.F_BranchName)
4830
+                || !string.IsNullOrEmpty(input.F_Salesman) || !string.IsNullOrEmpty(input.F_SalesPhone)
4831
+              || !string.IsNullOrEmpty(input.F_Brands))
4832
+            {
4833
+                n = true;
4834
+            }
4835
+            return n;
4836
+        }
4837
+
4777 4838
         /// <summary>
4778 4839
         /// 根据传入的对象和input的内容返回对象(添加修改使用)
4779 4840
         /// </summary>
@@ -4815,8 +4876,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
4815 4876
                                 Customer.F_Salesman = input.F_Salesman;
4816 4877
                             if (!string.IsNullOrEmpty(input.F_SalesPhone))
4817 4878
                                 Customer.F_SalesPhone = input.F_SalesPhone;
4818
-                       
4819
-                       
4820 4879
                         if (!string.IsNullOrEmpty(input.F_Brands))
4821 4880
                             Customer.F_SalesPhone = input.F_Brands;
4822 4881
                         if (!string.IsNullOrEmpty(input.F_AreaName))
@@ -4846,10 +4905,40 @@ namespace CallCenterApi.Interface.Controllers.workorder
4846 4905
                             }
4847 4906
                             Customer.F_BranchID = pdModel.F_DeptId.ToString();
4848 4907
                         }
4849
-                               
4850
-                            cusbll.Update(Customer);
4908
+                        if (!string.IsNullOrEmpty(input.F_CompanyName))
4909
+                            Customer.F_CompanyName = input.F_CompanyName;
4910
+                        cusbll.Update(Customer);
4911
+                        }
4912
+                        else
4913
+                        {
4914
+                        if (IsCustomerBaseNew(input))
4915
+                         {
4916
+                            
4917
+                            if (string.IsNullOrEmpty(input.F_CustomerID ))
4918
+                            {
4919
+                                int i = 0;
4920
+                                while (true)
4921
+                                {
4922
+                                    if (!getunique(0, GetCusCode(i)))
4923
+                                    {
4924
+                                        input.F_CustomerID = GetCusCode(i);
4925
+                                        break;
4926
+                                    }
4927
+                                    else
4928
+                                    {
4929
+                                        i++;
4930
+                                    }
4931
+                                }
4932
+                            }
4933
+                            var CustomerBaseNewmodel = new Model.T_Cus_CustomerBaseNew();
4934
+                            CustomerBaseNewmodel.F_CustomerCode  = input.F_CustomerID;
4935
+                            CustomerBaseNewmodel.F_CreateBy = usercode;
4936
+                            CustomerBaseNewmodel.F_CreateOn = DateTime.Now;
4937
+                            CustomerBaseNewmodel.F_IsDelete = 0;
4938
+                          
4939
+                            cusbll .Add(inputtooCustomer(CustomerBaseNewmodel, input));
4940
+                        }
4851 4941
                         }
4852
-
4853 4942
                     }
4854 4943
                     else
4855 4944
                     {
@@ -4862,9 +4951,11 @@ namespace CallCenterApi.Interface.Controllers.workorder
4862 4951
                                 Customer.F_SalesPhone = input.F_SalesPhone;
4863 4952
                             if (!string.IsNullOrEmpty(input.F_Brands))
4864 4953
                                Customer.F_Brands = input.F_Brands;
4954
+                        if (!string.IsNullOrEmpty(input.F_CompanyName))
4955
+                            Customer.F_CompanyName = input.F_CompanyName.Trim();
4865 4956
                         if (!string.IsNullOrEmpty(input.F_AreaName))
4866 4957
                         {
4867
-                            Model.T_Sys_Department pdModel = new T_Sys_Department();
4958
+                            Model.T_Sys_Department pdModel = new Model.T_Sys_Department();
4868 4959
                             try
4869 4960
                             {
4870 4961
                                 pdModel = departmentBLL.GetModel(int.Parse(input.F_AreaName));
@@ -4879,7 +4970,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4879 4970
                             if (!string.IsNullOrEmpty(input.F_BranchName))
4880 4971
                         {
4881 4972
                             {
4882
-                                Model.T_Sys_Department pdModel = new T_Sys_Department();
4973
+                                Model.T_Sys_Department pdModel = new Model . T_Sys_Department();
4883 4974
                                 try
4884 4975
                                 {
4885 4976
                                     pdModel = departmentBLL.GetModel(int.Parse(input.F_BranchName));
@@ -4891,8 +4982,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
4891 4982
                                 Customer.F_BranchID = pdModel.F_DeptId.ToString();
4892 4983
                             }
4893 4984
                         }
4894
-                              
4895
-                            cusbll.Update(Customer);
4985
+                        if (!string.IsNullOrEmpty(input.F_CompanyName))
4986
+                            Customer.F_CompanyName = input.F_CompanyName;
4987
+                        cusbll.Update(Customer);
4896 4988
                         }
4897 4989
                     }
4898 4990
                 }
@@ -4911,7 +5003,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
4911 5003
             model.F_Description = input.F_Description;//问题描述
4912 5004
             model.F_ZX_Area = input.F_ZX_Area;// 大区
4913 5005
             model.F_ZX_Branch = input.F_ZX_Branch;//分公司
4914
-            model.F_Files = model.F_Files;//附件上传ids
5006
+           
5007
+         
4915 5008
             model.F_Brand = input.F_WorkerBrand;//工单品牌
4916 5009
             model.F_DealType = model.F_DealType;//处理方式:当即办理、电话转接、网络转办(点选)
4917 5010
             #endregion
@@ -4931,7 +5024,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
4931 5024
             #region 咨询类
4932 5025
          //   model.F_ZX_ProName = input.F_ZX_ProName;//咨询-产品名称:三聚氰胺、甲醇、液氨、二甲醚、糠醇、其他
4933 5026
             model.F_ZX_Quantity = input.F_ZX_Quantity;// 咨询-问题数量(吨)
4934
-          
5027
+            if (!string.IsNullOrEmpty(input.F_Files))
5028
+                model.F_Files = input.F_Files;//附件上传ids
5029
+            else
5030
+                model.F_Files = model.F_Files;//附件上传ids
4935 5031
             #endregion
4936 5032
             #region 抽检类
4937 5033
             model.F_CJ_Time = input.F_CJ_Time;// 抽检-抽检时间
@@ -4952,7 +5048,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4952 5048
                     model.F_SC_QualityMonth = new WorkOrderController().GetProTime(input.F_BatchNumber, DateTime.Now).ToString();
4953 5049
                 }
4954 5050
             }
4955
-          
5051
+         
4956 5052
             if (type ==1)
4957 5053
             {
4958 5054
                 model.F_State = model.F_State;//工单状态
@@ -4960,6 +5056,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4960 5056
                 model.F_CreateBy = model.F_CreateBy;//添加人
4961 5057
                 model.F_UpdateBy = usercode;//修改人工号
4962 5058
                 model.F_UpdateOn = DateTime .Now ;//修改人工号
5059
+               
4963 5060
                 if (input.F_UpdateCount!=null )
4964 5061
                 {
4965 5062
                     model.F_UpdateCount = model.F_UpdateCount + 1;//修改次数
@@ -5082,21 +5179,38 @@ namespace CallCenterApi.Interface.Controllers.workorder
5082 5179
                     return Error("请输入客户姓名!");
5083 5180
                 if (string.IsNullOrEmpty(input.F_CusPhone))
5084 5181
                     return Error("请输入客户电话!");
5182
+                if (input.F_Type == 2)
5183
+                {
5184
+                    if (string.IsNullOrEmpty(input.F_SalesBase))
5185
+                        return Error("请输入基地!");
5186
+                    if (string.IsNullOrEmpty(input.F_QuestionType))
5187
+                        return Error("请选择问题类别!");
5188
+                }
5189
+                    
5085 5190
                 if (!string.IsNullOrEmpty(input.F_CustomerID) && !valcode(input.F_CustomerID.ToString(), 10))
5086 5191
                     return Error("客户编号为10为纯数字!");
5087 5192
 
5088 5193
                 if (!string.IsNullOrEmpty(input.F_MaterialID) && !valcode(input.F_MaterialID.ToString(), 11))
5089 5194
                     return Error("物料编码为11为纯数字!");
5090
-                //if (input.F_Type == 2 || input.F_Type == 3)
5091
-                //{
5092
-                //    if (string.IsNullOrEmpty(input.F_CustomerID))
5093
-                //    {
5094
-                //        if (string.IsNullOrEmpty(input.F_LegalPhone))
5095
-                //            return Error("请输入客户电话");
5096
-                //        if (getunphone(0, input.F_LegalPhone))
5097
-                //            return Error("已存在该客户请勿重复添加");
5098
-                //    }
5099
-                //}
5195
+                if (!string.IsNullOrEmpty(input.F_CustomerID))
5196
+                {
5197
+                    var Customer = cusbll .GetModel(input.F_CustomerID.Trim());
5198
+                    if (Customer == null)
5199
+                        return Error("无此客户编码!");
5200
+                }
5201
+                if (!string.IsNullOrWhiteSpace(input.F_MaterialID))
5202
+                {
5203
+                    var Customer = mmBLL.GetModel(input.F_MaterialID.Trim());
5204
+                    if (Customer == null)
5205
+                        return Error("无此物料编码!");
5206
+                }
5207
+                if (input.F_Type == 3)
5208
+                {
5209
+                    if (string.IsNullOrEmpty(input.F_Files))
5210
+                        return Error("请上传抽检单");
5211
+                    if (string.IsNullOrEmpty(input.F_CJ_Time.ToString()))
5212
+                        return Error("请选择抽检时间");
5213
+                }
5100 5214
                 #endregion
5101 5215
                 var model = new Model.T_Wo_WorkOrder();
5102 5216
                 #region 保存客户基本信息
@@ -5306,10 +5420,40 @@ namespace CallCenterApi.Interface.Controllers.workorder
5306 5420
             {
5307 5421
                 deptid = touser.F_DeptId;
5308 5422
             }
5309
-         
5423
+            string smscont = "";
5424
+   
5425
+          
5310 5426
             var itemid = AddLog((int)model.F_ID, 3, content, (int)EnumItemType.deal, 4, creatuser, deptid, nowUser, model.F_limit, sms);
5311 5427
             if (itemid > 0)
5312 5428
             {
5429
+                if (model.F_Type == "1")
5430
+                {
5431
+                    smscont = "咨询";
5432
+                }
5433
+                else if (model.F_Type == "2")
5434
+                {
5435
+                    smscont = "投诉";
5436
+                }
5437
+                else if (model.F_Type == "3")
5438
+                {
5439
+                    smscont = "抽检";
5440
+                }
5441
+                else
5442
+                {
5443
+                    smscont = "建议";
5444
+                }
5445
+                  string[] mag = { smscont };
5446
+                   string smsmsg = "您好,您有一条新的" + smscont + "工单,请及时接单处理!";
5447
+                if (touser!=null )
5448
+                {
5449
+                    if (!string .IsNullOrEmpty (touser.F_Mobile) )
5450
+                    {
5451
+
5452
+                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(445305, mag, touser.F_Mobile.Trim());
5453
+                        bool n = new SMSController().AddSmS(touser.F_Mobile.Trim(), smsmsg, nowUser.F_UserId);
5454
+                    }
5455
+                }
5456
+                   
5313 5457
                 #region 处理工单
5314 5458
                 model.F_State = 2;
5315 5459
                 workOrder.Update(model);
@@ -5363,26 +5507,45 @@ namespace CallCenterApi.Interface.Controllers.workorder
5363 5507
                         }
5364 5508
                     }
5365 5509
                 }
5510
+               
5366 5511
                 if (string.IsNullOrEmpty(input.F_CusName))
5367 5512
                     return Error("请输入客户姓名!");
5368 5513
                 if (string.IsNullOrEmpty(input.F_CusPhone))
5369 5514
                     return Error("请输入客户电话!");
5515
+                if (input.F_Type == 2)
5516
+                {
5517
+                    if (string.IsNullOrEmpty(input.F_SalesBase))
5518
+                        return Error("请输入基地!");
5519
+                    if (string.IsNullOrEmpty(input.F_QuestionType))
5520
+                        return Error("请选择问题类别!");
5521
+                }
5522
+                    
5370 5523
                 #endregion
5371 5524
                 if (!string.IsNullOrEmpty(input.F_CustomerID) && !valcode(input.F_CustomerID.ToString(), 10))
5372 5525
                     return Error("客户编号为10为纯数字!");
5373 5526
 
5374 5527
                 if (!string.IsNullOrEmpty(input.F_MaterialID) && !valcode(input.F_MaterialID.ToString(), 11))
5375 5528
                     return Error("物料编码为11为纯数字!");
5376
-                //if (input.F_Type == 2 || input.F_Type == 3)
5377
-                //{
5378
-                //    if (string.IsNullOrEmpty(input.F_CustomerID))
5379
-                //    {
5380
-                //        if (string.IsNullOrEmpty(input.F_LegalPhone))
5381
-                //            return Error("请输入客户电话");
5382
-                //        if (getunphone(0, input.F_LegalPhone))
5383
-                //            return Error("已存在该客户请勿重复添加");
5384
-                //    }
5385
-                //}
5529
+                if (!string.IsNullOrEmpty(input.F_CustomerID))
5530
+                {
5531
+                    var Customer = cusbll.GetModel(input.F_CustomerID.Trim());
5532
+                    if (Customer == null)
5533
+                        return Error("无此客户编码!");
5534
+                }
5535
+                if (!string.IsNullOrWhiteSpace(input.F_MaterialID))
5536
+                {
5537
+                    var Customer = mmBLL.GetModel(input.F_MaterialID.Trim());
5538
+                    if (Customer == null)
5539
+                        return Error("无此物料编码!");
5540
+                }
5541
+                if (input.F_Type == 3)
5542
+                {
5543
+                    if (string.IsNullOrEmpty(input.F_Files))
5544
+                        return Error("请上传抽检单");
5545
+                    if (string.IsNullOrEmpty(input.F_CJ_Time.ToString()))
5546
+                        return Error("请选择抽检时间");
5547
+                }
5548
+
5386 5549
                 var model = new Model.T_Wo_WorkOrder();
5387 5550
                 #region 保存客户基本信息
5388 5551
                 model = inputtoobj(model, input, 2);
@@ -5658,6 +5821,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
5658 5821
             int userId = CurrentUser.UserData.F_UserId;
5659 5822
             if (userId != 0)
5660 5823
             {
5824
+                if (string.IsNullOrEmpty(cont))
5825
+                    return Error("请输入处理内容");
5661 5826
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
5662 5827
                 WorkOrderNewInput input = new WorkOrderNewInput();
5663 5828
                 if (ua != null)
@@ -6118,6 +6283,34 @@ namespace CallCenterApi.Interface.Controllers.workorder
6118 6283
             var itemid = AddLog((int)model.F_ID , wostate, content, (int)EnumItemType.deal, optbut, touser, deptid, nowUser, model .F_limit ,sms );
6119 6284
             if (itemid > 0)
6120 6285
             {
6286
+                string smscont = "";
6287
+                if (model.F_Type == "1")
6288
+                {
6289
+                    smscont = "咨询";
6290
+                }
6291
+                else if (model.F_Type == "2")
6292
+                {
6293
+                    smscont = "投诉";
6294
+                }
6295
+                else if (model.F_Type == "3")
6296
+                {
6297
+                    smscont = "抽检";
6298
+                }
6299
+                else
6300
+                {
6301
+                    smscont = "建议";
6302
+                }
6303
+                string[] mag = { smscont };
6304
+                string smsmsg = "您好,您有一条新的" + smscont + "工单,请及时接单处理!";
6305
+                var tousermodel = new BLL.T_Sys_UserAccount().GetModel(touser);
6306
+                if (tousermodel != null)
6307
+                {
6308
+                    if (!string .IsNullOrEmpty (tousermodel.F_Mobile))
6309
+                    {
6310
+                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(445305, mag, tousermodel.F_Mobile.Trim());
6311
+                        bool n = new SMSController().AddSmS(tousermodel.F_Mobile.Trim(), smsmsg, nowUser.F_UserId);
6312
+                    }
6313
+                }
6121 6314
                 #region 处理工单
6122 6315
                 if (deptid==2)
6123 6316
                 {
@@ -6539,7 +6732,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
6539 6732
         /// <summary>
6540 6733
         /// 转派工单
6541 6734
         /// </summary>
6542
-        public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int clbm = 0, int clid = 0, int  overtime = 0, int sms = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, string creat = "")
6735
+        public bool AssignWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int clbm = 0, int clid = 0, int  overtime = 0, int sms = 0, int isApprovalp = 0, int hclbm = 0, int hclid = 0, string creat = "",int isbl=0)
6543 6736
         {
6544 6737
             string smscont = "";
6545 6738
             if (model.F_Type == "1")
@@ -6576,7 +6769,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
6576 6769
                     tousername = clus.F_UserName + "(" + clus.F_WorkNumber + ")";
6577 6770
                     if (sms != 0)
6578 6771
                     {
6579
-                        if (!string .IsNullOrEmpty (clus.F_Mobile.Trim ()))
6772
+                        if (!string .IsNullOrEmpty (clus.F_Mobile))
6580 6773
                         {
6581 6774
                           
6582 6775
                             SmsSingleSenderResult result = new SMSController().SMSSingleshot(445305, mag, clus.F_Mobile.Trim());
@@ -6591,7 +6784,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
6591 6784
             {
6592 6785
                 string users = string.Empty;
6593 6786
                 deptid = clbm;
6594
-                var list = sysUserAccountBll.GetModelList(" F_DeptId='" + clbm + "'");
6787
+                string sql = "";
6788
+                if (isbl > 0)
6789
+                {
6790
+                    sql = " and F_RoleId=59";
6791
+                }
6792
+                var list = sysUserAccountBll.GetModelList(" F_DeptId='" + clbm + "'"+ sql);
6595 6793
                 foreach (var l in list)
6596 6794
                 {
6597 6795
                     if (string.IsNullOrEmpty(users))