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