Quellcode durchsuchen

承办单位筛选

duhongyu vor 3 Jahren
Ursprung
Commit
12dd3b4338

+ 23 - 36
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

433
 
433
 
434
             if (deptid != 0)
434
             if (deptid != 0)
435
             {
435
             {
436
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
437
-                #region 20190924 zhengbingbing 主办单位查询以最后办理单位为准
438
-                #endregion
436
+                sql += " and  F_MainDeptId in (select F_DeptId from  GetDeptId ('"+ deptid + "'))";
439
             }
437
             }
440
 
438
 
441
 
439
 
1331
 
1329
 
1332
             if (deptid != 0)
1330
             if (deptid != 0)
1333
             {
1331
             {
1334
-
1335
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
1336
-                #region 20190924 zhengbingbing 主办单位查询以最后办理单位为准
1337
-                #endregion
1332
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
1338
             }
1333
             }
1339
             else
1334
             else
1340
             {
1335
             {
1781
             }
1776
             }
1782
             if (deptid != 0)
1777
             if (deptid != 0)
1783
             {
1778
             {
1784
-                //sql += " and ',' + F_MainDeptID + ',' like '%," + deptid.ToString() + ",%'";
1785
-                //sql += " and isnull(F_MainDeptId,null)='" + deptid + "'";
1786
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
1787
-                #region 20190924 zhengbingbing 主办单位查询以最后办理单位为准
1788
-
1789
-                #endregion
1779
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
1790
             }
1780
             }
1791
             else
1781
             else
1792
             {
1782
             {
2269
                     {
2259
                     {
2270
                         sql += " and datediff(day,F_CreateTime,'" + strjbendtime + "')>=0   ";
2260
                         sql += " and datediff(day,F_CreateTime,'" + strjbendtime + "')>=0   ";
2271
                     }
2261
                     }
2272
-                    //if (deptid != 0)
2273
-                    //{
2274
-                    //    //sql += " and ',' + F_MainDeptID + ',' like '%," + deptid.ToString() + ",%'";
2275
-                    //    sql += " and F_MainDeptId = '" + deptid + "'";
2276
-                    //}
2262
+                  
2277
                     if (User.F_RoleCode != "GLY" && User.F_RoleCode != "ZXLDGLY" && User.F_RoleCode != "ZXLDGLYGLY" && User.F_RoleCode != "DDZG"
2263
                     if (User.F_RoleCode != "GLY" && User.F_RoleCode != "ZXLDGLY" && User.F_RoleCode != "ZXLDGLYGLY" && User.F_RoleCode != "DDZG"
2278
                         && User.F_RoleCode != "ZXLD" && User.F_RoleCode != "SPZ" && User.F_RoleCode != "SPZJZ")
2264
                         && User.F_RoleCode != "ZXLD" && User.F_RoleCode != "SPZ" && User.F_RoleCode != "SPZJZ")
2279
                     {
2265
                     {
2608
             }
2594
             }
2609
             if (deptid != 0)
2595
             if (deptid != 0)
2610
             {
2596
             {
2611
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
2597
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
2612
             }
2598
             }
2613
             else
2599
             else
2614
             {
2600
             {
2615
                 if (User.F_RoleCode == "WLDW" || User.F_RoleCode == "EJWLDW")
2601
                 if (User.F_RoleCode == "WLDW" || User.F_RoleCode == "EJWLDW")
2616
                 {
2602
                 {
2617
                     deptid = User.F_DeptId;
2603
                     deptid = User.F_DeptId;
2618
-                    sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
2604
+                    sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
2619
                 }
2605
                 }
2620
             }
2606
             }
2621
 
2607
 
3399
             }
3385
             }
3400
             if (deptid != 0)
3386
             if (deptid != 0)
3401
             {
3387
             {
3402
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
3388
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
3403
             }
3389
             }
3404
             if (ejdeptid > 0)
3390
             if (ejdeptid > 0)
3405
             {
3391
             {
3825
             }
3811
             }
3826
             if (deptid != 0)
3812
             if (deptid != 0)
3827
             {
3813
             {
3828
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
3814
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
3829
             }
3815
             }
3830
 
3816
 
3831
 
3817
 
4264
             }
4250
             }
4265
             else if (deptid != 0)
4251
             else if (deptid != 0)
4266
             {
4252
             {
4267
-                sql += " and (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
4253
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
4268
             }
4254
             }
4269
 
4255
 
4270
             sql += ") or F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo WITH(NOLOCK) where F_State=1 and F_IsDelete=0 and ISNULL(F_FeedbackTime, '')='' ";
4256
             sql += ") or F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo WITH(NOLOCK) where F_State=1 and F_IsDelete=0 and ISNULL(F_FeedbackTime, '')='' ";
4800
             }
4786
             }
4801
             if (deptid != 0)
4787
             if (deptid != 0)
4802
             {
4788
             {
4803
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
4789
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
4804
             }
4790
             }
4805
 
4791
 
4806
             if (strpageindex.Trim() != "")
