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

反馈类型明细表修改,通话记录增加筛选

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

+ 54 - 16
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

106
             dt.Columns.Add("东北");
106
             dt.Columns.Add("东北");
107
             dt.Columns.Add("合计");
107
             dt.Columns.Add("合计");
108
             dt.Columns.Add("即时办结率");
108
             dt.Columns.Add("即时办结率");
109
-            dt.Columns.Add("超期数量");
110
-            dt.Columns.Add("满意数量");
111
-            dt.Columns.Add("不满意数量");
112
-            for (int i = 0; i < 5; i++)
109
+           
110
+            for (int i = 0; i < 8; i++)
113
             {
111
             {
114
                 DataRow drNew = dt.NewRow();
112
                 DataRow drNew = dt.NewRow();
115
                 switch (i)
113
                 switch (i)
129
                     case 4:
127
                     case 4:
130
                         drNew["反馈类型"] = "建议";
128
                         drNew["反馈类型"] = "建议";
131
                         break;
129
                         break;
130
+                    case 5:
131
+                        drNew["反馈类型"] = "超期数量";
132
+                        break;
133
+                    case 6:
134
+                        drNew["反馈类型"] = "满意数量";
135
+                        break;
136
+                    case 7:
137
+                        drNew["反馈类型"] = "不满意数量";
138
+                        break;
132
                 }
139
                 }
133
                 string nsg = "";
140
                 string nsg = "";
134
-                if (i > 0)
141
+                if (i > 0&& i<5)
135
                 {
142
                 {
136
                     nsg = "and F_Type=" + i;
143
                     nsg = "and F_Type=" + i;
137
                 }
144
                 }
145
+              else   if (i > 4)
146
+                {
147
+                    if (i ==5)
148
+                    {
149
+                        nsg = "and F_IsOver=" + 1;
150
+                    }
151
+                   else  if (i == 6)
152
+                    {
153
+                        nsg = "and F_VisitResult in('非常满意','满意')";
154
+                    }
155
+                    else if (i == 7)
156
+                    {
157
+                        nsg = "and F_VisitResult='不满意'";
158
+                    }
159
+                }
138
                 drNew["新乡"] = woBLL.GetModelList(sql + "and F_SalesBase='新乡'" + nsg).Count.ToString();
160
                 drNew["新乡"] = woBLL.GetModelList(sql + "and F_SalesBase='新乡'" + nsg).Count.ToString();
139
                 drNew["九江"] = woBLL.GetModelList(sql + "and F_SalesBase='九江'" + nsg).Count.ToString(); ;
161
                 drNew["九江"] = woBLL.GetModelList(sql + "and F_SalesBase='九江'" + nsg).Count.ToString(); ;
140
                 drNew["新疆"] = woBLL.GetModelList(sql + "and F_SalesBase='新疆' " + nsg).Count.ToString();
162
                 drNew["新疆"] = woBLL.GetModelList(sql + "and F_SalesBase='新疆' " + nsg).Count.ToString();
150
                 {
172
                 {
151
                     drNew["即时办结率"] = string.Format("0.00%");
173
                     drNew["即时办结率"] = string.Format("0.00%");
152
                 }
174
                 }
153
-                drNew["超期数量"] = woBLL.GetModelList(sql + "and F_IsOver=1" + nsg).Count.ToString();
154
-                drNew["满意数量"] = woBLL.GetModelList(sql + "and F_VisitResult in('非常满意','满意')" + nsg).Count.ToString();
155
-                drNew["不满意数量"] = woBLL.GetModelList(sql + "and F_VisitResult='不满意'" + nsg).Count.ToString();
156
                 dt.Rows.Add(drNew);
175
                 dt.Rows.Add(drNew);
157
             }
176
             }
158
 
177
 
189
             List<marketList> markets = new List<marketList>();
208
             List<marketList> markets = new List<marketList>();
190
 
209
 
191
 
210
 
192
-            for (int i = 0; i < 5; i++)
211
+            for (int i = 0; i < 8; i++)
193
             {
212
             {
194
                 marketList brand = new marketList();
213
                 marketList brand = new marketList();
195
                 switch (i)
214
                 switch (i)
209
                     case 4:
228
                     case 4:
210
                         brand.typename = "建议";
229
                         brand.typename = "建议";
211
                         break;
230
                         break;
231
+                    case 5:
232
+                        brand.typename = "超期数量";
233
+                        break;
234
+                    case 6:
235
+                        brand.typename = "满意数量";
236
+                        break;
237
+                    case 7:
238
+                        brand.typename = "不满意数量";
239
+                        break;
212
                 }
240
                 }
