duhongyu лет назад: 6
Родитель
Сommit
fb5624f50d

+ 63 - 81
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -403,7 +403,7 @@ namespace CallCenterApi.Interface.Controllers.customer
403 403
                     }
404 404
                     Input1.F_Salesman = model[i].F_Salesman;//业务员
405 405
                     Input1.F_SalesPhone = model[i].F_SalesPhone;//业务员电话
406
-                    Input1.F_CustomerNature = model[i].F_CustomerNature;//客户性质
406
+                
407 407
                     Input1.F_Channel = model[i].F_Channel;// 渠道类型:总经销、二级商、种田大户、农户、化工客户、公司员工
408 408
                     Input1.F_Credit = model[i].F_Credit;//信用等级:一星、二星、三星、四星、五星、空
409 409
                     Input1.F_Legal = model[i].F_Legal;//法人 
@@ -415,14 +415,6 @@ namespace CallCenterApi.Interface.Controllers.customer
415 415
                     Input1.F_AddressFull = model[i].F_AddressFull;//详细地址
416 416
                     Input1.F_Brands = model[i].F_Brands;// 经营品牌:心连心、手拉手、沃利沃、双心、空
417 417
                     Input1.F_Product = model[i].F_Product;//产品:复合肥心连心、复合肥手拉手、复合肥沃利沃、复合肥双心、尿素心连心、尿素手拉手、尿素沃利沃、尿素双心
418
-                    Input1.F_FrozenFlag = model[i].F_FrozenFlag;//冻结标志
419
-                    Input1.F_IsOpenAccount = model[i].F_IsOpenAccount;//是否开户:已开户、未开户
420
-                    Input1.F_LevelCode = model[i].F_LevelCode;//上级客户编码
421
-                    Input1.F_LevelName = model[i].F_LevelName;//上级客户名称
422
-                    Input1.F_MnemonicCode = model[i].F_MnemonicCode;//助记码
423
-                    Input1.F_InvoiceBank = model[i].F_InvoiceBank;//开票银行名称
424
-                    Input1.F_InvoiceBankAccount = model[i].F_InvoiceBankAccount;//开票银行账号
425
-                    Input1.F_TaxRegCode = model[i].F_TaxRegCode;//纳税人登记号
426 418
                     Input1.F_IsRunXLX = model[i].F_IsRunXLX;// 是否经营心连心:是、否
427 419
                     Input1.F_AnnualSales = model[i].F_AnnualSales;//年销量
428 420
                     Input1.F_Formula = model[i].F_Formula;//配方
@@ -461,7 +453,6 @@ namespace CallCenterApi.Interface.Controllers.customer
461 453
             model.F_Gender = input.F_Gender ;//分公司ID
462 454
             model.F_Salesman = input.F_Salesman;//业务员
463 455
             model.F_SalesPhone = input.F_SalesPhone;//业务员电话
464
-            model.F_CustomerNature = input.F_CustomerNature;//客户性质
465 456
             model.F_Channel = input.F_Channel;// 渠道类型:总经销、二级商、种田大户、农户、化工客户、公司员工
466 457
             model.F_Credit = input.F_Credit;//信用等级:一星、二星、三星、四星、五星、空
467 458
             model.F_Legal = input.F_Legal;//法人 
@@ -473,14 +464,6 @@ namespace CallCenterApi.Interface.Controllers.customer
473 464
             model.F_AddressFull = input.F_AddressFull;//详细地址
474 465
             model.F_Brands = input.F_Brands;// 经营品牌:心连心、手拉手、沃利沃、双心、空
475 466
             model.F_Product = input.F_Product;//产品:复合肥心连心、复合肥手拉手、复合肥沃利沃、复合肥双心、尿素心连心、尿素手拉手、尿素沃利沃、尿素双心
476
-            model.F_FrozenFlag = input.F_FrozenFlag;//冻结标志
477
-            model.F_IsOpenAccount = input.F_IsOpenAccount;//是否开户:已开户、未开户
478
-            model.F_LevelCode = input.F_LevelCode;//上级客户编码
479
-            model.F_LevelName = input.F_LevelName;//上级客户名称
480
-            model.F_MnemonicCode = input.F_MnemonicCode;//助记码
481
-            model.F_InvoiceBank = input.F_InvoiceBank;//开票银行名称
482
-            model.F_InvoiceBankAccount = input.F_InvoiceBankAccount;//开票银行账号
483
-            model.F_TaxRegCode = input.F_TaxRegCode;//纳税人登记号
484 467
             model.F_IsRunXLX = input.F_IsRunXLX;// 是否经营心连心:是、否
485 468
             model.F_AnnualSales = input.F_AnnualSales;//年销量
486 469
             model.F_Formula = input.F_Formula;//配方
@@ -653,80 +636,79 @@ namespace CallCenterApi.Interface.Controllers.customer
653 636
                             
654 637
                             if (dr["客户编号"].ToString() != "" && valcode(dr["客户编号"].ToString()))
655 638
                             {
656
-                                if (!getunique(0, dr["客户编号"].ToString()))
657
-                                {
658
-                                    dModel.F_CustomerCode = dr["客户编号"].ToString();
659
-                                    dModel.F_CompanyName = dr["公司名称"].ToString();
660
-                                #region
661
-                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(dr["大区名称"].ToString());
662
-                                if (pdModel!=null )
663
-                                {
664
-                                    dModel.F_AreaID = pdModel.F_DeptId.ToString();
665
-                                }
666
-                                    Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(dr["分公司名称"].ToString());
667
-                                if (pdModel1!=null )
668
-                                {
669
-                                    dModel.F_BranchID = pdModel1.F_DeptId.ToString();
670
-                                }
671
-                             
672
-                                dModel.F_Salesman = dr["业务员"].ToString();
673
-                                dModel.F_SalesPhone = dr["业务员电话"].ToString();
674
-                                dModel.F_CustomerNature = dr["客户性质"].ToString();
675
-                                dModel.F_Channel = dr["渠道类型"].ToString();
676
-                                dModel.F_Credit = dr["信用等级"].ToString();
677
-                                dModel.F_Legal = dr["客户"].ToString();
678
-                                    if (!string.IsNullOrEmpty(dr["性别"].ToString()))
639
+                               if (getunphone(0, dr["客户电话"].ToString()))
640
+                               {
641
+                                    if (!getunique(0, dr["客户编号"].ToString()))
679 642
                                     {
680
-                                        if (dr["性别"].ToString() == "女")
643
+                                        dModel.F_CustomerCode = dr["客户编号"].ToString();
644
+                                        dModel.F_CompanyName = dr["公司名称"].ToString();
645
+                                        #region
646
+                                        Model.T_Sys_Department pdModel = departmentBLL.GetModel(dr["大区名称"].ToString());
647
+                                        if (pdModel != null)
648
+                                        {
649
+                                            dModel.F_AreaID = pdModel.F_DeptId.ToString();
650
+                                        }
651
+                                        Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(dr["分公司名称"].ToString());
652
+                                        if (pdModel1 != null)
653
+                                        {
654
+                                            dModel.F_BranchID = pdModel1.F_DeptId.ToString();
655
+                                        }
656
+
657
+                                        dModel.F_Salesman = dr["业务员"].ToString();
658
+                                        dModel.F_SalesPhone = dr["业务员电话"].ToString();
659
+                                        dModel.F_Channel = dr["渠道类型"].ToString();
660
+                                        dModel.F_Credit = dr["信用等级"].ToString();
661
+                                        dModel.F_Legal = dr["客户"].ToString();
662
+                                        if (!string.IsNullOrEmpty(dr["性别"].ToString()))
663
+                                        {
664
+                                            if (dr["性别"].ToString() == "女")
665
+                                            {
666
+                                                dModel.F_Gender = "2";
667
+                                            }
668
+                                            else
669
+                                            {
670
+                                                dModel.F_Gender = "1";
671
+                                            }
672
+                                        }
673
+
674
+                                        dModel.F_LegalPhone = dr["客户电话"].ToString();
675
+                                        dModel.F_AddressProvince = dr["省"].ToString();
676
+                                        dModel.F_AddressCity = dr["市"].ToString();
677
+                                        dModel.F_AddressCountry = dr["县"].ToString();
678
+                                        dModel.F_AddressTownship = dr["乡"].ToString();
679
+                                        dModel.F_AddressFull = dr["详细地址"].ToString();
680
+                                        dModel.F_Brands = dr["经营品牌"].ToString();
681
+                                        dModel.F_Product = dr["产品"].ToString();
682
+                                        dModel.F_IsRunXLX = dr["是否经营心连心"].ToString();
683
+                                        dModel.F_AnnualSales = dr["年销量"].ToString();
684
+                                        dModel.F_Formula = dr["配方"].ToString();
685
+                                        dModel.F_RaiseCrops = dr["种植作物"].ToString();
686
+                                        dModel.F_PlantingArea = dr["种植面积"].ToString();
687
+                                        dModel.F_FertilizerBrand = dr["用肥品牌"].ToString();
688
+                                        dModel.F_Remark = dr["备注"].ToString();
689
+                                        #endregion
690
+                                        dModel.F_CreateOn = DateTime.Now;
691
+                                        var res = cusbll.Add(dModel);
692
+                                        if (res > 0)
681 693
                                         {
682
-                                            dModel.F_Gender = "2";
694
+                                            addoptlog(usercode, ip, EnumOpt.import.ToString(), res.ToString(), "导入成功,导入的文件为:" + newpath + ",当前为第" + headrow + "行");
683 695
                                         }
684 696
                                         else
685 697
                                         {
686
-                                            dModel.F_Gender = "1";
698
+
699
+                                            msg = msg + "第" + headrow + "行,导入失败<br>";
687 700
                                         }
688 701
                                     }
689
-                                   
690
-                                    dModel.F_LegalPhone = dr["客户电话"].ToString();
691
-                                dModel.F_AddressProvince = dr["省"].ToString();
692
-                                dModel.F_AddressCity = dr["市"].ToString();
693
-                                dModel.F_AddressCountry = dr["县"].ToString();
694
-                                dModel.F_AddressTownship = dr["乡"].ToString();
695
-                                dModel.F_AddressFull = dr["详细地址"].ToString();
696
-                                dModel.F_Brands = dr["经营品牌"].ToString();
697
-                                dModel.F_Product = dr["产品"].ToString();
698
-                                dModel.F_FrozenFlag = dr["冻结标志"].ToString();
699
-                                dModel.F_IsOpenAccount = dr["是否开户"].ToString();
700
-                                dModel.F_LevelCode = dr["上级客户编码"].ToString();
701
-                                dModel.F_LevelName = dr["上级客户名称"].ToString();
702
-                                dModel.F_MnemonicCode = dr["助记码"].ToString();
703
-                                dModel.F_InvoiceBank = dr["开票银行名称"].ToString();
704
-                                dModel.F_InvoiceBankAccount = dr["开票银行账号"].ToString();
705
-                                dModel.F_TaxRegCode = dr["纳税人登记号"].ToString();
706
-                                dModel.F_IsRunXLX = dr["是否经营心连心"].ToString();
707
-                                dModel.F_AnnualSales = dr["年销量"].ToString();
708
-                                dModel.F_Formula = dr["配方"].ToString();
709
-                                dModel.F_RaiseCrops = dr["种植作物"].ToString();
710
-                                dModel.F_PlantingArea = dr["种植面积"].ToString();
711
-                                dModel.F_FertilizerBrand = dr["用肥品牌"].ToString();
712
-                                dModel.F_Remark = dr["备注"].ToString();
713
-                                #endregion
714
-                                dModel.F_CreateOn = DateTime.Now;
715
-                                var res = cusbll.Add(dModel);
716
-                                if (res > 0)
717
-                                {
718
-                                    addoptlog(usercode, ip, EnumOpt.import.ToString(), res.ToString(), "导入成功,导入的文件为:" + newpath + ",当前为第" + headrow + "行");
719
-                                }
720
-                                else
721
-                                {
722
-
723
-                                    msg = msg + "第" + headrow + "行,导入失败<br>";
724
-                                }
702
+                                    else
703
+                                    {
704
+                                        msg = msg + "第" + headrow + "行,客户编号重复,未导入<br>";
705
+                                    }
725 706
                                 }
726 707
                                 else
727 708
                                 {
728
-                                    msg = msg + "第" + headrow + "行,客户编号重复,未导入<br>";
709
+                                    msg = msg + "第" + headrow + "行,客户电话重复,未导入<br>";
729 710
                                 }
711
+                                
730 712
                             }
731 713
                             else
732 714
                                 msg = msg + "第" + headrow + "行,客户编号为空或格式不正确,未导入<br>";

+ 4 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/RegionCategoryController.cs

@@ -352,7 +352,10 @@ namespace CallCenterApi.Interface.Controllers.customer
352 352
                     string currentID = tab[i].F_RegionId.ToString();//当前功能ID
353 353
                     model.id = currentID;
354 354
                     model.IconCls = "";//图标
355
-                    model.headerid = int.Parse(tab[i].F_Layer.ToString());
355
+                    if (tab[i].F_Layer!=null )
356
+                    {
357
+                        model.headerid = int.Parse(tab[i].F_Layer.ToString());
358
+                    }
356 359
                     model.text = tab[i].F_RegionName;
357 360
                     var tab2 = list.Where(x => x.F_ParentId == F_RegionId).OrderByDescending(x=>x.F_Sort).ToList();
358 361
                     if (tab2.Count > 0)

+ 206 - 94
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

@@ -73,6 +73,7 @@ namespace CallCenterApi.Interface.Controllers.report
73 73
                 sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerID(channel) + ") "; ;
74 74
             }
