Procházet zdrojové kódy

用户管理,客户档案,带出客户信息

duhongyu %!s(int64=6) %!d(string=před) roky
rodič
revize
a3a8ccc732

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

@@ -418,7 +418,6 @@ namespace CallCenterApi.Interface.Controllers
418 418
                     userAccountModel.F_SeatRight = input.SearRight;
419 419
                 if (input.Sex != null)
420 420
                     userAccountModel.F_SexFlag = input.Sex;
421
-                if (input.Remark != null)
422 421
                     userAccountModel.F_Remark = input.Remark;
423 422
                 if (input.Mobile != null)
424 423
                     userAccountModel.F_Mobile = input.Mobile;

+ 59 - 11
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -780,10 +780,6 @@ namespace CallCenterApi.Interface.Controllers.customer
780 780
 
781 781
                             if (dr["客户编号"].ToString() != "" && valcode(dr["客户编号"].ToString()))
782 782
                             {
783
-
784
-                                if (!getunphone(0, dr["客户电话"].ToString()))
785
-                                {
786
-
787 783
                                     if (!getunique(0, dr["客户编号"].ToString()))
788 784
                                     {
789 785
                                         dModel.F_CustomerCode = dr["客户编号"].ToString();
@@ -842,18 +838,70 @@ namespace CallCenterApi.Interface.Controllers.customer
842 838
                                             msg = msg + "第" + headrow + "行,导入失败<br>";
843 839
                                         }
844 840
                                     }
845
-
846 841
                                     else
847 842
                                     {
848
-                                        msg = msg + "第" + headrow + "行,客户编号重复,未导入<br>";
843
+                                    var CustomerBase = new BLL.T_Cus_CustomerBaseNew().GetModelList("F_CustomerCode='" + dr["客户编号"].ToString() + "'").FirstOrDefault  ();
844
+
845
+                                    if (CustomerBase!=null )
846
+                                    {
847
+                                        CustomerBase.F_CompanyName = dr["公司名称"].ToString();
848
+                                        Model.T_Sys_Department pdModel = departmentBLL.GetModel(dr["大区名称"].ToString());
849
+                                        if (pdModel != null)
850
+                                        {
851
+                                            CustomerBase.F_AreaID = pdModel.F_DeptId.ToString();
852
+                                        }
853
+                                        Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(dr["分公司名称"].ToString());
854
+                                        if (pdModel1 != null)
855
+                                        {
856
+                                            CustomerBase.F_BranchID = pdModel1.F_DeptId.ToString();
857
+                                        }
858
+                                        #region
859
+                                        CustomerBase.F_Salesman = dr["业务员"].ToString();
860
+                                        CustomerBase.F_SalesPhone = dr["业务员电话"].ToString();
861
+                                        CustomerBase.F_Channel = dr["渠道类型"].ToString();
862
+                                        CustomerBase.F_Credit = dr["信用等级"].ToString();
863
+                                        CustomerBase.F_Legal = dr["客户"].ToString();
864
+                                        if (!string.IsNullOrEmpty(dr["性别"].ToString()))
865
+                                        {
866
+                                            if (dr["性别"].ToString() == "女")
867
+                                            {
868
+                                                CustomerBase.F_Gender = "2";
869
+                                            }
870
+                                            else
871
+                                            {
872
+                                                CustomerBase.F_Gender = "1";
873
+                                            }
874
+                                        }
875
+                                        CustomerBase.F_LegalPhone = dr["客户电话"].ToString();
876
+                                        CustomerBase.F_AddressProvince = dr["省"].ToString();
877
+                                        CustomerBase.F_AddressCity = dr["市"].ToString();
878
+                                        CustomerBase.F_AddressCountry = dr["县"].ToString();
879
+                                        CustomerBase.F_AddressTownship = dr["乡"].ToString();
880
+                                        CustomerBase.F_AddressFull = dr["详细地址"].ToString();
881
+                                        CustomerBase.F_Brands = dr["经营品牌"].ToString();
882
+                                        CustomerBase.F_Product = dr["产品"].ToString();
883
+                                        CustomerBase.F_IsRunXLX = dr["是否经营心连心"].ToString();
884
+                                        CustomerBase.F_AnnualSales = dr["年销量"].ToString();
885
+                                        CustomerBase.F_Formula = dr["配方"].ToString();
886
+                                        CustomerBase.F_RaiseCrops = dr["种植作物"].ToString();
887
+                                        CustomerBase.F_PlantingArea = dr["种植面积"].ToString();
888
+                                        CustomerBase.F_FertilizerBrand = dr["用肥品牌"].ToString();
889
+                                        CustomerBase.F_Remark = dr["备注"].ToString();
890
+                                        var res = cusbll.Update (CustomerBase);
891
+                                        if (res)
892
+                                        {
893
+                                            addoptlog(usercode, ip, EnumOpt.import.ToString(), res.ToString(), "导入成功,导入的文件为:" + newpath + ",当前为第" + headrow + "行");
894
+                                        }
895
+                                        else
896
+                                        {
897
+                                            msg = msg + "第" + headrow + "行,导入失败<br>";
898
+                                        }
899
+                                    }
900
+
901
+
849 902
                                     }
850 903
 
851 904
 
852
-                                }
853
-                                else
854
-                                {
855
-                                    msg = msg + "第" + headrow + "行,客户电话重复,未导入<br>";
856
-                                }
857 905
 
858 906
                             }
859 907
                             else

+ 366 - 158
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

@@ -1272,30 +1272,57 @@ namespace CallCenterApi.Interface.Controllers.report
1272 1272
             foreach (var it in depts)