4792
             if (strpageindex.Trim() != "")
5234
             }
5220
             }
5235
             if (deptid != 0)
5221
             if (deptid != 0)
5236
             {
5222
             {
5237
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
5223
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
5238
             }
5224
             }
5239
             if (strpageindex.Trim() != "")
5225
             if (strpageindex.Trim() != "")
5240
             {
5226
             {
5554
 
5540
 
5555
             if (deptid != 0)
5541
             if (deptid != 0)
5556
             {
5542
             {
5557
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
5543
+                sql += " and  (F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
5558
             }
5544
             }
5559
             if (dealtype != -1)
5545
             if (dealtype != -1)
5560
             {
5546
             {
5888
             else if (deptid != 0)
5874
             else if (deptid != 0)
5889
             {
5875
             {
5890
                 sqlwhere += " and F_LimitTime<getdate() and F_WorkState NOT IN(6,7,9)";
5876
                 sqlwhere += " and F_LimitTime<getdate() and F_WorkState NOT IN(6,7,9)";
5891
-                sqlwhere += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
5892
-                sqlwhere1 += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
5877
+                sqlwhere  += " and  F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "'))";
5878
+                sqlwhere1  += " and  F_MainDeptId in (select F_DeptId from  GetDeptId ('" + deptid + "'))";
5893
             }
5879
             }
5894
             else
5880
             else
5895
             {
5881
             {
6360
             {
6346
             {
6361
                 sql += " and F_SourceArea = '" + sourcearea + "' ";
6347
                 sql += " and F_SourceArea = '" + sourcearea + "' ";
6362
             }
6348
             }
6349
+         
6363
             if (deptid != 0)
6350
             if (deptid != 0)
6364
             {
6351
             {
6365
-                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
6352
+                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + deptid + "')) and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
6366
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
6353
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
6367
             }
6354
             }
6368
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
6355
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
6633
             }
6620
             }
6634
             if (deptid != 0)
6621
             if (deptid != 0)
6635
             {
6622
             {
6636
-                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
6623
+                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + deptid + "')) and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
6637
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
6624
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
6638
             }
6625
             }
6639
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
6626
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
6914
             }
6901
             }
6915
             if (deptid != 0)
6902
             if (deptid != 0)
6916
             {
6903
             {
6917
-                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
6904
+                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + deptid + "')) and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
6918
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
6905
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
6919
             }
6906
             }
6920
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
6907
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
7156
             }
7143
             }
7157
             if (dbdeptid > 0)
7144
             if (dbdeptid > 0)
7158
             {
7145
             {
7159
-                sql += " and F_WorkOrderId in(select F_WorkOrderId from T_Bus_AssignedInfo  WITH(NOLOCK) where  F_MainDeptId =" + dbdeptid + " )";
7146
+                sql += " and F_WorkOrderId in(select F_WorkOrderId from T_Bus_AssignedInfo  WITH(NOLOCK) where  F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + dbdeptid  + "')) )";
7160
             }
7147
             }
7161
 
7148
 
7162
             if (dealstarttime.Trim() != "" && dealstarttime != "undefined")
7149
             if (dealstarttime.Trim() != "" && dealstarttime != "undefined")
7490
             {
7477
             {
7491
                 if (deptlevel == 0)
7478
                 if (deptlevel == 0)
7492
                 {
7479
                 {
7493
-                    string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
7480
+                    string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + deptid + "')) and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
7494
                     sql += " and F_WorkOrderID in(" + sqlwhere + ")";
7481
                     sql += " and F_WorkOrderID in(" + sqlwhere + ")";
7495
                 }
7482
                 }
7496
                 else
7483
                 else
7497
                 {
7484
                 {
7498
-                    string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo_Next WITH(NOLOCK) where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
7485
+                    string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo_Next WITH(NOLOCK) where F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + deptid + "')) and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
7499
                     sql += " and F_WorkOrderID in(" + sqlwhere + ")";
7486
                     sql += " and F_WorkOrderID in(" + sqlwhere + ")";
7500
                 }
7487
                 }
7501
             }
7488
             }
7502
             if (deptid != 0)
7489
             if (deptid != 0)
7503
             {
7490
             {
7504
-                sql += " and  (F_MainDeptId = '" + deptid + "' or F_MainDeptID3='" + deptid + "')";
7491
+                sql += " and  (F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + deptid + "')) or F_MainDeptID3='" + deptid + "')";
7505
             }
7492
             }
7506
             #endregion
7493
             #endregion
7507
 
7494
 
7892
             }
7879
             }
7893
             if (deptid != 0)
7880
             if (deptid != 0)
7894
             {
7881
             {
7895
-                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
7882
+                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo WITH(NOLOCK) where F_MainDeptId  in (select F_DeptId from  GetDeptId ('" + deptid + "')) and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
7896
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
7883
                 sql += " and F_WorkOrderID in(" + sqlwhere + ")";
7897
             }
7884
             }
7898
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
7885
             if (strstarttime.Trim() != "" && strstarttime != "undefined")