Commit b751bbe8 authored by dkasliwal's avatar dkasliwal

Add in MFG HAlolMFG Dashboard


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98023 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e7010812
...@@ -65,7 +65,7 @@ public class BSRTransferReportSchedule implements Schedule ...@@ -65,7 +65,7 @@ public class BSRTransferReportSchedule implements Schedule
finalURI = CommonConstants.TOMCAT_HOME + uri + "&userID=" + userID; finalURI = CommonConstants.TOMCAT_HOME + uri + "&userID=" + userID;
System.out.println("direct uri from table =" + uri); System.out.println("direct uri from table =" + uri);
System.out.println("User id is =" + userID); System.out.println("User id is =" + userID);
System.out.println("Final url appended user id in URL =" + finalURI); System.out.println("Final url appended in BSRTransferReportSchedule =" + finalURI);
sendFinalURIList.add(finalURI); sendFinalURIList.add(finalURI);
} }
...@@ -78,7 +78,7 @@ public class BSRTransferReportSchedule implements Schedule ...@@ -78,7 +78,7 @@ public class BSRTransferReportSchedule implements Schedule
if (os.indexOf("win") >= 0) if (os.indexOf("win") >= 0)
{ {
System.out.println("Start Window Section part execution"); System.out.println("Start Window Section part execution in BSRTransferReportSchedule");
if (Desktop.isDesktopSupported()) if (Desktop.isDesktopSupported())
{ {
Desktop desktop = Desktop.getDesktop(); Desktop desktop = Desktop.getDesktop();
...@@ -86,10 +86,10 @@ public class BSRTransferReportSchedule implements Schedule ...@@ -86,10 +86,10 @@ public class BSRTransferReportSchedule implements Schedule
{ {
try try
{ {
System.out.println("run on browser(IE) through window machine"); System.out.println("run on browser(IE) through window machine in BSRTransferReportSchedule");
desktop.browse(new URI(resourcePath)); desktop.browse(new URI(resourcePath));
Thread.sleep(120000); Thread.sleep(150000);
System.out.println("End run on browser through window "); System.out.println("End run on browser through window in BSRTransferReportSchedule");
} catch (Exception e) } catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
...@@ -152,10 +152,10 @@ public class BSRTransferReportSchedule implements Schedule ...@@ -152,10 +152,10 @@ public class BSRTransferReportSchedule implements Schedule
try try
{ {
int second = (int) (System.currentTimeMillis() / 1000) % 60; int second = (int) (System.currentTimeMillis() / 1000) % 60;
System.out.println("View for Time when next URL are comming===" + second); System.out.println("View for Time when next URL are comming in BSRTransferReportSchedule===" + second);
Runtime.getRuntime().exec(new String[] Runtime.getRuntime().exec(new String[]
{ browserPath, resourcePath }); { browserPath, resourcePath });
Thread.sleep(120000); Thread.sleep(150000);
System.out.println("In Linex12"); System.out.println("In Linex12");
} catch (Exception e) } catch (Exception e)
{ {
......
package ibase.dashboard.mfg.bean;
import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.webitm.utility.ITMException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.awt.Desktop;
import java.net.URI;
public class HalolMFGReleaseSchedule implements Schedule
{
public String schedule(HashMap map) throws Exception
{
System.out.println(schedule((String) map.get("PROCESS_NAME")));
return schedule((String) map.get("PROCESS_NAME"));
}
public String schedule(String schedule) throws Exception
{
System.out.println("inside HalolMFGReleaseSchedule.........");
this.runSchedule();
return schedule;
}
public String schedulePriority(String arg0) throws Exception
{
return null;
}
private void runSchedule() throws ITMException
{
// Add new code on dated 10/01/2013
String sql = "";
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ConnDriver connDriver = new ConnDriver();
String userID = "";
String uri = "";
String finalURI = "";
List<String> sendFinalURIList = null;
//add new variable on dated1/02/2013
String os = System.getProperty("os.name").toLowerCase();
String browserPathForLinex = "";
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sendFinalURIList = new ArrayList<String>();
//sql = " select user_id,uri from dashboard_comp where uri like '%ProductionVsBudgetReportExport.jsp%'";
sql = "select user_id,uri from dashboard_comp where uri like '%ExportExample/GwtDashboardPage.html%'";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next())
{
userID = rs.getString("user_id").trim();
uri = rs.getString("uri").trim();
finalURI = CommonConstants.TOMCAT_HOME + uri +"&EMP_MAILCODE="+ userID;
System.out.println("direct uri from dashboard_comp for HalolMFGReleaseSchedule =" + uri);
System.out.println("User id is =" + userID);
System.out.println("Final url for HalolMFGReleaseSchedule =" + finalURI);
sendFinalURIList.add(finalURI.trim());
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if (os.indexOf("win") >= 0)
{
System.out.println("Start Window Section part execution for HalolMFGReleaseSchedule");
if (Desktop.isDesktopSupported())
{
Desktop desktop = Desktop.getDesktop();
for (String resourcePath : sendFinalURIList)
{
try
{
System.out.println("run on browser(IE) through window machine");
desktop.browse(new URI(resourcePath));
Thread.sleep(90000);
System.out.println("End run on browser through window ");
} catch (Exception e)
{
e.printStackTrace();
}
}
}
System.out.println("End of Window Machine section part execution HalolMFGReleaseSchedule");
}
/* Ended Added new code for windows palform */
if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0)
{
//browserPathForLinex ="/usr/lib/firefox/firefox";//this is my PC firefox
browserPathForLinex = "/usr/bin/firefox";
for (String resourcePath : sendFinalURIList)
{
callURL(browserPathForLinex, resourcePath); //call synchronized method
}
}
}// end try block
catch (Exception e)
{
e.printStackTrace();
} finally
{
try
{
if (conn != null)
{
if (rs != null)
rs.close();
rs = null;
if (pstmt != null)
pstmt.close();
pstmt = null;
conn.close();
conn = null;
}
conn = null;
} catch (Exception e)
{
e.printStackTrace();
System.out.println("ibase.dashboard.mfg.bean: HalolMFGReleaseSchedule :runSchedule() " + e.getMessage());
}
}
}
synchronized void callURL(String browserPath, String resourcePath)
{
try
{
int second = (int) (System.currentTimeMillis() / 1000) % 60;
System.out.println("View for Time when next URL are comming in HalolMFGReleaseSchedule===" + second);
Runtime.getRuntime().exec(new String[]
{ browserPath, resourcePath });
Thread.sleep(90000);
} catch (Exception e)
{
System.out.println("ibase.dashboard.mfg.bean: HalolMFGReleaseSchedule() " + e.getMessage());
}
}
// This method call for check null
private String checkNull(String input)
{
if (input == null)
{
input = "";
} else
{
input = input.trim();
}
return input;
}
}
...@@ -68,7 +68,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -68,7 +68,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule
finalURI = CommonConstants.TOMCAT_HOME+uri+"&userID="+userID; finalURI = CommonConstants.TOMCAT_HOME+uri+"&userID="+userID;
System.out.println("direct uri from table ="+ uri); System.out.println("direct uri from table ="+ uri);
System.out.println("User id is =" + userID); System.out.println("User id is =" + userID);
System.out.println("Final url appended user id in URL =" + finalURI); System.out.println("Final url appended in ProductionVsBudgetReportSchedule=" + finalURI);
sendFinalURIList.add(finalURI); sendFinalURIList.add(finalURI);
} }
...@@ -95,7 +95,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -95,7 +95,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule
if (os.indexOf("win") >= 0) if (os.indexOf("win") >= 0)
{ {
System.out.println("Start Window Section part execution"); System.out.println("Start Window Section part execution for ProductionVsBudgetReportSchedule");
if (Desktop.isDesktopSupported()) if (Desktop.isDesktopSupported())
{ {
Desktop desktop = Desktop.getDesktop(); Desktop desktop = Desktop.getDesktop();
...@@ -105,7 +105,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -105,7 +105,7 @@ public class ProductionVsBudgetReportSchedule implements Schedule
{ {
System.out.println("run on browser(IE) through window machine"); System.out.println("run on browser(IE) through window machine");
desktop.browse(new URI(resourcePath)); desktop.browse(new URI(resourcePath));
Thread.sleep(120000); Thread.sleep(150000);
System.out.println("End run on browser through window "); System.out.println("End run on browser through window ");
} }
catch (Exception e) catch (Exception e)
...@@ -171,11 +171,11 @@ public class ProductionVsBudgetReportSchedule implements Schedule ...@@ -171,11 +171,11 @@ public class ProductionVsBudgetReportSchedule implements Schedule
try{ try{
int second = (int)(System.currentTimeMillis() / 1000) % 60 ; int second = (int)(System.currentTimeMillis() / 1000) % 60 ;
System.out.println("View for Time when next URL are comming==="+second); System.out.println("View for Time when next URL are comming in ProductionVsBudgetReportSchedule==="+second);
Runtime.getRuntime().exec(new String[] {browserPath, resourcePath}); Runtime.getRuntime().exec(new String[] {browserPath, resourcePath});
Thread.sleep(120000); Thread.sleep(150000);
System.out.println("In Linex12"); System.out.println("In Linex12");
}catch(Exception e){System.out.println("Exception Inside callURL by synchronization method "+e.getMessage());} }catch(Exception e){System.out.println("Exception Inside when synchronization method for ProductionVsBudgetReportSchedule "+e.getMessage());}
} }
......
...@@ -189,12 +189,6 @@ public class BSRTransferReport extends ValidatorEJB implements BSRTransferReport ...@@ -189,12 +189,6 @@ public class BSRTransferReport extends ValidatorEJB implements BSRTransferReport
listDate.add(String.valueOf(i)); listDate.add(String.valueOf(i));
} }
{
xmlData.append("</country_code>");
// end of changes
System.out.println("select Final initGeoLocation inside in EJB ===" + geoLoc + "selected initUnitForm inside in java ==" + unitForm + "length of List ====" + listDate.size() + "AND Value of ===" + listDate); System.out.println("select Final initGeoLocation inside in EJB ===" + geoLoc + "selected initUnitForm inside in java ==" + unitForm + "length of List ====" + listDate.size() + "AND Value of ===" + listDate);
// sql_changesbySahul on data-130215 = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty, " + "cum_budqty , sum(day_quantity) over (partition by geo_loc, unit__form order by tran_date) " + "as cur_cumqty from ( select s.GEO_LOC,p.tran_date, t.unit__form, " + "sum(fn_qty_form(p.item_code,p.unit,t.unit__form,i.phy_attrib_6, p.quantity)) " + "as day_quantity, fn_get_pyr_cumqty( to_date(add_months(p.tran_date,-12)),s.geo_loc,t.unit__form ) " + "as pyr_cumqty, fn_get_budgetqty(p.tran_date,s.GEO_LOC,t.unit__form ) " + "as cum_budqty from dwh_production_day_events p, item i, item_type t, " + "site s where p.site_code = s.site_code and p.item_code = i.item_code " + "and i.item_type = t.item_type and p.tran_date >= ? " + "and p.tran_date <= ? " + "and p.ref_type = (case when t.item_type in('AMPOULES','BOTTLES','DROPS','INHALER','POWDER','POUCH','SUSPENSION','TUBE','VIALS','GRANULES') then 'P' when t.item_type in('CAPSULES','TABLETS',' SOFTGELCAP') then 'P' else '' end ) " + "and p.ref_ser = 'W-RCP' and s.geo_loc in(" + geoLoc + ") " + "and t.unit__form in(" + unitForm + ") group by s.GEO_LOC, p.tran_date, t.unit__form ) " + "order by geo_loc, unit__form,tran_date"; // sql_changesbySahul on data-130215 = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty, " + "cum_budqty , sum(day_quantity) over (partition by geo_loc, unit__form order by tran_date) " + "as cur_cumqty from ( select s.GEO_LOC,p.tran_date, t.unit__form, " + "sum(fn_qty_form(p.item_code,p.unit,t.unit__form,i.phy_attrib_6, p.quantity)) " + "as day_quantity, fn_get_pyr_cumqty( to_date(add_months(p.tran_date,-12)),s.geo_loc,t.unit__form ) " + "as pyr_cumqty, fn_get_budgetqty(p.tran_date,s.GEO_LOC,t.unit__form ) " + "as cum_budqty from dwh_production_day_events p, item i, item_type t, " + "site s where p.site_code = s.site_code and p.item_code = i.item_code " + "and i.item_type = t.item_type and p.tran_date >= ? " + "and p.tran_date <= ? " + "and p.ref_type = (case when t.item_type in('AMPOULES','BOTTLES','DROPS','INHALER','POWDER','POUCH','SUSPENSION','TUBE','VIALS','GRANULES') then 'P' when t.item_type in('CAPSULES','TABLETS',' SOFTGELCAP') then 'P' else '' end ) " + "and p.ref_ser = 'W-RCP' and s.geo_loc in(" + geoLoc + ") " + "and t.unit__form in(" + unitForm + ") group by s.GEO_LOC, p.tran_date, t.unit__form ) " + "order by geo_loc, unit__form,tran_date";
sql = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty, " + "cum_budqty , sum(day_quantity) over (partition by geo_loc, unit__form order by tran_date) " + "as cur_cumqty from ( select s.GEO_LOC,p.tran_date, t.unit__form, " + "sum(fn_qty_form(p.item_code,p.unit,t.unit__form,i.phy_attrib_6, p.quantity)) " + "as day_quantity, fn_get_pyr_cumqty( to_date(add_months(p.tran_date,-12)),s.geo_loc,t.unit__form ) " + "as pyr_cumqty, fn_get_budgetqty(p.tran_date,s.GEO_LOC,t.unit__form ) " + "as cum_budqty from dwh_production_day_events p, item i, item_type t, " + "site s where p.site_code = s.site_code and p.item_code = i.item_code " + "and i.item_type = t.item_type and p.tran_date >= ? " + "and p.tran_date <= ? " + "and p.ref_type = (case when t.item_type in (select trim(item_type) from item_type where unit__form is not null) then 'P' when t.item_type in (select trim(item_type) from item_type where unit__form is not null) then 'P' else '' end ) " + "and p.ref_ser = 'W-RCP' and s.geo_loc in(" + geoLoc + ") " + "and t.unit__form in(" + unitForm + ") group by s.GEO_LOC, p.tran_date, t.unit__form ) " + "order by geo_loc, unit__form,tran_date"; sql = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty, " + "cum_budqty , sum(day_quantity) over (partition by geo_loc, unit__form order by tran_date) " + "as cur_cumqty from ( select s.GEO_LOC,p.tran_date, t.unit__form, " + "sum(fn_qty_form(p.item_code,p.unit,t.unit__form,i.phy_attrib_6, p.quantity)) " + "as day_quantity, fn_get_pyr_cumqty( to_date(add_months(p.tran_date,-12)),s.geo_loc,t.unit__form ) " + "as pyr_cumqty, fn_get_budgetqty(p.tran_date,s.GEO_LOC,t.unit__form ) " + "as cum_budqty from dwh_production_day_events p, item i, item_type t, " + "site s where p.site_code = s.site_code and p.item_code = i.item_code " + "and i.item_type = t.item_type and p.tran_date >= ? " + "and p.tran_date <= ? " + "and p.ref_type = (case when t.item_type in (select trim(item_type) from item_type where unit__form is not null) then 'P' when t.item_type in (select trim(item_type) from item_type where unit__form is not null) then 'P' else '' end ) " + "and p.ref_ser = 'W-RCP' and s.geo_loc in(" + geoLoc + ") " + "and t.unit__form in(" + unitForm + ") group by s.GEO_LOC, p.tran_date, t.unit__form ) " + "order by geo_loc, unit__form,tran_date";
...@@ -294,9 +288,7 @@ public class BSRTransferReport extends ValidatorEJB implements BSRTransferReport ...@@ -294,9 +288,7 @@ public class BSRTransferReport extends ValidatorEJB implements BSRTransferReport
pstmt1 = null; pstmt1 = null;
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
// End here decr pupose for Unit_form and geo_location // End here decr pupose for Unit_form and geo_location
cntFrBudget = 0; cntFrBudget = 0;
xmlData.append("<geo_loc location=\"" + geoLocation + "\" glocdescr =\"" + geol_Descr + "\" >"); xmlData.append("<geo_loc location=\"" + geoLocation + "\" glocdescr =\"" + geol_Descr + "\" >");
xmlData.append("<unit_form unit=\"" + checkNull(rs.getString("unit__form")) + "\" unitdescr =\"" + unit_Descr + "\">"); xmlData.append("<unit_form unit=\"" + checkNull(rs.getString("unit__form")) + "\" unitdescr =\"" + unit_Descr + "\">");
...@@ -409,8 +401,7 @@ public class BSRTransferReport extends ValidatorEJB implements BSRTransferReport ...@@ -409,8 +401,7 @@ public class BSRTransferReport extends ValidatorEJB implements BSRTransferReport
xmlData.append("</unit_form>"); xmlData.append("</unit_form>");
xmlData.append("</geo_loc>"); xmlData.append("</geo_loc>");
} }
xmlData.append("</country_code>");
}
xmlData.append("</Detail>"); xmlData.append("</Detail>");
xmlData.append("</Root>"); xmlData.append("</Root>");
......
...@@ -17,4 +17,5 @@ public interface HalolMFGReleaseLocal extends ValidatorLocal ...@@ -17,4 +17,5 @@ public interface HalolMFGReleaseLocal extends ValidatorLocal
public JSONObject getSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException; public JSONObject getSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException;
public JSONObject getTBDBatch(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException; public JSONObject getTBDBatch(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException;
public JSONObject getUnreleasedSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException; public JSONObject getUnreleasedSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException;
public String getPDFByScheduler(String rptTitle,String remark,String userID , String imgName) throws RemoteException, ITMException;
} }
...@@ -16,5 +16,6 @@ public interface HalolMFGReleaseRemote extends ValidatorRemote ...@@ -16,5 +16,6 @@ public interface HalolMFGReleaseRemote extends ValidatorRemote
public JSONObject getSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException; public JSONObject getSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException;
public JSONObject getTBDBatch(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException; public JSONObject getTBDBatch(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException;
public JSONObject getUnreleasedSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException; public JSONObject getUnreleasedSummaryGrid(String dataSourceName,String month,String geoLoc) throws RemoteException, ITMException;
public String getPDFByScheduler(String rptTitle,String remark,String userID, String imgName) throws RemoteException, ITMException;
} }
...@@ -16,6 +16,6 @@ public interface ProductionVsBudgetReportRemote extends ValidatorRemote ...@@ -16,6 +16,6 @@ public interface ProductionVsBudgetReportRemote extends ValidatorRemote
public String getGeoLoCodeXmlData() throws RemoteException, ITMException; public String getGeoLoCodeXmlData() throws RemoteException, ITMException;
public String getUnitFormXmlData() throws RemoteException, ITMException; public String getUnitFormXmlData() throws RemoteException, ITMException;
public boolean getRoleValid(String userCode, String roleCode) throws RemoteException, ITMException; public boolean getRoleValid(String userCode, String roleCode) throws RemoteException, ITMException;
public String generatePDF(HashMap<String, List<String>> hashMap ,String exportPDFPath,String exportImagePath,String preyearMonth,String rptTitle,String userID) throws RemoteException, ITMException; public String generatePDF(HashMap<String, List<String>> hashMap ,String exportPDFPath,String exportImagePath,String preyearMonth,String rptTitle,String userID) throws RemoteException, ITMException;
} }
package ibase.dashboard.mfg.servlet;
import ibase.dashboard.mfg.ejb.HalolMFGReleaseRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@SuppressWarnings("serial")
public class QCBatchExportPDFServlet extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost( request, response );
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
String rptTitle ="";
String remark ="";
String userID ="";
String imgName = "";
String resultString ="";
HalolMFGReleaseRemote halolMFGReleaseRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
System.out.println(" ENTER - QCBatchExportPDFServlet ***********************");
try
{
response.setContentType("application/xml");
userID = request.getParameter("userID");
rptTitle = request.getParameter("rptTitle");
remark = request.getParameter("remark");
imgName = request.getParameter("imgNameList");
System.out.println("userID inside QCBatchExportPDFServlet====="+ userID +"---rptTitle----->"+rptTitle + "---remark--->"+remark);
// call EJB method for PDF creation*******************
context = new InitialContext(appConnectParm.getProperty());
halolMFGReleaseRemote = (HalolMFGReleaseRemote) context.lookup("ibase/HalolMFGRelease/remote");
resultString = halolMFGReleaseRemote.getPDFByScheduler(rptTitle,remark,userID,imgName);
response.setContentType("text/html");
if(resultString.equals("false"))
{
response.getWriter().write("false");
}
else
{
response.getWriter().write("true");
}
}
catch (Exception e)
{
System.out.println("Exception :QCBatchExportPDFServlet : QCBatchExportPDFServlet) :"+e.getMessage()); //$NON-NLS-1$
try
{
throw new ITMException(e);
}
catch (ITMException e1)
{
e1.printStackTrace();
}
}
finally
{
userID="";
rptTitle="";
}
}
}
\ No newline at end of file
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