213
                 string nsg = "";
241
                 string nsg = "";
214
-                if (i > 0)
242
+                if (i > 0 && i < 5)
215
                 {
243
                 {
216
                     nsg = "and F_Type=" + i;
244
                     nsg = "and F_Type=" + i;
217
                 }
245
                 }
246
+                else if (i > 4)
247
+                {
248
+                    if (i == 5)
249
+                    {
250
+                        nsg = "and F_IsOver=" + 1;
251
+                    }
252
+                    else if (i == 6)
253
+                    {
254
+                        nsg = "and F_VisitResult in('非常满意','满意')";
255
+                    }
256
+                    else if (i == 7)
257
+                    {
258
+                        nsg = "and F_VisitResult='不满意'";
259
+                    }
260
+                }
218
 
261
 
219
                 brand.salexinxinag = woBLL.GetModelList(sql + "and F_SalesBase='新乡'" + nsg).Count;
262
                 brand.salexinxinag = woBLL.GetModelList(sql + "and F_SalesBase='新乡'" + nsg).Count;
220
                 brand.salejiujiang = woBLL.GetModelList(sql + "and F_SalesBase='九江'" + nsg).Count;
263
                 brand.salejiujiang = woBLL.GetModelList(sql + "and F_SalesBase='九江'" + nsg).Count;
231
                 {
274
                 {
232
                     brand.immediate = string.Format("0.00%");
275
                     brand.immediate = string.Format("0.00%");
233
                 }
276
                 }
234
-
235
-                brand.overdue = woBLL.GetModelList(sql + "and F_IsOver=1" + nsg).Count;
236
-
237
-                brand.satisfied = woBLL.GetModelList(sql + "and F_VisitResult in('非常满意','满意')" + nsg).Count;
238
-                brand.dissatisfied = woBLL.GetModelList(sql + "and F_VisitResult='不满意'" + nsg).Count;
239
                 markets.Add(brand);
277
                 markets.Add(brand);
240
             }
278
             }
241
 
279
 
2982
                 model.efficiency = string.Format("-{0:f2}% ", Percentile);
3020
                 model.efficiency = string.Format("-{0:f2}% ", Percentile);
2983
                 modelList.Add(model);
3021
                 modelList.Add(model);
2984
             }
3022
             }
2985
-            modelList.Sort((a, b) => a.number .CompareTo(b.number ));
3023
+            modelList.Sort((a, b) => b .number .CompareTo(a .number ));
2986
             var obj = new
3024
             var obj = new
2987
             {
3025
             {
2988
                 state = "success",
3026
                 state = "success",

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

256
                         string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
256
                         string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
257
                         string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
257
                         string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
258
 
258
 
259
-                        string strpageindex = RequestString.GetQueryString("page");
259
+                        string strpageindex = RequestString.GetQueryString("pageindex");
260
                         int pageindex = 1;
260
                         int pageindex = 1;
261
                         string strpagesize = RequestString.GetQueryString("pagesize");
261
                         string strpagesize = RequestString.GetQueryString("pagesize");
262
                         int pagesize = 10;
262
                         int pagesize = 10;

+ 6 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallrecordsController.cs

39
             string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
39
             string starttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));
40
             string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
40
             string endtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));
41
             string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
41
             string dept = HttpUtility.UrlDecode(RequestString.GetQueryString("dept"));
42
-
42
+            string depttype = HttpUtility.UrlDecode(RequestString.GetQueryString("depttype"));
43
+            
43
             string strpageindex = RequestString.GetQueryString("page");
44
             string strpageindex = RequestString.GetQueryString("page");
44
             int pageindex = 1;
45
             int pageindex = 1;
45
             string strpagesize = RequestString.GetQueryString("pagesize");
46
             string strpagesize = RequestString.GetQueryString("pagesize");
131
             {
132
             {
132
                 sql += " and CallState='" + callstate + "'";
133
                 sql += " and CallState='" + callstate + "'";
133
             }
134
             }
135
+            if (depttype .Trim() != "")
136
+            {
137
+                sql += " and DealType='" + depttype + "'";
138
+            }
134
             if (calltype.Trim() != "")