1273 1273
             {
1274 1274
                 DataRow drNew = dt.NewRow();
1275
-                if (!string .IsNullOrEmpty (it.F_CustomerID))
1276
-               {
1277
-                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
1278
-                    {
1279
-                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
1275
+                Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
1276
+                if (!string.IsNullOrEmpty(it.F_CustomerID))//验证客户编码为10位纯数字
1277
+                {
1278
+                    cuModel = cusbll.GetModel(it.F_CustomerID);//通过客户编号获取客户资料
1279
+                }
1280
+                else
1281
+                {
1282
+                    
1283
+                    cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 and  F_LegalPhone ='" + it.F_CusPhone.Trim() + "'").FirstOrDefault();
1284
+                }
1285
+                        
1280 1286
                         if (cuModel != null)
1281 1287
                         {
1282
-                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1283
-                            if (pdModel != null)
1284
-                            {
1285
-                                drNew["大区名称"] = pdModel.F_DeptName;
1286
-                            }
1287
-                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
1288
-                            if (pdModel1 != null)
1289
-                            {
1290
-                                drNew["分公司名称"] = pdModel1.F_DeptName;
1291
-                            }
1288
+                    if (!string.IsNullOrEmpty(cuModel.F_AreaID))
1289
+                    {
1290
+                        Model.T_Sys_Department pdModel = new T_Sys_Department();
1291
+                        try
1292
+                        {
1293
+                            pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
1294
+                        }
1295
+                        catch
1296
+                        {
1297
+                            pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1298
+                        }
1299
+
1300
+                        if (pdModel != null)
1301
+                        {
1302
+                            drNew["大区名称"] = pdModel.F_DeptName;
1303
+                        }
1304
+                    }
1305
+                    if (!string.IsNullOrEmpty(cuModel.F_BranchID))
1306
+                    {
1307
+                        Model.T_Sys_Department pdModel1 = new T_Sys_Department();
1308
+                        try
1309
+                        {
1310
+                            pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));//通过公司id获取部门
1311
+                        }
1312
+                        catch
1313
+                        {
1314
+                            pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);//通过公司id获取部门
1315
+                        }
1316
+                        if (pdModel1 != null)
1317
+                        {
1318
+                            drNew["分公司名称"] = pdModel1.F_DeptName;
1319
+                        }
1320
+                    }
1292 1321
                             drNew["业务员"] = cuModel.F_Salesman;
1293 1322
                             drNew["品牌"] = cuModel.F_Brands;
1294 1323
                             drNew["渠道类型"] = cuModel.F_Channel;
1295 1324
 
1296 1325
                         }
1297
-                    }
1298
-                }
1299 1326
                
1300 1327
                 drNew["产品"] = it.F_TS_Category;
1301 1328
                 if (it.F_Type == "1")
@@ -1434,7 +1461,7 @@ namespace CallCenterApi.Interface.Controllers.report
1434 1461
             }
1435 1462
             sql += $"  and T_Wo_WorkOrder.F_QuestionType in ( '" + GetComplaint("'化肥产品质量问题反馈','化肥服务质量问题反馈','化肥农作物长势问题反馈'") + "') "; ;
1436 1463
             sql += $"  and T_Wo_WorkOrder.F_State in ( " + (int)EnumWorkOrderState.finish + "," + (int)EnumWorkOrderState.evaluate + ") "; ;
1437
-            sql += " order by F_CreateOn desc";
1464
+           sql += " order by F_CreateOn desc";
1438 1465
             #endregion
1439 1466
             var depts = new BLL.T_Wo_WorkOrder().GetModelList(sql);
1440 1467
 
@@ -1491,34 +1518,45 @@ namespace CallCenterApi.Interface.Controllers.report
1491 1518
             foreach (var it in depts)
1492 1519
             {
1493 1520
                 DataRow drNew = dt.NewRow();
1494
-                if (!string .IsNullOrEmpty (it.F_CustomerID))
1521
+                Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew(); 
1522
+                if (!string.IsNullOrEmpty(it.F_CustomerID))//验证客户编码为10位纯数字
1495 1523
                 {
1496
-                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
1497
-                    {
1498
-                        drNew["客户编号"] = it.F_CustomerID;//
1499
-                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
1524
+                    cuModel = cusbll.GetModel(it.F_CustomerID);//通过客户编号获取客户资料
1525
+                }
1526
+                else
1527
+                {
1528
+
1529
+                    cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 and  F_LegalPhone ='" + it.F_CusPhone.Trim() + "'").FirstOrDefault();
1530
+                }
1531
+                       
1500 1532
                         if (cuModel != null)
1501 1533
                         {
1502
-                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1503
-                            if (pdModel != null)
1504
-                            {
1505
-                                drNew["大区名称"] = pdModel.F_DeptName;//
1506
-                            }
1507
-                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
1508
-                            if (pdModel1 != null)
1509
-                            {
1510
-                                drNew["分公司名称"] = pdModel1.F_DeptName;//分公司名称
1511
-                            }
1512
-                            drNew["业务员"] = cuModel.F_Salesman;//业务员
1534
+                    drNew["客户编号"] = cuModel.F_CustomerCode ;//
1535
+                    if (!string.IsNullOrEmpty(cuModel.F_AreaID))
1536
+                    {
1537
+                        Model.T_Sys_Department pdModel = new T_Sys_Department();
1538
+                        try
1539
+                        {
1540
+                            pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
1541
+                        }
1542
+                        catch
1543
+                        {
1544
+                            pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1513 1545
                         }
1514
-                    }
1515 1546
 
1516
-                }
1547
+                        if (pdModel != null)
1548
+                        {
1549
+                            drNew["大区名称"] = pdModel.F_DeptName;
1550
+                        }
1551
+                    }
1552
+                            drNew["业务员"] = cuModel.F_Salesman;//业务员
1553
+                        }
1554
+                  
1517 1555
                 if (!string .IsNullOrEmpty (it.F_MaterialID))
