Commit 9d6665de authored by bpandey's avatar bpandey

modify source code as per client changes


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93977 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fd7d3644
package ibase.dashboard.mfg.ejb;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
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;
/**
* Session Bean implementation class MachineUtilizationDetails
*/
@Stateless
public class MachineUtlDetails extends ValidatorEJB implements MachineUtlDetailsRemote, MachineUtlDetailsLocal {
/**
* Default constructor.
*/
public MachineUtlDetails() {
// TODO Auto-generated constructor stub
}
public String getSiteCodeList() throws RemoteException,ITMException
{
StringBuffer xmlData = null;
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sql="select distinct site_code,descr FROM site ORDER BY site_code";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
xmlData = new StringBuffer("<?xml version=\"1.0\"?><Root>");
while(rs.next())
{
xmlData.append("<Detail>");
xmlData.append("<site_code>").append("<![CDATA[" + checkNull(rs.getString("site_code"))+"]]>").append("</site_code>");
xmlData.append("<descr>").append("<![CDATA[" + checkNull(rs.getString("descr"))+"]]>").append("</descr>");
xmlData.append("</Detail>");
}
xmlData.append("</Root>");
}
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 :MachineUtilizationDetails:getSiteCode:"+d.getMessage());
throw new ITMException(d);
}
}
return xmlData.toString();
}
public String getMachineUtlDetailsBySiteCode(String siteCode,String month,String year) throws RemoteException,ITMException
{
String sql = "";
ResultSet rs = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
ResultSet rs3 = null;
ResultSet rs4 = null;
Connection conn = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null;
PreparedStatement pstmt3 = null;
PreparedStatement pstmt4 = null;
ConnDriver connDriver = null;
StringBuffer xmlData =new StringBuffer();
String pre_workDate="";
int count=0;
String currentWrkDate ="";
SimpleDateFormat simpleDateFormat=null,sdf =null;
String curentDateString=null;
Date currentDate=null;
Date workDate=null;
String shift="";
Calendar calendar=null;
String wrkDateInString="";
int day=1;
String workOrder="";
int operation=0;
String fromDate="";
String toDate="";
int number=0;
try
{
//here date & time activity
simpleDateFormat = new SimpleDateFormat("dd-MMM-yy");
sdf= new SimpleDateFormat("yyyy-MM-dd");
curentDateString= sdf.format(new java.util.Date());
currentDate = sdf.parse(curentDateString);
//ADD-------1St of month and last of month
calendar =Calendar.getInstance();
calendar.set(Integer.parseInt(year), Integer.parseInt(month), day);
fromDate = simpleDateFormat.format(calendar.getTime());
System.out.println(" 1st date of month="+fromDate);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
toDate = simpleDateFormat.format(calendar.getTime());
System.out.println("last date of month="+toDate);
//End of -------1St of month and last of month
System.out.println("from date in side Machine Utilization ="+fromDate);
System.out.println("toDate date in Machine Utilization="+toDate);
connDriver=new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
xmlData = new StringBuffer("<?xml version=\"1.0\"?><Root>");
sql="SELECT DISTINCT WORK_CTR, DESCR FROM WORKCNTR WHERE SITE_CODE =? ORDER BY WORK_CTR";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
while (rs.next())
{ count=0;
xmlData.append("<Detail>");
String wrkCenter=checkNull(rs.getString("WORK_CTR"));
xmlData.append("<work_ctr wrkcenter=\""+wrkCenter+"\">");
xmlData.append("<descr>").append("<![CDATA["+checkNull(rs.getString("DESCR"))+"]]>").append("</descr>");
sql="SELECT work_date,shift from work_calendar " +
" where (work_date between ? and ?) and site_code=?";
pstmt1=conn.prepareStatement(sql);
pstmt1.setString(1,fromDate);
pstmt1.setString(2,toDate);
pstmt1.setString(3,siteCode);
rs1=pstmt1.executeQuery();
while (rs1.next())
{
count++;
currentWrkDate=checkNull(rs1.getString("work_date"));
if(count>1 && !pre_workDate.equals(currentWrkDate))
{
xmlData.append("</work_date>");
}
if(count==1 || !pre_workDate.equals(currentWrkDate))
{
xmlData.append("<work_date date=\""+currentWrkDate+"\">");
pre_workDate=currentWrkDate;
}
shift=rs1.getString("shift");
if(shift!=null && shift.trim().length()>0)
{
xmlData.append("<shift shift=\""+shift+"\">");
workDate=sdf.parse(sdf.format(rs1.getTimestamp("work_date")));
calendar=Calendar.getInstance();
calendar.setTime(rs1.getDate("work_date"));
wrkDateInString=simpleDateFormat.format(calendar.getTime());
if(workDate.before(currentDate))
{
sql="SELECT WORK_ORDER,OPERATION,shift FROM WORKORDER_FEEDBACK WHERE(START_TIME BETWEEN '"+wrkDateInString+"' AND '"+ wrkDateInString+"') AND SITE_CODE = ? AND WORK_CTR = ? AND SHIFT = ?";
pstmt2=conn.prepareStatement(sql);
pstmt2.setString(1,siteCode);
pstmt2.setString(2,wrkCenter);
pstmt2.setString(3,shift);
rs2=pstmt2.executeQuery();
if(rs2.next())
{
workOrder =checkNull(rs2.getString("WORK_ORDER"));
operation =rs2.getInt("OPERATION");
sql="select w.item_code, i.descr, w.work_order, w.work_ctr,w.start_date, w.end_date from worder_route w ,item i where w.item_code=i.item_code and w.work_order = ? and w.operation=? and w.work_ctr=? ";
pstmt4=conn.prepareStatement(sql);
pstmt4.setString(1, workOrder);
pstmt4.setInt(2, operation);
pstmt4.setString(3, wrkCenter);
rs4= pstmt4.executeQuery();
number=0;
while(rs4.next())
{
number++;
xmlData.append("<actual_used color=\""+"lightgreen"+"\">");
xmlData.append("<work_order>").append("<![CDATA["+checkNull(rs4.getString("work_order"))+"]]>").append("</work_order>");
xmlData.append("<item_code>").append("<![CDATA["+checkNull(rs4.getString("item_code"))+"]]>").append("</item_code>");
xmlData.append("<item_descr>").append("<![CDATA["+checkNull(rs4.getString("descr"))+"]]>").append("</item_descr>");
xmlData.append("<work_ctr>").append("<![CDATA["+checkNull(rs4.getString("work_ctr"))+"]]>").append("</work_ctr>");
xmlData.append("<start_date>").append("<![CDATA["+checkNull(rs4.getString("start_date"))+"]]>").append("</start_date>");
xmlData.append("<end_date>").append("<![CDATA["+checkNull(rs4.getString("end_date"))+"]]>").append("</end_date>");
xmlData.append("</actual_used>");
}
if(number==0)
{
xmlData.append("<actual_used color=\""+"lightgray"+"\"> </actual_used>");
}
rs4.close();
rs4=null;
pstmt4.close();
pstmt4=null;
}else
{
xmlData.append("<actual_used color=\""+"lightgray"+"\"> </actual_used>");
}
pstmt2.close();
pstmt2=null;
rs2.close();
rs2=null;
}
else
{
sql=" SELECT WORK_ORDER,OPERATION,SHIFT FROM MACHINE_LOAD_DET WHERE(LOAD_DATE BETWEEN '"+wrkDateInString+"' AND '"+wrkDateInString+"') AND SITE_CODE=? AND WORK_CTR= ? AND SHIFT=?";
pstmt3=conn.prepareStatement(sql);
pstmt3.setString(1,siteCode);
pstmt3.setString(2,wrkCenter);
pstmt3.setString(3,shift);
rs3=pstmt3.executeQuery();
if(rs3.next())
{
workOrder =checkNull(rs3.getString("WORK_ORDER"));
operation =rs3.getInt("OPERATION");
sql="select w.item_code, i.descr, w.work_order, w.work_ctr,w.start_date, w.end_date from worder_route w ,item i where w.item_code=i.item_code and w.work_order = ? and w.operation=? and w.work_ctr=?";
pstmt4=conn.prepareStatement(sql);
pstmt4.setString(1, workOrder);
pstmt4.setInt(2, operation);
pstmt4.setString(3, wrkCenter);
rs4= pstmt4.executeQuery();
number=0;
while (rs4.next())
{
number++;
xmlData.append("<actual_used color=\""+"yellow"+"\">");
xmlData.append("<work_order>").append("<![CDATA["+checkNull(rs4.getString("work_order"))+"]]>").append("</work_order>");
xmlData.append("<item_code>").append("<![CDATA["+checkNull(rs4.getString("item_code"))+"]]>").append("</item_code>");
xmlData.append("<item_descr>").append("<![CDATA["+checkNull(rs4.getString("descr"))+"]]>").append("</item_descr>");
xmlData.append("<work_ctr>").append("<![CDATA["+checkNull(rs4.getString("work_ctr"))+"]]>").append("</work_ctr>");
xmlData.append("<start_date>").append("<![CDATA["+checkNull(rs4.getString("start_date"))+"]]>").append("</start_date>");
xmlData.append("<end_date>").append("<![CDATA["+checkNull(rs4.getString("end_date"))+"]]>").append("</end_date>");
xmlData.append("</actual_used>");
}
if(number==0)
{
xmlData.append("<actual_used color=\""+"white"+"\"> </actual_used>");
}
rs4.close();
rs4=null;
pstmt4.close();
pstmt4=null;
}
else
{
xmlData.append("<actual_used color=\""+"white"+"\"> </actual_used>");
}
pstmt3.close();
pstmt3=null;
rs3.close();
rs3=null;
}
xmlData.append("</shift>");
}
}
if(count>0)
{
xmlData.append("</work_date>");
}
rs1.close();
rs1=null;
pstmt1.close();
pstmt1=null;
xmlData.append("</work_ctr>");
xmlData.append("</Detail>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
xmlData.append("</Root>");
}
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 :: MachineUtilizationDetails:getMachineUtyListBySiteCode:"+d.getMessage());
throw new ITMException(d);
}
}
return xmlData.toString();
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
} else
{
input = input.trim();
}
return input;
}
}
package ibase.dashboard.mfg.ejb;
import java.rmi.RemoteException;
import java.util.List;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
@Local
public interface MachineUtlDetailsLocal extends ValidatorLocal
{
public String getSiteCodeList() throws RemoteException, ITMException;
public String getMachineUtlDetailsBySiteCode(String siteCode,String fromDate,String toDate) throws RemoteException,ITMException;
}
package ibase.dashboard.mfg.ejb;
import java.rmi.RemoteException;
import java.util.List;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface MachineUtlDetailsRemote extends ValidatorRemote{
public String getSiteCodeList() throws RemoteException, ITMException;
public String getMachineUtlDetailsBySiteCode(String siteCode,String fromDate,String toDate) throws RemoteException,ITMException;
}
......@@ -3,7 +3,8 @@ package ibase.dashboard.mfg.ejb;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
import java.io.File;
import java.io.IOException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -14,7 +15,6 @@ import java.util.Calendar;
import java.util.List;
import javax.ejb.Stateless;
/**
* Session Bean implementation class ProductionVsBudgetReport
*/
......@@ -27,8 +27,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
List<String> listDate =null;
StringBuffer xmlDataForGeo = null;
StringBuffer xmlDataForUnit = null;
String initGeoLocation ="";
String initUnitForm ="";
public ProductionVsBudgetReport() throws RemoteException, ITMException
{
// TODO Auto-generated constructor stub
......@@ -37,8 +36,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ConnDriver connDriver = new ConnDriver();
listDate = new ArrayList<String>();
ConnDriver connDriver = new ConnDriver();
String firstDateofMonth="";
String lstDateofMonth="";
Calendar cal=null;
......@@ -48,7 +46,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sql="select to_char ( trunc(sysdate,'Month') + rownum - 1,'DD') as tran_date from item where rownum <= last_day (sysdate) - trunc(sysdate,'Month') + 1 order by 1 ";
/* sql="select to_char ( trunc(sysdate,'Month') + rownum - 1,'DD') as tran_date from item where rownum <= last_day (sysdate) - trunc(sysdate,'Month') + 1 order by 1 ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
......@@ -74,27 +72,25 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
cal.set(Calendar.DATE, cal.getActualMinimum(Calendar.DATE));
firstDateofMonth= sdf.format(cal.getTime());
//coding for generate geoLocation combo box
//sql ="select fld_value, descr from gencodes where FLD_NAME='GEO_LOC' and mod_name='X' ";
sql="select fld_value, descr from gencodes where fld_name = 'GEO_LOC' and mod_name = 'X' and fld_value in (select distinct geo_loc from site where site_code in (select distinct site_code from dwh_production_day_events where tran_date between ? and ? and ref_ser ='W-RCP'))";
//This will generated geoLocation droup down changes on dated 28/11/2013
//sql(V.1) ="select fld_value, descr from gencodes where FLD_NAME ='GEO_LOC' and mod_name='X' ";
//sql(v.2) ="select fld_value, descr from gencodes where fld_name = 'GEO_LOC' and mod_name = 'X' and fld_value in (select distinct geo_loc from site where site_code in (select distinct site_code from dwh_production_day_events where tran_date between ? and ? and ref_ser ='W-RCP'))";
sql="select g.fld_value, g.descr from gencodes g where fld_name = 'GEO_LOC' and mod_name = 'X' and instr((select trim(var_value) from disparm where var_name = 'DWH_SITE_GEO_LOC'),trim(g.fld_value)) >0";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, firstDateofMonth);
pstmt.setString(2, lstDateofMonth);
//pstmt.setString(1, firstDateofMonth);
//pstmt.setString(2, lstDateofMonth);
rs = pstmt.executeQuery();
xmlDataForGeo = new StringBuffer("<?xml version=\"1.0\"?><Root>");
int count=1;
while(rs.next())
{
if(count==1){
initGeoLocation =checkNull(rs.getString("fld_value"));
}
xmlDataForGeo.append("<Detail>");
xmlDataForGeo.append("<fld_value>").append("<![CDATA[" + checkNull(rs.getString("fld_value"))+"]]>").append("</fld_value>");
xmlDataForGeo.append("<descr>").append("<![CDATA[" + checkNull(rs.getString("descr"))+"]]>").append("</descr>");
xmlDataForGeo.append("</Detail>");
count++;
}
xmlDataForGeo.append("</Root>");
System.out.println("Geo Location Drop Down List=="+xmlDataForGeo);
......@@ -104,21 +100,21 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
rs = null;
//End of geoLoaction with unit_form
//coding for gererate unit form drop down
sql ="select distinct(unit__form) from item_type where unit__form is not null";
//coding for gererate unit form drop down
//sql ="select distinct(unit__form) from item_type where unit__form is not null";
sql="select distinct (i.unit__form),u.descr from item_type i ,uom u where i.unit__form=u.unit and i.unit__form is not null";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
xmlDataForUnit = new StringBuffer("<?xml version=\"1.0\"?><Root>");
int count2=1;
xmlDataForUnit = new StringBuffer("<?xml version=\"1.0\"?><Root>");
while(rs.next())
{
if(count2==1){
initUnitForm =checkNull(rs.getString("unit__form"));
}
xmlDataForUnit.append("<Detail>");
xmlDataForUnit.append("<unit_form>").append("<![CDATA[" + checkNull(rs.getString("unit__form"))+"]]>").append("</unit_form>");
xmlDataForUnit.append("<descr>").append("<![CDATA[" + checkNull(rs.getString("descr"))+"]]>").append("</descr>");
xmlDataForUnit.append("</Detail>");
count2++;
}
xmlDataForUnit.append("</Root>");
System.out.println("unitForm Drop Down List=="+xmlDataForUnit);
......@@ -126,6 +122,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
rs.close();
pstmt = null;
rs = null;
//End of unit for drop down
......@@ -176,7 +173,10 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
return xmlDataForUnit.toString();
}
//This is main method which are performed to all chart
public String getProductionBudget(String frmDate,String toDate,String geoLoc,String unitForm) throws RemoteException, ITMException
......@@ -191,41 +191,45 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
String unit="";
String previousUnit="";
String geoLocationPrevious="";
int count=0;
int todaysDay=0;
int lastDayOfMonth=0;
int count=0;
double dailyBudgetQty=0;
String geol_Descr="";
String unit_Descr="";
int year=0;
String month="";
String month="";
String[] tempfrmDate =null;
String[] temptoDate =null;
int firstDayOfMonth=0;
int lastDayOfMonth=0;
listDate = new ArrayList<String>();
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
connDriver = null;
// change on date 11/11/2013
//case1
System.out.println("from date from jsp ="+frmDate + "To Date from jsp=="+toDate);
tempfrmDate =frmDate.split("-");
firstDayOfMonth =Integer.parseInt(tempfrmDate[0]);
month =tempfrmDate[1];
year =Integer.parseInt(tempfrmDate[2]);
//case2
temptoDate =toDate.split("-");
lastDayOfMonth =Integer.parseInt(temptoDate[0]);
System.out.println("First of Month=="+firstDayOfMonth +"& Last of Month==="+lastDayOfMonth+"Month from jsp =="+month+"Year from jsp =="+year);
for (int i = firstDayOfMonth; i <= lastDayOfMonth; i++)
{
listDate.add(String.valueOf(i));
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yy");
Calendar calendar = Calendar.getInstance();
//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);
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
todaysDay =Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
lastDayOfMonth = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
year =calendar.get(Calendar.YEAR);
month = new SimpleDateFormat("MMM").format(calendar.getTime());
// change on item changes of GeoLocation code
initGeoLocation="'"+initGeoLocation+"'";
initUnitForm="'"+initUnitForm+"'";
if((geoLoc!=null && geoLoc.trim().length()>0)&& (unitForm!=null && unitForm.trim().length()>0)){
initGeoLocation =geoLoc;
initUnitForm =unitForm;
}
System.out.println("select Final initGeoLocation inside in java ==="+initGeoLocation +"selected initUnitForm inside in java =="+initUnitForm);
/*sql = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty,cum_budqty "+
/*sql (v.1) = "select geo_loc, unit__form,to_char (tran_date,'DD') as tran_date, day_quantity, pyr_cumqty,cum_budqty "+
"from ("+
"select s.GEO_LOC,p.tran_date, t.unit__form, "+
"fn_get_budgetqty(p.tran_date,s.GEO_LOC,t.unit__form ) as cum_budqty ,"+
......@@ -247,16 +251,16 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
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, p.quantity)) " +
"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','GRANULES','INHALER','POWDER','POUCH','PELLETS','SUSPENSION','SYRINGE','TUBE','VIALS') then 'P' when t.item_type in('CAPSULES','TABLETS',' SOFTGELCAP') then 'F' else '' end ) " +
"and p.ref_ser = 'W-RCP' and s.geo_loc in(" + initGeoLocation +") "+
"and t.unit__form in("+initUnitForm +") group by s.GEO_LOC, p.tran_date, t.unit__form ) " +
"and p.ref_type = (case when t.item_type in('AMPOULES','BOTTLES','DROPS','INHALER','POWDER','POUCH','SUSPENSION','TUBE','VIALS') then 'F' when t.item_type in('CAPSULES','TABLETS',' SOFTGELCAP') then 'F' 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";
......@@ -295,8 +299,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
xmlData.append("<day_quantity quantity=\"0\">");
//Add new Block for preyear Cumulative
//sql="select to_date(add_months(?,-12)) from dual ";
//sql="select to_date(add_months(?,-12)) from dual ";
missingDate =listDate.get(dayCount)+"-"+month+"-"+year;
sql ="select fn_get_pyr_cumqty( to_date(add_months('"+missingDate+"',-12)),"+geoLocationPrevious+",'"+previousUnit +"') as pyr_cumqty from dual";
pstmt1 = conn.prepareStatement(sql);
......@@ -335,8 +338,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
{
//Add here for decr pupose
sql="select descr from gencodes where FLD_NAME='GEO_LOC' and fld_value= ?";
sql="select descr from gencodes where FLD_NAME='GEO_LOC' and fld_value= ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,geoLocation);
rs1 = pstmt1.executeQuery();
......@@ -347,8 +349,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
pstmt1 = null;
rs1 = null;
//**************************************************
sql="select descr from uom where unit= ?";
sql="select descr from uom where unit= ?";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1,unit);
......@@ -488,6 +489,7 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
xmlData.append("</Detail>");
xmlData.append("</Root>");
pstmt.close();
pstmt = null;
rs.close();
......@@ -554,28 +556,47 @@ public class ProductionVsBudgetReport extends ValidatorEJB implements Production
}
//Add PDF Creater method on dated 22/11/2013
public String getPDFFormate () throws RemoteException, ITMException
{
System.out.println("Is Execute allow 1: ");
System.out.println("Is Write allow 1: ");
try {
File file = new File("/home/base/Desktop/test.sh");
if(file.exists()){
System.out.println("File path========= : " + file);
System.out.println("Is Execute allow : " + file.canExecute());
System.out.println("Is Write allow : " + file.canWrite());
System.out.println("Is Read allow : " + file.canRead());
}
file.setExecutable(true);
file.setWritable(true);
file.setReadable(true);
System.out.println("Is Execute allow : " + file.canExecute());
System.out.println("Is Write allow : " + file.canWrite());
System.out.println("Is Read allow : " + file.canRead());
if (file.createNewFile()){
System.out.println("File is created!");
}else{
System.out.println("File already exists.");
}
Runtime.getRuntime().exec("/home/base/Desktop/test.sh");
} catch (IOException e) {
e.printStackTrace();
}
return "Scussefullly";
}
//End of method on dated 22/11/2013
public String getInitGeoLocation()
{
return initGeoLocation;
}
public void setInitGeoLocation(String initGeoLocation)
{
this.initGeoLocation = initGeoLocation;
}
public String getInitUnitForm()
{
return initUnitForm;
}
public void setInitUnitForm(String initUnitForm)
{
this.initUnitForm = initUnitForm;
}
}
}
\ No newline at end of file
......@@ -9,9 +9,9 @@ import javax.ejb.Local;
@Local
public interface ProductionVsBudgetReportLocal extends ValidatorLocal{
public String getProductionBudget(String frmDate,String toDate,String geoLoc,String unitForm) throws RemoteException, ITMException;
public String getProductionBudget(String frmDate,String toDate,String geoLoc,String unitForm) throws RemoteException, ITMException;
public String getGeoLoCodeXmlData() throws RemoteException, ITMException;
public String getUnitFormXmlData() throws RemoteException, ITMException;
public String getInitUnitForm()throws RemoteException, ITMException;
public String getInitGeoLocation()throws RemoteException, ITMException;
public String getPDFFormate () throws RemoteException, ITMException;
}
......@@ -13,6 +13,6 @@ public interface ProductionVsBudgetReportRemote extends ValidatorRemote
public String getProductionBudget(String frmDate,String toDate,String geoLoc,String unitForm) throws RemoteException, ITMException;
public String getGeoLoCodeXmlData() throws RemoteException, ITMException;
public String getUnitFormXmlData() throws RemoteException, ITMException;
public String getInitGeoLocation() throws RemoteException, ITMException;
public String getInitUnitForm()throws RemoteException, ITMException;
public String getPDFFormate () throws RemoteException, ITMException;
}
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