Commit c9b69ac9 authored by manohar's avatar manohar

Oracle specific instr function removed and changed to IN


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91256 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2ed584e1
...@@ -18,6 +18,7 @@ import java.sql.Connection; ...@@ -18,6 +18,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.Date; import java.util.Date;
import java.util.*;
import javax.ejb.CreateException; import javax.ejb.CreateException;
import javax.ejb.SessionBean; import javax.ejb.SessionBean;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -3658,19 +3659,43 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -3658,19 +3659,43 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
else else
{ {
lcAvailStk =0.00; lcAvailStk =0.00;
// 23/03/10 manoharan
StringTokenizer st = new StringTokenizer(siteString,",");
ArrayList siteCodeList = new ArrayList();
String tempCode = "";
while(st.hasMoreTokens())
{
tempCode = st.nextToken();
if (tempCode != null && tempCode.trim().length() > 0)
{
siteCodeList.add("'"+tempCode.trim()+"'");
}
}
if(!siteCodeList.isEmpty())
{
siteString = siteCodeList.toString();
siteString = siteString.substring(1,siteString.length()-1);
}
else
{
siteString ="''";
}
sql="select sum((case when quantity is null then 0 else quantity end) - (case when alloc_qty is null then 0 else alloc_qty end)) " sql="select sum((case when quantity is null then 0 else quantity end) - (case when alloc_qty is null then 0 else alloc_qty end)) "
+" from stock a, invstat b " +" from stock a, invstat b "
+" where a.inv_stat = b.inv_stat " +" where a.inv_stat = b.inv_stat "
+" and a.item_code = ? " +" and a.item_code = ? "
+" and instr(?,a.site_code) > 0 " +" and a.site_code in (" + siteString + ") "
+" and b.available = 'Y' " +" and b.available = 'Y' "
+" and a.quantity > 0 " +" and a.quantity > 0 "
+" and a.loc_code = ? "; +" and a.loc_code = ? ";
// +" and instr(?,a.site_code) > 0 "
//System.out.println("sql...."+sql); //System.out.println("sql...."+sql);
pstmt= conn.prepareStatement(sql); pstmt= conn.prepareStatement(sql);
pstmt.setString(1,itemCode); pstmt.setString(1,itemCode);
pstmt.setString(2,siteString); //pstmt.setString(2,siteString);
pstmt.setString(3,disparmLoc); pstmt.setString(2,disparmLoc);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -4032,7 +4057,12 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF ...@@ -4032,7 +4057,12 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
//System.out.println("totqtyStr...value....."+totqtyStr); //System.out.println("totqtyStr...value....."+totqtyStr);
if(totqtyStr != null && totqtyStr.trim().length() > 0) if(totqtyStr != null && totqtyStr.trim().length() > 0)
{ {
totQty = Integer.parseInt(totqtyStr); // 25/03/10 manoharan the string is in the form of 999999.999 format
// cannot be parsed as int
//totQty = Integer.parseInt(totqtyStr);
//totQty = (new Double(Double.parseDouble(totqtyStr))).intValue();
totQty = Double.parseDouble(totqtyStr);
// end 25/03/10 manoharan
} }
siteCode = genericUtility.getColumnValue("site_code",dom1); siteCode = genericUtility.getColumnValue("site_code",dom1);
//System.out.println("xtraParams...value....."+xtraParams); //System.out.println("xtraParams...value....."+xtraParams);
......
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