1518 1556
                 {
1519 1557
                     if (valcode(it.F_MaterialID.ToString(), 11))
1520 1558
                     {
1521
-                        drNew["物料编码"] = int.Parse(it.F_MaterialID);//验证物料编码为11位纯数字
1559
+                        drNew["物料编码"] = it.F_MaterialID;//验证物料编码为11位纯数字
1522 1560
                         Model.T_Wo_MaterialManage maModel = mmBLL.GetModel(it.F_MaterialID.ToString());//通过物料编码获取物料信息
1523 1561
                         if (maModel != null)
1524 1562
                         {
@@ -1758,27 +1796,54 @@ namespace CallCenterApi.Interface.Controllers.report
1758 1796
             foreach (var it in depts)
1759 1797
             {
1760 1798
                 DataRow drNew = dt.NewRow();
1761
-                if (!string .IsNullOrEmpty (it.F_CustomerID))
1799
+                Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
1800
+                if (!string.IsNullOrEmpty(it.F_CustomerID))//验证客户编码为10位纯数字
1762 1801
                 {
1763
-                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
1764
-                    {
1765
-                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
1802
+                    cuModel = cusbll.GetModel(it.F_CustomerID);//通过客户编号获取客户资料
1803
+                }
1804
+                else
1805
+                {
1806
+                    cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 and  F_LegalPhone ='" + it.F_CusPhone.Trim() + "'").FirstOrDefault();
1807
+                }
1808
+              
1766 1809
                         if (cuModel != null)
1767 1810
                         {
1768
-                            Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1769
-                            if (pdModel != null)
1770
-                            {
1771
-                                drNew["大区名称"] = pdModel.F_DeptName;//大区名称
1772
-                            }
1773
-                            Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
1774
-                            if (pdModel1 != null)
1775
-                            {
1776
-                                drNew["分公司名称"] = pdModel1.F_DeptName;//大区名称
1777
-                            }
1778
-                            drNew["品牌"] = cuModel.F_Brands;//品牌
1811
+                    if (!string.IsNullOrEmpty(cuModel.F_AreaID))
1812
+                    {
1813
+                        Model.T_Sys_Department pdModel = new T_Sys_Department();
1814
+                        try
1815
+                        {
1816
+                            pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
1817
+                        }
1818
+                        catch
1819
+                        {
1820
+                            pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1821
+                        }
1822
+
1823
+                        if (pdModel != null)
1824
+                        {
1825
+                            drNew["大区名称"] = pdModel.F_DeptName;
1779 1826
                         }
1780 1827
                     }
1781
-                }
1828
+                    if (!string.IsNullOrEmpty(cuModel.F_BranchID))
1829
+                    {
1830
+                        Model.T_Sys_Department pdModel1 = new T_Sys_Department();
1831
+                        try
1832
+                        {
1833
+                            pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));//通过公司id获取部门
1834
+                        }
1835
+                        catch
1836
+                        {
1837
+                            pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);//通过公司id获取部门
1838
+                        }
1839
+                        if (pdModel1 != null)
1840
+                        {
1841
+                            drNew["分公司名称"] = pdModel1.F_DeptName;
1842
+                        }
1843
+                    }
1844
+                    drNew["品牌"] = cuModel.F_Brands;//品牌
1845
+                        }
1846
+                  
1782 1847
                 if (!string.IsNullOrEmpty(it.F_QuestionType))
1783 1848
                 {
1784 1849
                     Model.T_Wo_QuestionManage Manage = null ;
@@ -1952,20 +2017,24 @@ question, int page = 1, int limit = 10)
1952 2017
             foreach (var it in depts)
1953 2018
             {
1954 2019
                 DataRow drNew = dt.NewRow();
1955
-                if (!string .IsNullOrEmpty (it.F_CustomerID))
2020
+                Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
2021
+                if (!string.IsNullOrEmpty(it.F_CustomerID))//验证客户编码为10位纯数字
1956 2022
                 {
1957
-                    if (valcode(it.F_CustomerID, 10))//验证客户编码为10位纯数字
1958
-                    {
1959
-
1960
-                        Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(it.F_CustomerID.ToString());//通过客户编号获取客户资料
2023
+                    cuModel = cusbll.GetModel(it.F_CustomerID);//通过客户编号获取客户资料
2024
+                }
2025
+                else
2026
+                {
2027
+                    cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 and  F_LegalPhone ='" + it.F_CusPhone.Trim() + "'").FirstOrDefault();
2028
+                }
2029
+             
2030
+                       
1961 2031
                         if (cuModel != null)
1962 2032
                         {
1963 2033
                             Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
1964 2034
 
1965 2035
                             drNew["业务员"] = cuModel.F_Salesman;//业务员
1966 2036
                         }
1967
-                    }
1968
-                }
2037
+                  
1969 2038
                 
1970 2039
                 drNew["化工产品名称"] = it.F_TS_Category;//产品
1971 2040
                 drNew["客户单位"] = it.F_CompanyName;//客户单位
@@ -2094,12 +2163,24 @@ question, int page = 1, int limit = 10)
2094 2163
             public int Totalnumber;
2095 2164
             public string Proportion;
2096 2165
         }
2097
-
2166
+        public class Comling
2167
+        {
2168
+            public string name;
2169
+            public int typeid;
2170
+            public int number;//数量
2171
+            public List<Complainthand> Complainthand;
2172
+            /// <summary>
2173
+            /// 效率提升率
2174
+            /// </summary>
2175
+            public string efficiency = "0%";//
2176
+            public List<worker> worker;
2177
+        }
2098 2178
         public class Complainthandling
2099 2179
         {
2100 2180
             public string name;
2101 2181
             public int  typeid;
2102 2182
             public int number;//数量
2183
+            public List<Complainthand> Complainthand;
2103 2184
             /// <summary>
2104 2185
             /// 用时最长
2105 2186
             /// </summary>
@@ -2130,7 +2211,11 @@ question, int page = 1, int limit = 10)
2130 2211
             public string efficiency = "0%";//
2131 2212
             public List<worker> worker;
2132 2213
         }
2133
-       
2214
+       public class Complainthand
2215
+        {
2216
+            public string name;
2217
+            public string  total="0";
2218
+        }
2134 2219
         public class Channel
2135 2220
         {
2136 2221
             public string channel;//渠道
@@ -2957,7 +3042,7 @@ question, int page = 1, int limit = 10)
2957 3042
             public string F_SalesBase;//销售基地
2958 3043
             public string F_Type;//反馈类型
2959 3044
         }
2960
-    
3045
+ 
2961 3046
         /// <summary>
2962 3047
         ///月份投诉处理周期表
2963 3048
         /// </summary>
@@ -2972,18 +3057,31 @@ question, int page = 1, int limit = 10)
2972 3057
          else if (isEnd == 2)
2973 3058
                 sql += $" and F_State =11 ";
2974 3059
             string Queststr = "";
3060
+            bool k = true;
3061
+            if (questionName != "" && questionName != "0")
3062
+            {
3063
+                try
3064
+                {
3065
+                    int a = int.Parse(questionName);
3066
+                }
3067
+                catch
3068
+                {
3069
+                    k = false;
3070
+                }
3071
+            }
2975 3072
             if (questionName!=""&& questionName!="0")