139
             if (calltype.Trim() != "")
135
             {
140
             {
136
                 sql += " and CallType='" + calltype + "'";
141
                 sql += " and CallType='" + calltype + "'";

+ 80 - 64
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

1646
                 for (int i = 0; i < model1.Count; i++)
1646
                 for (int i = 0; i < model1.Count; i++)
1647
                 {
1647
                 {
1648
                     WorkOrderNewInput model = new WorkOrderNewInput();
1648
                     WorkOrderNewInput model = new WorkOrderNewInput();
1649
+                    Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
1649
                     if (!string.IsNullOrEmpty(model1[i].F_CustomerID))
1650
                     if (!string.IsNullOrEmpty(model1[i].F_CustomerID))
1650
                     {
1651
                     {
1651
-                       // var sql = "and  F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'";
1652
-                        //var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
1653
-                        Model.T_Cus_CustomerBaseNew cuModel = customerBaseBLL .GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
1654
-                        if (cuModel != null)
1652
+                        cuModel = customerBaseBLL .GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
1653
+                    }
1654
+                    else
1655
+                    {
1656
+                        var sql = $" and  F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'";
1657
+                        cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql).FirstOrDefault(); 
1658
+                    }
1659
+                    if (cuModel != null)
1660
+                    {
1661
+                        if (!string.IsNullOrEmpty(cuModel.F_AreaID))
1655
                         {
1662
                         {
1656
-                            if (!string.IsNullOrEmpty(cuModel.F_AreaID))
1663
+                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
1664
+                            if (pdModel != null)
1657
                             {
1665
                             {
1658
-                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
1659
-                                if (pdModel != null)
1660
-                                {
1661
-                                    model.F_AreaName = pdModel.F_DeptName;
1662
-                                }
1666
+                                model.F_AreaName = pdModel.F_DeptName;
1663
                             }
1667
                             }
1664
-                            if (!string.IsNullOrEmpty(cuModel.F_BranchID))
1668
+                        }
1669
+                        if (!string.IsNullOrEmpty(cuModel.F_BranchID))
1670
+                        {
1671
+                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
1672
+                            if (pdModel1 != null)
1665
                             {
1673
                             {
1666
-                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
1667
-                                if (pdModel1 != null)
1668
-                                {
1669
-                                    model.F_BranchName = pdModel1.F_DeptName;
1670
-                                }
1674
+                                model.F_BranchName = pdModel1.F_DeptName;
1671
                             }
1675
                             }
1672
-                            model.F_CompanyName = cuModel.F_CompanyName;//公司名称
1673
-                            model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
1674
-                            model.F_Salesman = cuModel.F_Salesman;
1675
-                            model.F_SalesPhone = cuModel.F_SalesPhone;
1676
-                            model.F_Legal = cuModel.F_Legal;
1677
-                            model.F_LegalPhone = cuModel.F_LegalPhone;
1678
-                            model.F_AddressProvince = cuModel.F_AddressProvince;
1679
-                            model.F_AddressCity = cuModel.F_AddressCity;
1680
-                            model.F_AddressCountry = cuModel.F_AddressCountry;
1681
-                            model.F_AddressTownship = cuModel.F_AddressTownship;
1682
-                            model.F_AddressFull = cuModel.F_AddressFull;
1683
-                            model.F_Brands = cuModel.F_Brands;
1684
-                            model.F_Channel = cuModel.F_Channel;
1685
-                            model.F_IsRunXLX = cuModel.F_IsRunXLX;
1686
-                            model.F_AnnualSales = cuModel.F_AnnualSales;
1687
-                            model.F_Formula = cuModel.F_Formula;
1688
-                            model.F_RaiseCrops = cuModel.F_RaiseCrops;
1689
-                            model.F_PlantingArea = cuModel.F_PlantingArea;
1690
-                            model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
1691
                         }
1676
                         }
1677
+                        model.F_CompanyName = cuModel.F_CompanyName;//公司名称
1678
+                        model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
1679
+                        model.F_Salesman = cuModel.F_Salesman;
1680
+                        model.F_SalesPhone = cuModel.F_SalesPhone;
1681
+                        model.F_Legal = cuModel.F_Legal;
1682
+                        model.F_LegalPhone = cuModel.F_LegalPhone;
1683
+                        model.F_AddressProvince = cuModel.F_AddressProvince;
1684
+                        model.F_AddressCity = cuModel.F_AddressCity;
1685
+                        model.F_AddressCountry = cuModel.F_AddressCountry;
1686
+                        model.F_AddressTownship = cuModel.F_AddressTownship;
1687
+                        model.F_AddressFull = cuModel.F_AddressFull;
1688
+                        model.F_Brands = cuModel.F_Brands;
1689
+                        model.F_Channel = cuModel.F_Channel;
1690
+                        model.F_IsRunXLX = cuModel.F_IsRunXLX;
1691
+                        model.F_AnnualSales = cuModel.F_AnnualSales;
1692
+                        model.F_Formula = cuModel.F_Formula;
1693
+                        model.F_RaiseCrops = cuModel.F_RaiseCrops;
1694
+                        model.F_PlantingArea = cuModel.F_PlantingArea;
1695
+                        model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
1692
                     }
1696
                     }
1693
-
1694
                     if (valcode(model1[i].F_MaterialID.ToString(), 11))
1697
                     if (valcode(model1[i].F_MaterialID.ToString(), 11))
1695
                     {
1698
                     {
1696
                         model.F_MaterialID =model1[i].F_MaterialID;//验证物料编码为11位纯数字
1699
                         model.F_MaterialID =model1[i].F_MaterialID;//验证物料编码为11位纯数字
2439
                 model.F_WorkOrderCode = model.F_WorkOrderCode;//工单编号
2442
                 model.F_WorkOrderCode = model.F_WorkOrderCode;//工单编号
2440
                 model.F_Source = model.F_Source.ToString();//工单来源
2443
                 model.F_Source = model.F_Source.ToString();//工单来源
2441
             }
2444
             }
2442
-            if (type == 2)
2443
-            {
2445
+           
2444
                 if (input.F_Type == 2||input.F_Type == 3)
2446
                 if (input.F_Type == 2||input.F_Type == 3)
2445
                 {
2447
                 {
2446
-                    //if (string .IsNullOrEmpty(input.F_CustomerID) )
2447
-                    //{
2448
-                    //    int i = 0;
2449
-                    //    while (true)
2450
-                    //    {
2451
-                    //        if (!getunique(0, GetCusCode(i)))
2452
-                    //        {
2453
-                    //            input.F_CustomerID = GetCusCode(i);
2454
-                    //            break;
2455
-                    //        }
2456
-                    //        else
2457
-                    //        {
2458
-                    //            i++;
2459
-                    //        }
2460
-                    //    }
2461
-                    //    var Customer = new Model.T_Cus_CustomerBaseNew();
2462
-                    //    #region 保存客户基本信息
2463
-                    //    Customer = inputtooCustomer(Customer, input);
2464
-                    //    Customer.F_CreateBy = usercode;
2465
-                    //    Customer.F_CreateOn = DateTime.Now;
2466
-                    //    Customer.F_IsDelete = 0;
2467
-                    //    #endregion
2468
-                    //    int b = customerBaseBLL.Add(Customer);
2469
-                    //}
2448
+                    if (string.IsNullOrEmpty(input.F_CustomerID))
2449
+                    {
2450
+                        var sql = $" and  F_LegalPhone  = '" + input.F_CusPhone.Trim() + "'";
2451
+                        var Customer = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql).FirstOrDefault(); ;
2452
+                        if (Customer != null)
2453
+                        {
2454
+                            model.F_CustomerID = Customer.F_CustomerCode;
2455
+                            if (!string.IsNullOrEmpty(input.F_Salesman))
2456
+                                Customer.F_Salesman = input.F_Salesman;
2457
+                            if (!string.IsNullOrEmpty(input.F_SalesPhone))
2458
+                                Customer.F_SalesPhone = input.F_SalesPhone;
2459
+                            if (!string.IsNullOrEmpty(input.F_Brands))
2460
+                                Customer.F_Brands = input.F_Brands;
2461
+                            if (!string.IsNullOrEmpty(input.F_AreaName))
2462
+                                Customer.F_AreaID = input.F_AreaName.Trim ();
2463
+                            if (!string.IsNullOrEmpty(input.F_BranchName))
2464
+                                Customer.F_BranchID = input.F_BranchName.Trim();
2465
+                            customerBaseBLL .Update(Customer);
2466
+                        }
2467
+                    }
2468
+                    else
2469
+                    {
2470
+                        var Customer = customerBaseBLL.GetModel(input.F_CustomerID.Trim());
2471
+                        if (Customer != null)
2472
+                        {
2473
+                            if (!string.IsNullOrEmpty(input.F_Salesman))
2474
+                                Customer.F_Salesman = input.F_Salesman;
2475
+                            if (!string.IsNullOrEmpty(input.F_SalesPhone))
2476
+                                Customer.F_SalesPhone = input.F_SalesPhone;
2477
+                            if (!string.IsNullOrEmpty(input.F_Brands))
2478
+                                Customer.F_Brands = input.F_Brands;
2479
+                            if (!string.IsNullOrEmpty(input.F_AreaName))
2480
+                                Customer.F_AreaID = input.F_AreaName.Trim();
2481
+                            if (!string.IsNullOrEmpty(input.F_BranchName))
2482
+                                Customer.F_BranchID = input.F_BranchName.Trim();
2483
+                            customerBaseBLL.Update(Customer);
2484
+                        }
2485
+
2486
+                    }
2470
                     if (IsMaterial(input))
2487
                     if (IsMaterial(input))
2471
                     {
2488
                     {
2472
                         if (string.IsNullOrEmpty(input.F_MaterialID))
2489
                         if (string.IsNullOrEmpty(input.F_MaterialID))
2490
                         }
2507
                         }
2491
                     }
2508
                     }
2492
                 }
2509
                 }
2493
-                
2494
-            }
2510
+          
2495
             #region 基本字段
