Commit e7ede5a8 authored by prane's avatar prane

bug fixed while testing Batch no case and changes done related to split and expiry logic

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@213336 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7c0d3980
...@@ -336,8 +336,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -336,8 +336,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
private String insertPricelist(String tranId, HashMap PList, ArrayList PricelistGen, Connection conn, private String insertPricelist(String tranId, HashMap PList, ArrayList PricelistGen, Connection conn,
String xtraParams) throws RemoteException, ITMException String xtraParams) throws RemoteException, ITMException
{ {
PreparedStatement pstmtSql = null, pstmtInsert = null, pstmtInner = null; PreparedStatement pstmtSql = null, pstmtInsert = null, pstmtInner = null, pstmtLot=null;
ResultSet rs = null, rsInner = null; ResultSet rs = null, rsInner = null, rsLot= null;
String dbName = ""; String dbName = "";
String sql = ""; String sql = "";
String retString = ""; String retString = "";
...@@ -379,6 +379,10 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -379,6 +379,10 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
String mid1 = "", mid2 = "", mid3 = "", mid4 = ""; String mid1 = "", mid2 = "", mid3 = "", mid4 = "";
java.text.SimpleDateFormat sdf = null; java.text.SimpleDateFormat sdf = null;
String lotnofrom = "", lotnoto1 = ""; String lotnofrom = "", lotnoto1 = "";
String priceListOldto = "", priceListOldFr="";
Timestamp efffromSplit = null, ValidUpToSplit = null;
double minqtySplit = 0.0, maxqtySplit = 0.0, rate1Split = 0.0;
String ratetypeSplit = "", PriceListParent1Split = "", refNo1Split = "", refNoold1Split = "";
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId"); termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
try try
...@@ -440,6 +444,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -440,6 +444,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
// pstmtSql.setString(1,plist); // pstmtSql.setString(1,plist);
// pstmtSql.setString(2,itemcode); // pstmtSql.setString(2,itemcode);
// rs = pstmtSql.executeQuery(); // rs = pstmtSql.executeQuery();
sql = "select lot_no__from, lot_no__to from pricelist where price_list = ? and item_code = ? "
+ " and unit = ? and list_type = ? and lot_no__from <= ? and min_qty <= ? and max_qty >= ? order by lot_no__from";
pstmtLot = conn.prepareStatement(sql);
for (Ctr = 0; Ctr < PricelistGen.size(); Ctr++) for (Ctr = 0; Ctr < PricelistGen.size(); Ctr++)
{ {
...@@ -505,7 +512,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -505,7 +512,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
MinQtyBrow = rsInner.getDouble("min_qty"); MinQtyBrow = rsInner.getDouble("min_qty");
MaxQtyBrow = rsInner.getDouble("max_qty"); MaxQtyBrow = rsInner.getDouble("max_qty");
System.out.println("Minimum value is@@@@@@@@@" + MinQtyBrow); System.out.println("Minimum value is@@@@@@@@@" + MinQtyBrow);
priceListOldto = LotNoToBrow;
priceListOldFr = LotFrBrow;
PList.put("LOT_NO__TO_OLD", LotNoToBrow);
//K = LotNoToBrow;
System.out.println("Split priceListOldFr ["+priceListOldFr+"] priceListOldto["+priceListOldto+"]");
System.out.println("---------------------- Check if Conditon -----------------------"); System.out.println("---------------------- Check if Conditon -----------------------");
DayDiff = (int) utilMethods.DaysAfter(ValidUpTo, EffDate); DayDiff = (int) utilMethods.DaysAfter(ValidUpTo, EffDate);
System.out.println("DayDiff-----------[" + DayDiff + "]"); System.out.println("DayDiff-----------[" + DayDiff + "]");
...@@ -600,6 +611,25 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -600,6 +611,25 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
if (Count > 0) if (Count > 0)
{ {
//Pavan Rane 09DEc19[to hold lot_no__to to update on splited price list] start
pstmtLot.setString(1, plist);
pstmtLot.setString(2, itemcode);
pstmtLot.setString(3, unit);
pstmtLot.setString(4, listtype);
pstmtLot.setString(5, lotnofrom);
pstmtLot.setDouble(6, minqty);
pstmtLot.setDouble(7, maxqty);
rsLot = pstmtLot.executeQuery();
if (rsLot.next())
{
priceListOldFr = rsLot.getString("lot_no__from");
priceListOldto = rsLot.getString("lot_no__to");
System.out.println("@268 priceListOldFr["+priceListOldFr+"]priceListOldto["+priceListOldto+"]");
}
rsLot.close();
rsLot = null;
pstmtLot.clearParameters();
//Pavan Rane 09DEc19[to hold lot_no__to to update on splited price list] end
String s2 = LotNoFrom.trim(); String s2 = LotNoFrom.trim();
System.out.println("Lotnumber " + s2.length()); System.out.println("Lotnumber " + s2.length());
...@@ -704,6 +734,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -704,6 +734,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql.close(); pstmtSql.close();
pstmtSql = null; pstmtSql = null;
} }
if(priceListOldFr.compareTo(LotNoFrom) <= 0)
{
PList.put("LOT_NO__TO_OLD", LotNoFrom);
}
//} //}
}//count end }//count end
}//if (listtype.equalsIgnoreCase("B")) }//if (listtype.equalsIgnoreCase("B"))
...@@ -713,6 +748,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -713,6 +748,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtInner.close(); pstmtInner.close();
pstmtInner = null; pstmtInner = null;
} }
if(pstmtLot != null)
{
pstmtLot .close();
pstmtLot = null;
}
} // end autoexpire if } // end autoexpire if
/////////////// ///////////////
...@@ -776,23 +816,27 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -776,23 +816,27 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
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 = ?"; //Modified By Pavan Rane 05dec19 start[issue as previous valid pricelist expired wrongly]
//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 lot_no__to >= ? and list_type = ? and min_qty <= ? and max_qty >= ? and ref_no = ?";
pstmtSql = conn.prepareStatement(sql); pstmtSql = conn.prepareStatement(sql);
pstmtSql.setString(1, plist); pstmtSql.setString(1, plist);
pstmtSql.setString(2, itemcode); pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit); pstmtSql.setString(3, unit);
pstmtSql.setString(4, lotnofrom); pstmtSql.setString(4, lotnofrom);
pstmtSql.setString(5, listtype); pstmtSql.setString(5, lotnofrom);
pstmtSql.setDouble(6, minqty); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, maxqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setString(8, refNoold); pstmtSql.setDouble(8, maxqty);
pstmtSql.setString(9, refNoold);
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
System.out.println("COUNT" + countup); //System.out.println("COUNT" + countup);
//Modified By Pavan Rane 05dec19 end [issue as previous valid pricelist expired wrongly]
if (rs.next()) if (rs.next())
{ {
countup = rs.getInt(1); countup = rs.getInt(1);
} }
System.out.println("RefNoOld countup["+countup+"]");
rs.close(); rs.close();
rs = null; rs = null;
pstmtSql.close(); pstmtSql.close();
...@@ -800,21 +844,25 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -800,21 +844,25 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
} else } else
{ {
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 is null "; //Modified By Pavan Rane 05dec19 start[issue as previous valid pricelist expired wrongly]
//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 is null ";
sql = "select count(*) from pricelist where price_list= ? and item_code = ? and unit = ? and lot_no__from <= ? and lot_no__to >= ? and list_type = ? and min_qty <= ? and max_qty >= ? and ref_no is null ";
pstmtSql = conn.prepareStatement(sql); pstmtSql = conn.prepareStatement(sql);
pstmtSql.setString(1, plist); pstmtSql.setString(1, plist);
pstmtSql.setString(2, itemcode); pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit); pstmtSql.setString(3, unit);
pstmtSql.setString(4, lotnofrom); pstmtSql.setString(4, lotnofrom);
pstmtSql.setString(5, listtype); pstmtSql.setString(5, lotnofrom);
pstmtSql.setDouble(6, minqty); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, maxqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
System.out.println("COUNT" + countup); //Modified By Pavan Rane 05dec19 end[issue as previous valid pricelist expired wrongly]
//System.out.println("COUNT" + countup);
if (rs.next()) { if (rs.next()) {
countup = rs.getInt(1); countup = rs.getInt(1);
} }
System.out.println("RefNoOld NUll countup["+countup+"]");
rs.close(); rs.close();
rs = null; rs = null;
pstmtSql.close(); pstmtSql.close();
...@@ -823,7 +871,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -823,7 +871,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
if (countup > 0) if (countup > 0)
{ {
if (refNoold != null && refNoold.trim().length() > 0) { if (refNoold != null && refNoold.trim().length() > 0) {
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 = ?"; //Modified By Pavan Rane 05dec19 start[issue as previous valid pricelist expired wrongly]
//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 = ?";
sql = "select slab_no,eff_from ,lot_no__from from pricelist where price_list = ? and item_code = ? and unit = ? and lot_no__from <= ? and lot_no__to >= ? and list_type = ? and min_qty <= ? and max_qty >= ? and ref_no = ?";
pstmtSql = conn.prepareStatement(sql); pstmtSql = conn.prepareStatement(sql);
// pstmtSql.setDouble(1, slabno); // pstmtSql.setDouble(1, slabno);
// pstmtSql.setTimestamp(2, efffromdt); // pstmtSql.setTimestamp(2, efffromdt);
...@@ -832,11 +882,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -832,11 +882,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql.setString(2, itemcode); pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit); pstmtSql.setString(3, unit);
pstmtSql.setString(4, lotnofrom); pstmtSql.setString(4, lotnofrom);
pstmtSql.setString(5, listtype); pstmtSql.setString(5, lotnofrom);
pstmtSql.setDouble(6, minqty); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, maxqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setString(8, refNoold); pstmtSql.setDouble(8, maxqty);
pstmtSql.setString(9, refNoold);
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
//Modified By Pavan Rane 05dec19 end[issue as previous valid pricelist expired wrongly]
if (rs.next()) if (rs.next())
{ {
SlabNo = rs.getDouble(1); SlabNo = rs.getDouble(1);
...@@ -850,7 +902,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -850,7 +902,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql = null; pstmtSql = null;
} else } else
{ {
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"; //Modified By Pavan Rane 05dec19 start[issue as previous valid pricelist expired wrongly]
//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";
sql = "select slab_no,eff_from ,lot_no__from from pricelist where price_list = ? and item_code = ? and unit = ? and lot_no__from <= ? and and lot_no__to >= ? and list_type = ? and min_qty <= ? and max_qty >= ? and ref_no is null";
pstmtSql = conn.prepareStatement(sql); pstmtSql = conn.prepareStatement(sql);
// pstmtSql.setDouble(1, slabno); // pstmtSql.setDouble(1, slabno);
// pstmtSql.setTimestamp(2, efffromdt); // pstmtSql.setTimestamp(2, efffromdt);
...@@ -859,9 +913,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -859,9 +913,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql.setString(2, itemcode); pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit); pstmtSql.setString(3, unit);
pstmtSql.setString(4, lotnofrom); pstmtSql.setString(4, lotnofrom);
pstmtSql.setString(5, listtype); pstmtSql.setString(5, lotnofrom);
pstmtSql.setDouble(6, minqty); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, maxqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty);
//Modified By Pavan Rane 05dec19 end[issue as previous valid pricelist expired wrongly]
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
if (rs.next()) { if (rs.next()) {
SlabNo = rs.getDouble(1); SlabNo = rs.getDouble(1);
...@@ -1079,15 +1135,21 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1079,15 +1135,21 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
if (listtype.equalsIgnoreCase("B")) if (listtype.equalsIgnoreCase("B"))
{ {
LotNoFrom = (String) PList.get("LOT_NO__FROM"); LotNoFrom = (String) PList.get("LOT_NO__FROM");
LotNoTo = (String) PList.get("LOT_NO__TO");
System.out.println("@@@@@lot number from2222222222222" + LotNoFrom); System.out.println("@@@@@lot number from2222222222222" + 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 >= ?"; 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);
pstmtSql.setString(2, itemcode); pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit); pstmtSql.setString(3, unit);
pstmtSql.setString(4, listtype); pstmtSql.setString(4, listtype);
pstmtSql.setString(5, LotFrBrow); //Modified By Pavan Rane 05dec19 start[split logic to be checked for given case]
pstmtSql.setString(6, LotNoToBrow); //pstmtSql.setString(5, LotFrBrow);
//pstmtSql.setString(6, LotNoToBrow);
pstmtSql.setString(5, LotNoFrom);
pstmtSql.setString(6, (String)PList.get("LOT_NO__TO_OLD"));//pstmtSql.setString(6, priceListOldFr);//LotFrBrow;
//Modified By Pavan Rane 05dec19 end[split logic to be checked for given case]
pstmtSql.setDouble(7, minqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty); pstmtSql.setDouble(8, maxqty);
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
...@@ -1109,28 +1171,49 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1109,28 +1171,49 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
LotNoFrom = (String) PList.get("LOT_NO__FROM"); LotNoFrom = (String) PList.get("LOT_NO__FROM");
LotNoTo = (String) PList.get("LOT_NO__TO"); LotNoTo = (String) PList.get("LOT_NO__TO");
nextlotnofr = LotNoFrom; nextlotnofr = LotNoFrom;
sql = "select lot_no__from, lot_no__to 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 >= ? order by lot_no__from";
//Modified By Pavan Rane 05dec19 start
/**To get details for splited pricelist for split logic to be checked for given case*/
//sql = "select lot_no__from, lot_no__to 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 >= ? order by lot_no__from";
//sql = "select lot_no__from, lot_no__to, eff_from, valid_upto, min_qty, max_qty, rate,rate_type, price_list__parent, ref_no, ref_no_old 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 >= ? order by lot_no__from";
sql = "select lot_no__from, lot_no__to, eff_from, valid_upto, min_qty, max_qty, rate,rate_type, price_list__parent, ref_no, ref_no_old 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 >= ? order by lot_no__from";
pstmtSql = conn.prepareStatement(sql); pstmtSql = conn.prepareStatement(sql);
pstmtSql.setString(1, plist); pstmtSql.setString(1, plist);
pstmtSql.setString(2, itemcode); pstmtSql.setString(2, itemcode);
pstmtSql.setString(3, unit); pstmtSql.setString(3, unit);
pstmtSql.setString(4, listtype); pstmtSql.setString(4, listtype);
pstmtSql.setString(5, lotnofrom); //pstmtSql.setString(5, lotnofrom);
pstmtSql.setString(6, LotNoToBrow); //pstmtSql.setString(6, LotNoToBrow);
pstmtSql.setString(5, LotNoFrom);
pstmtSql.setString(6, (String)PList.get("LOT_NO__TO_OLD"));
pstmtSql.setDouble(7, minqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty); pstmtSql.setDouble(8, maxqty);
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
while (rs.next()) //while (rs.next())
if(rs.next())
{ {
currentlotnofr = rs.getString(1); //currentlotnofr = rs.getString(1);
currentlotnoto = rs.getString(2); //currentlotnoto = rs.getString(2);
currentlotnofr = rs.getString("lot_no__from");
currentlotnoto = rs.getString("lot_no__to");
efffromSplit = rs.getTimestamp("eff_from");
ValidUpToSplit = rs.getTimestamp("valid_upto");
minqtySplit = rs.getDouble("min_qty");
maxqtySplit = rs.getDouble("max_qty");
rate1Split = rs.getDouble("rate");
ratetypeSplit = rs.getString("rate_type");
PriceListParent1Split = rs.getString("price_list__parent");
refNo1Split = rs.getString("ref_no");
refNoold1Split = rs.getString("ref_no_old");
// } // }
recordfound = true; recordfound = true;
System.out.println("Recode Found@@@@@@@@@@@@@" + recordfound); System.out.println("Recode Found##########" + recordfound);
currentlotnofrtemp = currentlotnofr; currentlotnofrtemp = currentlotnofr;
currentlotnototemp = currentlotnoto; currentlotnototemp = currentlotnoto;
Len = currentlotnofr.trim().length();
//************Pavan R start
/* Len = currentlotnofr.trim().length();
Ctr = 1; Ctr = 1;
OrigStr = ""; OrigStr = "";
Set = ""; Set = "";
...@@ -1138,14 +1221,15 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1138,14 +1221,15 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
New = 0; New = 0;
int diff3 = 0, cntt = 0; int diff3 = 0, cntt = 0;
String original = "", result = "", result2 = ""; String original = "", result = "", result2 = "";
System.out.println("LotNoFrom["+LotNoFrom+"] currentlotnofr["+currentlotnofr+"]");
String x = LotNoFrom.trim(); String x = LotNoFrom.trim();
System.out.println("@@@@@x" + x); System.out.println("@@@@@x" + x);
String y = currentlotnofr.trim(); String y = currentlotnofr.trim();
System.out.println("@@@@@x" + y); System.out.println("@@@@@y" + y);
String s2 = y; String s2 = y;
if (x.compareTo(y) < 0) if (x.compareTo(y) < 0)
{ {
/* /*
* char right3= y.charAt(y.length()-1); if(Character.isDigit(right3) ) { do { * char right3= y.charAt(y.length()-1); if(Character.isDigit(right3) ) { do {
* if(Character.isDigit(right3) ) { left3=y.charAt(0); if(left3=='0') { * if(Character.isDigit(right3) ) { left3=y.charAt(0); if(left3=='0') {
...@@ -1164,9 +1248,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1164,9 +1248,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
* trim(ls_NewStr) +string(ll_New) //ls_lot_no__fr = ls_next_lot_no_fr String * trim(ls_NewStr) +string(ll_New) //ls_lot_no__fr = ls_next_lot_no_fr String
* a2=Integer.toString(New); lotnoto = Set + NewStr.trim() +a2.trim(); lotnofr = * a2=Integer.toString(New); lotnoto = Set + NewStr.trim() +a2.trim(); lotnofr =
* nextlotnofr; * nextlotnofr;
*/
int length = currentlotnofr.trim().length(); int length = currentlotnofr.trim().length();
System.out.println("s22222222222222" + s2); System.out.println("x.compareTo(y) loop: s2=" + s2);
// char right= s2.charAt(s2.length()-1); // char right= s2.charAt(s2.length()-1);
...@@ -1220,7 +1304,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1220,7 +1304,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
System.out.println("testSub2::-" + testSub2); System.out.println("testSub2::-" + testSub2);
sub = Integer.parseInt(testSub2); sub = Integer.parseInt(testSub2);
int u2 = testSub2.length(); int u2 = testSub2.length();
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);
...@@ -1249,15 +1333,18 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1249,15 +1333,18 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
NewStr = ""; NewStr = "";
New = 0; New = 0;
String p = currentlotnoto.trim(); //String p = currentlotnoto.trim();
String q = LotNoTo.trim(); //String q = LotNoTo.trim();
String q = currentlotnoto.trim();
String p = LotNoTo.trim();
s2 = currentlotnoto.trim(); s2 = currentlotnoto.trim();
int length = currentlotnoto.trim().length(); int length = currentlotnoto.trim().length();
System.out.println("currentlotnoto["+currentlotnoto+"] LotNoTo["+LotNoTo+"]");
System.out.println("p--[" + p + "]q--[" + q + "]"); System.out.println("p--[" + p + "]q--[" + q + "]");
System.out.println("s22222222222222" + s2); System.out.println("s2" + s2);
if (q.compareTo(p) < 0) if (q.compareTo(p) < 0)
{ {
/*
* char right4= y.charAt(y.length()-1); if(Character.isDigit(right4) ) { do { * char right4= y.charAt(y.length()-1); if(Character.isDigit(right4) ) { do {
* if(Character.isDigit(right4) ) { left4 =y.charAt(0); if(left4=='0') { * if(Character.isDigit(right4) ) { left4 =y.charAt(0); if(left4=='0') {
* if(y.length()>2) { mid4= y.substring(2); Set=Set + '0'; } } else { OldLen = * if(y.length()>2) { mid4= y.substring(2); Set=Set + '0'; } } else { OldLen =
...@@ -1272,7 +1359,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1272,7 +1359,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
* trim(ls_NewStr) +string(ll_New) //ls_lot_no__fr = ls_next_lot_no_fr String * trim(ls_NewStr) +string(ll_New) //ls_lot_no__fr = ls_next_lot_no_fr String
* a2=Integer.toString(New); lotnofr = Set + NewStr.trim() +a2.trim(); lotnofr = * a2=Integer.toString(New); lotnofr = Set + NewStr.trim() +a2.trim(); lotnofr =
* nextlotnofr; * nextlotnofr;
*/
//Pavan Rane 21aug19[to set allow alphbet at right side]....start //Pavan Rane 21aug19[to set allow alphbet at right side]....start
char right= s2.charAt(s2.length()-1); char right= s2.charAt(s2.length()-1);
if(!isNumber(right)) if(!isNumber(right))
...@@ -1293,6 +1380,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1293,6 +1380,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//if (isNumber(s2.charAt(s2.length() - 1))) //if (isNumber(s2.charAt(s2.length() - 1)))
//Pavan Rane 21aug19[to set allow alphbet at right side]....end //Pavan Rane 21aug19[to set allow alphbet at right side]....end
{ {
cnt1 = 0; cnt1 = 0;
for (int i = length - 1; i >= 0; i--) for (int i = length - 1; i >= 0; i--)
{ {
...@@ -1346,7 +1434,94 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1346,7 +1434,94 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
} }
}*/
String s2 = LotNoTo.trim();
System.out.println("Lotnumber " + s2.length());
left = 0;
char right = s2.charAt(s2.length() - 1);
int diff3 = 0;
String original = "", result = "", result2 = "";
NewStr = "";
int length = LotNoFrom.trim().length();
/*
* System.out.println("insert in count"); Len=LotNoFrom.trim().length(); Ctr=1;
* String s2=LotNoFrom.trim(); //String chekStr=LotNoFrom.trim();
*/
System.out.println("s22222222222222" + s2);
// char right= s2.charAt(s2.length()-1);
//Pavan Rane 21aug19[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+"]");
} }
int asciiChar = (int)right;
System.out.println("--asciiChar--::["+asciiChar+"]");
char prevChar = (char) (asciiChar-1);
System.out.println("--Char--::["+asciiChar+"]");
LotNoFrom = LotNoFrom + String.valueOf(prevChar);
System.out.println("631 if char LotNoFrom["+LotNoFrom+"]");
}else
//if (isNumber(s2.charAt(s2.length() - 1)))
{
cnt1 = 0;
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);
nextlotnofr = testSub1.trim() + NewStr.trim() + a2;
int temp = 0; int temp = 0;
if (currentlotnofrtemp != LotNoFrom) { if (currentlotnofrtemp != LotNoFrom) {
// temp =Integer.parseInt(LotNoFrom); // temp =Integer.parseInt(LotNoFrom);
...@@ -1361,6 +1536,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1361,6 +1536,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
* lotnoto=LotNoToa[temp2]+1; } * lotnoto=LotNoToa[temp2]+1; }
*/ */
} }
}
//Added By Pavan Rane 05dec19 start[closed open cursors]
rs.close();
rs = null;
pstmtSql.close();
pstmtSql =null;
System.out.println("LotNoFromaList["+LotNoFroma+"]");
for (int i = 0; i < LotNoFroma.size(); i++) for (int i = 0; i < LotNoFroma.size(); i++)
{ {
lotnofr = LotNoFroma.get(i); lotnofr = LotNoFroma.get(i);
...@@ -1373,13 +1555,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1373,13 +1555,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
if (rs.next()) { if (rs.next()) {
LineNo = rs.getInt(1); LineNo = rs.getInt(1);
System.out.println("line no@@@@@@@" + LineNo); System.out.println("line no#1394@@@@@@@" + LineNo);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmtSql.close(); pstmtSql.close();
pstmtSql = null; pstmtSql = null;
if (LineNo == 0) { //if (LineNo == 0) {
System.out.println("Insert line no"); System.out.println("Insert line no");
LineNo++; LineNo++;
sql = "insert into pricelist (price_list, item_code,unit,list_type,slab_no,eff_from,valid_upto,lot_no__from,lot_no__to,min_qty,max_qty,rate,rate_type,min_rate,chg_date,chg_user,chg_term,max_rate,order_type, price_list__parent, chg_ref_no, ref_no,ref_no_old )" sql = "insert into pricelist (price_list, item_code,unit,list_type,slab_no,eff_from,valid_upto,lot_no__from,lot_no__to,min_qty,max_qty,rate,rate_type,min_rate,chg_date,chg_user,chg_term,max_rate,order_type, price_list__parent, chg_ref_no, ref_no,ref_no_old )"
...@@ -1390,31 +1572,31 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1390,31 +1572,31 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtInsert.setString(3, unit); pstmtInsert.setString(3, unit);
pstmtInsert.setString(4, listtype); pstmtInsert.setString(4, listtype);
pstmtInsert.setDouble(5, LineNo); pstmtInsert.setDouble(5, LineNo);
pstmtInsert.setTimestamp(6, efffrom); pstmtInsert.setTimestamp(6, efffromSplit);
pstmtInsert.setTimestamp(7, ValidUpTo); pstmtInsert.setTimestamp(7, ValidUpToSplit);
pstmtInsert.setString(8, lotnofrom); pstmtInsert.setString(8, lotnofr);
pstmtInsert.setString(9, lotnoto1); pstmtInsert.setString(9, priceListOldto);
pstmtInsert.setDouble(10, minqty); pstmtInsert.setDouble(10, minqtySplit);
pstmtInsert.setDouble(11, maxqty); pstmtInsert.setDouble(11, maxqtySplit);
pstmtInsert.setDouble(12, rate1); pstmtInsert.setDouble(12, rate1Split);
pstmtInsert.setString(13, ratetype); pstmtInsert.setString(13, ratetypeSplit);
pstmtInsert.setDouble(14, rate1); pstmtInsert.setDouble(14, rate1Split);
chgDate = new java.sql.Timestamp(System.currentTimeMillis()); chgDate = new java.sql.Timestamp(System.currentTimeMillis());
pstmtInsert.setTimestamp(15, chgDate); pstmtInsert.setTimestamp(15, chgDate);
pstmtInsert.setString(16, userId); pstmtInsert.setString(16, userId);
pstmtInsert.setString(17, termId); pstmtInsert.setString(17, termId);
pstmtInsert.setDouble(18, rate1); pstmtInsert.setDouble(18, rate1Split);
pstmtInsert.setString(19, orderType1); pstmtInsert.setString(19, orderType1);
pstmtInsert.setString(20, PriceListParent1); pstmtInsert.setString(20, PriceListParent1Split);
pstmtInsert.setString(21, chgref1); pstmtInsert.setString(21, chgref1);
pstmtInsert.setString(22, refNo1); pstmtInsert.setString(22, refNo1Split);
pstmtInsert.setString(23, refNoold1); pstmtInsert.setString(23, refNoold1Split);
UpdCnt = pstmtInsert.executeUpdate(); UpdCnt = pstmtInsert.executeUpdate();
pstmtInsert.close(); pstmtInsert.close();
pstmtInsert = null; pstmtInsert = null;
} //}
//Modified By Pavan Rane 05dec19 start[To get details for splited pricelist for split logic to be checked for given case]
} }
} }
} }
...@@ -1454,6 +1636,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1454,6 +1636,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
newCount = rs.getInt(1); newCount = rs.getInt(1);
System.out.println("Before insert new Lot Count::["+newCount+"]"); System.out.println("Before insert new Lot Count::["+newCount+"]");
} }
//Added By Pavan Rane 05dec19 start[closed open cursors]
rs.close();
rs = null;
pstmtSql.close();
pstmtSql = null;
//20jun19 end //20jun19 end
if (recordfound == false || newCount == 0)//if (recordfound == false) if (recordfound == false || newCount == 0)//if (recordfound == false)
{ {
...@@ -1641,6 +1828,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1641,6 +1828,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
PList.put("ITEM_CODE", itemCode = rs.getString("item_code")); PList.put("ITEM_CODE", itemCode = rs.getString("item_code"));
PList.put("LOT_NO__FROM", lotNoForm = rs.getString("lot_no__from")); PList.put("LOT_NO__FROM", lotNoForm = rs.getString("lot_no__from"));
PList.put("LOT_NO__TO", lotNoTo = rs.getString("lot_no__to")); PList.put("LOT_NO__TO", lotNoTo = rs.getString("lot_no__to"));
PList.put("LOT_NO__TO_OLD", lotNoTo = rs.getString("lot_no__to"));
PList.put("RATE", rate = rs.getDouble("rate")); PList.put("RATE", rate = rs.getDouble("rate"));
PList.put("RATE_TYPE", rateType = rs.getString("rate_type")); PList.put("RATE_TYPE", rateType = rs.getString("rate_type"));
PList.put("MIN_RATE", minrate = rs.getDouble("min_rate")); PList.put("MIN_RATE", minrate = rs.getDouble("min_rate"));
......
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