2976 3073
             {
2977 3074
                
2978
-                try
3075
+                if (k)
2979 3076
                 {
2980 3077
                     Queststr = " select * from T_Wo_QuestionManage where F_IsDelete=0 and F_Label in(3) and F_Id='" + questionName + "'";
2981 3078
                 }
2982
-                catch
3079
+                else
2983 3080
                 {
2984 3081
                     Queststr = " select * from T_Wo_QuestionManage where F_IsDelete=0 and F_Label in(3) and F_QuestionName='" + questionName + "'";
2985 3082
                 }
2986 3083
                
3084
+               
2987 3085
             }
2988 3086
             else
2989 3087
             {
@@ -3112,6 +3210,7 @@ question, int page = 1, int limit = 10)
3112 3210
                                 string timeover = "", timeover2 = ""; int x = 0, y = 0;
3113 3211
                                 var itemList = itembll.GetModelList("  F_WoID=" + it.F_ID  + " order by F_ID desc");
3114 3212
                                 if (itemList[0].F_NextDept > 0)
3213
+
3115 3214
                                 {
3116 3215
                                     var deptmodel = departmentBLL.GetModel(int.Parse(itemList[0].F_NextDept.ToString()));
3117 3216
                                     if (deptmodel != null)
@@ -3119,7 +3218,17 @@ question, int page = 1, int limit = 10)
3119 3218
                                         worker.F_Responsibility = deptmodel.F_DeptName;
3120 3219
                                     }
3121 3220
                                 }
3122
-
3221
+                                else
3222
+                                {
3223
+                                    if (itemList[0].F_WoState == 10)
3224
+                                    {
3225
+                                        var deptmodel = departmentBLL.GetModel(2);
3226
+                                        if (deptmodel != null)
3227
+                                        {
3228
+                                            worker.F_Responsibility = deptmodel.F_DeptName;
3229
+                                        }
3230
+                                    }
3231
+                                }
3123 3232
                                 int limit = it.F_limit ;
3124 3233
                                 if (itemList != null)
3125 3234
                                 {
@@ -3132,48 +3241,85 @@ question, int page = 1, int limit = 10)
3132 3241
                                                 x = z;
3133 3242
                                                 timeover = itemList[z].F_CreateTime.ToString();
3134 3243
                                                 //   limit = int.Parse(itemList[z].F_LimitTime);
3135
-                                                break; ;
3244
+                                                break ;
3136 3245
                                             }
3137 3246
                                         }
3138 3247
                                     }
3139
-                                 if (it .F_State ==10|| it.F_State == 11)
3140
-                                {
3141
-
3142
-                                    System.TimeSpan id = DateTime.Parse(it .F_DealTime .ToString ()) - DateTime.Parse(timeover);
3143
-                                    double a = id.TotalHours;
3144
-                                    worker.time = a - limit;
3145
-                                    timehource.Add((float)worker.time);
3146
-                                    if (worker.time > 24)
3248
+                                    for (int z = 0; z < itemList.Count; z++)
3147 3249
                                     {
3148
-                                        double t = worker.time / 24;
3149
-                                        double v = worker.time % 24;
3150
-                                        worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3250
+                                        if (itemList[z].F_WoState >= 1)
3251
+                                        {
3252
+                                            if (itemList[z].F_WoState == 11)
3253
+                                            {
3254
+                                                y = z;
3255
+                                                timeover2 = itemList[z].F_CreateTime.ToString();
3256
+                                                //      limit = int.Parse(itemList[z].F_LimitTime);
3257
+                                            }
3258
+                                        }
3259
+                                        if (timeover2 != "")
3260
+                                        {
3261
+                                            if (timeover != "")
3262
+                                            {
3263
+                                                if (x > y)
3264
+                                                {
3265
+                                                    System.TimeSpan id = DateTime.Parse(timeover2) - DateTime.Parse(timeover);
3266
+                                                    double a = id.TotalHours;
3267
+                                                    worker.time = a - limit;
3268
+                                                    timehource.Add((float)worker.time);
3269
+                                                    if (worker.time > 24)
3270
+                                                    {
3271
+                                                        double t = worker.time / 24;
3272
+                                                        double v = worker.time % 24;
3273
+                                                        worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3151 3274
 
3152
-                                    }
3153
-                                    else
3154
-                                    {
3155
-                                        worker.overtime = string.Format("{0:f2}h", a - limit);
3156
-                                    }
3157
-                                  }
3158
-                                 else
3159
-                                    {
3160
-                                        System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3161
-                                        double a = id.TotalHours;
3275
+                                                    }
3276
+                                                    else
3277
+                                                    {
3278
+                                                        worker.overtime = string.Format("{0:f2}h", a - limit);
3279
+                                                    }
3280
+                                                }
3281
+                                                else
3282
+                                                {
3283
+                                                    System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3284
+                                                    double a = id.TotalHours;
3285
+
3286
+                                                    worker.time = a - limit;
3287
+                                                    timehource.Add((float)worker.time);
3288
+                                                    if (worker.time > 24)
3289
+                                                    {
3290
+                                                        double t = worker.time / 24;
3291
+                                                        double v = worker.time % 24;
3292
+                                                        worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3293
+                                                    }
3294
+                                                    else
3295
+                                                    {
3296
+                                                        worker.overtime = string.Format("{0:f2}h", a - limit);
3297
+                                                    }
3298
+
3299
+                                                }
3300
+                                            }
3162 3301
 
3163
-                                        worker.time = a - limit;
3164
-                                        timehource.Add((float)worker.time);
3165
-                                        if (worker.time > 24)
3166
-                                        {
3167
-                                            double t = worker.time / 24;
3168
-                                            double v = worker.time % 24;
3169
-                                            worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3170 3302
                                         }
3171
-                                        else
3303
+                                        else if (timeover != "")
3172 3304
                                         {
3173
-                                            worker.overtime = string.Format("{0:f2}h", a - limit);
3305
+                                            System.TimeSpan id = DateTime.Now - DateTime.Parse(timeover);
3306
+                                            double a = id.TotalHours;
3307
+
3308
+                                            worker.time = a - limit;
3309
+                                            timehource.Add((float)worker.time);
3310
+                                            if (worker.time > 24)
3311
+                                            {
3312
+                                                double t = worker.time / 24;
3313
+                                                double v = worker.time % 24;
3314
+                                                worker.overtime = string.Format("{0:f0}天{1:f2}h", t, v);
3315
+                                            }
3316
+                                            else
3317
+                                            {
3318
+                                                worker.overtime = string.Format("{0:f2}h", a - limit);
3319
+                                            }
3174 3320
                                         }
3175 3321
                                     }
3176
-                                 
3322
+
3177 3323
                                 }
