Commit 597d10b5 authored by sshinde's avatar sshinde

Added new code for adding Stack node after same stock for two row


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98195 ce508802-f39f-4f6c-b175-0d175dae99d5
parent dcab4387
...@@ -227,6 +227,11 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -227,6 +227,11 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
} }
if (count > 1 && !currentRow.equals(previousRow)) if (count > 1 && !currentRow.equals(previousRow))
{ {
if(previousStack.equals(cuurentStack))
{
xmlData.append("</loc_phy_stack > ");
}
xmlData.append("</loc_phy_row > "); xmlData.append("</loc_phy_row > ");
} }
...@@ -234,6 +239,11 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -234,6 +239,11 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
{ {
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))
{
xmlData.append("<loc_phy_stack stack=\"" + cuurentStack + "\">");
}
} }
if (count == 1 || !previousStack.equals(cuurentStack)) if (count == 1 || !previousStack.equals(cuurentStack))
...@@ -345,7 +355,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe ...@@ -345,7 +355,7 @@ public class EORLocationStock extends ValidatorEJB implements EORLocationStockRe
throw new ITMException(d); throw new ITMException(d);
} }
} }
System.out.println("Final XML===" + xmlData.toString()); System.out.println("Final XML after change===" + xmlData.toString());
return xmlData.toString(); return xmlData.toString();
} }
private String checkNull(String input) private String checkNull(String input)
......
package ibase.dashboard.scm.ejb; package ibase.dashboard.wms.ejb;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
...@@ -55,8 +55,9 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -55,8 +55,9 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} catch (Exception e) }
catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
...@@ -82,6 +83,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -82,6 +83,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
throw new ITMException(d); throw new ITMException(d);
} }
} }
System.out.println("xmlData.toString() =" + xmlData.toString());
return xmlData.toString(); return xmlData.toString();
} }
...@@ -141,7 +143,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -141,7 +143,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
return selectedArea; return selectedArea;
} }
public String getLocDtl(String locPhyArea, String siteCode,String locationRange) 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;
...@@ -155,18 +157,20 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -155,18 +157,20 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
String cuurentStack = ""; String cuurentStack = "";
String locationCode = " "; String locationCode = " ";
int count = 0; int count = 0;
String locCode=""; String locCode = "";
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
connDriver = null; connDriver = null;
if(locationRange!=null && locationRange.trim().length()>0){ if (locationRange != null && locationRange.trim().length() > 0)
{
locCode ="AND loc_code like '"+locationRange+"%'";
locCode = "AND loc_code like '" + locationRange + "%'";
System.out.println("location Range from JSP ==="+locationRange);
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";
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);
...@@ -174,6 +178,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -174,6 +178,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
xmlData = new StringBuffer("<?xml version='1.0'?> <Root>"); xmlData = new StringBuffer("<?xml version='1.0'?> <Root>");
xmlData.append("<loc_phy_area area =\"" + locPhyArea + "\">"); xmlData.append("<loc_phy_area area =\"" + locPhyArea + "\">");
while (rs.next()) while (rs.next())
{ {
int isDataPresnt = 0; int isDataPresnt = 0;
...@@ -203,8 +208,8 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -203,8 +208,8 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
xmlData.append("<loc_phy_stack stack=\"" + cuurentStack + "\">"); xmlData.append("<loc_phy_stack stack=\"" + cuurentStack + "\">");
} }
xmlData.append("<loc_phy_col col=\"" + checkNull(rs.getString("loc_phy_col")) + "\">"); xmlData.append("<loc_phy_col col=\"" + checkNull(rs.getString("loc_phy_col")) + "\">");
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 =?"; 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 = ? ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, locationCode); pstmt1.setString(1, locationCode);
...@@ -212,6 +217,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -212,6 +217,7 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
xmlData.append("<location_code lcode=\"" + locationCode + "\">"); xmlData.append("<location_code lcode=\"" + locationCode + "\">");
while (rs1.next()) while (rs1.next())
{ {
isDataPresnt++; isDataPresnt++;
...@@ -250,37 +256,15 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -250,37 +256,15 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
{ {
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>");
pstmt1.close(); pstmt1.close();
rs1.close(); rs1.close();
pstmt1 = null; pstmt1 = null;
rs1 = null; rs1 = null;
} }
if (count > 0) if (count > 0)
{ {
xmlData.append("</loc_phy_stack > "); xmlData.append("</loc_phy_stack > ");
...@@ -290,10 +274,8 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -290,10 +274,8 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
xmlData.append("</loc_phy_area>"); xmlData.append("</loc_phy_area>");
xmlData.append("</Root>"); xmlData.append("</Root>");
} catch (Exception e) } catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
...@@ -332,7 +314,6 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -332,7 +314,6 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
System.out.println("Final XML===" + xmlData.toString()); System.out.println("Final XML===" + xmlData.toString());
return xmlData.toString(); return xmlData.toString();
} }
private String checkNull(String input) private String checkNull(String input)
{ {
if (input == null) if (input == null)
...@@ -344,5 +325,4 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc ...@@ -344,5 +325,4 @@ public class LocationStockOccupancy extends ValidatorEJB implements LocationStoc
} }
return input; return input;
} }
} }
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