Commit f75e8ba7 authored by bpandey's avatar bpandey

add one more filter range like


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96013 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 48d7975a
package ibase.dashboard.scm.ejb;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
......@@ -140,7 +141,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
return selectedArea;
}
public String getLocDtl(String locPhyArea, String siteCode) throws RemoteException, ITMException
public String getLocDtl(String locPhyArea, String siteCode,String locationRange) throws RemoteException, ITMException
{
String sql = "";
ResultSet rs = null, rs1 = null;
......@@ -154,12 +155,18 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
String cuurentStack = "";
String locationCode = " ";
int count = 0;
String locCode="";
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
if(locationRange!=null && locationRange.trim().length()>0){
locCode ="AND loc_code like '"+locationRange+"%'";
sql = "select loc_code,loc_phy_row,loc_phy_col,loc_phy_stack from location where loc_phy_area = ? and site_code = ? order by loc_phy_row, loc_phy_stack ,loc_phy_col";
System.out.println("location Range from JSP ==="+locationRange);
}
sql = "select loc_code,loc_phy_row,loc_phy_col,loc_phy_stack from location where loc_phy_area = ? and site_code = ? "+locCode +" order by loc_phy_row, loc_phy_stack ,loc_phy_col";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locPhyArea);
pstmt.setString(2, siteCode);
......@@ -169,6 +176,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
xmlData.append("<loc_phy_area area =\"" + locPhyArea + "\">");
while (rs.next())
{
int isDataPresnt = 0;
count++;
locationCode = checkNull(rs.getString("loc_code"));
currentRow = checkNull(rs.getString("loc_phy_row"));
......@@ -206,47 +214,64 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
xmlData.append("<location_code lcode=\"" + locationCode + "\">");
while (rs1.next())
{
isDataPresnt++;
xmlData.append("<stock>");
xmlData.append("<item_code>").append("<![CDATA[" + checkNull(rs1.getString("item_code")) + "]]>").append("</item_code>");
xmlData.append("<descr>").append("<![CDATA[" + checkNull(rs1.getString("descr"))+"]]>").append("</descr>");
xmlData.append("<descr>").append("<![CDATA[" + checkNull(rs1.getString("descr")) + "]]>").append("</descr>");
xmlData.append("<lot_no>").append("<![CDATA[" + checkNull(rs1.getString("lot_no"))+"]]>").append("</lot_no>");
xmlData.append("<lot_sl>").append("<![CDATA[" + checkNull(rs1.getString("lot_sl"))+"]]>").append("</lot_sl>");
xmlData.append("<quantity>").append("<![CDATA[" + rs1.getDouble("quantity")+"]]>").append("</quantity>");
xmlData.append("<lot_no>").append("<![CDATA[" + checkNull(rs1.getString("lot_no")) + "]]>").append("</lot_no>");
xmlData.append("<lot_sl>").append("<![CDATA[" + checkNull(rs1.getString("lot_sl")) + "]]>").append("</lot_sl>");
xmlData.append("<quantity>").append("<![CDATA[" + rs1.getDouble("quantity") + "]]>").append("</quantity>");
xmlData.append("<hold_qty>").append("<![CDATA[" + rs1.getDouble("hold_qty")+"]]>").append("</hold_qty>");
xmlData.append("<alloc_qty>").append("<![CDATA[" +rs1.getDouble("alloc_qty")+"]]>").append("</alloc_qty>");
xmlData.append("<hold_qty>").append("<![CDATA[" + rs1.getDouble("hold_qty") + "]]>").append("</hold_qty>");
xmlData.append("<alloc_qty>").append("<![CDATA[" + rs1.getDouble("alloc_qty") + "]]>").append("</alloc_qty>");
if(rs1.getDate("mfg_date") !=null)
if (rs1.getDate("mfg_date") != null)
{
xmlData.append("<mfg_date>").append("<![CDATA[" + rs1.getDate("mfg_date")+"]]>").append("</mfg_date>");
}
else
xmlData.append("<mfg_date>").append("<![CDATA[" + rs1.getDate("mfg_date") + "]]>").append("</mfg_date>");
} else
{
xmlData.append("<mfg_date>").append("<![CDATA[ ]]>").append("</mfg_date>");
}
if(rs1.getDate("exp_date") !=null)
if (rs1.getDate("exp_date") != null)
{
xmlData.append("<exp_date>").append("<![CDATA[" + rs1.getDate("exp_date")+"]]>").append("</exp_date>");
}else
xmlData.append("<exp_date>").append("<![CDATA[" + rs1.getDate("exp_date") + "]]>").append("</exp_date>");
} else
{
xmlData.append("<exp_date>").append("<![CDATA[ ]>").append("</exp_date>");
}
if(rs1.getDate("retest_date") !=null)
if (rs1.getDate("retest_date") != null)
{
xmlData.append("<retest_date>").append("<![CDATA[" +rs1.getDate("retest_date")+"]]>").append("</retest_date>");
}
else
xmlData.append("<retest_date>").append("<![CDATA[" + rs1.getDate("retest_date") + "]]>").append("</retest_date>");
} else
{
xmlData.append("<retest_date>").append("<![CDATA[ ]]>").append("</retest_date>");
}
xmlData.append("</stock>");
}
/*if (isDataPresnt == 0)
{
String empty="";
xmlData.append("<stock>");
xmlData.append("<item_code>").append("<![CDATA[" + empty + "]]>").append("</item_code>");
xmlData.append("<descr>").append("<![CDATA[" + empty + "]]>").append("</descr>");
xmlData.append("<lot_no>").append("<![CDATA[" + empty + "]]>").append("</lot_no>");
xmlData.append("<lot_sl>").append("<![CDATA[" + empty + "]]>").append("</lot_sl>");
xmlData.append("<quantity>").append("<![CDATA[" + empty + "]]>").append("</quantity>");
xmlData.append("<hold_qty>").append("<![CDATA[" + empty + "]]>").append("</hold_qty>");
xmlData.append("<alloc_qty>").append("<![CDATA[" + empty + "]]>").append("</alloc_qty>");
xmlData.append("<mfg_date>").append("<![CDATA[ ]]>").append("</mfg_date>");
xmlData.append("<exp_date>").append("<![CDATA[ ]]>").append("</exp_date>");
xmlData.append("<retest_date>").append("<![CDATA[ ]]>").append("</retest_date>");
xmlData.append("</stock>");
}*/
xmlData.append("</location_code>");
xmlData.append("</loc_phy_col>");
......@@ -304,153 +329,104 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
throw new ITMException(d);
}
}
System.out.println("Final XML===" + xmlData.toString());
return xmlData.toString();
}
/*public String getStkOccupncyDtl(String loginCode) throws RemoteException, ITMException
{
String data = "";
String sql = "";
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ConnDriver connDriver = new ConnDriver();
StringBuffer xmlData = null;
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sql = "select s.item_code,s.site_code,s.loc_code,s.lot_no,s.lot_sl,s.quantity,s.alloc_qty,s.exp_date, l.loc_phy_area,l.loc_phy_row,l.loc_phy_col,l.loc_phy_stack " + "From stock s left outer join location l on s.loc_code=l.loc_code where s.quantity >0 " + "AND s.exp_date <=SYSDATE AND S.SITE_CODE= ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
xmlData = new StringBuffer("<?xml version='1.0'?> <Root>");
while (rs.next())
{
xmlData.append("<Detail>");
xmlData.append("<item_code>").append("<![CDATA[" + this.checkNull(rs.getString("item_code")) + "]]>").append("</item_code>");
xmlData.append("<site_code>").append("<![CDATA[" + this.checkNull(rs.getString("site_code")) + "]]>").append("</site_code>");
xmlData.append("<loc_code>").append("<![CDATA[" + this.checkNull(rs.getString("loc_code")) + "]]>").append("</loc_code>");
xmlData.append("<lot_no>").append("<![CDATA[" + this.checkNull(rs.getString("lot_no")) + "]]>").append("</lot_no>");
xmlData.append("<quantity>").append("<![CDATA[" + rs.getDouble("quantity") + "]]>").append("</quantity>");
xmlData.append("<exp_date>").append("<![CDATA[" + rs.getDate("exp_date") + "]]>").append("</exp_date>");
xmlData.append("<loc_phy_area>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_area")) + "]]>").append("</loc_phy_area>");
xmlData.append("<loc_phy_row>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_row")) + "]]>").append("</loc_phy_row>");
xmlData.append("<loc_phy_col>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_col")) + "]]>").append("</loc_phy_col>");
xmlData.append("<loc_phy_stack>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_stack")) + "]]>").append("</loc_phy_stack>");
xmlData.append("</Detail>");
}
xmlData.append("</Root>");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} 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();
throw new ITMException(d);
}
}
return data;
}
public String getStkDtl(String locationCode, String siteCode) throws RemoteException, ITMException
{
String sql = "";
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ConnDriver connDriver = new ConnDriver();
String selectedArea = "";
StringBuffer xmlData = null;
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
sql = "select item_code,site_code,loc_code,lot_no,lot_sl,exp_date,quantity,alloc_qty,hold_qty From stock where quantity >0 AND exp_date <= SYSDATE and loc_code= ? and SITE_CODE=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locationCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
xmlData = new StringBuffer("<?xml version='1.0'?> <Root>");
xmlData.append("<location_code lcode=\"" + locationCode + "\">");
xmlData.append("<detail>");
while (rs.next())
{
xmlData.append("<stock>");
xmlData.append("<item_code>").append("<![CDATA[" + rs.getString("item_code") + "]]>").append("</item_code>");
xmlData.append("<lot_sl>").append("<![CDATA[" + rs.getString("lot_sl") + "]]>").append("</lot_sl>");
xmlData.append("<quantity>").append("<![CDATA[" + rs.getString("quantity") + "]]>").append("</quantity>");
xmlData.append("<lot_no>").append("<![CDATA[" + rs.getString("lot_no") + "]]>").append("</lot_no>");
xmlData.append("</stock>");
}
xmlData.append("</detail>");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} 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();
throw new ITMException(d);
}
}
return selectedArea;
}
*/
/*
* public String getStkOccupncyDtl(String loginCode) throws RemoteException,
* ITMException { String data = ""; String sql = ""; ResultSet rs = null;
* Connection conn = null; PreparedStatement pstmt = null; ConnDriver
* connDriver = new ConnDriver(); StringBuffer xmlData = null; try { conn =
* connDriver.getConnectDB("DriverITM"); connDriver = null;
*
* sql =
* "select s.item_code,s.site_code,s.loc_code,s.lot_no,s.lot_sl,s.quantity,s.alloc_qty,s.exp_date, l.loc_phy_area,l.loc_phy_row,l.loc_phy_col,l.loc_phy_stack "
* +
* "From stock s left outer join location l on s.loc_code=l.loc_code where s.quantity >0 "
* + "AND s.exp_date <=SYSDATE AND S.SITE_CODE= ?";
*
* pstmt = conn.prepareStatement(sql); pstmt.setString(1, loginCode); rs =
* pstmt.executeQuery();
*
* xmlData = new StringBuffer("<?xml version='1.0'?> <Root>"); while
* (rs.next()) { xmlData.append("<Detail>");
*
* xmlData.append("<item_code>").append("<![CDATA[" +
* this.checkNull(rs.getString("item_code")) +
* "]]>").append("</item_code>");
* xmlData.append("<site_code>").append("<![CDATA[" +
* this.checkNull(rs.getString("site_code")) +
* "]]>").append("</site_code>");
* xmlData.append("<loc_code>").append("<![CDATA[" +
* this.checkNull(rs.getString("loc_code")) + "]]>").append("</loc_code>");
* xmlData.append("<lot_no>").append("<![CDATA[" +
* this.checkNull(rs.getString("lot_no")) + "]]>").append("</lot_no>");
* xmlData.append("<quantity>").append("<![CDATA[" +
* rs.getDouble("quantity") + "]]>").append("</quantity>");
* xmlData.append("<exp_date>").append("<![CDATA[" + rs.getDate("exp_date")
* + "]]>").append("</exp_date>");
* xmlData.append("<loc_phy_area>").append("<![CDATA[" +
* this.checkNull(rs.getString("loc_phy_area")) +
* "]]>").append("</loc_phy_area>");
* xmlData.append("<loc_phy_row>").append("<![CDATA[" +
* this.checkNull(rs.getString("loc_phy_row")) +
* "]]>").append("</loc_phy_row>");
* xmlData.append("<loc_phy_col>").append("<![CDATA[" +
* this.checkNull(rs.getString("loc_phy_col")) +
* "]]>").append("</loc_phy_col>");
* xmlData.append("<loc_phy_stack>").append("<![CDATA[" +
* this.checkNull(rs.getString("loc_phy_stack")) +
* "]]>").append("</loc_phy_stack>");
*
* xmlData.append("</Detail>"); } xmlData.append("</Root>");
*
* rs.close(); rs = null; pstmt.close(); pstmt = null;
*
* } 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(); throw
* new ITMException(d); } } return data; }
*
* public String getStkDtl(String locationCode, String siteCode) throws
* RemoteException, ITMException { String sql = ""; ResultSet rs = null;
* Connection conn = null; PreparedStatement pstmt = null; ConnDriver
* connDriver = new ConnDriver(); String selectedArea = ""; StringBuffer
* xmlData = null; try { conn = connDriver.getConnectDB("DriverITM");
* connDriver = null;
*
* sql =
* "select item_code,site_code,loc_code,lot_no,lot_sl,exp_date,quantity,alloc_qty,hold_qty From stock where quantity >0 AND exp_date <= SYSDATE and loc_code= ? and SITE_CODE=? "
* ;
*
* pstmt = conn.prepareStatement(sql); pstmt.setString(1, locationCode);
* pstmt.setString(2, siteCode); rs = pstmt.executeQuery(); xmlData = new
* StringBuffer("<?xml version='1.0'?> <Root>");
* xmlData.append("<location_code lcode=\"" + locationCode + "\">");
* xmlData.append("<detail>");
*
* while (rs.next()) {
*
* xmlData.append("<stock>");
* xmlData.append("<item_code>").append("<![CDATA[" +
* rs.getString("item_code") + "]]>").append("</item_code>");
* xmlData.append("<lot_sl>").append("<![CDATA[" + rs.getString("lot_sl") +
* "]]>").append("</lot_sl>");
* xmlData.append("<quantity>").append("<![CDATA[" +
* rs.getString("quantity") + "]]>").append("</quantity>");
* xmlData.append("<lot_no>").append("<![CDATA[" + rs.getString("lot_no") +
* "]]>").append("</lot_no>"); xmlData.append("</stock>"); }
*
* xmlData.append("</detail>"); rs.close(); rs = null; pstmt.close(); pstmt
* = null; } 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(); throw new ITMException(d); } } return selectedArea;
*
* }
*/
private String checkNull(String input)
{
if (input == null)
......
......@@ -11,6 +11,6 @@ import javax.ejb.Local;
public interface LocationStockOccupancyLocal extends ValidatorLocal
{
public String getLocPhyArea() throws RemoteException, ITMException;
public String getLocDtl(String locPhyArea,String loginCode) throws RemoteException, ITMException;
public String getLocDtl(String locPhyArea,String loginCode,String locationRange) throws RemoteException, ITMException;
public String getSelectedArea() throws RemoteException, ITMException;
}
......@@ -11,7 +11,7 @@ import javax.ejb.Remote;
public interface LocationStockOccupancyRemote extends ValidatorRemote
{
public String getLocPhyArea() throws RemoteException, ITMException;
public String getLocDtl(String locPhyArea,String loginCode) throws RemoteException, ITMException;
public String getLocDtl(String locPhyArea,String loginCode,String locationRange) throws RemoteException, ITMException;
public String getSelectedArea() 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