3178 3324
                                 if (it.F_State != 11)
3179 3325
                                     Overdue++;
@@ -3211,23 +3357,23 @@ question, int page = 1, int limit = 10)
3211 3357
                     {
3212 3358
                         timehource.Sort((a, b) => b.CompareTo(a));
3213 3359
 
3214
-                        model.ongesttime = string.Format("{0:f2}h", timehource[0]);
3215
-                        model.minimumtime = string.Format("{0:f2}h", timehource[timehource.Count - 1]);
3360
+                        model.ongesttime = string.Format("{0:f2}", timehource[0]/24);
3361
+                        model.minimumtime = string.Format("{0:f2}", timehource[timehource.Count - 1]/24);
3216 3362
                         int n = timehource.Count / 2;
3217
-                        model.median = string.Format("{0:f2}h", timehource[n]);
3363
+                        model.median = string.Format("{0:f2}", timehource[n]/24);
3218 3364
                         float y = 0;
3219 3365
                         foreach (var iu in timehource)
3220 3366
                         {
3221 3367
                             y += iu;
3222 3368
                         }
3223
-                        model.averageTime = string.Format("{0:f2}h", y / timehource.Count);
3369
+                        model.averageTime = string.Format("{0:f2}", y / timehource.Count/24);
3224 3370
                     }
3225 3371
                     else
3226 3372
                     {
3227
-                        model.ongesttime = "0h";
3228
-                        model.minimumtime = "0h";
3229
-                        model.median = "0h";
3230
-                        model.averageTime = "0h";
3373
+                        model.ongesttime = "0";
3374
+                        model.minimumtime = "0";
3375
+                        model.median = "0";
3376
+                        model.averageTime = "0";
3231 3377
                     }
3232 3378
 
3233 3379
                     model.worker.Sort((a, b) => b.time.CompareTo(a.time));
@@ -3342,7 +3488,7 @@ question, int page = 1, int limit = 10)
3342 3488
                                                         x = z;
3343 3489
                                                         timeover = itemList[z].F_CreateTime.ToString();
3344 3490
                                                         //   limit = int.Parse(itemList[z].F_LimitTime);
3345
-                                                        continue;
3491
+                                                        break ;
3346 3492
                                                     }
3347 3493
                                                 }
3348 3494
                                             }
@@ -3461,23 +3607,23 @@ question, int page = 1, int limit = 10)
3461 3607
                         {
3462 3608
                             timehource.Sort((a, b) => b.CompareTo(a));
3463 3609
 
3464
-                            model.ongesttime = string.Format("{0:f2}h", timehource[0]);
3465
-                            model.minimumtime = string.Format("{0:f2}h", timehource[timehource.Count - 1]);
3610
+                            model.ongesttime = string.Format("{0:f2}", timehource[0]/24);
3611
+                            model.minimumtime = string.Format("{0:f2}", timehource[timehource.Count - 1]/24);
3466 3612
                             int n = timehource.Count / 2;
3467
-                            model.median = string.Format("{0:f2}h", timehource[n]);
3613
+                            model.median = string.Format("{0:f2}", timehource[n]/24);
3468 3614
                             float y = 0;
3469 3615
                             foreach (var iu in timehource)
3470 3616
                             {
3471 3617
                                 y += iu;
3472 3618
                             }
3473
-                            model.averageTime = string.Format("{0:f2}h", y / timehource.Count);
3619
+                            model.averageTime = string.Format("{0:f2}", y / timehource.Count/24);
3474 3620
                         }
3475 3621
                         else
3476 3622
                         {
3477
-                            model.ongesttime = "0h";
3478
-                            model.minimumtime = "0h";
3479
-                            model.median = "0h";
3480
-                            model.averageTime = "0h";
3623
+                            model.ongesttime = "0";
3624
+                            model.minimumtime = "0";
3625
+                            model.median = "0";
3626
+                            model.averageTime = "0";
3481 3627
                         }
3482 3628
 
3483 3629
                         model.worker.Sort((a, b) => b.time.CompareTo(a.time));
@@ -3492,13 +3638,18 @@ question, int page = 1, int limit = 10)
3492 3638
 
3493 3639
                 }
3494 3640
             }
3495
-            
3496
-            modeNamelList.Sort((a, b) => b .number .CompareTo(a .number ));
3641
+            int max = 0;
3642
+            if (modeNamelList.Count >0)
3643
+            {
3644
+                modeNamelList.Sort((a, b) => b.number.CompareTo(a.number));
3645
+                max = modeNamelList.Max(t => t.number);
3646
+            }
3497 3647
             var obj = new
3498 3648
             {
3499 3649
                 state = "success",
3500 3650
                 message = "成功",
3501 3651
                 rows = modeNamelList,
3652
+                max,
3502 3653
                 total = modeNamelList.Count 
3503 3654
             };
3504 3655
 
@@ -3723,27 +3874,56 @@ question, int page = 1, int limit = 10)
3723 3874
                 for (int i = 0; i < model1.Count; i++)
3724 3875
                 {
3725 3876
                     Prescription model = new Prescription();
3726
-                    if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
3877
+                    Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
3878
+                    if (!string.IsNullOrEmpty(model1[i].F_CustomerID))//验证客户编码为10位纯数字
3727 3879
                     {
3728
-                        if (valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
3729
-                        {
3730
-                            Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
3880
+                        cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
3881
+                    }
3882
+                    else
3883
+                    {
3884
+                        cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 and  F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'").FirstOrDefault();
3885
+                    }
3886
+                 
3887
+                            
3731 3888
                             if (cuModel != null)
3732 3889
                             {
3733
-                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
3734
-                                if (pdModel != null)
3735
-                                {
3736
-                                    model.AreaName = pdModel.F_DeptName;//大区名称
3737
-                                }
3738
-                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
3739
-                                if (pdModel1 != null)
3740
-                                {
3741
-                                    model.BranchName = pdModel1.F_DeptName;//大区名称
3742
-                                }
3743
-                                model.Brands = cuModel.F_Brands;//品牌
3890
+                        if (!string.IsNullOrEmpty(cuModel.F_AreaID))
3891
+                        {
3892
+                            Model.T_Sys_Department pdModel = new T_Sys_Department();
3893
+                            try
3894
+                            {
3895
+                                pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
3896
+                            }
3897
+                            catch
3898
+                            {
3899
+                                pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
3900
+                            }
3901
+
3902
+                            if (pdModel != null)
3903
+                            {
3904
+                                model.AreaName = pdModel.F_DeptName;
3744 3905
                             }
3745 3906
                         }
3746
-                    }
3907
+                        if (!string.IsNullOrEmpty(cuModel.F_BranchID))
3908
+                        {
3909
+                            Model.T_Sys_Department pdModel1 = new T_Sys_Department();
3910
+                            try
3911
+                            {
3912
+                                pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));//通过公司id获取部门
3913
+                            }
3914
+                            catch
3915
+                            {
3916
+                                pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);//通过公司id获取部门
3917
+                            }
3918
+                            if (pdModel1 != null)
3919
+                            {
3920
+                                model.BranchName = pdModel1.F_DeptName;
3921
+                            }
3922
+                        }
3923
+                      
3924
+                                model.Brands = cuModel.F_Brands;//品牌
3925
+                            }
3926
+                       
3747 3927
                    
