zhupei 3 年 前
コミット
b932b10813

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Base/BaseController.cs

29
         /// </summary>
29
         /// </summary>
30
         public Log FileLog
30
         public Log FileLog
31
         {
31
         {
32
-            get { return LogFactory.GetLogger(this.GetType().ToString() + "/" + this.ControllerContext.RouteData.Values["Action"].ToString()); }
32
+            get { return LogFactory.GetLogger(this.GetType().ToString() + "/" + this.ControllerContext?.RouteData.Values["Action"].ToString() ?? ""); }
33
         }
33
         }
34
 
34
 
35
                 
35
                 

+ 10 - 2
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SMSController.cs

29
         #endregion
29
         #endregion
30
         public ActionResult SMSSend(string name, string phone, string cusphone)
30
         public ActionResult SMSSend(string name, string phone, string cusphone)
31
         {
31
         {
32
-            int userId = CurrentUser.UserData.F_UserId;
32
+            int userId = 1545;
33
+            if (CurrentUser != null)
34
+            {
35
+                userId = CurrentUser.UserData.F_UserId;
36
+            }
33
             if (userId > 0)
37
             if (userId > 0)
34
             {
38
             {
35
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
39
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
207
         }
211
         }
208
         public ActionResult SMSSendSalesman(string name, string phone, string cusphone)
212
         public ActionResult SMSSendSalesman(string name, string phone, string cusphone)
209
         {
213
         {
210
-            int userId = CurrentUser.UserData.F_UserId;
214
+            int userId = 1545;
215
+            if (CurrentUser != null)
216
+            {
217
+                userId = CurrentUser.UserData.F_UserId;
218
+            }
211
             if (userId > 0)
219
             if (userId > 0)
212
             {
220
             {
213
                 if (string.IsNullOrEmpty(name))
221
                 if (string.IsNullOrEmpty(name))

+ 51 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

377
         {
377
         {
378
             if (!string.IsNullOrWhiteSpace(tel))
378
             if (!string.IsNullOrWhiteSpace(tel))
379
             {
379
             {
380
-                string Province = "", City="";
380
+                string Province = "", City = "", CityaddressDes="";
381
+                string[] CityDes= { };
381
                 var model = new object();
382
                 var model = new object();
382
                 var sql = $" and  F_LegalPhone  = '" + tel.Trim() + "'";
383
                 var sql = $" and  F_LegalPhone  = '" + tel.Trim() + "'";
383
                 var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
384
                 var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
396
                         {
397
                         {
397
                             try
398
                             try
398
                             {
399
                             {
399
-                                var CityDes = mobileModel.F_CityDes.Split('-');
400
+                                CityaddressDes = mobileModel.F_CityDes;
401
+                                CityDes = mobileModel.F_CityDes.Split('-');
400
                                 Province = CityDes[0].ToString() + "省";
402
                                 Province = CityDes[0].ToString() + "省";
401
                                 City = CityDes[1].ToString() + "市";
403
                                 City = CityDes[1].ToString() + "市";
402
                             }
404
                             }
421
                         {
423
                         {
422
                             try
424
                             try
423
                             {
425
                             {
424
-                                var CityDes = mobileModel[0].F_TitleName.Split('-');
426
+                                CityaddressDes = mobileModel[0].F_TitleName;
427
+                                CityDes = mobileModel[0].F_TitleName.Split('-');
425
                                 Province = CityDes[0].ToString() ;
428
                                 Province = CityDes[0].ToString() ;
426
                                 City = CityDes[1].ToString();
429
                                 City = CityDes[1].ToString();
427
                             }
430
                             }
442
                 {
445
                 {
443
                     model = model,
446
                     model = model,
444
                     Province = Province,
447
                     Province = Province,
445
-                    City = City
448
+                    City = City,
449
+                    CityaddressDes = CityaddressDes
446
                 };
450
                 };
447
                 return Success("获取成功", obj);
451
                 return Success("获取成功", obj);
448
                 //}
452
                 //}
464
         }
468
         }
465
         public ActionResult CallAdd(CustomerBaseNewInput input)
469
         public ActionResult CallAdd(CustomerBaseNewInput input)
466
         {
470
         {
467
-            string usercode = CurrentUser.UserData.F_UserCode;
471
+            string usercode = "8000";
472
+            if (CurrentUser != null)
473
+            {
474
+                usercode = CurrentUser.UserData.F_UserCode;
475
+            }      
468
             if (string.IsNullOrEmpty(input.F_LegalPhone))
476
             if (string.IsNullOrEmpty(input.F_LegalPhone))
469
                 return Error("请输入客户电话");
477
                 return Error("请输入客户电话");
470
             var sql = $" and  F_LegalPhone ='" + input.F_LegalPhone.Trim() + "'";
478
             var sql = $" and  F_LegalPhone ='" + input.F_LegalPhone.Trim() + "'";
550
             {
558
             {
551
                 //Salesman = new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName + "-" + p.F_UserName + "(" + p.F_UserCode + ")",              
559
                 //Salesman = new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName + "-" + p.F_UserName + "(" + p.F_UserCode + ")",              
552
                 Salesman = p.F_UserName +"-"+ new BLL.T_Sys_RoleInfo().GetModel(p.F_RoleId).F_RoleName + "-" + new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName,
560
                 Salesman = p.F_UserName +"-"+ new BLL.T_Sys_RoleInfo().GetModel(p.F_RoleId).F_RoleName + "-" + new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName,
553
-                SalesPhone = p.F_Mobile
561
+                SalesPhone = p.F_Mobile,
562
+                ResponsArea=p.F_Remark
554
             });
563
             });
555
             var obj = new
564
             var obj = new
556
             {
565
             {
563
             };
572
             };
564
             return Content(obj.ToJson());
573
             return Content(obj.ToJson());
565
         }
574
         }
575
+
576
+        /// <summary>
577
+        /// 获取区县下业务员信息
578
+        /// </summary>
579
+        /// <param name="country"></param>
580
+        /// <returns></returns>
581
+        public ActionResult GetAreaSalesman(string country)
582
+        {
583
+            if (!string.IsNullOrEmpty(country))
584
+            {
585
+                string sql = $" F_DeleteFlag=0";
586
+                sql += $" and F_Remark like '%{ country.Trim()}%'";
587
+
588
+                var modelist = new BLL.T_Sys_UserAccount().GetModelList(sql);
589
+                if (modelist.Count>0)
590
+                {
591
+                    var saleslist = modelist.Where(t => !string.IsNullOrEmpty(t.F_UserCode)).Select(p => new
592
+                    {
593
+                        Salesman = p.F_UserName + "-" + new BLL.T_Sys_RoleInfo().GetModel(p.F_RoleId).F_RoleName + "-" + new BLL.T_Sys_Department().GetModel(p.F_DeptId).F_DeptName,
594
+                        SalesPhone = p.F_Mobile,
595
+                        ResponsArea = p.F_Remark
596
+                    });
597
+                    var obj = new
598
+                    {
599
+                        state = "success",
600
+                        message = "成功",
601
+                        rows = saleslist.GroupBy(x => x.Salesman).Select(y => y.First())
602
+                    };
603
+                    return Content(obj.ToJson());
604
+                }
605
+                else
606
+                    return Error("该区域不存在业务员信息!");
607
+            }
608
+            else
609
+                return Error("请选择负责区域!");
610
+        }
566
         /// <summary>
611
         /// <summary>
567
         /// 添加客户信息
612
         /// 添加客户信息
568
         /// </summary>
613
         /// </summary>

+ 241 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

2
 using CallCenterApi.DB;
2
 using CallCenterApi.DB;
3
 using CallCenterApi.Interface.App_Start;
3
 using CallCenterApi.Interface.App_Start;
4
 using CallCenterApi.Interface.Controllers.Base;
4
 using CallCenterApi.Interface.Controllers.Base;
5
+using CallCenterApi.Interface.Controllers.customer;
5
 using CallCenterApi.Interface.Controllers.workorder;
6
 using CallCenterApi.Interface.Controllers.workorder;
6
 using CallCenterApi.Interface.Models.Enum;
7
 using CallCenterApi.Interface.Models.Enum;
7
 using CallCenterApi.Interface.Models.Input;
8
 using CallCenterApi.Interface.Models.Input;
5317
             if (!string.IsNullOrEmpty(input.F_ZL_ImprovementRequirements) && !model.F_ZL_ImprovementRequirements.Contains(input.F_ZL_ImprovementRequirements))
5318
             if (!string.IsNullOrEmpty(input.F_ZL_ImprovementRequirements) && !model.F_ZL_ImprovementRequirements.Contains(input.F_ZL_ImprovementRequirements))
5318
             {
5319
             {
5319
                 string strimprovement = str + input.F_ZL_ImprovementRequirements + ";@# ";
5320
                 string strimprovement = str + input.F_ZL_ImprovementRequirements + ";@# ";
5320
-                model.F_ZL_ImprovementRequirements = string.IsNullOrEmpty(model.F_ZL_ImprovementRequirements) ? strimprovement : model.F_ZL_ImprovementRequirements + strimprovement; //质量管理科-改进要求
5321
+                //model.F_ZL_ImprovementRequirements = string.IsNullOrEmpty(model.F_ZL_ImprovementRequirements) ? strimprovement : model.F_ZL_ImprovementRequirements + strimprovement; //质量管理科-改进要求
5322
+                model.F_ZL_ImprovementRequirements = input.F_ZL_ImprovementRequirements; //质量管理科-改进要求
5321
             }
5323
             }
5322
             if (!string.IsNullOrEmpty(input.F_ZL_CApprovalNo))
5324
             if (!string.IsNullOrEmpty(input.F_ZL_CApprovalNo))
5323
                 model.F_ZL_CApprovalNo = input.F_ZL_CApprovalNo;//质量管理科-对应审批工作流单号
5325
                 model.F_ZL_CApprovalNo = input.F_ZL_CApprovalNo;//质量管理科-对应审批工作流单号
5347
             if (!string.IsNullOrEmpty(input.F_EventReason) &&  !model.F_EventReason.Contains(input.F_EventReason))
5349
             if (!string.IsNullOrEmpty(input.F_EventReason) &&  !model.F_EventReason.Contains(input.F_EventReason))
5348
             {
5350
             {
5349
                 string strevent = str + input.F_EventReason + ";@# ";
5351
                 string strevent = str + input.F_EventReason + ";@# ";
5350
-                model.F_EventReason = string.IsNullOrEmpty(model.F_EventReason) ? strevent : model.F_EventReason + strevent; //质量管理科-事件原因
5352
+                //model.F_EventReason = string.IsNullOrEmpty(model.F_EventReason) ? strevent : model.F_EventReason + strevent; //质量管理科-事件原因
5353
+                model.F_EventReason = input.F_EventReason; //质量管理科-事件原因
5351
             }
5354
             }
5352
             if (!string.IsNullOrEmpty(input.F_DrivePhone))
5355
             if (!string.IsNullOrEmpty(input.F_DrivePhone))
5353
                 model.F_DrivePhone = input.F_DrivePhone;//电话号码
5356
                 model.F_DrivePhone = input.F_DrivePhone;//电话号码
5979
                     {
5982
                     {
5980
                         if (!model.F_SuperiorOpinion.Trim().Contains(Supercont.Trim()))
5983
                         if (!model.F_SuperiorOpinion.Trim().Contains(Supercont.Trim()))
5981
                         {
5984
                         {
5982
-                            model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? strconts1 : model.F_SuperiorOpinion + strconts1;
5985
+                            //model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? strconts1 : model.F_SuperiorOpinion + strconts1;
5986
+                            model.F_SuperiorOpinion = Supercont.Trim();
5983
                         }
5987
                         }
5984
                     }
5988
                     }
5985
                     else if (flag == 2)
5989
                     else if (flag == 2)
5986
                     {
5990
                     {
5987
                         if (!model.F_SuperiorOpinion2.Trim().Contains(Supercont.Trim()))
5991
                         if (!model.F_SuperiorOpinion2.Trim().Contains(Supercont.Trim()))
5988
                         {
5992
                         {
5989
-                            model.F_SuperiorOpinion2 = string.IsNullOrEmpty(model.F_SuperiorOpinion2) ? strconts1 : model.F_SuperiorOpinion2 + strconts1;
5993
+                            model.F_SuperiorOpinion2 = Supercont.Trim();
5990
                         }
5994
                         }
5991
                     }
5995
                     }
5992
                 }
5996
                 }
7407
                     {
7411
                     {
7408
                         if (!model.F_SuperiorOpinion.Trim().Contains(cont.Trim()))
7412
                         if (!model.F_SuperiorOpinion.Trim().Contains(cont.Trim()))
7409
                         {
7413
                         {
7410
-                            model.F_SuperiorOpinion = nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ") " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + cont;
7414
+                            //model.F_SuperiorOpinion = nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ") " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + cont;
7415
+                            model.F_SuperiorOpinion = cont;
7411
                         }
7416
                         }
7412
                     }
7417
                     }
7413
                     else if (flag == 2)
7418
                     else if (flag == 2)
7414
                     {
7419
                     {
7415
                         if (!model.F_SuperiorOpinion2.Trim().Contains(cont.Trim()))
7420
                         if (!model.F_SuperiorOpinion2.Trim().Contains(cont.Trim()))
7416
                         {
7421
                         {
7417
-                            model.F_SuperiorOpinion2 = string.IsNullOrEmpty(model.F_SuperiorOpinion2) ? strconts1 : model.F_SuperiorOpinion2 + strconts1;
7422
+                            //model.F_SuperiorOpinion2 = string.IsNullOrEmpty(model.F_SuperiorOpinion2) ? strconts1 : model.F_SuperiorOpinion2 + strconts1;
7423
+                            model.F_SuperiorOpinion2 = cont;
7418
                         }
7424
                         }
7419
                     }
7425
                     }
7420
                     //model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? cont : model.F_SuperiorOpinion + "; " + cont;
7426
                     //model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? cont : model.F_SuperiorOpinion + "; " + cont;
7857
             var res = itembll.Add(itemModel);
7863
             var res = itembll.Add(itemModel);
7858
             return res;
7864
             return res;
7859
         }
7865
         }
7866
+
7867
+        #region 客户来电
7868
+        public ActionResult GetCallList(string phone,int pageindex = 1, int pagesize = 10)
7869
+        {
7870
+            DataTable dt = new DataTable();
7871
+            string sql = " and DealType =3";
7872
+            //sql+= " and datediff(Minute,BeginTime,'" + DateTime.Now.ToString() + "')<=5 ";
7873
+            if (phone != null && phone.Trim() != "")
7874
+            {
7875
+                sql += " and CallNumber like '%" + phone + "%'";
7876
+            }
7877
+            int recordCount = 0;
7878
+            dt = BLL.PagerBLL.GetListPager(
7879
+                "T_Call_CallRecords left join T_Sys_UserAccount on UserCode=F_UserCode",
7880
+                "CallRecordsId",
7881
+                "T_Call_CallRecords.*,T_Sys_UserAccount.F_SeartGroup,(SELECT F_DeptName FROM dbo.T_Sys_Department WHERE F_DeptId = T_Sys_UserAccount.F_DeptId) AS DeptName",
7882
+                sql,
7883
+                "ORDER BY CallRecordsId desc",
7884
+                pagesize,
7885
+                pageindex,
7886
+                true,
7887
+                out recordCount);
7888
+
7889
+            dt.Columns.Add("CusName");
7890
+            dt.Columns.Add("PhoneAddress",typeof(string));
7891
+
7892
+            var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
7893
+            var users = new BLL.T_Sys_UserAccount().GetModelList("");
7894
+
7895
+            foreach (DataRow dr in dt.Rows)
7896
+            {
7897
+                string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
7898
+                if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
7899
+                {
7900
+                    var ym = config.F_ParamValue;
7901
+                    if (ym.Substring(ym.Length - 1) == "/")
7902
+                    {
7903
+                        ym = ym.Substring(0, ym.Length - 1);
7904
+                    }
7905
+                    dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
7906
+                }
7907
+                string ucode = dr["UserCode"] != null ? dr["UserCode"].ToString() : "";
7908
+                string uname = dr["UserName"] != null ? dr["UserName"].ToString() : "";
7909
+                string tephone = dr["CallNumber"] != null ? dr["CallNumber"].ToString() : "";
7910
+                if (ucode != "")
7911
+                {
7912
+                    if (uname == "")
7913
+                    {
7914
+                        var uu = users.Where(u => u.F_UserCode.Equals(ucode)).FirstOrDefault();
7915
+                        if (uu != null)
7916
+                            dr["UserName"] = uu.F_UserName;
7917
+                    }
7918
+                }
7919
+                if (!string.IsNullOrEmpty(tephone))
7920
+                {
7921
+                    //12:08 2020/2/27 过滤字段F_LegalPhone字段中的空格
7922
+                    Model.T_Cus_CustomerBaseNew cus = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='" + tephone + "'  ").FirstOrDefault();
7923
+                    Model.T_Cus_CustomerBaseNew cusll = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='0" + tephone + "'  ").FirstOrDefault();
7924
+                    if (cus != null)
7925
+                    {
7926
+                        dr["CusName"] = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='" + tephone + "'  ").FirstOrDefault().F_Legal;
7927
+                    }
7928
+                    else if (cusll != null)
7929
+                    {
7930
+                        dr["CusName"] = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='0" + tephone + "'  ").FirstOrDefault().F_Legal;
7931
+                    }
7932
+
7933
+                    var otherController = DependencyResolver.Current.GetService<CustomerNewController>();
7934
+                    var result = ((ContentResult)otherController.GetCustomerByTel(tephone)).Content.ToObject<AjaxResult>();
7935
+                    if (result.state.ToString() == "success")
7936
+                    {
7937
+                        dr["PhoneAddress"] = ((dynamic)result.data).CityaddressDes;
7938
+                    }
7939
+                    //object acre = JsonConvert.DeserializeObject<object>(GetActionResult(tephone).ToJson());
7940
+                    //dr["PhoneAddress"] = ((dynamic)acre).CityaddressDes;
7941
+                }
7942
+
7943
+            }
7944
+
7945
+            var obj = new
7946
+            {
7947
+                state = "success",
7948
+                message = "成功",
7949
+                rows = dt,
7950
+                total = recordCount
7951
+            };
7952
+
7953
+            return Content(obj.ToJson());
7954
+
7955
+        }
7956
+
7957
+        public ActionResult GetActionResult(string tel)
7958
+        {
7959
+            var otherController = DependencyResolver.Current.GetService<CustomerNewController>();
7960
+            var result = otherController.GetCustomerByTel(tel);
7961
+            return result;
7962
+        }
7963
+
7964
+        #endregion
7965
+        /// <summary>
7966
+        /// 获取记录详情
7967
+        /// </summary>
7968
+        /// <param name="callid"></param>
7969
+        /// <returns></returns>
7970
+        public ActionResult GetCallDetail(int callid)
7971
+        {
7972
+            if (callid != 0)
7973
+            {
7974
+                var model = new BLL.T_Call_CallRecords().GetModel(callid);
7975
+                Model.T_Cus_CustomerBaseNew cusmodel = null;
7976
+                if (model != null)
7977
+                {
7978
+                    string CusName = "", PhoneAddress="";
7979
+                    string tephone = model.CallNumber!= null ? model.CallNumber.ToString() : "";
7980
+                    if (!string.IsNullOrEmpty(tephone))
7981
+                    {
7982
+                        //12:08 2020/2/27 过滤字段F_LegalPhone字段中的空格
7983
+                        Model.T_Cus_CustomerBaseNew cus = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='" + tephone + "'  ").FirstOrDefault();
7984
+                        Model.T_Cus_CustomerBaseNew cusll = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='0" + tephone + "'  ").FirstOrDefault();
7985
+                        if (cus != null)
7986
+                        {
7987
+                            cusmodel = cus;
7988
+                            CusName = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='" + tephone + "'  ").FirstOrDefault().F_Legal;
7989
+                        }
7990
+                        else if (cusll != null)
7991
+                        {
7992
+                            cusmodel = cusll;
7993
+                            CusName = new BLL.T_Cus_CustomerBaseNew().GetModelList(" REPLACE(F_LegalPhone,' ','') ='0" + tephone + "'  ").FirstOrDefault().F_Legal;
7994
+                        }
7995
+
7996
+                        var otherController = DependencyResolver.Current.GetService<CustomerNewController>();
7997
+                        var result = ((ContentResult)otherController.GetCustomerByTel(tephone)).Content.ToObject<AjaxResult>();
7998
+                        if (result.state.ToString() == "success")
7999
+                        {
8000
+                            PhoneAddress = ((dynamic)result.data).CityaddressDes;
8001
+                        }
8002
+                    }
8003
+                    var obj = new
8004
+                    {
8005
+                        tephone = tephone,
8006
+                        PhoneAddress= PhoneAddress,
8007
+                        CusId= cusmodel?.F_CustomerId??0,
8008
+                        CusName = CusName,
8009
+                        Province=cusmodel?.F_AddressProvince??"",
8010
+                        City = cusmodel?.F_AddressCity??"",
8011
+                        Country = cusmodel?.F_AddressCountry??"",
8012
+                        Township=cusmodel?.F_AddressTownship??""
8013
+                    };
8014
+                    return Content(obj.ToJson());
8015
+                }
8016
+                else return Error("获取失败!");
8017
+            }
8018
+            else
8019
+            {
8020
+                return Error("参数传输失败");
8021
+            }
8022
+        }
8023
+        #region  客户信息添加
8024
+        //public ActionResult CallAdd(CustomerBaseNewInput input,string OpenId)
8025
+        //{
8026
+        //    if (!string.IsNullOrEmpty(OpenId))
8027
+        //    {
8028
+        //        var otherController = DependencyResolver.Current.GetService<CustomerNewController>();
8029
+        //        var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
8030
+        //        string usercode = ua.F_UserCode;
8031
+        //        if (string.IsNullOrEmpty(input.F_LegalPhone))
8032
+        //            return Error("请输入客户电话");
8033
+        //        var sql = $" and  F_LegalPhone ='" + input.F_LegalPhone.Trim() + "'";
8034
+        //        var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
8035
+        //        if (userModel.Count() > 0)
8036
+        //        {
8037
+        //            var model = new BLL.T_Cus_CustomerBaseNew().GetModel(userModel[0].F_CustomerId);
8038
+        //            #region 保存客户基本信息                 
8039
+        //            model = otherController.inputtoobj(model, input);
8040
+        //            #endregion
8041
+        //            bool n = new BLL.T_Cus_CustomerBaseNew().Update(model);
8042
+        //            if (n)
8043
+        //            {
8044
+        //                return Success("保存成功!", model.F_CustomerId);
8045
+        //            }
8046
+        //            else
8047
+        //                return Error("保存失败!");
8048
+        //        }
8049
+        //        else
8050
+        //        {
8051
+        //            int i = 0;
8052
+        //            if (string.IsNullOrEmpty(input.F_CustomerCode))
8053
+        //            {
8054
+        //                while (true)
8055
+        //                {
8056
+        //                    if (!getunique(0, otherController.GetIntCode(i)))
8057
+        //                    {
8058
+        //                        input.F_CustomerCode = otherController.GetIntCode(i);
8059
+        //                        break;
8060
+        //                    }
8061
+        //                    else
8062
+        //                    {
8063
+        //                        i++;
8064
+        //                    }
8065
+        //                }
8066
+        //            }
8067
+        //            var model = new Model.T_Cus_CustomerBaseNew();
8068
+        //            #region 保存客户基本信息
8069
+        //            model = otherController.inputtoobj(model, input);
8070
+        //            model.F_CreateBy = usercode;
8071
+        //            model.F_CreateOn = DateTime.Now;
8072
+        //            model.F_IsDelete = 0;
8073
+        //            #endregion
8074
+        //            int n = new BLL.T_Cus_CustomerBaseNew().Add(model);
8075
+        //            if (n > 0)
8076
+        //            {
8077
+        //                return Success("新增成功!", n);
8078
+        //            }
8079
+        //            else
8080
+        //                return Error("新增失败!");
8081
+
8082
+        //        }
8083
+        //    }
8084
+        //    else
8085
+        //    {
8086
+        //        return Error("");
8087
+        //    }
8088
+
8089
+        //}
8090
+        #endregion
7860
         #region
8091
         #region
7861
         //workorder.WoBillController blcon = new WoBillController();
8092
         //workorder.WoBillController blcon = new WoBillController();
7862
         ///// <summary>
8093
         ///// <summary>
9824
 
10055
 
9825
     }
10056
     }
9826
     #endregion
10057
     #endregion
10058
+
10059
+        
10060
+
10061
+
9827
 }
10062
 }

+ 27 - 11
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

9636
         /// <param name="input"></param>
9636
         /// <param name="input"></param>
9637
         /// <returns></returns>
9637
         /// <returns></returns>
9638
         [Authority]
9638
         [Authority]
9639
-        public ActionResult EndOrder(long orderid, int isover = 0,int inoutflag=0)
9639
+        public ActionResult EndOrder(long orderid, int isover = 0, int inoutflag = 0)
9640
         {
9640
         {
9641
             int userId = CurrentUser.UserData.F_UserId;
9641
             int userId = CurrentUser.UserData.F_UserId;
9642
             if (userId != 0)
9642
             if (userId != 0)
9649
                     if (model != null)
9649
                     if (model != null)
9650
                     {
9650
                     {
9651
                         int flag = 0;
9651
                         int flag = 0;
9652
-                        var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_OptType={(int)EnumItemOpt.end} and F_WoID='{model.F_ID }' and F_WoState in({(int)EnumWorkOrderState.finish},{(int)EnumWorkOrderState.audit}) order by F_CreateTime desc").FirstOrDefault();                    
9652
+                        int itemflag = 0;
9653
+                        var itemlist = itembll.GetModelList($" F_ItemType={ (int)EnumItemType.deal} and  F_OptType={(int)EnumItemOpt.end} and F_WoID='{model.F_ID }' and F_WoState in({(int)EnumWorkOrderState.finish},{(int)EnumWorkOrderState.audit}) order by F_CreateTime desc");
9654
+                        foreach (var item in itemlist)
9655
+                        {
9656
+                            if (item.F_Type == 1 && model.F_State == 10)
9657
+                                itemflag = 1;
9658
+                            if (item.F_Type == 2 && model.F_State2 == 10)
9659
+                                itemflag = 2;
9660
+                        }
9653
                         if (isover == 1)
9661
                         if (isover == 1)
9654
                         {
9662
                         {
9655
                             if (inoutflag > 0)
9663
                             if (inoutflag > 0)
9656
                                 flag = inoutflag;
9664
                                 flag = inoutflag;
9657
                             else
9665
                             else
9658
-                                flag = Convert.ToInt32(itemlist.F_Type);
9666
+                            {
9667
+                                if (itemflag == 0)
9668
+                                    return Error("完结失败!");
9669
+                                flag = itemflag;
9670
+                            }
9659
                         }
9671
                         }
9660
 
9672
 
9661
                         var res = Overorder(ua, model, isover, flag);
9673
                         var res = Overorder(ua, model, isover, flag);
10465
                         if (!model.F_SuperiorOpinion.Trim().Contains(cont.Trim()))
10477
                         if (!model.F_SuperiorOpinion.Trim().Contains(cont.Trim()))
10466
                         {
10478
                         {
10467
                             //model.F_SuperiorOpinion = nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ") " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + cont;
10479
                             //model.F_SuperiorOpinion = nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ") " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + cont;
10468
-                            model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? strconts1 : model.F_SuperiorOpinion + strconts1;
10480
+                            //model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? strconts1 : model.F_SuperiorOpinion + strconts1;
10481
+                            model.F_SuperiorOpinion =  cont;
10469
                         }
10482
                         }
10470
                     }
10483
                     }
10471
                     else if (flag == 2)
10484
                     else if (flag == 2)
10472
                     {
10485
                     {
10473
                         if (!model.F_SuperiorOpinion2.Trim().Contains(cont.Trim()))
10486
                         if (!model.F_SuperiorOpinion2.Trim().Contains(cont.Trim()))
10474
                         {
10487
                         {
10475
-                            //model.F_SuperiorOpinion2 = nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ") " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + cont;
10476
-                            model.F_SuperiorOpinion2 = string.IsNullOrEmpty(model.F_SuperiorOpinion2) ? strconts1 : model.F_SuperiorOpinion2 + strconts1;
10488
+                            model.F_SuperiorOpinion2 = cont;
10489
+                            //model.F_SuperiorOpinion2 = string.IsNullOrEmpty(model.F_SuperiorOpinion2) ? strconts1 : model.F_SuperiorOpinion2 + strconts1;
10477
                         }
10490
                         }
10478
                     }                 
10491
                     }                 
10479
                 }
10492
                 }
10688
             if (!string.IsNullOrEmpty(input.F_ZL_ImprovementRequirements) && !model.F_ZL_ImprovementRequirements.Contains(input.F_ZL_ImprovementRequirements) )
10701
             if (!string.IsNullOrEmpty(input.F_ZL_ImprovementRequirements) && !model.F_ZL_ImprovementRequirements.Contains(input.F_ZL_ImprovementRequirements) )
10689
             {
10702
             {
10690
                string  strimprovement = str + input.F_ZL_ImprovementRequirements + ";@# ";
10703
                string  strimprovement = str + input.F_ZL_ImprovementRequirements + ";@# ";
10691
-                model.F_ZL_ImprovementRequirements = string.IsNullOrEmpty(model.F_ZL_ImprovementRequirements) ? strimprovement : model.F_ZL_ImprovementRequirements + strimprovement; //质量管理科-改进要求
10692
-                //model.F_ZL_ImprovementRequirements = input.F_ZL_ImprovementRequirements;//质量管理科-改进要求
10704
+                //model.F_ZL_ImprovementRequirements = string.IsNullOrEmpty(model.F_ZL_ImprovementRequirements) ? strimprovement : model.F_ZL_ImprovementRequirements + strimprovement; //质量管理科-改进要求
10705
+                model.F_ZL_ImprovementRequirements = input.F_ZL_ImprovementRequirements;//质量管理科-改进要求
10693
             }
10706
             }
10694
             if (!string.IsNullOrEmpty(input.F_ZL_CApprovalNo))
10707
             if (!string.IsNullOrEmpty(input.F_ZL_CApprovalNo))
10695
                 model.F_ZL_CApprovalNo = input.F_ZL_CApprovalNo;//质量管理科-对应审批工作流单号
10708
                 model.F_ZL_CApprovalNo = input.F_ZL_CApprovalNo;//质量管理科-对应审批工作流单号
10722
             if (!string.IsNullOrEmpty(input.F_EventReason) && !model.F_EventReason.Contains(input.F_EventReason))
10735
             if (!string.IsNullOrEmpty(input.F_EventReason) && !model.F_EventReason.Contains(input.F_EventReason))
10723
             {
10736
             {
10724
                 string strevent = str + input.F_EventReason + ";@# ";
10737
                 string strevent = str + input.F_EventReason + ";@# ";
10725
-                model.F_EventReason = string.IsNullOrEmpty(model.F_EventReason) ? strevent : model.F_EventReason + strevent; //质量管理科-事件原因
10738
+                //model.F_EventReason = string.IsNullOrEmpty(model.F_EventReason) ? strevent : model.F_EventReason + strevent; //质量管理科-事件原因
10739
+                model.F_EventReason = input.F_EventReason; //质量管理科-事件原因
10726
             }
10740
             }
10727
             if (!string.IsNullOrEmpty(input.F_DrivePhone))
10741
             if (!string.IsNullOrEmpty(input.F_DrivePhone))
10728
                 model.F_DrivePhone = input.F_DrivePhone;//电话号码
10742
                 model.F_DrivePhone = input.F_DrivePhone;//电话号码
10956
                     {
10970
                     {
10957
                         if (!model.F_SuperiorOpinion.Trim().Contains(Supercont.Trim()))
10971
                         if (!model.F_SuperiorOpinion.Trim().Contains(Supercont.Trim()))
10958
                         {
10972
                         {
10959
-                            model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? strconts1 : model.F_SuperiorOpinion + strconts1;
10973
+                            //model.F_SuperiorOpinion = string.IsNullOrEmpty(model.F_SuperiorOpinion) ? strconts1 : model.F_SuperiorOpinion + strconts1;
10974
+                            model.F_SuperiorOpinion = Supercont;
10960
                         }
10975
                         }
10961
                     }
10976
                     }
10962
                     else if (flag == 2)
10977
                     else if (flag == 2)
10963
                     {
10978
                     {
10964
                         if (!model.F_SuperiorOpinion2.Trim().Contains(Supercont.Trim()))
10979
                         if (!model.F_SuperiorOpinion2.Trim().Contains(Supercont.Trim()))
10965
                         {
10980
                         {
10966
-                            model.F_SuperiorOpinion2 = string.IsNullOrEmpty(model.F_SuperiorOpinion2) ? strconts1 : model.F_SuperiorOpinion2 + strconts1;
10981
+                            //model.F_SuperiorOpinion2 = string.IsNullOrEmpty(model.F_SuperiorOpinion2) ? strconts1 : model.F_SuperiorOpinion2 + strconts1;
10982
+                            model.F_SuperiorOpinion2 = Supercont;
10967
                         }
10983
                         }
10968
                     }
10984
                     }
10969
 
10985