Commit 04146bdb authored by kshinde's avatar kshinde

Bug Fix


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@105501 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7c2096af
package ibase.webitm.ejb.dis;
import ibase.utility.EMail;
import ibase.utility.CommonConstants;
import ibase.webitm.utility.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.mfg.ExplodeBom;
import ibase.webitm.ejb.mfg.adv.RcpBackflushConfirm;
import ibase.webitm.ejb.sys.*;
import ibase.system.config.*;
import ibase.webitm.utility.ITMException;
import java.text.*;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.*;
import ibase.webitm.utility.TransIDGenerator;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.*;
import java.rmi.RemoteException;
import java.sql.*;
import java.util.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import javax.ejb.Stateless;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
//import org.drools.runtime.pipeline.SmooksTransformerProvider;
import org.w3c.dom.*;
import javax.xml.rpc.ParameterMode;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.parsers.*;
import java.text.SimpleDateFormat;
import ibase.utility.CommonConstants;
//import ibase.utility.GenericUtility;
import ibase.webitm.ejb.E12CreateBatchLoadEjb;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.CreateRCPXML;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
......@@ -17,6 +57,11 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import com.ibm.db2.jcc.b.SQLException;
@Stateless
public class PriceListConf extends ActionHandlerEJB implements PriceListConfLocal, PriceListConfRemote
{
......@@ -71,10 +116,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
//Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
connStatus = true;
......@@ -180,10 +222,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
//Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
connStatus = true;
......@@ -363,6 +402,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
String refNoold1="";
String chgref1="";
double maxrate1=0.0;
char left=0;
String PriceListParent1="",orderType1="";
int Ctr=0,countup=0,Len=0,Len1=0;
java.sql.Timestamp ChgDate=null,efffromdt=null,validupto=null;
......@@ -377,7 +417,6 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//String LotNoFroma[] = null, LotNoToa[]=null;
ArrayList<String> LotNoFroma=new ArrayList<String>(); ArrayList<String> LotNoToa=new ArrayList<String>();
char left1=0,left2=0,left3 = 0,left4=0;
char left=0;
int updCnt = 0;
String mid1="",mid2="",mid3="",mid4="";
java.text.SimpleDateFormat sdf = null;
......@@ -412,7 +451,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//minrate=(Double)PList.get("min_rate");
//maxrate1=(Double)PList.get("max_rate");
PricelistGen.add(PList);
PricelistGen.add(PList);
System.out.println("List size is"+PricelistGen);
lotnofrom=(String)PList.get("lot_no__from");
System.out.println("lot no from "+lotnofrom);
......@@ -535,7 +574,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql.setString(3,unit);
pstmtSql.setString(4,listtype);
pstmtSql.setString(5,lotnofrom);
pstmtSql.setString(6,lotnoto1);
pstmtSql.setString(6,lotnofrom);//lotnoto1
pstmtSql.setDouble(7,minqty);
pstmtSql.setDouble(8,maxqty);
rs=pstmtSql.executeQuery();
......@@ -658,80 +697,84 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//char right= s2.charAt(s2.length()-1);
System.out.println("right s22222222222222"+right);
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = LotNoFrom.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + LotNoFrom.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=LotNoFrom.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=LotNoFrom.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub-1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom);
sql="update pricelist set lot_no__to = ? where price_list = ? and item_code = ? and unit = ? and list_type = ? and lot_no__from <= ? and lot_no__to >= ? and min_qty <= ? and max_qty >= ?";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setString(1,LotNoFrom);
pstmtSql.setString(2, plist);
pstmtSql.setString(3, itemcode);
pstmtSql.setString(4, unit);
pstmtSql.setString(5,listtype);
pstmtSql.setString(6, lotnofrom);
pstmtSql.setString(7, lotnofrom);
pstmtSql.setDouble(8, minqty);
pstmtSql.setDouble(9, maxqty);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated@@@@@@@@------>>"+upcnt1);
if(pstmtSql !=null)
{
pstmtSql.close();
pstmtSql=null;
}
if(isNumber(s2.charAt(s2.length()-1)))
{
System.out.println("right s22222222222222"+right);
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = LotNoFrom.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + LotNoFrom.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=LotNoFrom.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=LotNoFrom.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub-1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom);
sql="update pricelist set lot_no__to = ? where price_list = ? and item_code = ? and unit = ? and list_type = ? and lot_no__from <= ? and lot_no__to >= ? and min_qty <= ? and max_qty >= ?";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setString(1,LotNoFrom);
pstmtSql.setString(2, plist);
pstmtSql.setString(3, itemcode);
pstmtSql.setString(4, unit);
pstmtSql.setString(5,listtype);
pstmtSql.setString(6, lotnofrom);
pstmtSql.setString(7, lotnofrom);
pstmtSql.setDouble(8, minqty);
pstmtSql.setDouble(9, maxqty);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated@@@@@@@@------>>"+upcnt1);
if(pstmtSql !=null)
{
pstmtSql.close();
pstmtSql=null;
}
}
}
}
//to expire the pricelist in case of revise circular of old circular.
......@@ -798,20 +841,24 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{
sql="select slab_no,eff_from ,lot_no__from from pricelist where price_list = ? and item_code = ? and unit = ? and lot_no__from >= ? and list_type = ? and min_qty >= ? and max_qty <= ? and ref_no = ?";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setDouble(1, slabno);
pstmtSql.setTimestamp(2, efffromdt);
pstmtSql.setString(3, LotNoFrom);
//pstmtSql.setDouble(1, slabno);
//pstmtSql.setTimestamp(2, efffromdt);
//pstmtSql.setString(3, LotNoFrom);
pstmtSql.setString(1, plist);
pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit);
pstmtSql.setString(4, lotnofrom);
pstmtSql.setString(5, listtype);
pstmtSql.setDouble(6, minqty);
pstmtSql.setDouble(7, maxqty);
pstmtSql.setString(8, refNoold);
rs = pstmtSql.executeQuery();
if (rs.next())
{
plist=rs.getString(1);
itemcode=rs.getString(2);
unit=rs.getString(3);
lotnofrom=rs.getString(4);
listtype=rs.getString(5);
minqty=rs.getDouble(6);
maxqty=rs.getDouble(7);
refNoold=rs.getString(8);
SlabNo=rs.getDouble(1);
efffromdt=rs.getTimestamp(2);
LotNoFrom=rs.getString(3);
}
rs.close();
rs = null;
......@@ -822,20 +869,24 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{
sql="select slab_no,eff_from ,lot_no__from from pricelist where price_list = ? and item_code = ? and unit = ? and lot_no__from >= ? and list_type = ? and min_qty >= ? and max_qty <= ? and ref_no is null";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setDouble(1, slabno);
pstmtSql.setTimestamp(2, efffromdt);
pstmtSql.setString(3, lotnofrom);
//pstmtSql.setDouble(1, slabno);
//pstmtSql.setTimestamp(2, efffromdt);
//pstmtSql.setString(3, lotnofrom);
pstmtSql.setString(1, plist);
pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit);
pstmtSql.setString(4, lotnofrom);
pstmtSql.setString(5, listtype);
pstmtSql.setDouble(6, minqty);
pstmtSql.setDouble(7, maxqty);
pstmtSql.setString(8, refNoold);
rs = pstmtSql.executeQuery();
if (rs.next())
{
plist=rs.getString(1);
itemcode=rs.getString(2);
unit=rs.getString(3);
LotFrBrow=rs.getString(4);
listtype=rs.getString(5);
minqty=rs.getDouble(6);
maxqty=rs.getDouble(7);
refNoold=rs.getString(8);
SlabNo=rs.getDouble(1);
efffromdt=rs.getTimestamp(2);
System.out.println("efffromdt++++"+efffromdt);
LotNoFrom=rs.getString(3);
}
rs.close();
rs = null;
......@@ -927,151 +978,156 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//char right= s2.charAt(s2.length()-1);
System.out.println("right s22222222222222"+right);
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = LotNoFrom.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + LotNoFrom.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=LotNoFrom.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=LotNoFrom.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub-1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom);
if( dbName.equalsIgnoreCase("db2"))
{
validupto=(ValidUpTo);
if(refNoold !=null && refNoold.trim().length() > 0)
if(isNumber(s2.charAt(s2.length()-1)))
{
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = LotNoFrom.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + LotNoFrom.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=LotNoFrom.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=LotNoFrom.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub-1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom);
if( dbName.equalsIgnoreCase("db2"))
{
sql="update pricelist set valid_upto = ? lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no =?";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1, validupto);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
pstmtSql.setString(10, refNoold);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
validupto=(ValidUpTo);
if(refNoold !=null && refNoold.trim().length() > 0)
{
pstmtSql.close();
pstmtSql=null;
sql="update pricelist set valid_upto = ?,lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no =?";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1, validupto);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
pstmtSql.setString(10, refNoold);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
{
pstmtSql.close();
pstmtSql=null;
}
}
}
else
{
sql="update pricelist set valid_upto = ? lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no is null ";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1, ValidUpTo);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
else
{
pstmtSql.close();
pstmtSql=null;
sql="update pricelist set valid_upto = ?,lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no is null ";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1, ValidUpTo);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
{
pstmtSql.close();
pstmtSql=null;
}
}
}
}
else
{
if(refNoold !=null && refNoold.trim().length() > 0)
else
{
sql="update pricelist set valid_upto = ? lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no =?";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1,ValidUpTo);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
pstmtSql.setString(10, refNoold);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
if(refNoold !=null && refNoold.trim().length() > 0)
{
pstmtSql.close();
pstmtSql=null;
sql="update pricelist set valid_upto = ?,lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no =?";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1,ValidUpTo);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
pstmtSql.setString(10, refNoold);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
{
pstmtSql.close();
pstmtSql=null;
}
}
}
else
{
sql="update pricelist set valid_upto = ? ,lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no is null ";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1, ValidUpTo);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
else
{
pstmtSql.close();
pstmtSql=null;
sql="update pricelist set valid_upto = ? ,lot_no__to = ? where price_list = ? and item_code = ? and unit =? and list_type = ? and min_qty >= ? and max_qty <= ? and slab_no = ? and ref_no is null ";
pstmtSql=conn.prepareStatement(sql);
pstmtSql.setTimestamp(1, ValidUpTo);
pstmtSql.setString(2, LotNoFrom);
pstmtSql.setString(3, plist);
pstmtSql.setString(4, itemcode);
pstmtSql.setString(5, unit);
pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
pstmtSql.setDouble(9, SlabNo);
int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated11111111111------>>"+upcnt1);
if(pstmtSql !=null)
{
pstmtSql.close();
pstmtSql=null;
}
}
}
}
}
}
}
......@@ -1150,7 +1206,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
String y=currentlotnofr.trim();
System.out.println("@@@@@x"+y);
String s2=y;
if(x.length()<y.length())
if(x.compareTo(y)<0)
{
/*char right3= y.charAt(y.length()-1);
if(Character.isDigit(right3) )
......@@ -1207,58 +1263,62 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//char right= s2.charAt(s2.length()-1);
//System.out.println("right s22222222222222"+right);
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = currentlotnofr.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + currentlotnofr.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=currentlotnofr.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=currentlotnofr.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub-1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
lotnoto = testSub1.trim()+NewStr.trim()+a2 ;
lotnofr = nextlotnofr;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+lotnoto);
if(isNumber(s2.charAt(s2.length()-1)))
{
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = currentlotnofr.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + currentlotnofr.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=currentlotnofr.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=currentlotnofr.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub-1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
lotnoto = testSub1.trim()+NewStr.trim()+a2 ;
lotnofr = nextlotnofr;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+lotnoto);
}
......@@ -1275,7 +1335,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
s2=currentlotnoto.trim();
int length = currentlotnoto.trim().length();
System.out.println("s22222222222222"+s2);
if(p.length()<q.length())
if(p.compareTo(q)<0)
{
/*char right4= y.charAt(y.length()-1);
if(Character.isDigit(right4) )
......@@ -1324,60 +1384,63 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
String a2=Integer.toString(New);
lotnofr = Set + NewStr.trim() +a2.trim();
lotnofr = nextlotnofr;*/
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = currentlotnoto.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + currentlotnoto.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=currentlotnofr.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=currentlotnoto.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub+1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
//int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
nextlotnofr= testSub1.trim()+NewStr.trim()+a2 ;
lotnofr = nextlotnofr;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+lotnofr);
if(isNumber(s2.charAt(s2.length()-1)))
{
for ( int i = length - 1 ; i >= 0 ; i-- )
{
Character character = currentlotnoto.trim().charAt(i);
System.out.println("Char"+character);
boolean flag = isNumber(character);
if(!flag)
{
result = result + currentlotnoto.trim().charAt(i);
break;
}
System.out.println("result"+result);
cnt1++;
System.out.println("Count is"+cnt1);
}
System.out.println("Result of entered string is: "+result);
System.out.println("Count is:::"+cnt1);
int testOrginal=0;
int sub=0;
testOrginal=length-cnt1;
System.out.println("testOrginal["+testOrginal+"]");
String testSub1=currentlotnofr.trim().substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length();
System.out.println("testSub"+testSub);
String testSub2=currentlotnoto.trim().substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2);
sub=Integer.parseInt(testSub2);
int u2=testSub2.length();
int OrgSub=sub+1;
String v1=String.valueOf(OrgSub);
int v2=v1.length();
System.out.println("V2:"+v2);
int z=u2-v2;
System.out.println("z:"+z);
if(z!=0)
{
for(int s3=0;s3<z;s3++)
{
System.out.println("For loop if ");
NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length());
}
}
//int q=NewStr.length();
String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr);
nextlotnofr= testSub1.trim()+NewStr.trim()+a2 ;
lotnofr = nextlotnofr;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+lotnofr);
}
}
int temp=0;
......@@ -1472,8 +1535,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql.close();
pstmtSql = null;
}
System.out
.println("Record found@@@@@@@@@@@@@"+recordfound);
System.out.println("Record found@@@@@@@@@@@@@"+recordfound);
today=new Timestamp(System.currentTimeMillis());
ChgDate = today;
if(recordfound == false)
......@@ -1487,8 +1549,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtInsert.setString(3, unit);
pstmtInsert.setString(4, listtype);
pstmtInsert.setDouble(5, LineNo);
pstmtInsert.setTimestamp(6, EffDate);
pstmtInsert.setTimestamp(7, ValidUpTo);
pstmtInsert.setTimestamp(6, (Timestamp)PList.get("eff_from"));
pstmtInsert.setTimestamp(7, (Timestamp)PList.get("valid_upto"));
pstmtInsert.setString(8,lotnofrom);//lotnofr)
pstmtInsert.setString(9, lotnoto1);//lotnoto)
pstmtInsert.setDouble(10, minqty);
......@@ -1633,11 +1695,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
sql="select d.item_code,d.lot_no__from,d.lot_no__to,d.rate,d.rate_type,d.min_rate,d.max_rate,d.chg_ref_no,d.eff_from,d.valid_upto,m.price_list,m.list_type ,m.price_list__parent,m.order_type,m.manage_type,d.min_qty ,d.max_qty,d.unit,d.line_no,h.ref_no,ref_no_old,h.calc_basis from pricelist_hdr h, pricelist_det d, pricelist_mst m where h.tran_id = d.tran_id and h.price_list = m.price_list and h.tran_id = ?";
pstmtSql = conn.prepareStatement(sql);
pstmtSql.setString(1, tranId);
System.out.println("Tran_id"+tranId);
rs = pstmtSql.executeQuery();
while (rs.next())
while ( rs.next() )
{
System.out.print("Inside loop");
PList = new HashMap();
PList.put("item_code",itemCode=rs.getString("item_code"));
PList.put("lot_no__from",lotNoForm=rs.getString("lot_no__from"));
......@@ -1661,7 +1721,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
PList.put("ref_no",refNO=rs.getString("ref_no"));
PList.put("ref_no_old",refNoold=rs.getString("ref_no_old"));
PList.put("calc_basis",calc=rs.getString("calc_basis"));
/*PList = new HashMap();
PList.put(PriceList,"PriceList");
......@@ -1690,25 +1750,23 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{
return retString;
}
/*sql="select calc_method, price_list__tar , price_list__parent from pricelist_mst_det where price_list = ? order by line_no ";
pstmtSql = conn.prepareStatement(sql);
pstmtSql.setString(1, PriceList);
rs = pstmtSql.executeQuery();
//sql="select calc_method, price_list__tar , price_list__parent from pricelist_mst_det where price_list = ? order by line_no ";
//pstmtSql = conn.prepareStatement(sql);
//pstmtSql.setString(1, PriceList);
//rs = pstmtSql.executeQuery();
/*while ( rs.next() )
{
calcmeth=rs.getString(1);
plisttar=rs.getString(2);
PriceListParent=rs.getString(3);
rs.close();
rs = null;
pstmtSql.close();
pstmtSql = null;
PList.put("price_list__tar",plisttar);
PList.put("price_list__parentfrom",PriceListParent);
PList.put(plisttar,"price_list__tar");
PList.put(PriceListParent,"price_list__parentfrom");
// PList.put(PriceListParent,"rate");
......@@ -1719,8 +1777,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
}
}*/
}
rs.close();
}
rs.close();
rs = null;
pstmtSql.close();
pstmtSql = null;
......
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