3748 3928
                     if (!string.IsNullOrEmpty(model1[i].F_QuestionType))
3749 3929
                     {
@@ -3916,28 +4096,56 @@ question, int page = 1, int limit = 10)
3916 4096
                 for (int i = 0; i < model1.Count; i++)
3917 4097
                 {
3918 4098
                     WorkOrderComplaint model = new WorkOrderComplaint();
3919
-                    if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
4099
+                    Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
4100
+                    if (!string.IsNullOrEmpty(model1[i].F_CustomerID))//验证客户编码为10位纯数字
3920 4101
                     {
3921
-                        if (valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
3922
-                        {
3923
-                            model.F_CustomerID = model1[i].F_CustomerID;//客户编码
3924
-                            Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
4102
+                        cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
4103
+                    }
4104
+                    else
4105
+                    {
4106
+
4107
+                        cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 and  F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'").FirstOrDefault();
4108
+                    }
4109
+                    
3925 4110
                             if (cuModel != null)
3926 4111
                             {
3927
-                                Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
3928
-                                if (pdModel != null)
3929
-                                {
3930
-                                    model.F_AreaName = pdModel.F_DeptName;//大区名称
3931
-                                }
3932
-                                Model.T_Sys_Department pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);
3933
-                                if (pdModel1 != null)
3934
-                                {
3935
-                                    model.F_BranchName = pdModel1.F_DeptName;//分公司名称
3936
-                                }
3937
-                                model.F_Salesman = cuModel.F_Salesman;//业务员
4112
+                        model.F_CustomerID = cuModel.F_CustomerCode;//客户编码
4113
+                        if (!string.IsNullOrEmpty(cuModel.F_AreaID))
4114
+                        {
4115
+                            Model.T_Sys_Department pdModel = new T_Sys_Department();
4116
+                            try
4117
+                            {
4118
+                                pdModel = departmentBLL.GetModel(int.Parse(cuModel.F_AreaID));//通过公司id获取部门
4119
+                            }
4120
+                            catch
4121
+                            {
4122
+                                pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
4123
+                            }
4124
+
4125
+                            if (pdModel != null)
4126
+                            {
4127
+                                model.F_AreaName = pdModel.F_DeptName;
3938 4128
                             }
3939 4129
                         }
3940
-                    }
4130
+                        if (!string.IsNullOrEmpty(cuModel.F_BranchID))
4131
+                        {
4132
+                            Model.T_Sys_Department pdModel1 = new T_Sys_Department();
4133
+                            try
4134
+                            {
4135
+                                pdModel1 = departmentBLL.GetModel(int.Parse(cuModel.F_BranchID));//通过公司id获取部门
4136
+                            }
4137
+                            catch
4138
+                            {
4139
+                                pdModel1 = departmentBLL.GetModel(cuModel.F_BranchID);//通过公司id获取部门
4140
+                            }
4141
+                            if (pdModel1 != null)
4142
+                            {
4143
+                                model.F_BranchName = pdModel1.F_DeptName;
4144
+                            }
4145
+                        }
4146
+                        model.F_Salesman = cuModel.F_Salesman;//业务员
4147
+                            }
4148
+                       
3941 4149
                     if (!string .IsNullOrEmpty (model1[i].F_MaterialID))
3942 4150
                     {
3943 4151
                         if (valcode(model1[i].F_MaterialID, 11))
@@ -4051,21 +4259,21 @@ question, int page = 1, int limit = 10)
4051 4259
                 for (int i = 0; i < model1.Count; i++)
4052 4260
                 {
4053 4261
                     Product model = new Product();
4054
-                    if (!string .IsNullOrEmpty (model1[i].F_CustomerID))
4262
+                    Model.T_Cus_CustomerBaseNew cuModel = new Model.T_Cus_CustomerBaseNew();
4263
+                    if (!string.IsNullOrEmpty(model1[i].F_CustomerID))//验证客户编码为10位纯数字
4055 4264
                     {
4056
-                        if (valcode(model1[i].F_CustomerID, 10))//验证客户编码为10位纯数字
4057
-                        {
4058
-
4059
-                            Model.T_Cus_CustomerBaseNew cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
4265
+                        cuModel = cusbll.GetModel(model1[i].F_CustomerID);//通过客户编号获取客户资料
4266
+                    }
4267
+                    else
4268
+                    {
4269
+                        cuModel = new BLL.T_Cus_CustomerBaseNew().GetModelList(" F_IsDelete = 0 and  F_LegalPhone ='" + model1[i].F_CusPhone.Trim() + "'").FirstOrDefault();
4270
+                    }
4060 4271
                             if (cuModel != null)
4061 4272
                             {
4062 4273
                                 Model.T_Sys_Department pdModel = departmentBLL.GetModel(cuModel.F_AreaID);//通过公司id获取部门
4063 4274
 
4064 4275
                                 model.F_Salesman = cuModel.F_Salesman;//业务员
4065 4276
                             }
4066
-                        }
4067
-                    }
4068
-                   
4069 4277
                     model.Category = model1[i].F_TS_Category;//产品
4070 4278
                     model.Company = model1[i].F_CompanyName;//客户单位
4071 4279
                     if (!string.IsNullOrEmpty(model1[i].F_BatchNumber))

+ 63 - 8
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -563,7 +563,12 @@ namespace CallCenterApi.Interface.Controllers.weixin
563 563
                 if (type > 0 && type < 5)//工单类型
564 564
                     sql += $" and F_Type=" + type;
565 565
                 if (source > 0)//工单来源
566
-                    sql += $" and F_Source=" + source;
566
+                {
567
+                    if (source == 1)
568
+                        sql += $" and F_Source in (1,'')";
569
+                    else
570
+                        sql += $" and F_Source='" + source + "'";
571
+                }
567 572
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
568 573
                     sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
569 574
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
@@ -874,7 +879,12 @@ namespace CallCenterApi.Interface.Controllers.weixin
874 879
                 if (state >= 0)//
875 880
                     sql += $" and F_State=" + state;
876 881
                 if (source > 0)//工单来源
877
-                    sql += $" and F_Source=" + source;
882
+                {
883
+                    if (source == 1)
884
+                        sql += $" and F_Source in (1,'')";
885
+                    else
886
+                        sql += $" and F_Source='" + source + "'";
887
+                }
878 888
                 if (!string.IsNullOrWhiteSpace(createby))//创建人
879 889
                     sql += $" and F_CreateBy like '%" + createby.Trim() + "%'";
880 890
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
@@ -1199,7 +1209,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
1199 1209
                 int  YCD = 0, DJD = 0, DCL = 0, DSP = 0, YCL = 0, GCDBL = 0, YBL = 0, CQGD = 0,  TD = 0,YFP=0;
1200 1210
                 for (int i = 0; i <= 9; i++)
1201 1211
                 {
1202
-                    switch (i)
1212
+               
1213
+                switch (i)
1203 1214
                     {
1204 1215
                         case 0://待接单的
1205 1216
                             sql = "";
@@ -1428,6 +1439,42 @@ namespace CallCenterApi.Interface.Controllers.weixin
1428 1439
 
1429 1440
         }
1430 1441
         /// <summary>
1442
+        /// 注解
1443
+        /// </summary>
1444
+        /// <param name="orderid"></param>
1445
+        /// <param name="cont"></param>
1446
+        /// <returns></returns>
1447
+        public ActionResult Annotation(string OpenId, int orderid, string cont)
1448
+        {
1449
+            if (!string.IsNullOrEmpty(OpenId))
1450
+            {
1451
+                var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
1452
+                if (ua != null)
1453
+                {
1454
+                    Model.T_Wo_WorkOrder model = woBLL .GetModel(orderid);
1455
+                    //验证信息 
1456
+                    if (model != null)
1457
+                    {
1458
+                        if (string.IsNullOrEmpty(model.F_Annotation))
1459
+                        {
1460
+                            model.F_Annotation = cont;
1461
+                        }
1462
+                        else
1463
+                        {
1464
+                            model.F_Annotation = model.F_Annotation + "。" + cont;
1465
+                        }
1466
+                        var res = woBLL.Update(model);
1467
+                        if (res)
1468
+                            return Success("注解成功");
1469
+                        else
1470
+                            return Error("注解失败!");
1471
+                    }
1472
+                    return Error("工单不存在");
1473
+                }
1474
+            }
1475
+            return Error("无操作权限");
1476
+        }
1477
+        /// <summary>
1431 1478
         /// 审核工单
1432 1479
         /// </summary>
1433 1480
         public ActionResult GetApproval(string OpenId, long orderid, string AuditCont, int IsAudit = 0, int AuditState = 0, float overtime = 0, int sms = 0)
@@ -1641,6 +1688,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
1641 1688
             List<WorkOrderNewInput> Input = modeltooip(modeLlist, ua);
1642 1689
             string cont = "";
1643 1690
             int dapt = 0, nextda = 0; string opt = "";
1691
+            var itemlast = itembll.GetModelList("   F_WoID='" + model.F_ID + "' order by F_ID desc").FirstOrDefault();
1692
+            int sms =(int ) itemlast.F_IsSMS;
1644 1693
             var deptmodel1 = departmentBLL.GetModel(ua.F_DeptId);
1645 1694
             if (deptmodel1 != null)
1646 1695
             {
@@ -1679,7 +1728,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
1679 1728
             }
1680 1729
             if (nextda != 0)
1681 1730
             {
1682
-                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, 0, 0, 0, 0, 0, time.ToString());
1731
+                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, model .F_limit , sms, 0, 0, 0, time.ToString());
1683 1732
                 return res;
1684 1733
             }
