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 ...@@ -76,4 +76,32 @@ public class EORLocationStockBean implements Serializable
} }
return xmlData; 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 ...@@ -140,7 +140,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
return selectedArea; 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 = ""; String sql = "";
ResultSet rs = null, rs1 = null; ResultSet rs = null, rs1 = null;
...@@ -156,13 +156,14 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -156,13 +156,14 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
StringBuffer sqlStr = null; StringBuffer sqlStr = null;
int count = 0; int count = 0;
String locCode = ""; String locCode = "";
String sysDate = "sysdate()"; //String sysDate = "sysdate()";
String sysDate = "sysdate";
final String yseString = "Yes"; final String yseString = "Yes";
final String noString = "No"; final String noString = "No";
try try
{ {
System.out.println(" occupiedRack ="+occupiedRack); System.out.println(" occupiedRack =" + occupiedRack);
//sysDate = "sysdate"; //sysDate = "sysdate";
sqlStr = new StringBuffer(); sqlStr = new StringBuffer();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -175,8 +176,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -175,8 +176,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
if (expDate != null && expDate.trim().length() != 0 && expDate.equalsIgnoreCase(yseString)) if (expDate != null && expDate.trim().length() != 0 && expDate.equalsIgnoreCase(yseString))
{ {
sqlStr.append(" and s.exp_date <= " + sysDate); 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); sqlStr.append(" and s.exp_date > " + sysDate);
} }
...@@ -184,25 +184,24 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -184,25 +184,24 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
if (occupiedRack != null && occupiedRack.trim().length() != 0 && occupiedRack.equalsIgnoreCase(yseString)) if (occupiedRack != null && occupiedRack.trim().length() != 0 && occupiedRack.equalsIgnoreCase(yseString))
{ {
//sqlStr.append(" and s.exp_date <= " + sysDate); //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); //sqlStr.append(" and s.exp_date > " + sysDate);
} }
/* if (reTestDate != null && reTestDate.trim().length() != 0 && reTestDate.equalsIgnoreCase(yseString)) /*
{ * if (reTestDate != null && reTestDate.trim().length() != 0 &&
sqlStr.append(" and s.retest_date < " + sysDate); * reTestDate.equalsIgnoreCase(yseString)) {
} * sqlStr.append(" and s.retest_date < " + sysDate); } else
else if(reTestDate != null && reTestDate.trim().length() != 0 && reTestDate.equalsIgnoreCase(noString)) * if(reTestDate != null && reTestDate.trim().length() != 0 &&
{ * reTestDate.equalsIgnoreCase(noString)) {
sqlStr.append(" and s.retest_date > " + sysDate); * 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"; //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 **/ //*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 **/ //* End Change query for alphanumeric sorting **/
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -217,30 +216,25 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -217,30 +216,25 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
{ {
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"));
cuurentStack = checkNull(rs.getString("loc_phy_stack")); cuurentStack = checkNull(rs.getString("loc_phy_stack"));
if (count > 1 && !previousStack.equals(cuurentStack)) if (count > 1 && !previousStack.equals(cuurentStack))
{ {
xmlData.append("</loc_phy_stack > "); xmlData.append("</loc_phy_stack > ");
} }
if (count > 1 && !currentRow.equals(previousRow)) if (count > 1 && !currentRow.equals(previousRow))
{ {
if(previousStack.equals(cuurentStack)) if (previousStack.equals(cuurentStack))
{ {
xmlData.append("</loc_phy_stack > "); xmlData.append("</loc_phy_stack > ");
} }
xmlData.append("</loc_phy_row > "); xmlData.append("</loc_phy_row > ");
} }
if (count == 1 || !currentRow.equals(previousRow)) if (count == 1 || !currentRow.equals(previousRow))
{ {
previousRow = checkNull(rs.getString("loc_phy_row")); previousRow = checkNull(rs.getString("loc_phy_row"));
xmlData.append("<loc_phy_row row =\"" + currentRow + "\">"); xmlData.append("<loc_phy_row row =\"" + currentRow + "\">");
if (previousStack.equals(cuurentStack))
if(previousStack.equals(cuurentStack))
{ {
xmlData.append("<loc_phy_stack stack=\"" + cuurentStack + "\">"); xmlData.append("<loc_phy_stack stack=\"" + cuurentStack + "\">");
} }
...@@ -258,7 +252,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -258,7 +252,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
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(); 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 = conn.prepareStatement(sql);
pstmt1.setString(1, locationCode); pstmt1.setString(1, locationCode);
pstmt1.setString(2, siteCode); pstmt1.setString(2, siteCode);
...@@ -355,9 +349,10 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -355,9 +349,10 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
throw new ITMException(d); 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(); return xmlData.toString();
} }
private String checkNull(String input) private String checkNull(String input)
{ {
if (input == null) if (input == null)
...@@ -369,4 +364,79 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -369,4 +364,79 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
} }
return input; 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 ...@@ -13,4 +13,5 @@ public interface EORLocationStockLocal extends ValidatorLocal
public String getEORLocPhyArea() throws RemoteException, ITMException; 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 getEORLocDtl(String locPhyArea,String loginCode,String locationRange,String expDate,String retestDate,String occupiedRack) throws RemoteException, ITMException;
public String getSelectedArea() throws RemoteException, ITMException; public String getSelectedArea() throws RemoteException, ITMException;
public String getSiteCode() throws RemoteException, ITMException;
} }
...@@ -13,5 +13,6 @@ public interface EORLocationStockRemote extends ValidatorRemote ...@@ -13,5 +13,6 @@ public interface EORLocationStockRemote extends ValidatorRemote
public String getEORLocPhyArea() throws RemoteException, ITMException; 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 getEORLocDtl(String locPhyArea,String loginCode,String locationRange,String expDate,String retestDate,String occupiedRack) throws RemoteException, ITMException;
public String getSelectedArea() 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