75 75
             sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
76
+            sql += " order by F_CreateOn desc";
76 77
             var depts = new BLL.T_Wo_WorkOrder().GetModelList(sql);
77 78
             #endregion
78 79
             dt.Columns.Add("创建时间");
@@ -91,27 +92,31 @@ namespace CallCenterApi.Interface.Controllers.report
91 92
             foreach (var it in depts)
92 93
             {
93 94
                 DataRow drNew = dt.NewRow();
94
-                if (!valcode(it.F_CustomerID.ToString(), 10))//验证客户编码为10位纯数字
95
-                {
96
-                    Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
97
-                    if (cuModel != null)
95
+                if (!string .IsNullOrEmpty (it.F_CustomerID))
96
+               {
97
+                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
98 98
                     {
99
-                        Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
100
-                        if (pdModel != null)
101
-                        {
102
-                            drNew["大区名称"] = pdModel.F_DeptName;
103
-                        }
104
-                        Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
105
-                        if (pdModel1 != null)
99
+                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
100
+                        if (cuModel != null)
106 101
                         {
107
-                            drNew["分公司名称"] = pdModel1.F_DeptName;
108
-                        }
109
-                        drNew["业务员"] = cuModel.F_Salesman;
110
-                        drNew["品牌"] = cuModel.F_Brands;
111
-                        drNew["渠道类型"] = cuModel.F_Channel;
102
+                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
103
+                            if (pdModel != null)
104
+                            {
105
+                                drNew["大区名称"] = pdModel.F_DeptName;
106
+                            }
107
+                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
108
+                            if (pdModel1 != null)
109
+                            {
110
+                                drNew["分公司名称"] = pdModel1.F_DeptName;
111
+                            }
112
+                            drNew["业务员"] = cuModel.F_Salesman;
113
+                            drNew["品牌"] = cuModel.F_Brands;
114
+                            drNew["渠道类型"] = cuModel.F_Channel;
112 115
 
116
+                        }
113 117
                     }
114 118
                 }
119
+               
115 120
                 drNew["产品"] = it.F_TS_Category;
116 121
                 if (it.F_Type == "1")
117 122
                 {
@@ -161,7 +166,7 @@ namespace CallCenterApi.Interface.Controllers.report
161 166
         /// 集团市场问题反馈汇总表
162 167
         /// </summary>
163 168
         /// <returns></returns>
164
-        public ActionResult GetQuestionList(string stime, string endtime, string salesBase, string channel, int type = 0, int pageindex = 1, int pagesize = 10)
169
+        public ActionResult GetQuestionList(string stime, string endtime, string salesBase, string channel, int type = 0, int page = 1, int limit = 10)
165 170
         {
166 171
             string sql = $" and F_IsDelete=0";
167 172
             DataTable dt = new DataTable();
@@ -194,8 +199,8 @@ namespace CallCenterApi.Interface.Controllers.report
194 199
                     "*",
195 200
                     sql,
196 201
                     "ORDER BY T_Wo_WorkOrder.F_ID desc",
197
-                    pagesize,
198
-                    pageindex,
202
+                    limit,
203
+                    page,
199 204
                     true,
200 205
                     out recordCount);
201 206
             }
@@ -247,8 +252,9 @@ namespace CallCenterApi.Interface.Controllers.report
247 252
             {
248 253
                 sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerID(channel) + ") "; ;
249 254
             }
250
-            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( " + GetComplaint("'化肥产品质量问题反馈','化肥服务质量问题反馈','化肥农作物长势问题反馈'") + ") "; ;
255
+            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( '" + GetComplaint("'化肥产品质量问题反馈','化肥服务质量问题反馈','化肥农作物长势问题反馈'") + "') "; ;
251 256
             sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
257
+            sql += " order by F_CreateOn desc";
252 258
             #endregion
253 259
             var depts = new BLL.T_Wo_WorkOrder().GetModelList(sql);
254 260
 
@@ -305,46 +311,65 @@ namespace CallCenterApi.Interface.Controllers.report
305 311
             foreach (var it in depts)
306 312
             {
307 313
                 DataRow drNew = dt.NewRow();
308
-                if (!valcode(it.F_CustomerID.ToString(), 10))//验证客户编码为10位纯数字
314
+                if (!string .IsNullOrEmpty (it.F_CustomerID))
309 315
                 {
310
-                    drNew["客户编号"] = it.F_CustomerID;//
311
-                    Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
312
-                    if (cuModel != null)
316
+                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
313 317
                     {
314
-                        Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
315
-                        if (pdModel != null)
316
-                        {
317
-                            drNew["大区名称"] = pdModel.F_DeptName;//
318
-                        }
319
-                        Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
320
-                        if (pdModel1 != null)
318
+                        drNew["客户编号"] = it.F_CustomerID;//
319
+                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
320
+                        if (cuModel != null)
321 321
                         {
322
-                            drNew["分公司名称"] = pdModel1.F_DeptName;//分公司名称
322
+                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
323
+                            if (pdModel != null)
324
+                            {
325
+                                drNew["大区名称"] = pdModel.F_DeptName;//
326
+                            }
327
+                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
328
+                            if (pdModel1 != null)
329
+                            {
330
+                                drNew["分公司名称"] = pdModel1.F_DeptName;//分公司名称
331
+                            }
332
+                            drNew["业务员"] = cuModel.F_Salesman;//业务员
323 333
                         }
324
-                        drNew["业务员"] = cuModel.F_Salesman;//业务员
325 334
                     }
335
+
326 336
                 }
327
-                if (!valcode(it.F_MaterialID.ToString(), 11))
337
+                if (!string .IsNullOrEmpty (it.F_MaterialID))
328 338
                 {
329
-                    drNew["物料编码"] = int.Parse(it.F_MaterialID);//验证物料编码为11位纯数字
330
-                    Model.T_Wo_MaterialManage maModel = mmBLL.GetModel(it.F_MaterialID.ToString());//通过物料编码获取物料信息
331
-                    if (maModel != null)
339
+                    if (valcode(it.F_MaterialID.ToString(), 11))
332 340
                     {
333
-                        drNew["物料名称"] = maModel.F_MaterialName;//物料名称
334
-                        drNew["型号"] = maModel.F_Model;//型号
335
-                        drNew["规格"] = maModel.F_Specs;//规格
336
-                        drNew["一级分类"] = maModel.F_Level1;//一级分类
337
-                        drNew["二级分类"] = maModel.F_Level2;//二级分类
338
-                        drNew["三级分类"] = maModel.F_Level3;//三级分类
339
-                        drNew["品牌"] = maModel.F_Brand;//品牌
340
-                        drNew["复合肥肥效"] = maModel.F_MaterialEffect;//F_MaterialEffect
341
-                        drNew["产品线"] = maModel.F_Pipeline;//F_Pipeline
342
-                        drNew["工艺"] = maModel.F_Craft;//F_Craft
341
+                        drNew["物料编码"] = int.Parse(it.F_MaterialID);//验证物料编码为11位纯数字
342
+                        Model.T_Wo_MaterialManage maModel = mmBLL.GetModel(it.F_MaterialID.ToString());//通过物料编码获取物料信息
343
+                        if (maModel != null)
344
+                        {
345
+                            drNew["物料名称"] = maModel.F_MaterialName;//物料名称
346
+                            drNew["型号"] = maModel.F_Model;//型号
347
+                            drNew["规格"] = maModel.F_Specs;//规格
348
+                            drNew["一级分类"] = maModel.F_Level1;//一级分类
349
+                            drNew["二级分类"] = maModel.F_Level2;//二级分类
350
+                            drNew["三级分类"] = maModel.F_Level3;//三级分类
351
+                            drNew["品牌"] = maModel.F_Brand;//品牌
352
+                            drNew["复合肥肥效"] = maModel.F_MaterialEffect;//F_MaterialEffect
353
+                            drNew["产品线"] = maModel.F_Pipeline;//F_Pipeline
354
+                            drNew["工艺"] = maModel.F_Craft;//F_Craft
355
+                        }
343 356
                     }
344 357
                 }
358
+               
345 359
                 if (!string.IsNullOrEmpty(it.F_QuestionType))
346 360
                 {
347
-                    Model.T_Wo_QuestionManage Manage = quesBLL.GetModel(it.F_QuestionType);//获取问题类别
361
+                    Model.T_Wo_QuestionManage Manage = null;
362
+                    try
363
+                    {
364
+                        int b = int.Parse(it.F_QuestionType.Trim());
365
+                        Manage = quesBLL.GetModel(b);
366
+
367
+
368
+                    }
369
+                    catch (Exception)
370
+                    {
371
+                        Manage = quesBLL.GetModel(it.F_QuestionType); //问题类别(投诉抽捡和咨询类别不一样)
372
+                    }
348 373
                     if (Manage != null)
349 374
                     {
350 375
                         if (Manage.F_Label == "1")
@@ -426,14 +451,27 @@ namespace CallCenterApi.Interface.Controllers.report
426 451
             string str = "";
427 452
             string str1 = " select F_Id from T_Wo_QuestionManage where F_QuestionName in(" + msg + ")";
428 453
             string str3 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str1 + ")";
429
-            string str4 = " select F_QuestionName from T_Wo_QuestionManage where F_ParentId in(" + str3 + ")";
430
-            return str4;
454
+            var dept = quesBLL .GetModelList("F_ParentId in(" + str3+")");
455
+            if (dept != null)
456
+            {
457
+                foreach (var it in dept)
458
+                {
459
+                    
460
+                        if (str != "")
461
+                        str += "','" + it.F_Id ;
462
+                        else
463
+                        str += it.F_Id;
464
+                   
465
+                }
466
+            }
467
+          //  string str4 = " select F_Id from T_Wo_QuestionManage where F_ParentId in(" + str3 + ")";
468
+            return str;
431 469
         }
432 470
         /// <summary>
433 471
         /// 化肥产品投诉明细表
434 472
         /// </summary>
435 473
         /// <returns></returns>
436
-        public ActionResult GetComplaintList(string stime, string endtime, string salesBase, string channel, int pageindex = 1, int pagesize = 10)
474
+        public ActionResult GetComplaintList(string stime, string endtime, string salesBase, string channel, int page = 1, int limit = 10)
437 475
         {
438 476
             string sql = $" and F_IsDelete=0";
439 477
             DataTable dt = new DataTable();
@@ -453,7 +491,7 @@ namespace CallCenterApi.Interface.Controllers.report
453 491
             {
454 492
                 sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerID(channel) + ") "; ;
455 493
             }
456
-            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( " + GetComplaint("'化肥产品质量问题反馈','化肥服务质量问题反馈','化肥农作物长势问题反馈'") + ") "; ;
494
+            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( '" + GetComplaint("'化肥产品质量问题反馈','化肥服务质量问题反馈','化肥农作物长势问题反馈'") + "') "; ;
457 495
             sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
458 496
             #endregion
459 497
             int recordCount = 0;
@@ -466,8 +504,8 @@ namespace CallCenterApi.Interface.Controllers.report
466 504
                     "*",
467 505
                     sql,
468 506
                     "ORDER BY T_Wo_WorkOrder.F_ID desc",
469
-                    pagesize,
470
-                    pageindex,
507
+                     limit,
508
+                    page,
471 509
                     true,
472 510
                     out recordCount);
473 511
             }
@@ -521,6 +559,7 @@ namespace CallCenterApi.Interface.Controllers.report
521 559
             }
522 560
 
523 561
             sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
562
+            sql += " order by F_CreateOn desc";
524 563
             var depts = new BLL.T_Wo_WorkOrder().GetModelList(sql);
525 564
             #endregion
526 565
             dt.Columns.Add("创建时间");
@@ -538,27 +577,41 @@ namespace CallCenterApi.Interface.Controllers.report
538 577
             foreach (var it in depts)
539 578
             {
540 579
                 DataRow drNew = dt.NewRow();
541
-                if (!valcode(it.F_CustomerID.ToString(), 10))//验证客户编码为10位纯数字
580
+                if (!string .IsNullOrEmpty (it.F_CustomerID))
542 581
                 {
543
-                    Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
544
-                    if (cuModel != null)
582
+                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
545 583
                     {
546
-                        Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
547
-                        if (pdModel != null)
548
-                        {
549
-                            drNew["大区名称"] = pdModel.F_DeptName;//大区名称
550
-                        }
551
-                        Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
552
-                        if (pdModel1 != null)
584
+                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
585
+                        if (cuModel != null)
553 586
                         {
554
-                            drNew["分公司名称"] = pdModel1.F_DeptName;//大区名称
587
+                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
588
+                            if (pdModel != null)
589
+                            {
590
+                                drNew["大区名称"] = pdModel.F_DeptName;//大区名称
591
+                            }
592
+                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
593
+                            if (pdModel1 != null)
594
+                            {
595
+                                drNew["分公司名称"] = pdModel1.F_DeptName;//大区名称
596
+                            }
597
+                            drNew["品牌"] = cuModel.F_Brands;//品牌
555 598
                         }
556
-                        drNew["品牌"] = cuModel.F_Brands;//品牌
557 599
                     }
558 600
                 }
559 601
                 if (!string.IsNullOrEmpty(it.F_QuestionType))
560 602
                 {
561
-                    Model.T_Wo_QuestionManage Manage = quesBLL.GetModel(it.F_QuestionType);//获取问题类别
603
+                    Model.T_Wo_QuestionManage Manage = null ;
604
+                    try
605
+                    {
606
+                        int b = int.Parse(it.F_QuestionType.Trim());
607
+                        Manage = quesBLL.GetModel(b);
608
+                      
609
+
610
+                    }
611
+                    catch (Exception)
612
+                    {
613
+                        Manage = quesBLL.GetModel(it.F_QuestionType); //问题类别(投诉抽捡和咨询类别不一样)
614
+                    }
562 615
                     if (Manage != null)
563 616
                     {
564 617
                         if (Manage.F_Label == "1")
@@ -608,7 +661,7 @@ namespace CallCenterApi.Interface.Controllers.report
608 661
         /// 市场投诉处理时效明细表
609 662
         /// </summary>
610 663
         /// <returns></returns>
611
-        public ActionResult GetPrescriptionList(string stime, string endtime, string salesBase, string channel, int pageindex = 1, int pagesize = 10)
664
+        public ActionResult GetPrescriptionList(string stime, string endtime, string salesBase, string channel, int page = 1, int limit = 10)
612 665
         {
613 666
             string sql = $" and F_IsDelete=0";
614 667
             DataTable dt = new DataTable();
@@ -640,8 +693,8 @@ namespace CallCenterApi.Interface.Controllers.report
640 693
                     "*",
641 694
                     sql,
642 695
                     "ORDER BY T_Wo_WorkOrder.F_ID desc",
643
-                    pagesize,
644
-                    pageindex,
696
+                    limit,
697
+                    page,
645 698
                     true,
646 699
                     out recordCount);
647 700
             }
@@ -693,8 +746,9 @@ namespace CallCenterApi.Interface.Controllers.report
693 746
             {
694 747
                 sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerID(channel) + ") "; ;
695 748
             }
696
-            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( " + GetComplaint("'化工产品质量问题反馈','化工服务质量问题反馈'") + ") "; ;
749
+            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( '" + GetComplaint("'化工产品质量问题反馈','化工服务质量问题反馈'") + "') "; ;
697 750
             sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
751
+            sql += " order by F_CreateOn desc";
698 752
             var depts = new BLL.T_Wo_WorkOrder().GetModelList(sql);
699 753
             #endregion
700 754
             dt.Columns.Add("化工产品名称");
@@ -711,17 +765,21 @@ namespace CallCenterApi.Interface.Controllers.report
711 765
             foreach (var it in depts)
712 766
             {
713 767
                 DataRow drNew = dt.NewRow();
714
-                if (!valcode(it.F_CustomerID.ToString(), 10))//验证客户编码为10位纯数字
768
+                if (!string .IsNullOrEmpty (it.F_CustomerID))
715 769
                 {
716
-
717
-                    Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
718
-                    if (cuModel != null)
770
+                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
719 771
                     {
720
-                        Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
721 772
 
722
-                        drNew["业务员"] = cuModel.F_Salesman;//业务员
773
+                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
774
+                        if (cuModel != null)
775
+                        {
776
+                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
777
+
778
+                            drNew["业务员"] = cuModel.F_Salesman;//业务员
779
+                        }
723 780
                     }
724 781
                 }
782
+                
725 783
                 drNew["化工产品名称"] = it.F_TS_Category;//产品
726 784
                 drNew["客户单位"] = it.F_CompanyName;//客户单位
727 785
                 if (!string.IsNullOrEmpty(it.F_BatchNumber))
@@ -741,7 +799,24 @@ namespace CallCenterApi.Interface.Controllers.report
741 799
                 }
742 800
                 drNew["反馈日期"] = it.F_CreateOn.ToString(); ;
743 801
                 drNew["喷码"] = it.F_BatchNumber;
744
-                drNew["问题分类"] = it.F_QuestionType;
802
+                Model.T_Wo_QuestionManage Manage = null;
803
+                try
804
+                {
805
+                    int b = int.Parse(it.F_QuestionType.Trim());
806
+                    Manage = quesBLL.GetModel(b);
807
+                    if (Manage!=null )
808
+                    {
809
+                        drNew["问题分类"] = Manage.F_QuestionName ;
810
+                    }
811
+                   
812
+
813
+
814
+                }
815
+                catch (Exception)
816
+                {
817
+                    drNew["问题分类"] = it.F_QuestionType;
818
+                }
819
+              
745 820
                 drNew["问题描述"] = it.F_Description;
746 821
                 drNew["处理方法"] = it.F_DealType;
747 822
                 drNew["责任部门"] = it.F_ZL_CResponsibleUnits;
@@ -764,7 +839,7 @@ namespace CallCenterApi.Interface.Controllers.report
764 839
         /// 化工产品市场投诉汇总表
765 840
         /// </summary>
766 841
         /// <returns></returns>
767
-        public ActionResult GetChemicalList(string stime, string endtime, string salesBase, string channel, int pageindex = 1, int pagesize = 10)
842
+        public ActionResult GetChemicalList(string stime, string endtime, string salesBase, string channel, int page = 1, int limit = 10)
768 843
         {
769 844
             string sql = $" and F_IsDelete=0";
770 845
             DataTable dt = new DataTable();
@@ -784,7 +859,7 @@ namespace CallCenterApi.Interface.Controllers.report
784 859
             {
785 860
                 sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerID(channel) + ") "; ;
786 861
             }
787
-            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( " + GetComplaint("'化工产品质量问题反馈','化工服务质量问题反馈'") + ") "; ;
862
+            sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( '" + GetComplaint("'化工产品质量问题反馈','化工服务质量问题反馈'") + "') "; ;
788 863
             sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
789 864
             #endregion
790 865
             int recordCount = 0;
@@ -797,8 +872,8 @@ namespace CallCenterApi.Interface.Controllers.report
797 872
                     "*",
798 873
                     sql,
799 874
                     "ORDER BY T_Wo_WorkOrder.F_ID desc",
800
-                    pagesize,
801
-                    pageindex,
875
+                    limit,
876
+                    page,
802 877
                     true,
803 878
                     out recordCount);
804 879
             }
@@ -1013,7 +1088,7 @@ namespace CallCenterApi.Interface.Controllers.report
1013 1088
             {
1014 1089
                 Complainthandling model = new Complainthandling();
1015 1090
                 model.name = categorylist[i].F_QuestionName;
1016
-                string strnumber = " select  F_QuestionType,count(F_QuestionType) number from T_Wo_WorkOrder where" + sql+"and F_QuestionType= '" + categorylist[i].F_QuestionName +"'" +
1091
+                string strnumber = " select  F_QuestionType,count(F_QuestionType) number from T_Wo_WorkOrder where" + sql+"and F_QuestionType= '" + categorylist[i].F_Id  +"'" +
1017 1092
                     "group by F_QuestionType order by count(F_QuestionType) desc";
1018 1093
                 DataTable QuestionType = DbHelperSQL.Query(strnumber).Tables[0];
1019 1094
                 List<QuestionType> QuestionTypelists = DataTableToList(QuestionType);
@@ -1025,7 +1100,7 @@ namespace CallCenterApi.Interface.Controllers.report
1025 1100
                 {
1026 1101
                     model.number = 0;
1027 1102
                 }
1028
-                string msg = "select F_QuestionType,datediff(HH ,F_CreateOn,F_DealTime) number from T_Wo_WorkOrder where " + sql + time + "and F_QuestionType  =" + "'" + categorylist[i].F_QuestionName + "'" + "ORDER BY number ";
1103
+                string msg = "select F_QuestionType,datediff(HH ,F_CreateOn,F_DealTime) number from T_Wo_WorkOrder where " + sql + time + "and F_QuestionType  =" + "'" + categorylist[i].F_Id  + "'" + "ORDER BY number ";
1029 1104
                 DataTable dtxy = DbHelperSQL.Query(msg).Tables[0];
1030 1105
                 List<QuestionType> QuestionTypes = DataTableToList(dtxy);
1031 1106
                 float average = 0;
@@ -1063,7 +1138,7 @@ namespace CallCenterApi.Interface.Controllers.report
1063 1138
                 }
1064 1139
                 model.averageTime = string.Format("{0:f2}", ave);
1065 1140
                 string Over = "select  F_QuestionType,count(F_IsOver) number from T_Wo_WorkOrder where  " + sql +
1066
-                    "and F_QuestionType  ='" + categorylist[i].F_QuestionName + "'" + time + "group by F_QuestionType order by count(F_IsOver) desc";
1141
+                    "and F_QuestionType  ='" + categorylist[i].F_Id  + "'" + time + "group by F_QuestionType order by count(F_IsOver) desc";
1067 1142
                 DataTable Overdtxy = DbHelperSQL.Query(Over).Tables[0];
1068 1143
                 List<QuestionType> Overdue = DataTableToList(Overdtxy);
1069 1144
                 if (Overdue.Count >0)
@@ -1100,7 +1175,7 @@ namespace CallCenterApi.Interface.Controllers.report
1100 1175
                 string times = "";
1101 1176
                 times += " and CONVERT(varchar , F_CreateOn, 120)>=CONVERT(varchar , '" + time1.Trim() + " 00:00:01', 120) ";
1102 1177
                 times += " and CONVERT(varchar , F_CreateOn, 120)<=CONVERT(varchar , '" + time2.Trim() + " 23:59:59', 120) ";
1103
-                string msgs = "select F_QuestionType,datediff(HH ,F_CreateOn,F_DealTime) number from T_Wo_WorkOrder where " + sql + times + "and F_QuestionType  =" + "'" + categorylist[i].F_QuestionName + "'" + "ORDER BY number ";
1178
+                string msgs = "select F_QuestionType,datediff(HH ,F_CreateOn,F_DealTime) number from T_Wo_WorkOrder where " + sql + times + "and F_QuestionType  =" + "'" + categorylist[i].F_Id  + "'" + "ORDER BY number ";
1104 1179
                 DataTable dtxys = DbHelperSQL.Query(msgs).Tables[0];
1105 1180
                 List<QuestionType> Questionmonth = DataTableToList(dtxys);
1106 1181
                 float efficien = 0;
@@ -1258,7 +1333,7 @@ namespace CallCenterApi.Interface.Controllers.report
1258 1333
                     Prescription model = new Prescription();
1259 1334
                     if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
1260 1335
                     {
1261
-                        if (!valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1336
+                        if (valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1262 1337
                         {
1263 1338
                             Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
1264 1339
                             if (cuModel != null)
@@ -1280,7 +1355,18 @@ namespace CallCenterApi.Interface.Controllers.report
1280 1355
                    
1281 1356
                     if (!string.IsNullOrEmpty(model1[i].F_QuestionType))
1282 1357
                     {
1283
-                        Model.T_Wo_QuestionManage Manage = quesBLL.GetModel(model1[i].F_QuestionType);//获取问题类别
1358
+                        Model.T_Wo_QuestionManage Manage = null;
1359
+                        try
1360
+                        {
1361
+                            int b = int.Parse(model1[i].F_QuestionType.Trim());
1362
+                            Manage = quesBLL.GetModel(b);
1363
+
1364
+
1365
+                        }
1366
+                        catch (Exception)
1367
+                        {
1368
+                            Manage = quesBLL.GetModel(model1[i].F_QuestionType); //问题类别(投诉抽捡和咨询类别不一样)
1369
+                        }
1284 1370
                         if (Manage != null)
1285 1371
                         {
1286 1372
                             if (Manage.F_Label == "1")
@@ -1338,7 +1424,7 @@ namespace CallCenterApi.Interface.Controllers.report
1338 1424
                     Questions model = new Questions();
1339 1425
                     if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
1340 1426
                     {
1341
-                        if (!valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1427
+                        if (valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1342 1428
                         {
1343 1429
                             Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
1344 1430
                             if (cuModel != null)
@@ -1413,7 +1499,7 @@ namespace CallCenterApi.Interface.Controllers.report
1413 1499
                     WorkOrderComplaint model = new WorkOrderComplaint();
1414 1500
                     if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
1415 1501
                     {
1416
-                        if (!valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1502
+                        if (valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1417 1503
                         {
1418 1504
                             model.F_CustomerID = model1[i].F_CustomerID;//客户编码
1419 1505
                             Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
@@ -1435,7 +1521,7 @@ namespace CallCenterApi.Interface.Controllers.report
1435 1521
                     }
1436 1522
                     if (!string .IsNullOrEmpty (model1[i].F_MaterialID))
1437 1523
                     {
1438
-                        if (!valcode(model1[i].F_MaterialID, 11))
1524
+                        if (valcode(model1[i].F_MaterialID, 11))
1439 1525
                         {
1440 1526
                             model.F_MaterialID = int.Parse(model1[i].F_MaterialID);//验证物料编码为11位纯数字
1441 1527
                             Model.T_Wo_MaterialManage maModel = mmBLL.GetModel(model1[i].F_MaterialID);//通过物料编码获取物料信息
@@ -1456,7 +1542,18 @@ namespace CallCenterApi.Interface.Controllers.report
1456 1542
                     }
1457 1543
                     if (!string .IsNullOrEmpty(model1[i].F_QuestionType))
1458 1544
                     {
1459
-                        Model.T_Wo_QuestionManage Manage = quesBLL.GetModel(model1[i].F_QuestionType);//获取问题类别
1545
+                        Model.T_Wo_QuestionManage Manage = null;
1546
+                        try
1547
+                        {
1548
+                            int b = int.Parse(model1[i].F_QuestionType.Trim());
1549
+                            Manage = quesBLL.GetModel(b);
1550
+
1551
+
1552
+                        }
1553
+                        catch (Exception)
1554
+                        {
1555
+                            Manage = quesBLL.GetModel(model1[i].F_QuestionType); //问题类别(投诉抽捡和咨询类别不一样)
1556
+                        }
1460 1557
                         if (Manage !=null )
1461 1558
                         {
1462 1559
                             if (Manage .F_Label =="1")
@@ -1537,7 +1634,7 @@ namespace CallCenterApi.Interface.Controllers.report
1537 1634
                     Product model = new Product();
1538 1635
                     if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
1539 1636
                     {
1540
-                        if (!valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1637
+                        if (valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
1541 1638
                         {
1542 1639
 
1543 1640
                             Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
@@ -1569,7 +1666,22 @@ namespace CallCenterApi.Interface.Controllers.report
1569 1666
                     }
1570 1667
                     model.CreatOn = model1[i].F_CreateOn .ToString (); ;
1571 1668
                     model.Spurtcode = model1[i].F_BatchNumber;
1572
-                    model.QuestionType = model1[i].F_QuestionType;
1669
+                    Model.T_Wo_QuestionManage Manage = null;
1670
+                    try
1671
+                    {
1672
+                        int b = int.Parse(model1[i].F_QuestionType.Trim());
1673
+                        Manage = quesBLL.GetModel(b);
1674
+                        if (Manage !=null )
1675
+                        {
1676
+                            model.QuestionType = Manage.F_QuestionName;
1677
+                        }
1678
+
1679
+                    }
1680
+                    catch (Exception)
1681
+                    {
1682
+                        model.QuestionType = model1[i].F_QuestionType;
1683
+                    }
1684
+                 
1573 1685
                     model.Description = model1[i].F_Description;
1574 1686
                     model.DealType = model1[i].F_DealType;
1575 1687
                     model.CResponsibleUnits = model1[i].F_ZL_CResponsibleUnits;

+ 93 - 51
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -31,7 +31,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
31 31
         private readonly BLL.T_Sys_RoleInfo rolebll = new BLL.T_Sys_RoleInfo();
32 32
         private readonly BLL.T_Sys_DictionaryValue dicvalueBll = new BLL.T_Sys_DictionaryValue();
33 33
         private readonly BLL.T_Wo_MaterialManage mmBLL = new BLL.T_Wo_MaterialManage();
34
-      
34
+        BLL.T_Wo_QuestionManage quesBLL = new BLL.T_Wo_QuestionManage();
35
+
35 36
         ///// <summary>
36 37
         ///// 绑定微信号
37 38
         ///// </summary>
@@ -72,8 +73,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
72 73
                 customerBaseBLL.Update(modelcustomer);
73 74
             }
74 75
             #endregion
75
-            if (login.UserType == 1)
76
-            {
76
+          
77 77
                 Dictionary<string, string> paras = new Dictionary<string, string>();
78 78
                 string sql = " select * from T_Sys_UserAccount (NOLOCK) where F_UserCode=@F_UserCode and F_PassWord=@F_PassWord and F_DeleteFlag = 0 ";
79 79
                 paras.Add("@F_UserCode", login.UserCode);
@@ -100,9 +100,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
100 100
                         //部门角色(-1管理员,1接待部,2案场经理、项目负责人,3销售部总经理、物业部总经理、工程总经理、设计总经理,4区域客服,5业主(客户档案))
101 101
                     if (user.F_RoleId == 17 )
102 102
                     {
103
-                        //-1管理员
104
-                        UserType = -1;
105
-                    }
103
+                    //-1管理员
104
+                    return Error("无操作权限");
105
+                }
106 106
                     else
107 107
                     {
108 108
                         if ( user.F_RoleId == 60 || user.F_RoleId == 62)
@@ -123,8 +123,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
123 123
                         }
124 124
                         else
125 125
                         {
126
-                            UserType = 1;
127
-                        }
126
+                        return Error("无操作权限");
127
+                    }
128 128
                        
129 129
                         #region
130 130
                         ////部门操作权限:1接待部,2办理人员,3区域客服,4监管
@@ -169,7 +169,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
169 169
                         return Error("绑定失败");
170 170
                 }
171 171
                 return Error("账号或密码错误,请重新登录");
172
-            }
172
+            
173 173
             //else if (login.UserType == 5)
174 174
             //{
175 175
             //    //客户档案登录 - 用戶信息不存在时,登录客户档案业主账号
@@ -515,7 +515,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
515 515
 
516 516
             str = "select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType in(" + (int)EnumItemType.deal+"," + (int)EnumItemType.audit + ")"
517 517
                 + " and "
518
-                    + "F_OptType in(" + (int)EnumItemOpt.create + "," + (int)EnumItemOpt.abreback + "," + (int)EnumItemOpt.reback + ") and F_NextUser='" + ua.F_UserCode  + "'"
518
+                    + "F_OptType in("  + (int)EnumItemOpt.abreback + "," + (int)EnumItemOpt.reback + ") and F_NextUser='" + ua.F_UserCode  + "'"
519 519
                 + ""
520 520
                 + " and isnull(F_IsUsed,'0')='0' ";
521 521
 
@@ -1193,7 +1193,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1193 1193
                     else if (AuditState == 1)
1194 1194
                     {
1195 1195
                         opt = "驳回修订";
1196
-                        var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.create, toussers, 0, nowUser, overtime, sms);
1196
+                        var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.reback, toussers, 0, nowUser, overtime, sms);
1197 1197
                         if (userid <= 0)
1198 1198
                             res = false;
1199 1199
                     }
@@ -1224,7 +1224,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1224 1224
                         else if (AuditState == 1)
1225 1225
                         {
1226 1226
                             opt = "驳回修订";
1227
-                            var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.create, toussers, 0, nowUser, overtime, sms);
1227
+                            var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.reback, toussers, 0, nowUser, overtime, sms);
1228 1228
                             if (userid <= 0)
1229 1229
                                 res = false;
1230 1230
                             wostate = 16;
@@ -1568,46 +1568,51 @@ namespace CallCenterApi.Interface.Controllers.weixin
1568 1568
                 for (int i = 0; i < model1.Count; i++)
1569 1569
                 {
1570 1570
                     WorkOrderNewInput model = new WorkOrderNewInput();
1571
-                    if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
1571
+                    if (!string.IsNullOrEmpty(model1[i].F_CustomerID))
1572 1572
                     {
1573
-                        if (!valcode(model1[i].F_CustomerID.ToString(), 10))//验证客户编码为10位纯数字
1573
+                       // var sql = "and  F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'";
1574
+                        //var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
1575
+                        Model.T_Cus_CustomerBaseNew cuModel = customerBaseBLL .GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
1576
+                        if (cuModel != null)
1574 1577
                         {
1575
-                            model.F_CustomerID = model1[i].F_CustomerID;//客户编码
1576
-                            Model.T_Cus_CustomerBaseNew cuModel = customerBaseBLL.GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
1577
-                            if (cuModel != null)
1578
+                            if (!string.IsNullOrEmpty(cuModel.F_AreaID))
1578 1579
                             {
1579
-                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1580
+                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
1580 1581
                                 if (pdModel != null)
1581 1582
                                 {
1582 1583
                                     model.F_AreaName = pdModel.F_DeptName;
1583 1584
                                 }
1584
-                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
1585
+                            }
1586
+                            if (!string.IsNullOrEmpty(cuModel.F_BranchID))
1587
+                            {
1588
+                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
1585 1589
                                 if (pdModel1 != null)
1586 1590
                                 {
1587 1591
                                     model.F_BranchName = pdModel1.F_DeptName;
1588 1592
                                 }
1589
-                                model.F_Salesman = cuModel.F_Salesman;
1590
-                                model.F_SalesPhone = cuModel.F_SalesPhone;
1591
-                                model.F_Legal = cuModel.F_Legal;
1592
-                                model.F_LegalPhone = cuModel.F_LegalPhone;
1593
-                                model.F_AddressProvince = cuModel.F_AddressProvince;
1594
-                                model.F_AddressCity = cuModel.F_AddressCity;
1595
-                                model.F_AddressCountry = cuModel.F_AddressCountry;
1596
-                                model.F_AddressTownship = cuModel.F_AddressTownship;
1597
-                                model.F_AddressFull = cuModel.F_AddressFull;
1598
-                                model.F_Brands = cuModel.F_Brands;
1599
-                                model.F_Channel = cuModel.F_Channel;
1600
-                                model.F_IsRunXLX = cuModel.F_IsRunXLX;
1601
-                                model.F_AnnualSales = cuModel.F_AnnualSales;
1602
-                                model.F_Formula = cuModel.F_Formula;
1603
-                                model.F_RaiseCrops = cuModel.F_RaiseCrops;
1604
-                                model.F_PlantingArea = cuModel.F_PlantingArea;
1605
-                                model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
1606 1593
                             }
1594
+                            model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
1595
+                            model.F_Salesman = cuModel.F_Salesman;
1596
+                            model.F_SalesPhone = cuModel.F_SalesPhone;
1597
+                            model.F_Legal = cuModel.F_Legal;
1598
+                            model.F_LegalPhone = cuModel.F_LegalPhone;
1599
+                            model.F_AddressProvince = cuModel.F_AddressProvince;
1600
+                            model.F_AddressCity = cuModel.F_AddressCity;
1601
+                            model.F_AddressCountry = cuModel.F_AddressCountry;
1602
+                            model.F_AddressTownship = cuModel.F_AddressTownship;
1603
+                            model.F_AddressFull = cuModel.F_AddressFull;
1604
+                            model.F_Brands = cuModel.F_Brands;
1605
+                            model.F_Channel = cuModel.F_Channel;
1606
+                            model.F_IsRunXLX = cuModel.F_IsRunXLX;
1607
+                            model.F_AnnualSales = cuModel.F_AnnualSales;
1608
+                            model.F_Formula = cuModel.F_Formula;
1609
+                            model.F_RaiseCrops = cuModel.F_RaiseCrops;
1610
+                            model.F_PlantingArea = cuModel.F_PlantingArea;
1611
+                            model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
1607 1612
                         }
1608 1613
                     }
1609
-                   
1610
-                    if (!valcode(model1[i].F_MaterialID.ToString(), 11))
1614
+
1615
+                    if (valcode(model1[i].F_MaterialID.ToString(), 11))
1611 1616
                     {
1612 1617
                         model.F_MaterialID =model1[i].F_MaterialID;//验证物料编码为11位纯数字
1613 1618
                         Model.T_Wo_MaterialManage maModel = mmBLL.GetModel(model1[i].F_MaterialID.ToString());//通过物料编码获取物料信息
@@ -1735,7 +1740,23 @@ namespace CallCenterApi.Interface.Controllers.weixin
1735 1740
                     model.F_Files = "0";//附件上传ids
1736 1741
                     model.F_DealType = model1[i].F_DealType;//处理方式:当即办理、电话转接、网络转办(点选)
1737 1742
                     #endregion
1738
-                    model.F_QuestionType = model1[i].F_QuestionType;//问题类别(投诉抽捡和咨询类别不一样)
1743
+                    if (!string.IsNullOrEmpty(model1[i].F_QuestionType))
1744
+                    {
1745
+                        try
1746
+                        {
1747
+                            int b = int.Parse(model1[i].F_QuestionType.Trim());
1748
+                            Model.T_Wo_QuestionManage manage = quesBLL.GetModel(b);
1749
+                            if (manage != null)
1750
+                            {
1751
+                                model.F_QuestionType = manage.F_QuestionName;
1752
+                            }
1753
+
1754
+                        }
1755
+                        catch (Exception)
1756
+                        {
1757
+                            model.F_QuestionType = model1[i].F_QuestionType; //问题类别(投诉抽捡和咨询类别不一样)
1758
+                        }
1759
+                    }
1739 1760
                     #region 投诉类
1740 1761
                     model.F_BatchNumber = model1[i].F_BatchNumber;//生产批次号
1741 1762
                     model.F_TS_Formula = model1[i].F_TS_Formula;// 投诉-配方
@@ -2226,6 +2247,20 @@ namespace CallCenterApi.Interface.Controllers.weixin
2226 2247
             string timecode = 3 + "" + RandKey + "" + time;
2227 2248
             return timecode;
2228 2249
         }
2250
+        private bool IsMaterial(WorkOrderNewInput input)
2251
+        {
2252
+            bool n = false;
2253
+            if (!string.IsNullOrEmpty(input.F_MaterialID) && !string.IsNullOrEmpty(input.F_MaterialName)
2254
+               && !string.IsNullOrEmpty(input.F_Model) && !string.IsNullOrEmpty(input.F_Specs)
2255
+                && !string.IsNullOrEmpty(input.F_Level1) && !string.IsNullOrEmpty(input.F_Level2)
2256
+              && !string.IsNullOrEmpty(input.F_Level3) && !string.IsNullOrEmpty(input.F_Brand)
2257
+              && !string.IsNullOrEmpty(input.F_MaterialEffect) && !string.IsNullOrEmpty(input.F_Craft)
2258
+              && !string.IsNullOrEmpty(input.F_Pipeline))
2259
+            {
2260
+                n = true;
2261
+            }
2262
+            return n;
2263
+        }
2229 2264
         /// <summary>
2230 2265
         /// 根据传入的对象和input的内容返回对象(添加修改使用)
2231 2266
         /// </summary>
@@ -2273,7 +2308,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2273 2308
                     //    #endregion
2274 2309
                     //    int b = customerBaseBLL.Add(Customer);
2275 2310
                     //}
2276
-                    if (string.IsNullOrEmpty(input.F_MaterialID))
2311
+                    if (string.IsNullOrEmpty(input.F_MaterialID) && IsMaterial(input))
2277 2312
                     {
2278 2313
                         while (true)
2279 2314
                         {
@@ -2476,6 +2511,10 @@ namespace CallCenterApi.Interface.Controllers.weixin
2476 2511
                         return Error("客户编号为10为纯数字!");
2477 2512
                     if (!string .IsNullOrEmpty (input.F_MaterialID ) && !valcode(input.F_MaterialID.ToString(), 11))
2478 2513
                         return Error("物料编码为11为纯数字!");
2514
+                if (string.IsNullOrEmpty(input.F_CusName))
2515
+                    return Error("请输入客户姓名!");
2516
+                if (string.IsNullOrEmpty(input.F_CusPhone))
2517
+                    return Error("请输入客户电话!");
2479 2518
                 //if (input.F_Type == 2 || input.F_Type == 3)
2480 2519
                 //{
2481 2520
                 //    if (string.IsNullOrEmpty(input.F_CustomerID))
@@ -2501,11 +2540,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
2501 2540
                     long n = woBLL.Add(model);
2502 2541
                     if (n > 0)
2503 2542
                     {
2504
-                        #region 流转上一级领导审批
2505
-                        DataTable dt = new DataTable();
2506
-                        dt = new BLL.T_Wo_WorkOrder().GetList(1, "", "F_ID desc").Tables[0];
2507
-                        List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
2508
-                        if (modlelist!=null && modlelist.Count >0)
2543
+                    #region 流转上一级领导审批
2544
+                    Model.T_Wo_WorkOrder modlelist = new BLL.T_Wo_WorkOrder().GetModel(n);
2545
+                    if (modlelist!=null)
2509 2546
                         {
2510 2547
                         if (ua !=null )
2511 2548
                         {
@@ -2523,8 +2560,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
2523 2560
                                 {
2524 2561
                                     deptname1 = deptmodel1.F_DeptName + "-";
2525 2562
                                 }
2526
-                                AddLog(modlelist[0].F_ID,0, deptname1 + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, user.F_UserCode, user.F_DeptId, ua , 0, 0);
2527
-                                AddLog(modlelist[0].F_ID, modlelist[0].F_State.Value, deptname + user.F_UserName + "(" + user.F_UserCode + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, 0, 0);
2563
+                                AddLog(modlelist.F_ID,0, deptname1 + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, user.F_UserCode, user.F_DeptId, ua , 0, 0);
2564
+                                AddLog(modlelist.F_ID, modlelist.F_State.Value, deptname + user.F_UserName + "(" + user.F_UserCode + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, 0, 0);
2528 2565
                             }
2529 2566
                             else
2530 2567
                             {
@@ -2534,8 +2571,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
2534 2571
                                 {
2535 2572
                                     deptname1 = deptmodel1.F_DeptName + "-";
2536 2573
                                 }
2537
-                                AddLog(modlelist[0].F_ID, 0, deptname1 + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create,"",0, ua, 0, 0);
2538
-                                var res = AssignWO(ua, modlelist[0], input, "流转市场管理科", 37, 0, overtime, sms);
2574
+                                AddLog(modlelist.F_ID, 0, deptname1 + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create,"",0, ua, 0, 0);
2575
+                                var res = AssignWO(ua, modlelist, input, "流转市场管理科", 37, 0, overtime, sms);
2539 2576
                                 if (res)
2540 2577
                                 return Success("添加成功");
2541 2578
                                 else
@@ -2544,7 +2581,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2544 2581
                         }
2545 2582
                         else
2546 2583
                         {
2547
-                            AddLog(modlelist[0].F_ID, 0, "客户" + "创建工单", (int)EnumItemType.deal, (int)EnumItemOpt.create, "", 0, null, 0, 0);
2584
+                            AddLog(modlelist.F_ID, 0, "客户" + "创建工单", (int)EnumItemType.deal, (int)EnumItemOpt.create, "", 0, null, 0, 0);
2548 2585
                             return Success("添加成功");
2549 2586
                         }
2550 2587
                             
@@ -2638,7 +2675,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2638 2675
                 {
2639 2676
                     if (clbm == 0 && clid == 0)
2640 2677
                     {
2641
-                        return Error("请选择接收");
2678
+                        return Error("请选择接收部门");
2642 2679
                     }
2643 2680
                     else
2644 2681
                     {
@@ -3697,10 +3734,15 @@ namespace CallCenterApi.Interface.Controllers.weixin
3697 3734
                     return Error("参数错误!");
3698 3735
                 if (!(input.F_Type > 0 && input.F_Type < 5))
3699 3736
                     return Error("工单类型错误!");
3737
+                if (string.IsNullOrEmpty(input.F_CusName))
3738
+                    return Error("请输入客户姓名!");
3739
+                if (string.IsNullOrEmpty(input.F_CusPhone))
3740
+                    return Error("请输入客户电话!");
3700 3741
                 if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
3701 3742
                 {
3702 3743
                     return Error("请输入正确的生产批次号!");
3703 3744
                 }
3745
+
3704 3746
                 else
3705 3747
                 {
3706 3748
                     if (!string.IsNullOrEmpty(input.F_BatchNumber))

+ 143 - 88
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -24,6 +24,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
24 24
         BLL.T_Cus_CustomerBaseNew cusbll = new BLL.T_Cus_CustomerBaseNew();
25 25
         BLL.T_Sys_Department departmentBLL = new BLL.T_Sys_Department();
26 26
         BLL.T_Wo_MaterialManage mmBLL = new BLL.T_Wo_MaterialManage();
27
+        BLL.T_Wo_QuestionManage quesBLL = new BLL.T_Wo_QuestionManage();
27 28
         BLL.T_Wo_WorkOrderItem_New itembll = new BLL.T_Wo_WorkOrderItem_New();
28 29
         BLL.T_Wo_WorkOrder_Logs blllogs = new BLL.T_Wo_WorkOrder_Logs();
29 30
         BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
@@ -294,7 +295,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
294 295
                     case 12://微信未通过工单
295 296
                         if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
296 297
                         {
297
-                            sql += $" and F_ID in(" + GetDelay() + ")";
298
+                           
298 299
                         }
299 300
                         else
300 301
                         {
@@ -856,7 +857,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
856 857
 
857 858
             str = "select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType in(" + (int)EnumItemType.deal + "," + (int)EnumItemType.audit + ")"
858 859
                 + " and "
859
-                    + "F_OptType in(" + (int)EnumItemOpt.create + "," + (int)EnumItemOpt.abreback + "," + (int)EnumItemOpt.reback + ") and F_NextUser='" + ua.F_UserCode + "'"
860
+                    + "F_OptType in(" + (int)EnumItemOpt.abreback + "," + (int)EnumItemOpt.reback + ") and F_NextUser='" + ua.F_UserCode + "'"
860 861
                 + ""
861 862
                 + " and isnull(F_IsUsed,'0')='0' ";
862 863
 
@@ -945,7 +946,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
945 946
                     else if (AuditState == 1)
946 947
                     {
947 948
                         opt = "驳回修订";
948
-                        var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.create, toussers, 0, nowUser, overtime, sms);
949
+                        var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.reback, toussers, 0, nowUser, overtime, sms);
949 950
                         if (userid <= 0)
950 951
                             res = false;
951 952
                     }
@@ -976,7 +977,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
976 977
                         else if (AuditState == 1)
977 978
                         {
978 979
                             opt = "驳回修订";
979
-                            var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.create, toussers, 0, nowUser, overtime, sms);
980
+                            var userid = AddLog(model.F_ID, model.F_State.Value, deptmodelsname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")" + "工单审批:驳回修订" + AuditCont, (int)EnumItemType.audit, (int)EnumItemOpt.reback, toussers, 0, nowUser, overtime, sms);
980 981
                             if (userid <= 0)
981 982
                                 res = false;
982 983
                             wostate = 16;
@@ -1231,7 +1232,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1231 1232
         private string GetDelay()
1232 1233
         {
1233 1234
             string str = "";
1234
-            str = "select F_WoID from T_Wo_WorkOrderItem_New where F_OptType=" + (int)EnumItemOpt.Delay;
1235
+            str = "select F_WoID from T_Wo_WorkOrderItem_New where F_OptType=" + (int)EnumItemOpt.Delay + "and F_ItemType = " + (int)EnumItemType.Delay;
1235 1236
             return str;
1236 1237
         }
1237 1238
         /// <summary>
@@ -1344,13 +1345,16 @@ namespace CallCenterApi.Interface.Controllers.workorder
1344 1345
         {
1345 1346
             #region 工单处理
1346 1347
             int sms = 0; int wostate = 0; int limit = 0;
1347
-            var itemlasts = itembll.GetModelList("  F_OptType=" + (int)EnumItemOpt.Delay + " and  F_WoID=" + model.F_ID + " ");
1348
+            var itemlasts = itembll.GetModelList("  F_OptType=" + (int)EnumItemOpt.Delay + "and F_ItemType = " + (int)EnumItemType.Delay + " and  F_WoID=" + model.F_ID + " ");
1348 1349
             if (itemlasts.Count > 0)
1349 1350
             {
1350 1351
                 foreach (var it in itemlasts)
1351 1352
                 {
1352 1353
                         sms = int.Parse(it.F_IsSMS.ToString());
1353 1354
                         limit = int.Parse(it.F_LimitTime);
1355
+                    it.F_ItemType = (int)EnumItemType.deal;
1356
+                    it.F_OptType = (int)EnumItemOpt.deal;
1357
+                    itembll.Update(it);
1354 1358
                 }
1355 1359
             }
1356 1360
             string opt = "";
@@ -1358,7 +1362,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1358 1362
             if (isadopt == 0)
1359 1363
             {
1360 1364
                 opt = "未通过";
1361
-                optbut = (int)EnumItemOpt.Delay;
1365
+                optbut = (int)EnumItemOpt.deal;
1362 1366
                 limit = model.F_limit;
1363 1367
             }
1364 1368
             else
@@ -1381,7 +1385,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1381 1385
             var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
1382 1386
             if (itemlast != null)
1383 1387
                 touser = itemlast.F_CreateUser;
1384
-            var itemid = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, touser, 0, nowUser, limit, sms);
1388
+            var itemid = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, touser, 0, nowUser, limit, sms,"",1);
1385 1389
             if (itemid > 0)
1386 1390
             {
1387 1391
                 
@@ -1526,7 +1530,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1526 1530
                 {
1527 1531
                     DataRow drNew = dt.NewRow();
1528 1532
                     #region 客户
1529
-                    if (!valcode(it.F_CustomerID.ToString(), 10))//验证客户编码为10位纯数字
1533
+                    if (valcode(it.F_CustomerID.ToString(), 10))//验证客户编码为10位纯数字
1530 1534
                     {
1531 1535
                         drNew["客户编号"] = it.F_CustomerID;//客户编码
1532 1536
                         Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
@@ -1563,7 +1567,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1563 1567
                     }
1564 1568
                     #endregion
1565 1569
                     #region 物料
1566
-                    if (!valcode(it.F_MaterialID.ToString(), 11))
1570
+                    if (valcode(it.F_MaterialID.ToString(), 11))
1567 1571
                     {
1568 1572
                         drNew["物料编码"] = int.Parse(it.F_MaterialID);//验证物料编码为11位纯数字
1569 1573
                         Model.T_Wo_MaterialManage maModel = mmBLL.GetModel(it.F_MaterialID.ToString());//通过物料编码获取物料信息
@@ -2866,7 +2870,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2866 2870
             int userId = CurrentUser.UserData.F_UserId;
2867 2871
             if (userId != 0)
2868 2872
             {
2869
-                string sql = " and F_IsDelete=0 and F_State != " + (int)EnumWorkOrderState.finish;
2873
+                string sql = "";
2870 2874
               
2871 2875
                 DataTable dt = new DataTable();
2872 2876
                 #region 筛选条件
@@ -3057,6 +3061,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
3057 3061
                 #region 添加验证判断
3058 3062
                 if (!(input.F_Type> 0 && input.F_Type < 5))
3059 3063
                     return Error("工单类型错误!");
3064
+                if(string .IsNullOrEmpty (input.F_CusName))
3065
+                    return Error("请输入客户姓名!");
3066
+                if (string.IsNullOrEmpty(input.F_CusPhone))
3067
+                    return Error("请输入客户电话!");
3060 3068
                 if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
3061 3069
                 {
3062 3070
                     return Error("请输入正确的生产批次号!");
@@ -3100,8 +3108,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
3100 3108
 
3101 3109
                         var model = new Model.T_Wo_WorkOrder();
3102 3110
                 #region 保存客户基本信息
3111
+                Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
3103 3112
                 model = inputtoobj(model, input, 2);
3104
-
3113
+                if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "YWY")
3114
+                {
3115
+                    model.F_State = (int)EnumWorkOrderState.audit;
3116
+                }
3105 3117
                 #endregion
3106 3118
                 long n = workOrder.Add(model);
3107 3119
                 if (n > 0)
@@ -3112,13 +3124,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
3112 3124
                     {
3113 3125
                         deptname = deptmodel.F_DeptName + "-";
3114 3126
                     }
3115
-                    DataTable dt = new DataTable();
3116
-                    dt = new BLL.T_Wo_WorkOrder().GetList(1, "", "F_ID desc").Tables[0];
3117
-                    List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
3118
-                 
3119
-                    if (ua != null)
3120
-                    {
3121
-                        Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
3127
+                    Model.T_Wo_WorkOrder  modlelist = new BLL.T_Wo_WorkOrder().GetModel(n);
3128
+                      
3122 3129
                         if (ro.F_RoleCode == "DQJL" || ro.F_RoleCode == "FGSJL" || ro.F_RoleCode == "YWY")
3123 3130
                         {
3124 3131
 
@@ -3132,13 +3139,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
3132 3139
                                     deptname1 = deptmodel1.F_DeptName + "-";
3133 3140
                                 }
3134 3141
 
3135
-                                AddLog(modlelist[0].F_ID, 0, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, user.F_UserCode, user.F_DeptId, ua, 0, 0);
3136
-                                AddLog(modlelist[0].F_ID, modlelist[0].F_State.Value, deptname1 + user.F_UserName + "(" + user.F_UserCode + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, 0, 0);
3142
+                                AddLog(modlelist.F_ID, 0, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, user.F_UserCode, user.F_DeptId, ua, 0, 0);
3143
+                                AddLog(modlelist.F_ID, modlelist.F_State.Value, deptname1 + user.F_UserName + "(" + user.F_UserCode + ")" + "待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, user.F_UserCode, user.F_DeptId, ua, 0, 0);
3137 3144
                             }
3138 3145
                             else
3139 3146
                             {
3140
-                                AddLog(modlelist[0].F_ID, 0, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, 0, 0);
3141
-                                var res = AssignWO(ua, modlelist[0], input, "流转市场管理科", 37, 0, 0, 0);
3147
+                                AddLog(modlelist.F_ID, 0, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, 0, 0);
3148
+                                var res = AssignWO(ua, modlelist, input, "流转市场管理科", 37, 0, 0, 0);
3142 3149
                                 if (res)
3143 3150
                                     return Success("添加成功");
3144 3151
                                 else
@@ -3147,10 +3154,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
3147 3154
                         }
3148 3155
                         else
3149 3156
                         {
3150
-                            AddLog(modlelist[0].F_ID, modlelist[0].F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, 0, 0);
3157
+                            AddLog(modlelist.F_ID, modlelist.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "创建工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, 0, 0);
3151 3158
                         }
3152
-                        
3153
-                    }
3154 3159
                     return Success("添加成功!");
3155 3160
 
3156 3161
                 }
@@ -3278,6 +3283,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
3278 3283
                     return Error("参数错误!");
3279 3284
                 if (!(input.F_Type> 0 && input.F_Type < 5))
3280 3285
                     return Error("工单类型错误!");
3286
+                if (string.IsNullOrEmpty(input.F_CusName))
3287
+                    return Error("请输入客户姓名!");
3288
+                if (string.IsNullOrEmpty(input.F_CusPhone))
3289
+                    return Error("请输入客户电话!");
3281 3290
                 if (!string.IsNullOrEmpty(input.F_BatchNumber) && !vaBatchNumber(input.F_BatchNumber))
3282 3291
                 {
3283 3292
                     return Error("请输入正确的生产批次号!");
@@ -3387,22 +3396,28 @@ namespace CallCenterApi.Interface.Controllers.workorder
3387 3396
                     WorkOrderNewInput model = new WorkOrderNewInput();
3388 3397
                     if (!string .IsNullOrEmpty(model1[i].F_CustomerID))
3389 3398
                     {
3390
-                        if (!valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
3391
-                        {
3392
-                            model.F_CustomerID = model1[i].F_CustomerID;//客户编码
3399
+                          //  var sql = "and  F_LegalPhone ='" + model1[i ].F_CusPhone.Trim() + "'";
3400
+                          //  var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
3393 3401
                             Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
3394 3402
                             if (cuModel != null)
3395 3403
                             {
3396
-                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
3404
+                            if (!string .IsNullOrEmpty (cuModel.F_AreaID))
3405
+                            {
3406
+                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
3397 3407
                                 if (pdModel != null)
3398 3408
                                 {
3399 3409
                                     model.F_AreaName = pdModel.F_DeptName;
3400 3410
                                 }
3401
-                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
3411
+                            }
3412
+                               if (!string .IsNullOrEmpty (cuModel.F_BranchID))
3413
+                            {
3414
+                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
3402 3415
                                 if (pdModel1 != null)
3403 3416
                                 {
3404 3417
                                     model.F_BranchName = pdModel1.F_DeptName;
3405 3418
                                 }
3419
+                            }
3420
+                               model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
3406 3421
                                 model.F_Salesman = cuModel.F_Salesman;
3407 3422
                                 model.F_SalesPhone = cuModel.F_SalesPhone;
3408 3423
                                 model.F_Legal = cuModel.F_Legal;
@@ -3421,10 +3436,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
3421 3436
                                 model.F_PlantingArea = cuModel.F_PlantingArea;
3422 3437
                                 model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
3423 3438
                             }
3424
-                        }
3425 3439
                     }
3426 3440
                    
3427
-                    if (!valcode(model1[i].F_MaterialID.ToString(), 11))
3441
+                    if (valcode(model1[i].F_MaterialID.ToString(), 11))
3428 3442
                     {
3429 3443
                         model.F_MaterialID = model1[i].F_MaterialID;//验证物料编码为11位纯数字
3430 3444
                         Model.T_Wo_MaterialManage maModel = mmBLL .GetModel(model1[i].F_MaterialID.ToString());//通过物料编码获取物料信息
@@ -3556,7 +3570,33 @@ namespace CallCenterApi.Interface.Controllers.workorder
3556 3570
                     model.F_Files = "0";//附件上传ids
3557 3571
                     model.F_DealType = model1[i].F_DealType;//处理方式:当即办理、电话转接、网络转办(点选)
3558 3572
                     #endregion
3559
-                    model.F_QuestionType = model1[i].F_QuestionType;//问题类别(投诉抽捡和咨询类别不一样)
3573
+                  
3574
+                    
3575
+                    if (!string .IsNullOrEmpty (model1[i].F_QuestionType) )
3576
+                    {
3577
+                        try
3578
+                        {
3579
+                            int b = int.Parse(model1[i].F_QuestionType.Trim());
3580
+                            Model.T_Wo_QuestionManage manage = quesBLL.GetModel(b);
3581
+                            if (manage!=null )
3582
+                            {
3583
+                                model.F_QuestionType = manage.F_QuestionName;
3584
+                                   if (manage.F_Label == "3")
3585
+                                   {
3586
+                                    Model.T_Wo_QuestionManage Manage1 = quesBLL.GetModel(int.Parse(manage.F_ParentId.ToString()));//获取问题类别
3587
+                                    Model.T_Wo_QuestionManage Manage2 = quesBLL.GetModel(int.Parse(Manage1.F_ParentId.ToString()));//获取问题类别
3588
+                                    model.F_QuestionTypeone = Manage2.F_QuestionName;//问题类别1
3589
+                                    model.F_QuestionTypetwo = Manage1.F_QuestionName;//问题类别2
3590
+                                  
3591
+                                }
3592
+                            }
3593
+
3594
+                        }
3595
+                        catch (Exception)
3596
+                        {
3597
+                            model.F_QuestionType = model1[i].F_QuestionType; //问题类别(投诉抽捡和咨询类别不一样)
3598
+                        }
3599
+                    }
3560 3600
                     #region 投诉类
3561 3601
                     model.F_BatchNumber = model1[i].F_BatchNumber;//生产批次号
3562 3602
                     model.F_TS_Formula = model1[i].F_TS_Formula;// 投诉-配方
@@ -3650,7 +3690,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
3650 3690
                     {
3651 3691
                         model.F_AuditState = "";
3652 3692
                     }
3653
-                  
3693
+                  model .F_limit = model1[i].F_limit ;
3654 3694
                     model.F_AuditBy = model1[i].F_AuditBy;//审核人
3655 3695
                     model.F_AuditOn = model1[i].F_AuditOn;//审核时间
3656 3696
                     model.F_AuditCont = model1[i].F_AuditCont;//审核内容
@@ -3705,7 +3745,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
3705 3745
         private int DelayTimelimit(int id,int limit)
3706 3746
         {
3707 3747
             int time = 0;
3708
-            var itemlist = itembll.GetModelList("F_WoID="+ id + "and F_OptType="+ (int)EnumItemOpt.Delay);
3748
+            var itemlist = itembll.GetModelList("F_WoID="+ id + "and F_OptType="+ (int)EnumItemOpt.Delay+ "and F_ItemType = " + (int)EnumItemType.Delay);
3709 3749
             foreach (var it in itemlist )
3710 3750
             {
3711 3751
                 time = int.Parse(it.F_LimitTime) - limit;
@@ -3853,6 +3893,20 @@ namespace CallCenterApi.Interface.Controllers.workorder
3853 3893
             }
3854 3894
             return true;
3855 3895
         }
3896
+        private bool IsMaterial(WorkOrderNewInput input)
3897
+        {
3898
+            bool n= false;
3899
+            if (!string .IsNullOrEmpty (input.F_MaterialID)&& !string.IsNullOrEmpty(input.F_MaterialName)
3900
+               && !string.IsNullOrEmpty(input.F_Model) && !string.IsNullOrEmpty(input.F_Specs)
3901
+                && !string.IsNullOrEmpty(input.F_Level1) && !string.IsNullOrEmpty(input.F_Level2)
3902
+              && !string.IsNullOrEmpty(input.F_Level3) && !string.IsNullOrEmpty(input.F_Brand)
3903
+              && !string.IsNullOrEmpty(input.F_MaterialEffect) && !string.IsNullOrEmpty(input.F_Craft)
3904
+              && !string.IsNullOrEmpty(input.F_Pipeline))
3905
+            {
3906
+                n = true;
3907
+            }
3908
+            return n;
3909
+        }
3856 3910
         /// <summary>
3857 3911
         /// 根据传入的对象和input的内容返回对象(添加修改使用)
3858 3912
         /// </summary>
@@ -3861,13 +3915,15 @@ namespace CallCenterApi.Interface.Controllers.workorder
3861 3915
             string usercode = CurrentUser.UserData.F_UserCode;
3862 3916
             var newmodel = model;
3863 3917
             if (input.F_ID!=0)
3918
+            {
3864 3919
                 model.F_ID = input.F_ID;
3920
+                model.F_WorkOrderCode = model.F_WorkOrderCode;//工单编号
3921
+            }
3865 3922
             else
3923
+            {
3866 3924
                 model.F_ID = model.F_ID;//工单ID
3867
-            if (!string.IsNullOrWhiteSpace(input.F_WorkOrderCode))
3868
-                model.F_WorkOrderCode = input.F_WorkOrderCode;//工单编号
3869
-            else
3870 3925
                 model.F_WorkOrderCode = DateTime.Now.ToString("yyyyMMddHHmmssfff");  //工单编号  
3926
+            }
3871 3927
             #region 基本字段
3872 3928
             if (type == 2)
3873 3929
             {
@@ -3899,7 +3955,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
3899 3955
                     //    #endregion
3900 3956
                     //    int b = cusbll.Add(Customer);
3901 3957
                     //  }
3902
-                    if (string.IsNullOrEmpty(input.F_MaterialID))
3958
+                    if (string.IsNullOrEmpty(input.F_MaterialID)&& IsMaterial(input))
3903 3959
                     {
3904 3960
                         while (true)
3905 3961
                         {
@@ -4090,6 +4146,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
4090 4146
                     return Error("工单类型错误!");
4091 4147
                 if (input.F_State == 2 && !vaBatchNumber(input.F_BatchNumber))
4092 4148
                     return Error("请输入正确的工单批次号!");
4149
+                if (string.IsNullOrEmpty(input.F_CusName))
4150
+                    return Error("请输入客户姓名!");
4151
+                if (string.IsNullOrEmpty(input.F_CusPhone))
4152
+                    return Error("请输入客户电话!");
4093 4153
                 if (!string.IsNullOrEmpty(input.F_CustomerID) && !valcode(input.F_CustomerID.ToString(), 10))
4094 4154
                     return Error("客户编号为10为纯数字!");
4095 4155
 
@@ -4114,22 +4174,20 @@ namespace CallCenterApi.Interface.Controllers.workorder
4114 4174
                 long n = workOrder.Add(model);
4115 4175
                 if (n > 0)
4116 4176
                 {
4117
-                    DataTable dt = new DataTable();
4118
-                    dt = new BLL.T_Wo_WorkOrder().GetList(1,"", "F_ID desc").Tables [0];
4119
-                    List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
4177
+                    Model.T_Wo_WorkOrder modlelist = new BLL.T_Wo_WorkOrder().GetModel(n);
4120 4178
                     WorkOrderNewInput inputs = new WorkOrderNewInput();
4121 4179
                         if (clbm == 0 && clid == 0)
4122 4180
                         {
4123
-                            return Error("请选择接收");
4181
+                            return Error("请选择接收部门");
4124 4182
                         }
4125 4183
                         else
4126 4184
                         {
4127 4185
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
4128 4186
                         if (deptmodel != null)
4129 4187
                             {
4130
-                                if (modlelist != null&& modlelist.Count >0)
4188
+                                if (modlelist != null)
4131 4189
                                 {
4132
-                                    if (modlelist[0].F_Type == "2")
4190
+                                    if (modlelist.F_Type == "2")
4133 4191
                                     {
4134 4192
                                         if (deptmodel.F_DeptId == 37)
4135 4193
                                         {
@@ -4152,7 +4210,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4152 4210
 
4153 4211
                                         }
4154 4212
                                     }
4155
-                                    else if (modlelist[0].F_Type == "3")
4213
+                                    else if (modlelist.F_Type == "3")
4156 4214
                                     {
4157 4215
                                         if (deptmodel.F_DeptId == 37)
4158 4216
                                         {
@@ -4187,7 +4245,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4187 4245
                             }
4188 4246
                         }
4189 4247
 
4190
-                        if (modlelist[0] != null&& modlelist.Count >0)
4248
+                        if (modlelist != null)
4191 4249
                         {
4192 4250
                         string deptname = "";
4193 4251
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
@@ -4195,8 +4253,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
4195 4253
                         {
4196 4254
                             deptname = deptmodel.F_DeptName + "-";
4197 4255
                         }
4198
-                        AddLog(modlelist[0].F_ID, modlelist[0].F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "添加工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, 0, 0);
4199
-                        var res = AssignWO(ua, modlelist[0], inputs, cont, clbm, clid, overtime, sms);
4256
+                        AddLog(modlelist.F_ID, modlelist.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "添加工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, 0, 0);
4257
+                        var res = AssignWO(ua, modlelist, inputs, cont, clbm, clid, overtime, sms);
4200 4258
                             if (res)
4201 4259
                                 return Success("转派成功");
4202 4260
                             else
@@ -4204,9 +4262,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
4204 4262
                         }
4205 4263
                         else
4206 4264
                             return Error("工单不存在!");
4207
-
4208
-                  
4209
-
4210 4265
                 }
4211 4266
                 else
4212 4267
                     return Error("添加失败!");
@@ -4229,6 +4284,10 @@ namespace CallCenterApi.Interface.Controllers.workorder
4229 4284
                     return Error("工单类型错误!");
4230 4285
                 if (input.F_State == 2 && !vaBatchNumber(input.F_BatchNumber))
4231 4286
                     return Error("请输入正确的工单批次号!");
4287
+                if (string.IsNullOrEmpty(input.F_CusName))
4288
+                    return Error("请输入客户姓名!");
4289
+                if (string.IsNullOrEmpty(input.F_CusPhone))
4290
+                    return Error("请输入客户电话!");
4232 4291
                 #endregion
4233 4292
                 if (!string.IsNullOrEmpty(input.F_CustomerID) && !valcode(input.F_CustomerID.ToString(), 10))
4234 4293
                     return Error("客户编号为10为纯数字!");
@@ -4253,39 +4312,37 @@ namespace CallCenterApi.Interface.Controllers.workorder
4253 4312
                 long n = workOrder.Add(model);
4254 4313
                 if (n > 0)
4255 4314
                 {
4256
-                    DataTable dt = new DataTable();
4257
-                    dt = new BLL.T_Wo_WorkOrder().GetList(1, "", "F_ID desc").Tables[0];
4258
-                    List<Model.T_Wo_WorkOrder> modlelist = new BLL.T_Wo_WorkOrder().DataTableToList(dt);
4315
+                    Model.T_Wo_WorkOrder modlelist = new BLL.T_Wo_WorkOrder().GetModel(n);
4259 4316
                     WorkOrderNewInput inputs = new WorkOrderNewInput();
4260 4317
 
4261
-                    modlelist[0].F_SC_ProductBase = input.F_SC_ProductBase;//市场管理科-生产基地(新乡、新疆、九江、东北、贴牌、无法确定)
4262
-                    modlelist[0].F_SC_PreliminaryOpinion = input.F_SC_PreliminaryOpinion;//市场管理科-初审意见:退货、换货、补偿、自行处理
4263
-                    modlelist[0].F_SC_CJ_SpotResult = input.F_SC_CJ_SpotResult;//市场管理科-抽检-抽检结果(视同合格、合格、不合格、复检后合格、未送检)
4264
-                    modlelist[0].F_SC_CJ_SelfResult = input.F_SC_CJ_SelfResult;// 市场管理科-抽检-自检结果
4265
-                    modlelist[0].F_SC_CJ_ApprovalNo = input.F_SC_CJ_ApprovalNo;//市场管理科-抽检-对应审批工作流单号
4266
-                    modlelist[0].F_SC_CJ_ReturnAccount = input.F_SC_CJ_ReturnAccount;//市场管理科-抽检-确认返账金额(元)
4267
-                    modlelist[0].F_ZL_QualityEventLevel = input.F_ZL_QualityEventLevel;//质量管理科-质量事件等级(未遂、一般、较大、重大)
4268
-                    modlelist[0].F_ZL_ClaimAmount = input.F_ZL_ClaimAmount;//质量管理科-索赔金额(单位元,对应责任单位)
4269
-                    modlelist[0].F_ZL_ResponsibleUnit = input.F_ZL_ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
4270
-                    modlelist[0].F_ZL_ApprovalOpinions = input.F_ZL_ApprovalOpinions;// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
4271
-                    modlelist[0].F_ZL_ApprovalDisagree = input.F_ZL_ApprovalDisagree;//质量管理科-审批不同意意见
4272
-                    modlelist[0].F_ZL_CompensationMethod = input.F_ZL_CompensationMethod;//质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
4273
-                    modlelist[0].F_ZL_CompensationMoney = input.F_ZL_CompensationMoney;// 质量管理科-补偿钱款
4274
-                    modlelist[0].F_ZL_CResponsibleUnits = input.F_ZL_CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
4275
-                    modlelist[0].F_ZL_Fquantity = input.F_ZL_Fquantity;//质量管理科-确认实收数量(吨)
4276
-                    modlelist[0].F_ZL_ImprovementRequirements = input.F_ZL_ImprovementRequirements;// 质量管理科-改进要求
4277
-                    modlelist[0].F_ZL_CApprovalNo = input.F_ZL_CApprovalNo;// 质量管理科-对应审批工作流单号
4278
-                    modlelist[0].F_ZL_CJ_IsRecord = input.F_ZL_CJ_IsRecord;// 质量管理科-抽检-未备案、已备案
4279
-                    modlelist[0].F_DealBy = ua.F_UserCode;// 处理人
4280
-                    modlelist[0].F_DealTime =DateTime .Now ;// 处理时间
4281
-                    modlelist[0].F_DealContent = input.F_DealContent;//完结内容
4282
-                    modlelist[0].F_DealType = input.F_DealType;//处理方式:当即办理、电话转接、网络转办
4283
-                    bool f = workOrder  .Update(modlelist[0]);
4318
+                    modlelist.F_SC_ProductBase = input.F_SC_ProductBase;//市场管理科-生产基地(新乡、新疆、九江、东北、贴牌、无法确定)
4319
+                    modlelist.F_SC_PreliminaryOpinion = input.F_SC_PreliminaryOpinion;//市场管理科-初审意见:退货、换货、补偿、自行处理
4320
+                    modlelist.F_SC_CJ_SpotResult = input.F_SC_CJ_SpotResult;//市场管理科-抽检-抽检结果(视同合格、合格、不合格、复检后合格、未送检)
4321
+                    modlelist.F_SC_CJ_SelfResult = input.F_SC_CJ_SelfResult;// 市场管理科-抽检-自检结果
4322
+                    modlelist.F_SC_CJ_ApprovalNo = input.F_SC_CJ_ApprovalNo;//市场管理科-抽检-对应审批工作流单号
4323
+                    modlelist.F_SC_CJ_ReturnAccount = input.F_SC_CJ_ReturnAccount;//市场管理科-抽检-确认返账金额(元)
4324
+                    modlelist.F_ZL_QualityEventLevel = input.F_ZL_QualityEventLevel;//质量管理科-质量事件等级(未遂、一般、较大、重大)
4325
+                    modlelist.F_ZL_ClaimAmount = input.F_ZL_ClaimAmount;//质量管理科-索赔金额(单位元,对应责任单位)
4326
+                    modlelist.F_ZL_ResponsibleUnit = input.F_ZL_ResponsibleUnit;// 质量管理科-责任单位(需列出,可选多个)
4327
+                    modlelist.F_ZL_ApprovalOpinions = input.F_ZL_ApprovalOpinions;// 质量管理科-审批意见(同意、不同意,若选择不同意,增加输入框输入补充内容)
4328
+                    modlelist.F_ZL_ApprovalDisagree = input.F_ZL_ApprovalDisagree;//质量管理科-审批不同意意见
4329
+                    modlelist.F_ZL_CompensationMethod = input.F_ZL_CompensationMethod;//质量管理科-补偿方式(实物、钱款【单位元】,若选择钱款,增加输入框输入补充内容)
4330
+                    modlelist.F_ZL_CompensationMoney = input.F_ZL_CompensationMoney;// 质量管理科-补偿钱款
4331
+                    modlelist.F_ZL_CResponsibleUnits = input.F_ZL_CResponsibleUnits;//质量管理科-对应责任单位(生产、研发、农化、物流、质量管理科,销售内勤)
4332
+                    modlelist.F_ZL_Fquantity = input.F_ZL_Fquantity;//质量管理科-确认实收数量(吨)
4333
+                    modlelist.F_ZL_ImprovementRequirements = input.F_ZL_ImprovementRequirements;// 质量管理科-改进要求
4334
+                    modlelist.F_ZL_CApprovalNo = input.F_ZL_CApprovalNo;// 质量管理科-对应审批工作流单号
4335
+                    modlelist.F_ZL_CJ_IsRecord = input.F_ZL_CJ_IsRecord;// 质量管理科-抽检-未备案、已备案
4336
+                    modlelist.F_DealBy = ua.F_UserCode;// 处理人
4337
+                    modlelist.F_DealTime =DateTime .Now ;// 处理时间
4338
+                    modlelist.F_DealContent = input.F_DealContent;//完结内容
4339
+                    modlelist.F_DealType = input.F_DealType;//处理方式:当即办理、电话转接、网络转办
4340
+                    bool f = workOrder  .Update(modlelist);
4284 4341
                     if (!f )
4285 4342
                     {
4286 4343
                          return Error("完结失败!");
4287 4344
                     }
4288
-                    if (modlelist[0] != null && modlelist.Count > 0)
4345
+                    if (modlelist != null )
4289 4346
                     {
4290 4347
                         string deptname = "";
4291 4348
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
@@ -4293,16 +4350,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
4293 4350
                         {
4294 4351
                             deptname = deptmodel.F_DeptName + "-";
4295 4352
                         }
4296
-                        AddLog(modlelist[0].F_ID, modlelist[0].F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "添加工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.create, "", 0, ua, 0, 0);
4297
-                        var res = Overorder(ua, modlelist[0], 1);
4353
+                        AddLog(modlelist.F_ID, modlelist.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_UserCode + ")" + "添加工单", (int)EnumWorkOrderState.neworder, (int)EnumItemOpt.end, "", 0, ua, 0, 0);
4354
+                        var res = Overorder(ua, modlelist, 1);
4298 4355
                         if (res)
4299 4356
                             return Success("完结成功");
4300
-                        else
4301
-                            return Error("完结失败!");
4302 4357
                     }
4303 4358
                 }
4304
-                else
4305
-                    return Error("完结失败!");
4306 4359
             }
4307 4360
             else
4308 4361
             {
@@ -4334,7 +4387,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
4334 4387
                 {
4335 4388
                     if (clbm == 0 && clid == 0)
4336 4389
                     {
4337
-                        return Error("请选择接收");
4390
+                        return Error("请选择接收部门");
4338 4391
                     }
4339 4392
                     else
4340 4393
                     {
@@ -4888,7 +4941,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
4888 4941
             var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.F_ID + "' and F_NextUser='" + nowUser.F_UserCode + "' order by F_CreateTime desc").FirstOrDefault();
4889 4942
             if (itemlast != null)
4890 4943
                 touser = itemlast.F_CreateUser;
4891
-            var itemid = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, touser, 0, nowUser, limit + model .F_limit , sms);
4944
+            
4945
+               
4946
+            var itemid = AddLog((int)model.F_ID, wostate, content, (int)EnumItemType.Delay, optbut, touser, 0, nowUser, limit + model .F_limit , sms,"",1);
4892 4947
 
4893 4948
             #endregion
4894 4949
 

+ 2 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Enum/EnumWorkOrderState.cs

@@ -61,6 +61,8 @@ namespace CallCenterApi.Interface.Models.Enum
61 61
         visit = 6,
62 62
         [Description("审批")]
63 63
         audit = 7,
64
+        [Description("延期")]
65
+         Delay = 8,
64 66
     }
65 67
     /// <summary>
66 68
     /// 工单记录操作

+ 0 - 36
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Input/CustomerBaseNewInput.cs

@@ -48,10 +48,6 @@ namespace CallCenterApi.Interface.Models.Input
48 48
         /// </summary>
49 49
         public string F_SalesPhone { set; get; }
50 50
         /// <summary>
51
-        /// 客户性质
52
-        /// </summary>
53
-        public string F_CustomerNature { set; get; }
54
-        /// <summary>
55 51
         /// 渠道类型:总经销、二级商、种田大户、农户、化工客户、公司员工
56 52
         /// </summary>
57 53
         public string F_Channel { set; get; }
@@ -96,38 +92,6 @@ namespace CallCenterApi.Interface.Models.Input
96 92
         /// </summary>
97 93
         public string F_Product { set; get; }
98 94
         /// <summary>
99
-        /// 冻结标志
100
-        /// </summary>
101
-        public string F_FrozenFlag { set; get; }
102
-        /// <summary>
103
-        /// 是否开户:已开户、未开户
104
-        /// </summary>
105
-        public string F_IsOpenAccount { set; get; }
106
-        /// <summary>
107
-        /// 上级客户编码
108
-        /// </summary>
109
-        public string F_LevelCode { set; get; }
110
-        /// <summary>
111
-        /// 上级客户名称
112
-        /// </summary>
113
-        public string F_LevelName { set; get; }
114
-        /// <summary>
115
-        /// 助记码
116
-        /// </summary>
117
-        public string F_MnemonicCode { set; get; }
118
-        /// <summary>
119
-        /// 开票银行名称
120
-        /// </summary>
121
-        public string F_InvoiceBank { set; get; }
122
-        /// <summary>
123
-        /// 开票银行账号
124
-        /// </summary>
125
-        public string F_InvoiceBankAccount { set; get; }
126
-        /// <summary>
127
-        /// 纳税人登记号
128
-        /// </summary>
129
-        public string F_TaxRegCode { set; get; }
130
-        /// <summary>
131 95
         /// 是否经营心连心:是、否
132 96
         /// </summary>
133 97
         public string F_IsRunXLX { set; get; }

+ 19 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Input/WorkOrderNewInput.cs

@@ -284,12 +284,27 @@ namespace CallCenterApi.Interface.Models.Input
284 284
         /// </summary>
285 285
         public string F_Craft { get; set; }
286 286
         /// <summary>
287
+        /// 问题类别1
288
+        /// </summary>
289
+        public string F_QuestionTypeone
290
+        {
291
+            get; set;
292
+        }
293
+        /// <summary>
294
+        /// 问题类别2
295
+        /// </summary>
296
+        public string F_QuestionTypetwo
297
+        {
298
+            get; set;
299
+        }
300
+        /// <summary>
287 301
         /// 问题类别
288 302
         /// </summary>
289 303
         public string F_QuestionType
290 304
         {
291 305
             get; set;
292 306
         }
307
+  
293 308
         /// <summary>
294 309
         /// 生产批次号
295 310
         /// </summary>
@@ -563,6 +578,10 @@ namespace CallCenterApi.Interface.Models.Input
563 578
         {
564 579
             get; set;
565 580
         }
581
+        public float  F_limit
582
+        {
583
+            get; set;
584
+        }
566 585
         /// <summary>
567 586
         /// 审核人
568 587
         /// </summary>

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Model/T_Wo_MaterialManage.cs

@@ -53,7 +53,7 @@ namespace CallCenterApi.Model
53 53
             get { return _f_materialcode; }
54 54
         }
55 55
         /// <summary>
56
-        /// 物料编码
56
+        /// 物料名称
57 57
         /// </summary>
58 58
         public string F_MaterialName
59 59
         {