Commit b6e48d19 authored by dkasliwal's avatar dkasliwal

mfg dashboard code commit


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96912 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6e829e88
package ibase.dashboard.mfg.ejb;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.json.simple.JSONObject;
@Local
public interface ProfitLossBalSheetLocal extends ValidatorLocal {
public JSONObject getProfitBalanceSheetDetails(String sitecode, String prdfrom,String prdto,String acctprd,String formatcode,String reporttype,String dataSourceName) throws RemoteException, ITMException;
public JSONObject generateReport(String siteCode,String acctPrd,String prdFrom,String prdTo, String formatCode,String reportType,String dataSourceName) throws RemoteException, ITMException;
public boolean populateSubGroup(String siteCode,String siteDescr,String titleCode,double curGroupTotal,double preGroupTotal,
double printLevel,String acctPrd,String prdFrom,String prdTo,String prevPrd,String prevPrdCodeFrom,String prevPrdCodeTo,String formatCode,
String reportType,String factor,JSONObject rawDataJson,String dataSourceName) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.ejb;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import org.json.simple.JSONObject;
@Remote
public interface ProfitLossBalSheetRemote extends ValidatorRemote{
public JSONObject getProfitBalanceSheetDetails(String sitecode, String prdfrom,String prdto,String acctprd,String formatcode,String reporttype,String dataSourceName) throws RemoteException, ITMException;
public JSONObject generateReport(String siteCode,String acctPrd,String prdFrom,String prdTo, String formatCode,String reportType,String dataSourceName) throws RemoteException, ITMException;
public boolean populateSubGroup(String siteCode,String siteDescr,String titleCode,double curGroupTotal,double preGroupTotal,
double printLevel,String acctPrd,String prdFrom,String prdTo,String prevPrd,String prevPrdCodeFrom,String prevPrdCodeTo,String formatCode,
String reportType,String factor,JSONObject rawDataJson,String dataSourceName) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.ejb;
import ibase.dashboard.Report.Utility.DashboardUtility;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
/**
* Session Bean implementation class SalesPersonSales
*/
@Stateless
public class QCSampleCost extends ValidatorEJB implements QCSampleCostLocal, QCSampleCostRemote
{
/**
* Default constructor.
*/
public QCSampleCost()
{
}
@SuppressWarnings("unchecked")
public JSONObject getQCSampleCostData(String dataSourceName, String geoLocation, String lastMonth) throws RemoteException, ITMException
{
JSONObject qcSampleCostDataJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();
Date frmDate = null;
Date toDate = null;
DashboardUtility dashbordUtil = null;
try
{
/*String[] geoLocArray = this.getSplitedStrng(geoLocation);
if (geoLocArray != null)
{
for (int i = 0; i < geoLocArray.length; i++)
{
if (i == geoLocArray.length - 1)
{
modifyGeoLoc = modifyGeoLoc + "'" + geoLocArray[i] + "'";
} else
{
modifyGeoLoc = modifyGeoLoc + "'" + geoLocArray[i] + "',";
}
}
} else
{
modifyGeoLoc="";
}*/
/*monthInInt=Integer.parseInt(lastMonth);
calendar = Calendar.getInstance();
simpleDateFormat = new SimpleDateFormat("dd-MMM-yy");
String toDate = simpleDateFormat.format(calendar.getTime());
//calendar.add(Calendar.MONTH,-monthInInt);
calendar.add(Calendar.MONTH,-6);
String fromDate = simpleDateFormat.format(calendar.getTime());*/
SimpleDateFormat convrtToTimStmDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
dashbordUtil = new DashboardUtility();
geoLocation = dashbordUtil.getCommaSeparated(geoLocation);
if(lastMonth!=null && lastMonth.trim().length()>0 )
{
Calendar cal = Calendar.getInstance();
toDate = new Date(cal.get(Calendar.YEAR) - 1900, cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
cal.get(Calendar.MONTH + 1);
cal.add(Calendar.MONTH,-(Integer.parseInt(lastMonth)));
int month = cal.get(Calendar.MONTH);
frmDate = new Date(cal.get(Calendar.YEAR) - 1900, month, cal.get(Calendar.DATE));
}
System.out.println("From date is =" + frmDate + "and to date is =" + toDate + "and geolocation is ="+geoLocation+" and lastmonth is ="+lastMonth);
if (frmDate != null && toDate != null)
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
sql = " select to_char(tran_date,'MON-YY') as qc_date , to_date('01-' || to_char(tran_date,'MON-YY')),sum(i.quantity * s.rate) as sample_cost" +
" from invtrace i, stock s, site o where o.site_code = i.site_code and s.item_code = i.item_code and s.site_code = i.site_code" +
" and s.loc_code = i.loc_code and s.lot_no = i.lot_no and s.lot_sl = i.lot_sl and i.ref_ser in ('S-ISS','W-QCS') And I.Eff_Qty < 0" + " " +
//" and o.geo_loc in ("+ modifyGeoLoc +")" +
" and tran_date between ? and ?" +
" group by to_char(tran_date,'MON-YY') " + " Order By To_Date('01-' || To_Char(Tran_Date,'MON-YY'))";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(frmDate).toString() + " 00:00:00.0"));
pstmt.setTimestamp(2,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(toDate).toString() + " 00:00:00.0"));
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
rowData.put("qc_date", checkNull(rs.getString("qc_date")));
rowData.put("sample_cost", checkNull(rs.getString("sample_cost")));
qcSampleCostDataJson.put(count, rowData);
count++;
}
}
System.out.println("json object for QCSampleCost data====" + qcSampleCostDataJson.toString());
} catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} 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 d)
{
d.printStackTrace();
System.out.println("Exception in :QCSampleCost: getQCSampleCostData(String dataSourceName, String geoLocation) throws RemoteException, ITMException:" + d.getMessage());
throw new ITMException(d);
}
}
return qcSampleCostDataJson;
}
/*private String[] getSplitedStrng(String year)
{
String[] splitedArray = null;
if (year != null && year.length() > 0)
{
splitedArray = year.split(",");
}
return splitedArray;
}*/
private String checkNull(String str)
{
if (str == null)
{
return "";
} else
{
return str;
}
}
}
package ibase.dashboard.mfg.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
import org.json.simple.JSONObject;
@Local
public interface QCSampleCostLocal extends ValidatorLocal
{
public JSONObject getQCSampleCostData(String dataSourceName,String geoLocation,String month) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
import org.json.simple.JSONObject;
@Remote
public interface QCSampleCostRemote extends ValidatorRemote
{
public JSONObject getQCSampleCostData(String dataSourceName,String geoLocation,String month ) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.ejb;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
/**
* Session Bean implementation class RecallDetails
*/
@Stateless
public class RecallDetails extends ValidatorEJB implements RecallDetailsRemote, RecallDetailsLocal {
/**
* Default constructor.
*/
public RecallDetails() {
}
GenericUtility genericUtility = GenericUtility.getInstance();
@SuppressWarnings("unchecked")
public JSONObject getMarketWiseRecallDetails(String dataSourceName,String lastMonth) throws RemoteException, ITMException
{
JSONObject rawDataMarketWiseRecallJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
Date frmDate = null;
Date toDate = null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
SimpleDateFormat convrtToTimStmDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if(lastMonth!=null && lastMonth.trim().length()>0 )
{
Calendar cal = Calendar.getInstance();
toDate = new Date(cal.get(Calendar.YEAR) - 1900, cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
cal.get(Calendar.MONTH + 1);
cal.add(Calendar.MONTH,-(Integer.parseInt(lastMonth)));
int month = cal.get(Calendar.MONTH);
frmDate = new Date(cal.get(Calendar.YEAR) - 1900, month, cal.get(Calendar.DATE));
}
if (frmDate != null && toDate != null )
{
sql =" select i.market_reg as MARKET_REG ,count(1) as MARKET_RECALL "
+" from item_lot_info l, item i "
+" where i.item_code = l.item_code "
//+" and case when l.STOP_BUSINESS is null then 'N' else l.STOP_BUSINESS end= 'Y' "
//+" and l.stop_business_date between ? and ? "
+" group by i.market_reg ";
pstmt = conn.prepareStatement(sql);
//pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(frmDate).toString() + " 00:00:00.0"));
//pstmt.setTimestamp(2,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(toDate).toString() + " 00:00:00.0"));
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
rowData.put("market_reg", checkNull(rs.getString("MARKET_REG")));
rowData.put("market_recall", rs.getString("MARKET_RECALL"));
rawDataMarketWiseRecallJson.put(count, rowData);
count++;
}
}
System.out.println("getMarketWiseRecallDetails data :"+rawDataMarketWiseRecallJson);
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} 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 d)
{
d.printStackTrace();
System.out.println("Exception in :RecallDetails :getPlantWiseRecallDetails:" + d.getMessage());
throw new ITMException(d);
}
}
return rawDataMarketWiseRecallJson;
}
@SuppressWarnings("unchecked")
public JSONObject getProductWiseRecallDetails(String dataSourceName,String lastMonth) throws RemoteException, ITMException
{
JSONObject rawDataProductWiseRecallJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
Date frmDate = null;
Date toDate = null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
SimpleDateFormat convrtToTimStmDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if(lastMonth!=null && lastMonth.trim().length()>0 )
{
Calendar cal = Calendar.getInstance();
toDate = new Date(cal.get(Calendar.YEAR) - 1900, cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
cal.get(Calendar.MONTH + 1);
cal.add(Calendar.MONTH,-(Integer.parseInt(lastMonth)));
int month = cal.get(Calendar.MONTH);
frmDate = new Date(cal.get(Calendar.YEAR) - 1900, month, cal.get(Calendar.DATE));
}
if (frmDate != null && toDate != null )
{
sql =" select t.unit__form,count(1) as product_recall "
+" from item_lot_info l, item i, item_type t "
+" where i.item_code = l.item_code "
//+" and t.item_type = i.item_type "
// +" and case when l.STOP_BUSINESS is null then 'N' else l.STOP_BUSINESS end = 'Y' "
// +" and l.stop_business_date between ? and ? "
+" group by t.unit__form ";
pstmt = conn.prepareStatement(sql);
//pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(frmDate).toString() + " 00:00:00.0"));
//pstmt.setTimestamp(2,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(toDate).toString() + " 00:00:00.0"));
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
rowData.put("unit__form", checkNull(rs.getString("unit__form")));
rowData.put("product_recall", rs.getString("product_recall"));
rawDataProductWiseRecallJson.put(count, rowData);
count++;
}
}
System.out.println("getProductWiseRecallDetails data :"+rawDataProductWiseRecallJson);
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} 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 d)
{
d.printStackTrace();
System.out.println("Exception in :RecallDetails :getProductWiseRecallDetails:" + d.getMessage());
throw new ITMException(d);
}
}
return rawDataProductWiseRecallJson;
}
@SuppressWarnings("unchecked")
public JSONObject getPlantWiseRecallDetails(String dataSourceName,String lastMonth) throws RemoteException, ITMException
{
JSONObject rawDataPlantWiseRecallJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
Date frmDate = null;
Date toDate = null;
try
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
SimpleDateFormat convrtToTimStmDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
if(lastMonth!=null && lastMonth.trim().length()>0 )
{
Calendar cal = Calendar.getInstance();
toDate = new Date(cal.get(Calendar.YEAR) - 1900, cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
cal.get(Calendar.MONTH + 1);
cal.add(Calendar.MONTH,-(Integer.parseInt(lastMonth)));
int month = cal.get(Calendar.MONTH);
frmDate = new Date(cal.get(Calendar.YEAR) - 1900, month, cal.get(Calendar.DATE));
}
if (frmDate != null && toDate != null)
{
sql =" select s.geo_loc as geo_loc,g.descr as geodescr,count(1) as product_recall "
+" from item_lot_info l, site s,gencodes g "
+" where g.fld_value = s.geo_loc and g.fld_name = 'GEO_LOC' and g.mod_name = 'X' "
+" and s.geo_loc in(110,120,113,114,404,307,612,628) "
/*+" w.item_code = l.item_code "
+" and w.lot_no = l.lot_no "
+" and s.site_code = w.site_code "
+" and case when l.STOP_BUSINESS is null then 'N' else l.STOP_BUSINESS end= 'Y' "
+" and l.stop_business_date between ? and ? " //dwh_production w,
*/ +" group by s.geo_loc,g.descr ";
pstmt = conn.prepareStatement(sql);
//pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(frmDate).toString() + " 00:00:00.0"));
//pstmt.setTimestamp(2,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(toDate).toString() + " 00:00:00.0"));
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
rowData.put("geo_loc", checkNull(rs.getString("geodescr")));
rowData.put("product_recall", rs.getString("product_recall"));
rawDataPlantWiseRecallJson.put(count, rowData);
count++;
}
}
System.out.println("getPlantWiseRecallDetails data :"+rawDataPlantWiseRecallJson);
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} 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 d)
{
d.printStackTrace();
System.out.println("Exception in :RecallDetails :getPlantWiseRecallDetails:" + d.getMessage());
throw new ITMException(d);
}
}
return rawDataPlantWiseRecallJson;
}
private String checkNull(String str)
{
if(str == null)
{
return "";
}
else
{
return str ;
}
}
}
\ No newline at end of file
package ibase.dashboard.mfg.ejb;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.json.simple.JSONObject;
@Local
public interface RecallDetailsLocal extends ValidatorLocal {
public JSONObject getMarketWiseRecallDetails(String dataSourceName,String days) throws RemoteException, ITMException;
public JSONObject getProductWiseRecallDetails(String dataSourceName,String days) throws RemoteException, ITMException;
public JSONObject getPlantWiseRecallDetails(String dataSourceName,String days) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.ejb;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import org.json.simple.JSONObject;
@Remote
public interface RecallDetailsRemote extends ValidatorRemote{
public JSONObject getMarketWiseRecallDetails(String dataSourceName,String days) throws RemoteException, ITMException;
public JSONObject getProductWiseRecallDetails(String dataSourceName,String days) throws RemoteException, ITMException;
public JSONObject getPlantWiseRecallDetails(String dataSourceName,String days) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.ejb;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless;
import org.json.simple.JSONObject;
/**
* Session Bean implementation class SalesPersonSales
*/
@Stateless
public class SampleRCpDtl extends ValidatorEJB implements SampleRCpDtlRemote, SampleRCpDtlLocal
{
/**
* Default constructor.
*/
public SampleRCpDtl()
{
}
/***
* End of method getProfitGraphData()
*
* @author base
* @param metedata
* as xml file by client side
* @return JSONObject
* @throws RemoteException
* , ITMException @ *
***/
@SuppressWarnings("unchecked")
public JSONObject getSampleRCPDtlData(String dataSourceName, String lastMonth) throws RemoteException, ITMException
{
JSONObject smplRcpDateWiseJson = new JSONObject();
JSONObject rowData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
SimpleDateFormat simpleDateFormat = null;
Calendar calendar = null;
UtilMethods utilMethods = new UtilMethods();
int daysInInt=0;
GenericUtility genericUtility = GenericUtility.getInstance();
Date frmDate = null;
Date toDate = null;
try
{
SimpleDateFormat convrtToTimStmDate = new SimpleDateFormat(genericUtility.getDBDateFormat());
SimpleDateFormat graphDateFormat = new SimpleDateFormat("dd-MMM-yy");
if(lastMonth!=null && lastMonth.trim().length()>0 )
{
Calendar cal = Calendar.getInstance();
toDate = new Date(cal.get(Calendar.YEAR) - 1900, cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
cal.get(Calendar.MONTH + 1);
cal.add(Calendar.MONTH,-(Integer.parseInt(lastMonth)));
int month = cal.get(Calendar.MONTH);
frmDate = new Date(cal.get(Calendar.YEAR) - 1900, month, cal.get(Calendar.DATE));
}
System.out.println("From date is =" + frmDate + "and to date is =" + toDate+ "and to lastMonth is ="+lastMonth);
if (frmDate != null && toDate != null)
{
conn = connDriver.getConnectDB(dataSourceName);
connDriver = null;
sql = "select facility_code, curr_date,sum(day_received) as day_received, sum(day_approved) day_approved, sum (day_pending) day_pending from ( select s.facility_code, q.QORDER_DATE as curr_date,count(1) as day_received," + "0 as day_pending, 0 as day_approved from qc_order q, site s Where S.Site_Code = Q.Site_Code " +
" and q.QORDER_DATE between ? and ?"+
" group by s.facility_code, q.QORDER_DATE union all select s.facility_code, " + "q.QORDER_DATE, 0 day_received, count(1) day_pending, 0 day_approved from qc_order q, site s where s.site_code = q.site_code and case when q.status is null then 'U' else q.status end = 'U' " +
" and q.QORDER_DATE between ? and ?"+
" group by s.facility_code, q.QORDER_DATE union all select s.facility_code, q.status_DATE,0 day_received, 0 day_pending, count(1) day_approved from qc_order q, " + "site s where s.site_code = q.site_code and case when q.status is null then 'U' else q.status end = 'A' " +
" and q.QORDER_DATE between ? and ?"+
" group by s.facility_code, q.status_DATE ) Group By Facility_Code, Curr_Date";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(frmDate).toString() + " 00:00:00.0"));
pstmt.setTimestamp(2,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(toDate).toString() + " 00:00:00.0"));
pstmt.setTimestamp(3,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(frmDate).toString() + " 00:00:00.0"));
pstmt.setTimestamp(4,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(toDate).toString() + " 00:00:00.0"));
pstmt.setTimestamp(5,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(frmDate).toString() + " 00:00:00.0"));
pstmt.setTimestamp(6,java.sql.Timestamp.valueOf(convrtToTimStmDate.format(toDate).toString() + " 00:00:00.0"));
rs = pstmt.executeQuery();
int count = 0;
while (rs.next())
{
rowData = new JSONObject();
;
rowData.put("curr_date", String.valueOf(graphDateFormat.format(rs.getDate("CURR_DATE"))).substring(0, 6));
rowData.put("day_received", checkNull(rs.getString("DAY_RECEIVED")));
rowData.put("day_approved", rs.getString("DAY_APPROVED"));
rowData.put("day_pending", rs.getString("DAY_PENDING"));
smplRcpDateWiseJson.put(count, rowData);
count++;
}
}
System.out.println("json object for sample rcp data====" + smplRcpDateWiseJson.toString());
} catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
} 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 d)
{
d.printStackTrace();
System.out.println("Exception in :SampleRCpDtl: getSampleRCPDtlData(String dataSourceName, String days) :" + d.getMessage());
throw new ITMException(d);
}
}
return smplRcpDateWiseJson;
}
private String checkNull(String str)
{
if (str == null)
{
return "";
} else
{
return str;
}
}
}
package ibase.dashboard.mfg.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
import org.json.simple.JSONObject;
@Local
public interface SampleRCpDtlLocal extends ValidatorLocal
{
public JSONObject getSampleRCPDtlData(String dataSourceName,String days) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.ejb;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
import org.json.simple.JSONObject;
@Remote
public interface SampleRCpDtlRemote extends ValidatorRemote
{
public JSONObject getSampleRCPDtlData(String dataSourceName,String days) throws RemoteException, ITMException;
}
package ibase.dashboard.mfg.servlet;
import ibase.dashboard.mfg.ejb.RecallDetailsRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
@SuppressWarnings("serial")
public class MarketWiseRecallServlet extends HttpServlet
{
//private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
RecallDetailsRemote recallDetailsRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String lastMonth = "";
try
{
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
lastMonth = request.getParameter("lastMonth");
System.out.println("in doPost" + "lastMonth is =:" + lastMonth+":" );
context = new InitialContext(appConnectParm.getProperty());
recallDetailsRemote = (RecallDetailsRemote) context.lookup("ibase/RecallDetails/remote");
JSONObject jsonObjData = (JSONObject)recallDetailsRemote.getMarketWiseRecallDetails(dataSourceName,lastMonth);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for MarketWiseRecallServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception : MarketWiseRecallServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.mfg.servlet;
import ibase.dashboard.mfg.ejb.RecallDetailsRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
@SuppressWarnings("serial")
public class PlantWiseRecallServlet extends HttpServlet
{
//private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
RecallDetailsRemote recallDetailsRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String lastMonth = "";
try
{
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
lastMonth = request.getParameter("lastMonth");
System.out.println("in doPost lastMonth is ==:" + lastMonth );
context = new InitialContext(appConnectParm.getProperty());
recallDetailsRemote = (RecallDetailsRemote) context.lookup("ibase/RecallDetails/remote");
JSONObject jsonObjData = (JSONObject)recallDetailsRemote.getPlantWiseRecallDetails(dataSourceName,lastMonth);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for PlantWiseRecallServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception : PlantWiseRecallServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.mfg.servlet;
import ibase.dashboard.mfg.ejb.RecallDetailsRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
@SuppressWarnings("serial")
public class ProductWiseRecallServlet extends HttpServlet
{
//private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
RecallDetailsRemote recallDetailsRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String lastMonth = "";
try
{
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
lastMonth = (request.getParameter("lastMonth"));
System.out.println("in doPost" + "lastMonth is ==:" + lastMonth+":" );
context = new InitialContext(appConnectParm.getProperty());
recallDetailsRemote = (RecallDetailsRemote) context.lookup("ibase/RecallDetails/remote");
JSONObject jsonObjData = (JSONObject)recallDetailsRemote.getProductWiseRecallDetails(dataSourceName,lastMonth);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for ProductWiseRecallServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception : ProductWiseRecallServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.mfg.servlet;
import ibase.dashboard.mfg.ejb.ProfitLossBalSheetRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
@SuppressWarnings("serial")
public class ProfitLossBalSheetServlet extends HttpServlet
{
//private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
ProfitLossBalSheetRemote profitLossBalSheetRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String prdfrom = "", acctprd = "",sitecode="",prdto="",formatcode="",reporttype="";
try
{
response.setContentType("application/xml");
sitecode= request.getParameter("sitecode");
prdfrom = request.getParameter("prdfrom");
prdto= request.getParameter("prdto");
acctprd= request.getParameter("acctprd");
formatcode= request.getParameter("formatcode");
reporttype= request.getParameter("reporttype");
dataSourceName = request.getParameter("dataSourceName");
System.out.println("in doPost" );
System.out.println("days is =" + sitecode );
System.out.println("days is =" + prdfrom );
System.out.println("days is =" + prdto );
System.out.println("days is =" + acctprd );
System.out.println("days is =" + formatcode );
System.out.println("days is =" + reporttype );
context = new InitialContext(appConnectParm.getProperty());
profitLossBalSheetRemote = (ProfitLossBalSheetRemote) context.lookup("ibase/ProfitLossBalSheet/remote");
JSONObject jsonObjData = (JSONObject)profitLossBalSheetRemote.getProfitBalanceSheetDetails(sitecode,prdfrom,prdto,acctprd,formatcode,reporttype,dataSourceName);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for ProfitLossBalSheetServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception : ProfitLossBalSheetServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.mfg.servlet;
import ibase.dashboard.mfg.ejb.QCSampleCostRemote;
import ibase.dashboard.mfg.ejb.SampleRCpDtlRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
public class QCSampleCostServlet extends HttpServlet
{
// private static final long serialVersionUID = 1L;
/**
*
*/
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
QCSampleCostRemote qCSampleCostRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String geoLocation = "";
String lastMonth = "";
try
{
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
geoLocation = request.getParameter("geoLocation");
lastMonth = request.getParameter("lastMonth");
context = new InitialContext(appConnectParm.getProperty());
qCSampleCostRemote = (QCSampleCostRemote) context.lookup("ibase/QCSampleCost/remote");
JSONObject jsonObjData = (JSONObject) qCSampleCostRemote.getQCSampleCostData(dataSourceName,geoLocation,lastMonth);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for QCSampleCostServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception : QCSampleCostServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ No newline at end of file
package ibase.dashboard.mfg.servlet;
import ibase.dashboard.mfg.ejb.SampleRCpDtlRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
public class SampleRcpDtlServlet extends HttpServlet
{
// private static final long serialVersionUID = 1L;
/**
*
*/
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
SampleRCpDtlRemote sampleRCpDtlRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String lastMonth = "";
try
{
response.setContentType("application/xml");
dataSourceName = request.getParameter("dataSourceName");
lastMonth = request.getParameter("lastMonth");
context = new InitialContext(appConnectParm.getProperty());
sampleRCpDtlRemote = (SampleRCpDtlRemote) context.lookup("ibase/SampleRCpDtl/remote");
JSONObject jsonObjData = (JSONObject) sampleRCpDtlRemote.getSampleRCPDtlData(dataSourceName,lastMonth);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for SampleRcpDtlServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception : SampleRcpDtlServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ 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