2511
             #region 基本字段
2496
             model.F_Source = input.F_Source.ToString();//工单来源
2512
             model.F_Source = input.F_Source.ToString();//工单来源
2497
             model.F_WxOpenId = input.F_WxOpenId;
2513
             model.F_WxOpenId = input.F_WxOpenId;

+ 100 - 73
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

38
         /// </summary>
38
         /// </summary>
39
         /// <returns></returns>
39
         /// <returns></returns>
40
         public ActionResult GetList(string code, string cusname, string cusphone,string createby, string starttime, string endtime, string keywords, string companyname, string province, string city,
40
         public ActionResult GetList(string code, string cusname, string cusphone,string createby, string starttime, string endtime, string keywords, string companyname, string province, string city,
41
-            string country,string telephone, string township, string touser, int source=0,int type = 0, int state=-1, int pageindex = 1,int pagesize = 10)
41
+            string country,string telephone, string township, string touser,string strvisit,string endvisit, int source=0,int type = 0, int state=-1, int pageindex = 1,int pagesize = 10)
42
         {
42
         {
43
            
43
            
44
               int userId = CurrentUser.UserData.F_UserId;
44
               int userId = CurrentUser.UserData.F_UserId;
53
                     sql += $" and F_Source=" + source;
53
                     sql += $" and F_Source=" + source;
54
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
54
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
55
                     sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
55
                     sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
56
-                if (starttime.Trim() != "" && starttime != "undefined")
56
+                if (!string.IsNullOrEmpty(starttime))
57
                     sql += " and datediff(day,F_CreateOn,'" + starttime + "')<=0 ";
57
                     sql += " and datediff(day,F_CreateOn,'" + starttime + "')<=0 ";
58
-                if (endtime.Trim() != "" && endtime != "undefined")
58
+                if (!string.IsNullOrEmpty(endtime))
59
                     sql += " and datediff(day,F_CreateOn,'" + endtime + "')>=0   ";
59
                     sql += " and datediff(day,F_CreateOn,'" + endtime + "')>=0   ";
60
+                if (!string.IsNullOrEmpty(strvisit))
61
+                    sql += " and datediff(day,F_VisitOn,'" + strvisit + "')<=0 ";
62
+                if (!string .IsNullOrEmpty (endvisit))
63
+                    sql += " and datediff(day,F_VisitOn,'" + endvisit + "')>=0   ";
60
                 if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
64
                 if (!string.IsNullOrWhiteSpace(keywords))//关键字搜索
61
                     sql += $"  and ( F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%' ) ";
65
                     sql += $"  and ( F_CusName like '%" + keywords.Trim() + "%'or F_CusPhone like '%" + keywords.Trim() + "%' ) ";
62
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
66
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
2226
         ///综合查询列表
2230
         ///综合查询列表
2227
         /// </summary>
2231
         /// </summary>
2228
         public ActionResult GetComprehensive(string code, string cusname,string createby, string starttime, string endtime, string keywords, string cusphone, string companyname, string province, string city,
2232
         public ActionResult GetComprehensive(string code, string cusname,string createby, string starttime, string endtime, string keywords, string cusphone, string companyname, string province, string city,
2229
-            string country, string township,string category,string salebase, string touser, int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10)
2233
+            string country, string township,string category,string salebase, string touser,string visitby, string visitresult, int source = 0,int state=-1, int type = 0, int pageindex = 1, int pagesize = 10)
2230
         {
2234
         {
2231
             int userId = CurrentUser.UserData.F_UserId;
2235
             int userId = CurrentUser.UserData.F_UserId;
2232
             if (userId != 0)
2236
             if (userId != 0)
2289
                     sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
2293
                     sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
2290
                 if (!string.IsNullOrWhiteSpace(province))//乡
2294
                 if (!string.IsNullOrWhiteSpace(province))//乡
2291
                     sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
2295
                     sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
2296
+                if (!string.IsNullOrWhiteSpace(visitby))//回访人
2297
+                    sql += $" and F_VisitBy like '%" + visitby.Trim() + "%'";
2298
+                if (!string.IsNullOrWhiteSpace(visitresult))//回访结果
2299
+                    sql += $" and F_VisitResult like '%" + visitresult.Trim() + "%'";
2292
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
2300
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
2293
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
2301
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
2294
                 if (ro.F_RoleCode == "QTJS" || ro.F_RoleCode == "YWY")
2302
                 if (ro.F_RoleCode == "QTJS" || ro.F_RoleCode == "YWY")
2450
                     sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
2458
                     sql += $" and F_IncidentCountry like '%" + country.Trim() + "%'";
2451
                 if (!string.IsNullOrWhiteSpace(province))//乡
2459
                 if (!string.IsNullOrWhiteSpace(province))//乡
2452
                     sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
2460
                     sql += $" and F_IncidentTownship like '%" + township.Trim() + "%'";
2453
-                sql += $" and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
2454
-                (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + ")";
2461
+              
2455
                 sql += $" and F_IsOver=" + 1;
2462
                 sql += $" and F_IsOver=" + 1;
2456
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
2463
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
2457
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
2464
                 Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
3759
                 for (int i = 0; i < model1.Count; i++)
3766
                 for (int i = 0; i < model1.Count; i++)
3760
                 {
3767
                 {
3761
                     WorkOrderNewInput model = new WorkOrderNewInput();
3768
                     WorkOrderNewInput model = new WorkOrderNewInput();
3762
-                    if (!string .IsNullOrEmpty(model1[i].F_CustomerID))
3769
+                    Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
3770
+                    if (!string.IsNullOrEmpty(model1[i].F_CustomerID))
3763
                     {
3771
                     {
3764
-                          //  var sql = "and  F_LegalPhone ='" + model1[i ].F_CusPhone.Trim() + "'";
3765
-                          //  var userModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql);
3766
-                            Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
3767
-                            if (cuModel != null)
3768
-                            {
3769
-                            if (!string .IsNullOrEmpty (cuModel.F_AreaID))
3772
+                        cuModel = cusbll .GetModel(model1[i].F_CustomerID.ToString());//通过客户编号获取客户资料
3773
+                    }
3774
+                    else
3775
+                    {
3776
+                        var sql = $" and  F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'";
3777
+                        cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql).FirstOrDefault();
3778
+                    }
3779
+                    if (cuModel != null)
3780
+                    {
3781
+                        if (!string.IsNullOrEmpty(cuModel.F_AreaID))
3782
+                        {
3783
+                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
3784
+                            if (pdModel != null)
3770
                             {
3785
                             {
3771
-                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
3772
-                                if (pdModel != null)
3773
-                                {
3774
-                                    model.F_AreaName = pdModel.F_DeptName;
3775
-                                }
3786
+                                model.F_AreaName = pdModel.F_DeptName;
3776
                             }
3787
                             }
3777
-                               if (!string .IsNullOrEmpty (cuModel.F_BranchID))
3788
+                        }
3789
+                        if (!string.IsNullOrEmpty(cuModel.F_BranchID))
3790
+                        {
3791
+                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
3792
+                            if (pdModel1 != null)
3778
                             {
3793
                             {
3779
-                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));
3780
-                                if (pdModel1 != null)
3781
-                                {
3782
-                                    model.F_BranchName = pdModel1.F_DeptName;
3783
-                                }
3784
-                            }
3785
-                               model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
3786
-                                model.F_Salesman = cuModel.F_Salesman;
3787
-                                model.F_SalesPhone = cuModel.F_SalesPhone;
3788
-                                model.F_Legal = cuModel.F_Legal;
3789
-                                model.F_LegalPhone = cuModel.F_LegalPhone;
3790
-                                model.F_AddressProvince = cuModel.F_AddressProvince;
3791
-                                model.F_AddressCity = cuModel.F_AddressCity;
3792
-                                model.F_AddressCountry = cuModel.F_AddressCountry;
3793
-                                model.F_AddressTownship = cuModel.F_AddressTownship;
3794
-                                model.F_AddressFull = cuModel.F_AddressFull;
3795
-                                model.F_Brands = cuModel.F_Brands;
3796
-                                model.F_Channel = cuModel.F_Channel; 
3797
-                            model.F_Channel = cuModel.F_CompanyName ;
3798
-                            model.F_IsRunXLX = cuModel.F_IsRunXLX;
3799
-                                model.F_AnnualSales = cuModel.F_AnnualSales;
3800
-                                model.F_Formula = cuModel.F_Formula;
3801
-                                model.F_RaiseCrops = cuModel.F_RaiseCrops;
3802
-                                model.F_PlantingArea = cuModel.F_PlantingArea;
3803
-                                model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
3794
+                                model.F_BranchName = pdModel1.F_DeptName;
3804
                             }
3795
                             }
3796
+                        }
3797
+                        model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
3798
+                        model.F_Salesman = cuModel.F_Salesman;
3799
+                        model.F_SalesPhone = cuModel.F_SalesPhone;
3800
+                        model.F_Legal = cuModel.F_Legal;
3801
+                        model.F_LegalPhone = cuModel.F_LegalPhone;
3802
+                        model.F_AddressProvince = cuModel.F_AddressProvince;
3803
+                        model.F_AddressCity = cuModel.F_AddressCity;
3804
+                        model.F_AddressCountry = cuModel.F_AddressCountry;
3805
+                        model.F_AddressTownship = cuModel.F_AddressTownship;
3806
+                        model.F_AddressFull = cuModel.F_AddressFull;
3807
+                        model.F_Brands = cuModel.F_Brands;
3808
+                        model.F_Channel = cuModel.F_Channel;
3809
+                        model.F_Channel = cuModel.F_CompanyName;
3810
+                        model.F_IsRunXLX = cuModel.F_IsRunXLX;
3811
+                        model.F_AnnualSales = cuModel.F_AnnualSales;
3812
+                        model.F_Formula = cuModel.F_Formula;
3813
+                        model.F_RaiseCrops = cuModel.F_RaiseCrops;
3814
+                        model.F_PlantingArea = cuModel.F_PlantingArea;
3815
+                        model.F_FertilizerBrand = cuModel.F_FertilizerBrand;
3805
                     }
3816
                     }
3806
-                   
3817
+
3807
                     if (valcode(model1[i].F_MaterialID.ToString(), 11))
3818
                     if (valcode(model1[i].F_MaterialID.ToString(), 11))
3808
                     {
3819
                     {
3809
                         model.F_MaterialID = model1[i].F_MaterialID;//验证物料编码为11位纯数字
3820
                         model.F_MaterialID = model1[i].F_MaterialID;//验证物料编码为11位纯数字
4359
             dModel.F_CreateBy = usercode;
4370
             dModel.F_CreateBy = usercode;
4360
             int f = mmBLL.Add(dModel);
4371
             int f = mmBLL.Add(dModel);
4361
         }
4372
         }
4373
+      
4362
         /// <summary>
4374
         /// <summary>
4363
         /// 根据传入的对象和input的内容返回对象(添加修改使用)
4375
         /// 根据传入的对象和input的内容返回对象(添加修改使用)
4364
         /// </summary>
4376
         /// </summary>
4387
                 model.F_Source = model.F_Source.ToString();//工单来源
4399
                 model.F_Source = model.F_Source.ToString();//工单来源
4388
             }
4400
             }
4389
                 #region 基本字段
4401
                 #region 基本字段
4390
-                if (type == 2)
4391
-            {
4402
+            
4392
 
4403
 
4393
                 if (input.F_Type == 2 || input.F_Type == 3)
4404
                 if (input.F_Type == 2 || input.F_Type == 3)
4394
                 {
4405
                 {
4395
-                    //if (string .IsNullOrEmpty(input.F_CustomerID))
4396
-                    //{
4397
-                    //    int i = 0;
4398
-                    //    while (true)
4399
-                    //    {
4400
-                    //        if (!getunique(0, GetCusCode(i)))
4401
-                    //        {
4402
-                    //            input.F_CustomerID = GetCusCode(i);
4403
-                    //            break;
4404
-                    //        }
4405
-                    //        else
4406
-                    //        {
4407
-                    //            i++;
4408
-                    //        }
4409
-                    //    }
4410
-                    //    #endregion
4411
-                    //    var Customer = new Model.T_Cus_CustomerBaseNew();
4412
-                    //    #region 保存客户基本信息
4413
-                    //    Customer = inputtooCustomer(Customer, input);
4414
-                    //    Customer.F_CreateBy = usercode;
4415
-                    //    Customer.F_CreateOn = DateTime.Now;
4416
-                    //    Customer.F_IsDelete = 0;
4417
-                    //    #endregion
4418
-                    //    int b = cusbll.Add(Customer);
4419
-                    //  }
4406
+                    if (string.IsNullOrEmpty(input.F_CustomerID))
4407
+                    {
4408
+                        var sql = $" and  F_LegalPhone  = '" + input.F_CusPhone.Trim() + "'";
4409
+                        var Customer = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 " + sql).FirstOrDefault(); ;
4410
+                        if (Customer!=null )
4411
+                        {
4412
+                            model.F_CustomerID = Customer.F_CustomerCode;
4413
+                            if (!string.IsNullOrEmpty(input.F_Salesman))
4414
+                                Customer.F_Salesman = input.F_Salesman;
4415
+                            if (!string.IsNullOrEmpty(input.F_SalesPhone))
4416
+                                Customer.F_SalesPhone = input.F_SalesPhone;
4417
+                            if (!string.IsNullOrEmpty(input.F_Brands))
4418
+                                Customer.F_Brands = input.F_Brands;
4419
+                            if (!string.IsNullOrEmpty(input.F_AreaName))
4420
+                                Customer.F_AreaID = input.F_AreaName.Trim();
4421
+                            if (!string.IsNullOrEmpty(input.F_BranchName))
4422
+                                Customer.F_BranchID = input.F_BranchName.Trim();
4423
+                            cusbll.Update(Customer);
4424
+                        }
4425
+                       
4426
+
4427
+                    }
4428
+                    else
4429
+                    {
4430
+                        var Customer = cusbll.GetModel(input.F_CustomerID.Trim());
4431
+                        if (Customer!=null )
4432
+                        {
4433
+                            if (!string.IsNullOrEmpty(input.F_Salesman))
4434
+                                Customer.F_Salesman = input.F_Salesman;
4435
+                            if (!string.IsNullOrEmpty(input.F_SalesPhone))
4436
+                                Customer.F_SalesPhone = input.F_SalesPhone;
4437
+                            if (!string.IsNullOrEmpty(input.F_Brands))
4438
+                                Customer.F_Brands = input.F_Brands;
4439
+                            if (!string.IsNullOrEmpty(input.F_AreaName))
4440
+                                Customer.F_AreaID = input.F_AreaName.Trim();
4441
+                            if (!string.IsNullOrEmpty(input.F_BranchName))
4442
+                                Customer.F_BranchID = input.F_BranchName.Trim();
4443
+                            cusbll.Update(Customer);
4444
+                        }
4445
+                     
4446
+                    }
4420
                     if ( IsMaterial(input))
4447
                     if ( IsMaterial(input))
4421
                     {
4448
                     {
4422
                         if (string.IsNullOrEmpty(input.F_MaterialID))
4449
                         if (string.IsNullOrEmpty(input.F_MaterialID))
4440
                         }
4467
                         }
4441
                     }
4468
                     }
4442
                 }
4469
                 }
4443
-            }
4470
+           
4444
             #endregion
4471
             #endregion
4445
             model.F_Canal = input.F_Canal;//生产批次号
4472
             model.F_Canal = input.F_Canal;//生产批次号
4446
             model.F_Type = input.F_Type.ToString();//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)
4473
             model.F_Type = input.F_Type.ToString();//工单类型:咨询及需求、投诉、抽检、其他(其它手动输入别的点选)