duhongyu 3 yıl önce
ebeveyn
işleme
a1d0a2a82a

+ 7 - 11
RMYY_CallCenter_Api/Controllers/HomeController.cs

@@ -152,17 +152,13 @@ namespace RMYY_CallCenter_Api.Controllers
152 152
                 sql += " and datediff(day,T_time,'" + starttime + "')<=0";
153 153
             if (endtime.Trim() != "" && endtime != "undefined")
154 154
                 sql += " and datediff(day,T_time,'" + endtime + "')>=0";
155
-            string cols = "(select top 1  LoginTime from  rep_agentState_Duration  where LoginTime>=a.T_time  and LoginTime<= " +
156
-                "isnull((select top 1T_time from  T_Sys_Login_Logs where  " +
157
-                "T_usercode=a.T_usercode and T_time >a .T_time order by T_time  ),GETDATE())   and AgentID=a.T_usercode)as LoginTime," +
158
-                "(select top 1  T_time  from  rep_agentState_Duration where LoginTime>=a.T_time  and LoginTime<= " +
159
-                "isnull((select top 1T_time from  T_Sys_Login_Logs where " +
160
-                "T_usercode=a.T_usercode and T_time >a .T_time order by T_time  ),GETDATE()) and AgentID=a.T_usercode   )as LogoutTime," +
161
-                "(select top 1  OccurTime   from  rep_agent_state where OccurTime>=a.T_time and State =2  and OccurTime<=" +
162
-                " isnull((select top 1 T_time from  T_Sys_Login_Logs where  T_usercode=a.T_usercode and T_time >a .T_time  " +
163
-                " order by T_time ),GETDATE())  and AgentID=a.T_usercode  )as IdleTime,(select top 1  OccurTime  from  rep_agent_state " +
164
-                "where OccurTime>=a.T_time and State =5  and OccurTime<= isnull((select top 1 T_time from  T_Sys_Login_Logs where " +
165
-                "T_usercode=a.T_usercode and T_time >a .T_time   order by T_time ),GETDATE())  and AgentID=a.T_usercode )as BusyTime, *";
155
+            string cols = "(select top 1  LoginTime from  rep_agentState_Duration  where LoginTime>=a.T_time  and LoginTime<=  " +
156
+                "[dbo].[GetLoginTime](a.T_id)) as LoginTime, " +
157
+                "(select top 1  T_time from  rep_agentState_Duration where LoginTime >= a.T_time  and LoginTime<= " +
158
+                " [dbo].[GetLoginTime](a.T_id))as LogoutTime," +
159
+                "(select top 1  OccurTime from  rep_agent_state where OccurTime >= a.T_time and State = 2  and OccurTime<= " +
160
+                "[dbo].[GetLoginTime](a.T_id))as IdleTime,(select top 1  OccurTime from  rep_agent_state " +
161
+                "where OccurTime >= a.T_time and State = 5  and OccurTime<=   [dbo].[GetLoginTime](a.T_id))as BusyTime, *";
166 162
             datatable = Bll.PagerBll.GetListPager
167 163
                                 ("T_Sys_Login_Logs a",
168 164
                                   "T_id",