Commit abb8222c authored by sshinde's avatar sshinde

Added New Code For Site Code DropDown List For EorLocation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98321 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 432ae19b
......@@ -76,4 +76,32 @@ public class EORLocationStockBean implements Serializable
}
return xmlData;
}
public String getSiteCode()
{
String xmlData = "";
try
{
xmlData = eORLocationStockRemote.getSiteCode();
}
catch(Exception e)
{
System.out.println("Exception :ibase.dashboard.scm.bean::EORLocationStockBean:getLocPhyArea()"+e);
e.printStackTrace();
xmlData = null;
}
System.out.println("in EORLocationStockBean and getSiteCode()");
return xmlData;
}
}
......@@ -140,7 +140,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
return selectedArea;
}
public String getEORLocDtl(String locPhyArea, String siteCode, String locationRange, String expDate, String reTestDate,String occupiedRack) throws RemoteException, ITMException
public String getEORLocDtl(String locPhyArea, String siteCode, String locationRange, String expDate, String reTestDate, String occupiedRack) throws RemoteException, ITMException
{
String sql = "";
ResultSet rs = null, rs1 = null;
......@@ -156,13 +156,14 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
StringBuffer sqlStr = null;
int count = 0;
String locCode = "";
String sysDate = "sysdate()";
//String sysDate = "sysdate()";
String sysDate = "sysdate";
final String yseString = "Yes";
final String noString = "No";
try
{
System.out.println(" occupiedRack ="+occupiedRack);
System.out.println(" occupiedRack =" + occupiedRack);
//sysDate = "sysdate";
sqlStr = new StringBuffer();
conn = connDriver.getConnectDB("DriverITM");
......@@ -171,40 +172,38 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
{
locCode = "AND loc_code like '" + locationRange + "%'";
}
if (expDate != null && expDate.trim().length() != 0 && expDate.equalsIgnoreCase(yseString))
{
sqlStr.append(" and s.exp_date <= " + sysDate);
}
else if(expDate != null && expDate.trim().length() != 0 && expDate.equalsIgnoreCase(noString))
} else if (expDate != null && expDate.trim().length() != 0 && expDate.equalsIgnoreCase(noString))
{
sqlStr.append(" and s.exp_date > " + sysDate);
}
if (occupiedRack != null && occupiedRack.trim().length() != 0 && occupiedRack.equalsIgnoreCase(yseString))
{
//sqlStr.append(" and s.exp_date <= " + sysDate);
}
else if(occupiedRack != null && occupiedRack.trim().length() != 0 && occupiedRack.equalsIgnoreCase(noString))
} else if (occupiedRack != null && occupiedRack.trim().length() != 0 && occupiedRack.equalsIgnoreCase(noString))
{
//sqlStr.append(" and s.exp_date > " + sysDate);
}
/* if (reTestDate != null && reTestDate.trim().length() != 0 && reTestDate.equalsIgnoreCase(yseString))
{
sqlStr.append(" and s.retest_date < " + sysDate);
}
else if(reTestDate != null && reTestDate.trim().length() != 0 && reTestDate.equalsIgnoreCase(noString))
{
sqlStr.append(" and s.retest_date > " + sysDate);
}*/
/*
* if (reTestDate != null && reTestDate.trim().length() != 0 &&
* reTestDate.equalsIgnoreCase(yseString)) {
* sqlStr.append(" and s.retest_date < " + sysDate); } else
* if(reTestDate != null && reTestDate.trim().length() != 0 &&
* reTestDate.equalsIgnoreCase(noString)) {
* sqlStr.append(" and s.retest_date > " + sysDate); }
*/
//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";
//*Change query for alphanumeric sorting **/
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 DESC, loc_phy_stack ,substr(loc_phy_col,1,1), cast(substr(loc_phy_col,2) as int)";
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 DESC, loc_phy_stack ";//,substr(loc_phy_col,1,1), cast(substr(loc_phy_col,2) as int)";
//* End Change query for alphanumeric sorting **/
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locPhyArea);
pstmt.setString(2, siteCode);
......@@ -217,30 +216,25 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
{
count++;
locationCode = checkNull(rs.getString("loc_code"));
currentRow = checkNull(rs.getString("loc_phy_row"));
cuurentStack = checkNull(rs.getString("loc_phy_stack"));
if (count > 1 && !previousStack.equals(cuurentStack))
{
xmlData.append("</loc_phy_stack > ");
}
if (count > 1 && !currentRow.equals(previousRow))
{
if(previousStack.equals(cuurentStack))
if (previousStack.equals(cuurentStack))
{
xmlData.append("</loc_phy_stack > ");
}
xmlData.append("</loc_phy_row > ");
}
if (count == 1 || !currentRow.equals(previousRow))
{
previousRow = checkNull(rs.getString("loc_phy_row"));
xmlData.append("<loc_phy_row row =\"" + currentRow + "\">");
if(previousStack.equals(cuurentStack))
if (previousStack.equals(cuurentStack))
{
xmlData.append("<loc_phy_stack stack=\"" + cuurentStack + "\">");
}
......@@ -253,12 +247,12 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
}
xmlData.append("<loc_phy_col col=\"" + checkNull(rs.getString("loc_phy_col")) + "\">");
System.out.println(" before generating sql=");
//sql = "select s.item_code, s.site_code, s.loc_code, s.lot_no, s.lot_sl, s.exp_date, s.quantity, s.alloc_qty, s.hold_qty , s.mfg_date, s.exp_date, s.retest_date , i.descr from stock s ,item i where s.quantity >0 and s.exp_date <= "+ sysDate +" and s.item_code=i.item_code and s.loc_code = ? and s.site_code = ? " + sqlStr.toString();
sql = " select s.item_code, s.site_code, s.loc_code, s.lot_no, s.lot_sl, s.exp_date, s.quantity, s.alloc_qty, s.hold_qty , s.mfg_date, s.exp_date, s.retest_date , i.descr , s.unit from stock s ,item i where s.quantity >0 and s.item_code=i.item_code and s.loc_code = ? and s.site_code = ? " + sqlStr.toString();
System.out.println(" site code sql is="+sql);
System.out.println(" site code sql is=" + sql);
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, locationCode);
pstmt1.setString(2, siteCode);
......@@ -275,7 +269,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
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>");
if (rs1.getDate("mfg_date") != null)
{
xmlData.append("<mfg_date>").append("<![CDATA[" + rs1.getDate("mfg_date") + "]]>").append("</mfg_date>");
......@@ -316,7 +310,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
rs = null;
pstmt.close();
pstmt = null;
xmlData.append("</loc_phy_area>");
xmlData.append("</Root>");
......@@ -355,9 +349,10 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
throw new ITMException(d);
}
}
System.out.println("Final XML after change===" + xmlData.toString());
System.out.println("Final XML after modified===" + xmlData.toString());
return xmlData.toString();
}
private String checkNull(String input)
{
if (input == null)
......@@ -369,4 +364,79 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
}
return input;
}
@Override
public String getSiteCode() throws RemoteException, ITMException
{
System.out.println(" in getSiteCode method os EORLocationStock");
String sql = "";
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ConnDriver connDriver = new ConnDriver();
StringBuffer xmlData = null;
String siteCode = "";
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
// sql = "select distinct loc_phy_area from location order by loc_phy_area ";
sql = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE='999999' AND VAR_NAME='SITE_CODE'";
System.out.println(" sql is =" + sql);
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{
siteCode = rs.getString("VAR_VALUE");
}
String[] siteCodeArr = siteCode.split(",");
xmlData = new StringBuffer("<?xml version='1.0'?> <Root>");
xmlData.append("<Detail>");
for (int i = 0; i < siteCodeArr.length; i++)
{
xmlData.append("<SITE_CODE>").append("<![CDATA[" + siteCodeArr[i] + "]]>").append("</SITE_CODE>");
}
xmlData.append("</Detail>");
xmlData.append("</Root>");
rs.close();
rs = null;
pstmt.close();
pstmt = null;
} catch (Exception e)
{
System.out.println("Exception :ibase.dashboard.scm.bean:EORLocationStock:getSiteCode()" + 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);
}
}
System.out.println("xmlData.toString() in getSiteCode =" + xmlData.toString());
return xmlData.toString();
}
}
......@@ -13,4 +13,5 @@ public interface EORLocationStockLocal extends ValidatorLocal
public String getEORLocPhyArea() throws RemoteException, ITMException;
public String getEORLocDtl(String locPhyArea,String loginCode,String locationRange,String expDate,String retestDate,String occupiedRack) throws RemoteException, ITMException;
public String getSelectedArea() throws RemoteException, ITMException;
public String getSiteCode() throws RemoteException, ITMException;
}
......@@ -13,5 +13,6 @@ public interface EORLocationStockRemote extends ValidatorRemote
public String getEORLocPhyArea() throws RemoteException, ITMException;
public String getEORLocDtl(String locPhyArea,String loginCode,String locationRange,String expDate,String retestDate,String occupiedRack) throws RemoteException, ITMException;
public String getSelectedArea() throws RemoteException, ITMException;
public String getSiteCode() 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