Commit d56ff81e authored by prane's avatar prane

allow alphbet at right side of lot number in price list

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205801 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 08833431
...@@ -959,7 +959,7 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -959,7 +959,7 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
if(listtype.equalsIgnoreCase("B")) if(listtype.equalsIgnoreCase("B"))
{ {
LotNoFrom=(String)PList.get("lot_no__from"); LotNoFrom=(String)PList.get("lot_no__from");
System.out.println("@@@@@lot number from"+LotNoFrom); System.out.println("@@@@@lot number from["+LotNoFrom+"]");
sql="select count(1) from pricelist 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 >= ?"; sql="select count(1) from pricelist 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=conn.prepareStatement(sql);
pstmtSql.setString(1,plist); pstmtSql.setString(1,plist);
...@@ -990,8 +990,9 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -990,8 +990,9 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
if(Count > 0) if(Count > 0)
{ {
System.out.println("LotNoFrom length["+LotNoFrom.length()+"]");
String s2=LotNoFrom.trim(); String s2=LotNoFrom.trim();
System.out.println("Lotnumber "+s2.length()); System.out.println("Lotnumber.trim() length["+s2.length()+"]");
left=0; left=0;
char right= s2.charAt(s2.length()-1); char right= s2.charAt(s2.length()-1);
int diff3=0; int diff3=0;
...@@ -1005,31 +1006,46 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1005,31 +1006,46 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
String s2=LotNoFrom.trim(); String s2=LotNoFrom.trim();
//String chekStr=LotNoFrom.trim(); //String chekStr=LotNoFrom.trim();
*/ */
System.out.println("s22222222222222"+s2); System.out.println("s2 ["+s2+"]");
//char right= s2.charAt(s2.length()-1); //char right= s2.charAt(s2.length()-1);
System.out.println("right s22222222222222"+right); System.out.println("right s2 ["+right+"]");
//Pavan Rane 23aug19[to set allow alphbet at right side]....start
if(!isNumber(right))
{
LotNoFrom ="";
for ( int i = 0; i <= s2.length()-2 ; i++ )
{
LotNoFrom = LotNoFrom + s2.charAt(i);
System.out.println("LotNoFrom......["+LotNoFrom+"]");
}
LotNoFrom = LotNoFrom+(int)right ;
System.out.println("1028 if char LotNoFrom["+LotNoFrom+"]");
}else
{
//Pavan Rane 23aug19[to set allow alphbet at right side]....end
cnt1 = 0; //Pavan Rane 20may19[to initialize count] cnt1 = 0; //Pavan Rane 20may19[to initialize count]
for ( int i = length - 1 ; i >= 0 ; i-- ) for ( int i = length - 1 ; i >= 0 ; i-- )
{ {
Character character = LotNoFrom.charAt(i); Character character = LotNoFrom.charAt(i);
System.out.println("Char"+character); System.out.println("Char ["+character+"]");
boolean flag = isNumber(character); boolean flag = isNumber(character);
if(!flag) if(!flag)
{ {
result = result + LotNoFrom.charAt(i); result = result + LotNoFrom.charAt(i);
System.out.println("result.....["+result+"]");
break; break;
} }
System.out.println("result"+result); System.out.println("result["+result+"]");
cnt1++; cnt1++;
System.out.println("Count is"+cnt1); System.out.println("Count is["+cnt1+"]");
} }
System.out.println("Result of entered string is: "+result); System.out.println("Result of entered string is: ["+result+"]");
System.out.println("Count is:::"+cnt1); System.out.println("Count is:::["+cnt1+"]");
int testOrginal=0; int testOrginal=0;
int sub=0; int sub=0;
testOrginal=length-cnt1; testOrginal=length-cnt1;
...@@ -1038,33 +1054,38 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1038,33 +1054,38 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
String testSub1=LotNoFrom.substring(0,testOrginal); String testSub1=LotNoFrom.substring(0,testOrginal);
System.out.println("testSub1::-["+testSub1+"]"); System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length(); int testSub=testSub1.length();
System.out.println("testSub"+testSub); System.out.println("testSub["+testSub+"]");
String testSub2=LotNoFrom.substring(s2.length()-cnt1); String testSub2=LotNoFrom.substring(s2.length()-cnt1);
System.out.println("testSub2::-"+testSub2); System.out.println("testSub2::-["+testSub2+"]");
sub=Integer.parseInt(testSub2); sub=Integer.parseInt(testSub2);
System.out.println("sub::["+testSub2+"]");
int u2=testSub2.length(); int u2=testSub2.length();
System.out.println("u2::["+u2+"]");
int OrgSub=sub-1; int OrgSub=sub-1;
System.out.println("OrgSub::["+OrgSub+"]");
String v1=String.valueOf(OrgSub); String v1=String.valueOf(OrgSub);
System.out.println("v1::["+v1+"]");
int v2=v1.length(); int v2=v1.length();
System.out.println("V2:"+v2); System.out.println("v2::["+v2+"]");
//System.out.println("V2:"+v2);
int z=u2-v2; int z=u2-v2;
System.out.println("z:"+z); System.out.println("z:["+z+"]");
if(z!=0) if(z!=0)
{ {
for(int s3=0;s3<z;s3++) for(int s3=0;s3<z;s3++)
{ {
System.out.println("For loop if "); System.out.println("For loop if ");
NewStr=NewStr.concat("0"); NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length()); System.out.println("@@@@@@@@@New String:::::::::::["+NewStr.length()+"]");
} }
} }
int q=NewStr.length(); int q=NewStr.length();
String a2=Integer.toString(OrgSub); String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr); System.out.println("NewStr["+NewStr+"]");
LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ; LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom); System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:["+LotNoFrom+"]");
}
sql="update pricelist set lot_no__to = ? , chg_user =?,chg_term = ?,chg_date = ? 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 >= ? and EFF_FROM not in ( ? ) "; sql="update pricelist set lot_no__to = ? , chg_user =?,chg_term = ?,chg_date = ? 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 >= ? and EFF_FROM not in ( ? ) ";
...@@ -1085,7 +1106,7 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1085,7 +1106,7 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
pstmtSql.setDouble(12, maxqty); pstmtSql.setDouble(12, maxqty);
pstmtSql.setTimestamp(13, efffrom); pstmtSql.setTimestamp(13, efffrom);
int upcnt1=pstmtSql.executeUpdate(); int upcnt1=pstmtSql.executeUpdate();
System.out.println("No. of rows updated@@@@@@@@------>>"+upcnt1); System.out.println("No. of rows updated@@@@@@@@------>>["+upcnt1+"]");
if(pstmtSql !=null) if(pstmtSql !=null)
{ {
pstmtSql.close(); pstmtSql.close();
...@@ -1100,11 +1121,11 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1100,11 +1121,11 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
//change the valid upto date of price before the eff from date and batch no less then the //change the valid upto date of price before the eff from date and batch no less then the
//plist1 = (String)PList.get("price_list"); //plist1 = (String)PList.get("price_list");
refNoold=(String)PList.get("ref_no_old"); refNoold=(String)PList.get("ref_no_old");
System.out.println("Reference Number old is:"+refNoold); System.out.println("Reference Number old is:["+refNoold+"]");
if(listtype.equalsIgnoreCase("B")) if(listtype.equalsIgnoreCase("B"))
{ {
LotNoFrom=(String)PList.get("lot_no__from"); LotNoFrom=(String)PList.get("lot_no__from");
System.out.println("@@@@@lot number from"+LotNoFrom); System.out.println("@@@@@lot number from["+LotNoFrom+"]");
if(refNoold !=null && refNoold.trim().length() > 0) if(refNoold !=null && refNoold.trim().length() > 0)
{ {
sql="select count(*) 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 = ?"; sql="select count(*) 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 = ?";
...@@ -1218,21 +1239,36 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1218,21 +1239,36 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
/*Len=LotNoFrom.trim().length(); /*Len=LotNoFrom.trim().length();
Ctr=1; Ctr=1;
*/ */
System.out.println("@@LotNoFrom@@@@@"+LotNoFrom); System.out.println("@@LotNoFrom@@@@@["+LotNoFrom+"]");
System.out.println("@@LotNoFrom.length()["+LotNoFrom.length()+"]");
String s2=LotNoFrom.trim(); String s2=LotNoFrom.trim();
System.out.println("Lotnumber "+s2.length()); System.out.println("Lotnumber.trim().length["+s2.length()+"]");
left=0; left=0;
char right= s2.charAt(LotNoFrom.length()-1); char right= s2.charAt(LotNoFrom.length()-1);
int diff3=0,cntt=0; int diff3=0,cntt=0;
String original="", result = "",result2=""; String original="", result = "",result2="";
int length = LotNoFrom.trim().length(); int length = LotNoFrom.trim().length();
System.out.println("s22222222222222"+s2.trim()); System.out.println("s22222222222222["+s2.trim()+"]");
//char right= s2.charAt(s2.length()-1); //char right= s2.charAt(s2.length()-1);
//Pavan Rane 23aug19[to set allow alphbet at right side]....start
System.out.println("right s22222222222222"+right); if(!isNumber(right))
{
LotNoFrom ="";
for ( int i = 0; i <= s2.length()-2 ; i++ )
{
LotNoFrom = LotNoFrom + s2.charAt(i);
System.out.println("LotNoFrom......["+LotNoFrom+"]");
}
LotNoFrom = LotNoFrom+(int)right ;
System.out.println("1028 if char LotNoFrom["+LotNoFrom+"]");
}else
{
//Pavan Rane 23aug19[to set allow alphbet at right side]....end
System.out.println("right s22222222222222["+right+"]");
cntt = 0; //Pavan Rane 20may19[to initialize count] cntt = 0; //Pavan Rane 20may19[to initialize count]
for ( int i = length - 1 ; i >= 0 ; i-- ) for ( int i = length - 1 ; i >= 0 ; i-- )
{ {
...@@ -1246,12 +1282,12 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1246,12 +1282,12 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
result = result + LotNoFrom.charAt(i); result = result + LotNoFrom.charAt(i);
break; break;
} }
System.out.println("result"+result); System.out.println("result["+result+"]");
cntt++; cntt++;
System.out.println("Count is"+cntt); System.out.println("Count is["+cntt+"]");
} }
System.out.println("Result of entered string is: "+result); System.out.println("Result of entered string is: ["+result+"]");
System.out.println("Count is:::"+cntt); System.out.println("Count is:::["+cntt+"]");
int testOrginal=0; int testOrginal=0;
int sub=0; int sub=0;
testOrginal=length-cntt; testOrginal=length-cntt;
...@@ -1260,34 +1296,35 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1260,34 +1296,35 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
String testSub1=LotNoFrom.substring(0,testOrginal)==null?"":LotNoFrom.substring(0,testOrginal).trim(); String testSub1=LotNoFrom.substring(0,testOrginal)==null?"":LotNoFrom.substring(0,testOrginal).trim();
System.out.println("testSub1::-["+testSub1+"]"); System.out.println("testSub1::-["+testSub1+"]");
int testSub=testSub1.length(); int testSub=testSub1.length();
System.out.println("testSub"+testSub); System.out.println("testSub["+testSub+"]");
String testSub21=LotNoFrom.substring(LotNoFrom.length()-cntt); String testSub21=LotNoFrom.substring(LotNoFrom.length()-cntt);
System.out.println("testSub2::-"+testSub21); System.out.println("testSub2::-["+testSub21+"]");
sub=Integer.parseInt(testSub21); sub=Integer.parseInt(testSub21);
// System.out.println("SUB@@@"+sub); System.out.println("SUB@@@["+sub+"]");
int u2=testSub21.length(); int u2=testSub21.length();
System.out.println("u2["+u2+"]");
int OrgSub=sub-1; int OrgSub=sub-1;
String v1=String.valueOf(OrgSub); String v1=String.valueOf(OrgSub);
int v2=v1.length(); int v2=v1.length();
System.out.println("V2:"+v2); System.out.println("V2:["+v2+"]");
int z=u2-v2; int z=u2-v2;
System.out.println("z:"+z); System.out.println("z:["+z+"]");
if(z!=0) if(z!=0)
{ {
for(int s3=0;s3<z;s3++) for(int s3=0;s3<z;s3++)
{ {
System.out.println("For loop if "); System.out.println("For loop if ");
NewStr=NewStr.concat("0"); NewStr=NewStr.concat("0");
System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length()); System.out.println("@@@@@@@@@New String:::::::::::"+NewStr.length()+"]");
} }
} }
int q=NewStr.length(); int q=NewStr.length();
String a2=Integer.toString(OrgSub); String a2=Integer.toString(OrgSub);
System.out.println("NewStr"+NewStr); System.out.println("NewStr"+NewStr+"]");
LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ; LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom); System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom+"]");
}
if( dbName.equalsIgnoreCase("db2")) if( dbName.equalsIgnoreCase("db2"))
{ {
...@@ -1912,4 +1949,4 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri ...@@ -1912,4 +1949,4 @@ public class PriceListPos extends ValidatorEJB implements PriceListPosLocal, Pri
} }
} }
\ No newline at end of file
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