1685 1734
             else
@@ -2160,6 +2209,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
2160 2209
                             model.F_QuestionType = model1[i].F_QuestionType; //问题类别(投诉抽捡和咨询类别不一样)
2161 2210
                         }
2162 2211
                     }
2212
+                    model.F_Annotation = model1[i].F_Annotation; ;//注解
2163 2213
                     #region 投诉类
2164 2214
                     model.F_BatchNumber = model1[i].F_BatchNumber;//生产批次号
2165 2215
                     model.F_TS_Formula = model1[i].F_TS_Formula;// 投诉-配方
@@ -3367,7 +3417,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3367 3417
                 {
3368 3418
                     if (!string.IsNullOrEmpty(clus.F_Mobile))
3369 3419
                     {
3370
-                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(395191, mag, clus.F_Mobile);
3420
+                        SmsSingleSenderResult result = new SMSController().SMSSingleshot(445305, mag, clus.F_Mobile);
3371 3421
                         bool n = new SMSController().AddSmS(clus.F_Mobile, smsmsg, nowUser.F_UserId);
3372 3422
                     }
3373 3423
 
@@ -3394,7 +3444,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
3394 3444
                     {
3395 3445
                         if (!string.IsNullOrEmpty(l.F_Mobile))
3396 3446
                         {
3397
-                            SmsSingleSenderResult result = new SMSController().SMSSingleshot(395191, mag, l.F_Mobile);
3447
+                            SmsSingleSenderResult result = new SMSController().SMSSingleshot(445305, mag, l.F_Mobile);
3398 3448
                             bool n = new SMSController().AddSmS(l.F_Mobile, smsmsg, nowUser.F_UserId);
3399 3449
                         }
3400 3450
 
@@ -3537,7 +3587,12 @@ namespace CallCenterApi.Interface.Controllers.weixin
3537 3587
                 if (type > 0 && type < 5)//工单类型
3538 3588
                     sql += $" and F_Type=" + type;
3539 3589
                 if (source > 0)//工单来源
3540
-                    sql += $" and F_Source=" + source;
3590
+                {
3591
+                    if (source == 1)
3592
+                        sql += $" and F_Source in (1,'')";
3593
+                    else
3594
+                        sql += $" and F_Source='" + source + "'";
3595
+                }
3541 3596
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
3542 3597
                     sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
3543 3598
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
@@ -4187,7 +4242,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
4187 4242
             if (itemid > 0)
4188 4243
             {
4189 4244
                 #region 处理工单
4190
-                if (model.F_State == (int)EnumWorkOrderState.assign || model.F_State == (int)EnumWorkOrderState.abreback)
4245
+                if (deptid == 2)
4191 4246
                 {
4192 4247
                     model.F_State = (int)EnumWorkOrderState.reassign;
4193 4248
                 }

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

@@ -50,7 +50,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
50 50
                 if (type > 0 && type < 5)//工单类型
51 51
                     sql += $" and F_Type=" + type;
52 52
                 if (source > 0)//工单来源
53
-                    sql += $" and F_Source=" + source;
53
+                {
54
+                    if (source==1)
55
+                        sql += $" and F_Source in (1,'')";
56
+                    else 
57
+                    sql += $" and F_Source='" + source + "'";
58
+                }
59
+                   
54 60
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
55 61
                     sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
56 62
                 if (!string.IsNullOrEmpty(starttime))
@@ -381,7 +387,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
381 387
                     case 14://业务员工单
382 388
                         if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
383 389
                         {
384
-                            sql += $" and F_Source=" + 2;
390
+                            sql += $" and F_Source='" + 2+"'";
385 391
                         }
386 392
                         else
387 393
                         {
@@ -906,7 +912,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
906 912
                             sql += $"  F_IsDelete=0";
907 913
                             if (ro.F_RoleCode == "JDYPTZX" || ro.F_RoleCode == "JDYBZZX" || ro.F_RoleCode == "XTGLY")
908 914
                             {
909
-                                sql += $" and F_Source=" + 2;
915
+                                sql += $" and F_Source='" + 2+"'";
910 916
                             }
911 917
                             else
912 918
                             {
@@ -1395,6 +1401,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
1395 1401
             List<WorkOrderNewInput> Input = modeltooip(modeLlist);
1396 1402
             string cont = "";
1397 1403
             int dapt = 0, nextda = 0; string opt = "";
1404
+            var itemlast = itembll.GetModelList("   F_WoID='" + model.F_ID + "' order by F_ID desc").FirstOrDefault();
1405
+            int sms = (int)itemlast.F_IsSMS;
1398 1406
             var deptmodel1 = departmentBLL.GetModel(ua.F_DeptId);
1399 1407
             if (deptmodel1 != null)
1400 1408
             {
@@ -1433,7 +1441,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1433 1441
             }
1434 1442
             if (nextda != 0)
1435 1443
             {
1436
-                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, 0, 0, 0, 0, 0, time.ToString());
1444
+                var res = AssignWO(ua, model, Input[0], cont, "", nextda, 0, model .F_limit , sms, 0, 0, 0, time.ToString());
1437 1445
                 return res;
1438 1446
             }
1439 1447
             else
@@ -2274,8 +2282,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2274 2282
                 }
2275 2283
             }
2276 2284
             string str = string.Empty;
2277
-            str = "select F_WoID from T_Wo_WorkOrderItem_New where "
2278
-                     + "F_CreateUser in(" + ua + ") "
2285
+                     str = "select F_WoID from T_Wo_WorkOrderItem_New where (F_CreateUser in(" + ua + ")  or F_NextDept ='"+ user + "')"
2279 2286
                ;
2280 2287
 
2281 2288
             return str;
@@ -2558,7 +2565,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
2558 2565
                   //  
2559 2566
                 }
2560 2567
                 if (source > 0)//工单来源
2561
-                    sql += $" and F_Source=" + source;
2568
+                {
2569
+                    if (source == 1)
2570
+                        sql += $" and F_Source in (1,'')";
2571
+                    else
2572
+                        sql += $" and F_Source='" + source + "'";
2573
+                }
2562 2574
                 if (!string.IsNullOrWhiteSpace(createby))//创建人
2563 2575
                 {
2564 2576
                     string F_WorkNumber = "";
@@ -2747,7 +2759,12 @@ namespace CallCenterApi.Interface.Controllers.workorder
2747 2759
                 if (type > 0 && type < 5)//工单类型
2748 2760
                     sql += $" and F_Type=" + type;
2749 2761
                 if (source > 0)//工单来源
2750
-                    sql += $" and F_Source=" + source;
2762
+                {
2763
+                    if (source == 1)
2764
+                        sql += $" and F_Source in (1,'')";
2765
+                    else
2766
+                        sql += $" and F_Source='" + source + "'";
2767
+                }
2751 2768
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
2752 2769
                     sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
2753 2770
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
@@ -3409,8 +3426,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
3409 3426
                     sql += $" and F_Type=" + type;
3410 3427
                 if (state >= 0)//工单状态
3411 3428
                     sql += $" and F_State=" + state;
3412
-                if (source >= 0)//工单状态
3413
-                    sql += $" and F_Source=" + source;
3429
+               
3430
+                    if (source > 0)//工单来源
3431
+                    {
3432
+                        if (source == 1)
3433
+                            sql += $" and F_Source in (1,'')";
3434
+                        else
3435
+                            sql += $" and F_Source='" + source + "'";
3436
+                    }
3414 3437
                 if (!string.IsNullOrWhiteSpace(touser))//参与人
3415 3438
                     sql += $" and F_DealBy like '%" + touser.Trim() + "%'";
3416 3439
                 if (!string.IsNullOrWhiteSpace(code))//工单编号
@@ -6061,7 +6084,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
6061 6084
             if (itemid > 0)
6062 6085
             {
6063 6086
                 #region 处理工单
6064
-                if (model .F_State == (int)EnumWorkOrderState.assign|| model.F_State == (int)EnumWorkOrderState.abreback) 
6087
+                if (deptid==2)
6065 6088
                 {
6066 6089
                     model.F_State = (int)EnumWorkOrderState.reassign;
6067 6090
                 }