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; package ibase.dashboard.scm.ejb;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
...@@ -140,7 +141,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -140,7 +141,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
return selectedArea; 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 = ""; String sql = "";
ResultSet rs = null, rs1 = null; ResultSet rs = null, rs1 = null;
...@@ -154,12 +155,18 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -154,12 +155,18 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
String cuurentStack = ""; String cuurentStack = "";
String locationCode = " "; String locationCode = " ";
int count = 0; int count = 0;
String locCode="";
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
connDriver = null; 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 = conn.prepareStatement(sql);
pstmt.setString(1, locPhyArea); pstmt.setString(1, locPhyArea);
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -169,6 +176,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -169,6 +176,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
xmlData.append("<loc_phy_area area =\"" + locPhyArea + "\">"); xmlData.append("<loc_phy_area area =\"" + locPhyArea + "\">");
while (rs.next()) while (rs.next())
{ {
int isDataPresnt = 0;
count++; count++;
locationCode = checkNull(rs.getString("loc_code")); locationCode = checkNull(rs.getString("loc_code"));
currentRow = checkNull(rs.getString("loc_phy_row")); currentRow = checkNull(rs.getString("loc_phy_row"));
...@@ -206,47 +214,64 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -206,47 +214,64 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
xmlData.append("<location_code lcode=\"" + locationCode + "\">"); xmlData.append("<location_code lcode=\"" + locationCode + "\">");
while (rs1.next()) while (rs1.next())
{ {
isDataPresnt++;
xmlData.append("<stock>"); xmlData.append("<stock>");
xmlData.append("<item_code>").append("<![CDATA[" + checkNull(rs1.getString("item_code")) + "]]>").append("</item_code>"); 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_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("<lot_sl>").append("<![CDATA[" + checkNull(rs1.getString("lot_sl")) + "]]>").append("</lot_sl>");
xmlData.append("<quantity>").append("<![CDATA[" + rs1.getDouble("quantity")+"]]>").append("</quantity>"); 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("<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("<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>"); xmlData.append("<mfg_date>").append("<![CDATA[" + rs1.getDate("mfg_date") + "]]>").append("</mfg_date>");
} } else
else
{ {
xmlData.append("<mfg_date>").append("<![CDATA[ ]]>").append("</mfg_date>"); 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>"); xmlData.append("<exp_date>").append("<![CDATA[" + rs1.getDate("exp_date") + "]]>").append("</exp_date>");
}else } else
{ {
xmlData.append("<exp_date>").append("<![CDATA[ ]>").append("</exp_date>"); 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>"); xmlData.append("<retest_date>").append("<![CDATA[" + rs1.getDate("retest_date") + "]]>").append("</retest_date>");
} } else
else
{ {
xmlData.append("<retest_date>").append("<![CDATA[ ]]>").append("</retest_date>"); xmlData.append("<retest_date>").append("<![CDATA[ ]]>").append("</retest_date>");
} }
xmlData.append("</stock>"); 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("</location_code>");
xmlData.append("</loc_phy_col>"); xmlData.append("</loc_phy_col>");
...@@ -304,153 +329,104 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -304,153 +329,104 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
throw new ITMException(d); throw new ITMException(d);
} }
} }
System.out.println("Final XML===" + xmlData.toString());
return xmlData.toString(); return xmlData.toString();
} }
/*public String getStkOccupncyDtl(String loginCode) throws RemoteException, ITMException /*
{ * public String getStkOccupncyDtl(String loginCode) throws RemoteException,
String data = ""; * ITMException { String data = ""; String sql = ""; ResultSet rs = null;
String sql = ""; * Connection conn = null; PreparedStatement pstmt = null; ConnDriver
ResultSet rs = null; * connDriver = new ConnDriver(); StringBuffer xmlData = null; try { conn =
Connection conn = null; * connDriver.getConnectDB("DriverITM"); connDriver = null;
PreparedStatement pstmt = null; *
ConnDriver connDriver = new ConnDriver(); * sql =
StringBuffer xmlData = null; * "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 "
try * +
{ * "From stock s left outer join location l on s.loc_code=l.loc_code where s.quantity >0 "
conn = connDriver.getConnectDB("DriverITM"); * + "AND s.exp_date <=SYSDATE AND S.SITE_CODE= ?";
connDriver = null; *
* pstmt = conn.prepareStatement(sql); pstmt.setString(1, loginCode); rs =
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.executeQuery();
*
pstmt = conn.prepareStatement(sql); * xmlData = new StringBuffer("<?xml version='1.0'?> <Root>"); while
pstmt.setString(1, loginCode); * (rs.next()) { xmlData.append("<Detail>");
rs = pstmt.executeQuery(); *
* xmlData.append("<item_code>").append("<![CDATA[" +
xmlData = new StringBuffer("<?xml version='1.0'?> <Root>"); * this.checkNull(rs.getString("item_code")) +
while (rs.next()) * "]]>").append("</item_code>");
{ * xmlData.append("<site_code>").append("<![CDATA[" +
xmlData.append("<Detail>"); * this.checkNull(rs.getString("site_code")) +
* "]]>").append("</site_code>");
xmlData.append("<item_code>").append("<![CDATA[" + this.checkNull(rs.getString("item_code")) + "]]>").append("</item_code>"); * xmlData.append("<loc_code>").append("<![CDATA[" +
xmlData.append("<site_code>").append("<![CDATA[" + this.checkNull(rs.getString("site_code")) + "]]>").append("</site_code>"); * this.checkNull(rs.getString("loc_code")) + "]]>").append("</loc_code>");
xmlData.append("<loc_code>").append("<![CDATA[" + this.checkNull(rs.getString("loc_code")) + "]]>").append("</loc_code>"); * xmlData.append("<lot_no>").append("<![CDATA[" +
xmlData.append("<lot_no>").append("<![CDATA[" + this.checkNull(rs.getString("lot_no")) + "]]>").append("</lot_no>"); * this.checkNull(rs.getString("lot_no")) + "]]>").append("</lot_no>");
xmlData.append("<quantity>").append("<![CDATA[" + rs.getDouble("quantity") + "]]>").append("</quantity>"); * xmlData.append("<quantity>").append("<![CDATA[" +
xmlData.append("<exp_date>").append("<![CDATA[" + rs.getDate("exp_date") + "]]>").append("</exp_date>"); * rs.getDouble("quantity") + "]]>").append("</quantity>");
xmlData.append("<loc_phy_area>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_area")) + "]]>").append("</loc_phy_area>"); * xmlData.append("<exp_date>").append("<![CDATA[" + rs.getDate("exp_date")
xmlData.append("<loc_phy_row>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_row")) + "]]>").append("</loc_phy_row>"); * + "]]>").append("</exp_date>");
xmlData.append("<loc_phy_col>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_col")) + "]]>").append("</loc_phy_col>"); * xmlData.append("<loc_phy_area>").append("<![CDATA[" +
xmlData.append("<loc_phy_stack>").append("<![CDATA[" + this.checkNull(rs.getString("loc_phy_stack")) + "]]>").append("</loc_phy_stack>"); * this.checkNull(rs.getString("loc_phy_area")) +
* "]]>").append("</loc_phy_area>");
xmlData.append("</Detail>"); * xmlData.append("<loc_phy_row>").append("<![CDATA[" +
} * this.checkNull(rs.getString("loc_phy_row")) +
xmlData.append("</Root>"); * "]]>").append("</loc_phy_row>");
* xmlData.append("<loc_phy_col>").append("<![CDATA[" +
rs.close(); * this.checkNull(rs.getString("loc_phy_col")) +
rs = null; * "]]>").append("</loc_phy_col>");
pstmt.close(); * xmlData.append("<loc_phy_stack>").append("<![CDATA[" +
pstmt = null; * this.checkNull(rs.getString("loc_phy_stack")) +
* "]]>").append("</loc_phy_stack>");
} catch (Exception e) *
{ * xmlData.append("</Detail>"); } xmlData.append("</Root>");
e.printStackTrace(); *
throw new ITMException(e); * rs.close(); rs = null; pstmt.close(); pstmt = null;
} finally *
{ * } catch (Exception e) { e.printStackTrace(); throw new ITMException(e); }
try * finally { try { if (conn != null) { if (rs != null) rs.close(); rs =
{ * null; if (pstmt != null) pstmt.close(); pstmt = null; conn.close(); conn
if (conn != null) * = null; } conn = null; } catch (Exception d) { d.printStackTrace(); throw
{ * new ITMException(d); } } return data; }
if (rs != null) *
rs.close(); * public String getStkDtl(String locationCode, String siteCode) throws
rs = null; * RemoteException, ITMException { String sql = ""; ResultSet rs = null;
if (pstmt != null) * Connection conn = null; PreparedStatement pstmt = null; ConnDriver
pstmt.close(); * connDriver = new ConnDriver(); String selectedArea = ""; StringBuffer
pstmt = null; * xmlData = null; try { conn = connDriver.getConnectDB("DriverITM");
conn.close(); * connDriver = null;
conn = null; *
} * sql =
conn = null; * "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=? "
} catch (Exception d) * ;
{ *
d.printStackTrace(); * pstmt = conn.prepareStatement(sql); pstmt.setString(1, locationCode);
throw new ITMException(d); * pstmt.setString(2, siteCode); rs = pstmt.executeQuery(); xmlData = new
} * StringBuffer("<?xml version='1.0'?> <Root>");
} * xmlData.append("<location_code lcode=\"" + locationCode + "\">");
return data; * xmlData.append("<detail>");
} *
* while (rs.next()) {
public String getStkDtl(String locationCode, String siteCode) throws RemoteException, ITMException *
{ * xmlData.append("<stock>");
String sql = ""; * xmlData.append("<item_code>").append("<![CDATA[" +
ResultSet rs = null; * rs.getString("item_code") + "]]>").append("</item_code>");
Connection conn = null; * xmlData.append("<lot_sl>").append("<![CDATA[" + rs.getString("lot_sl") +
PreparedStatement pstmt = null; * "]]>").append("</lot_sl>");
ConnDriver connDriver = new ConnDriver(); * xmlData.append("<quantity>").append("<![CDATA[" +
String selectedArea = ""; * rs.getString("quantity") + "]]>").append("</quantity>");
StringBuffer xmlData = null; * xmlData.append("<lot_no>").append("<![CDATA[" + rs.getString("lot_no") +
try * "]]>").append("</lot_no>"); xmlData.append("</stock>"); }
{ *
conn = connDriver.getConnectDB("DriverITM"); * xmlData.append("</detail>"); rs.close(); rs = null; pstmt.close(); pstmt
connDriver = null; * = null; } catch (Exception e) { e.printStackTrace(); throw new
* ITMException(e); } finally { try { if (conn != null) { if (rs != 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=? "; * rs.close(); rs = null; if (pstmt != null) pstmt.close(); pstmt = null;
* conn.close(); conn = null; } conn = null; } catch (Exception d) {
pstmt = conn.prepareStatement(sql); * d.printStackTrace(); throw new ITMException(d); } } return selectedArea;
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) private String checkNull(String input)
{ {
if (input == null) if (input == null)
......
...@@ -11,6 +11,6 @@ import javax.ejb.Local; ...@@ -11,6 +11,6 @@ import javax.ejb.Local;
public interface LocationStockOccupancyLocal extends ValidatorLocal public interface LocationStockOccupancyLocal extends ValidatorLocal
{ {
public String getLocPhyArea() throws RemoteException, ITMException; 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; public String getSelectedArea() throws RemoteException, ITMException;
} }
...@@ -11,7 +11,7 @@ import javax.ejb.Remote; ...@@ -11,7 +11,7 @@ import javax.ejb.Remote;
public interface LocationStockOccupancyRemote extends ValidatorRemote public interface LocationStockOccupancyRemote extends ValidatorRemote
{ {
public String getLocPhyArea() throws RemoteException, ITMException; 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; 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