Commit d54b2f9f authored by sshinde's avatar sshinde

Modify SQL For WorkAllocation for performance improvement


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99879 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 614ce00d
......@@ -654,7 +654,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
if( (empCode!=null && empCode.trim().length()>0) )
{
empCode = dashboardUtility.getCommaSeparated(empCode);
sql = " SELECT E.EMP_FNAME || ' ' || E.EMP_LNAME EMPLOYEE ,I.REQ_ID, I.DTL_DESCR AS REQ_DESCR, "
/*sql = " SELECT E.EMP_FNAME || ' ' || E.EMP_LNAME EMPLOYEE ,I.REQ_ID, I.DTL_DESCR AS REQ_DESCR, "
+" I.CUST_CODE, I.CUST_NAME, SUM(I.TIME_SPENT) as time_spent ,SUM(I.EMP_TIME_SPENT) as emp_time_spent , I.PLAN_START_DATE,I.ACT_START_DATE, "
+" I.PLAN_END_DATE,I.STD_TIME,I.ACTION_DETL FROM (select d.emp_code, r.req_id, "
+" c.cust_code, c.cust_name,r.dtl_descr, "
......@@ -672,11 +672,11 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" (select fn_feedbk_time(sum(iid.time_spent)) from SER_REQ_FEEDBKDTL iid,SER_REQ_FEEDBK iih "
+" where iid.feedbk_id = iih.feedbk_id and iih.req_id = r.req_id) time_spent , "
/**Start Added by sachin on 7-Dec-15*/
*//**Start Added by sachin on 7-Dec-15*//*
+" (select fn_feedbk_time(sum(iid.time_spent)) from SER_REQ_FEEDBKDTL iid,SER_REQ_FEEDBK iih, ser_req_act_detl ad, ser_req_act ah "
+" where iid.feedbk_id = iih.feedbk_id and iih.req_id = r.req_id and ah.action_id = ad.action_id and ah.req_id = iih.req_id and "
+" iih.emp_code = ad.emp_code and iid.action_id = ad.action_id and iid.action_code = iid.action_code ) emp_time_spent "
/**Ebd Added by sachin on 7-Dec-15*/
*//**Ebd Added by sachin on 7-Dec-15*//*
+" from ser_request r, customer c, ser_req_act h, ser_req_act_detl d "
+" where d.action_id = h.action_id "
......@@ -690,8 +690,49 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
+" ) i, employee e WHERE I.EMP_CODE = E.EMP_CODE "
+" GROUP BY E.EMP_FNAME || ' ' || E.EMP_LNAME,I.REQ_ID, I.DTL_DESCR,I.CUST_CODE, I.CUST_NAME, "
+" I.PLAN_START_DATE,I.ACT_START_DATE, I.PLAN_END_DATE,i.STD_TIME,i.ACTION_DETL "
+" ORDER BY I.PLAN_END_DATE asc ";
+" ORDER BY I.PLAN_END_DATE asc ";*/
sql="Select e.emp_fname || ' ' || e.emp_lname Employee ,i.req_id, i.dtl_descr,i.cust_code, cc.cust_name, "
+" sum(i.time_spent) time_spent, sum(i.emp_time_spent) emp_time_spent, i.plan_start_date,i.act_start_date, i.plan_end_date "
+" ,I.STD_TIME,I.ACTION_DETL "
+" from ( "
+" select d.emp_code, r.req_id, r.cust_code,r.dtl_descr, "
+" (select min(di.PLANSTDATE) from ser_req_act_detl di, ser_req_act hi "
+" where hi.action_id = di.action_id "
+" and hi.req_id = r.req_id "
+" and di.emp_code = d.emp_code "
+" ) plan_start_date, d.STD_TIME,d.ACTION_DETL, "
+" (select min(fd.START_DATE_ACTUAL) from SER_REQ_FEEDBKDTL fd, SER_REQ_FEEDBK fh where fd.feedbk_id = fh.feedbk_id and fh.req_id = r.req_id and fh.emp_code = d.emp_code) act_start_date, "
+" (select max(di.PLANENDDATE) from ser_req_act_detl di, ser_req_act hi "
+" where hi.action_id = di.action_id "
+" and hi.req_id = r.req_id "
+" and di.emp_code = d.emp_code "
+" ) plan_end_date, "
+" (select fn_feedbk_time(sum(iid.time_spent)) from SER_REQ_FEEDBKDTL iid,SER_REQ_FEEDBK iih "
+" where iid.feedbk_id = iih.feedbk_id "
+" and iih.req_id = r.req_id "
+" ) time_spent, "
+" sum(emp_spent.emp_time ) emp_time_spent "
+" from ser_request r, ser_req_act h, ser_req_act_detl d, "
+" ( select iih.emp_code, iih.req_id, iid.action_id, iid.action_code, fn_feedbk_time(sum(iid.time_spent)) emp_time from SER_REQ_FEEDBKDTL iid,SER_REQ_FEEDBK iih "
+" where iid.feedbk_id = iih.feedbk_id "
+" group by iih.emp_code, iih.req_id, iid.action_id, iid.action_code) emp_spent "
+" where d.action_id = h.action_id "
+" and r.req_id = h.req_id "
+" and emp_spent.req_id = r.req_id and emp_spent.action_id = d.action_id and emp_spent.req_id = r.req_id and "
+" emp_spent.emp_code = d.emp_code and emp_spent.action_id = d.action_id and emp_spent.action_code = d.action_code "
+" and r.comp_stat <> 'C' "
+" and ((d.emp_code in (select emp_code "
+" FROM EMPLOYEE START WITH EMP_CODE = "+empCode+" "
+" CONNECT BY PRIOR EMP_CODE = REPORT_TO AND REPORT_TO IS NOT NULL AND ( RELIEVE_DATE IS NULL OR RELIEVE_DATE >= SYSDATE ) "
+" )) OR (d.emp_code="+empCode+")) "
+ dateInpute
+" group by d.emp_code, r.req_id, r.cust_code, r.dtl_descr, d.STD_TIME, d.ACTION_DETL "
+" ) i, employee e, customer cc "
+" where i.emp_code = e.emp_code "
+" and cc.cust_code = i.cust_code "
+" group by e.emp_fname || ' ' || e.emp_lname, i.req_id, i.dtl_descr, i.cust_code, cc.cust_name, i.plan_start_date, i.act_start_date, i.plan_end_date, I.STD_TIME, I.ACTION_DETL "
+" order by e.emp_fname || ' ' || e.emp_lname,i.req_id";
pstmt = conn.prepareStatement(sql);
if(dateInpute.trim().length()>0)
......@@ -707,7 +748,7 @@ public class ManagmentDashboard implements ManagmentDashboardLocal, ManagmentDas
rowData = new JSONObject();
rowData.put("employee", checkNull(rs.getString("EMPLOYEE")));
rowData.put("req_no", checkNull(rs.getString("REQ_ID")));
rowData.put("descr", checkNull(rs.getString("REQ_DESCR")));
rowData.put("descr", checkNull(rs.getString("DTL_DESCR")));
rowData.put("client", checkNull(rs.getString("CUST_NAME")));
String startDate =checkNull(rs.getString("PLAN_START_DATE"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment