Commit 0d15e1b7 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@213644 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 56329a9c
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import ibase.utility.EMail; //import ibase.utility.EMail;
import ibase.utility.CommonConstants; //import ibase.utility.CommonConstants;
import ibase.webitm.utility.*; //import ibase.webitm.utility.*;
import ibase.webitm.ejb.*; //import ibase.webitm.ejb.*;
import ibase.webitm.ejb.mfg.ExplodeBom; /*import ibase.webitm.ejb.mfg.ExplodeBom;
import ibase.webitm.ejb.mfg.adv.RcpBackflushConfirm; import ibase.webitm.ejb.mfg.adv.RcpBackflushConfirm;
import ibase.webitm.ejb.sys.*; import ibase.webitm.ejb.sys.*;
import ibase.system.config.*; import ibase.system.config.*;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;*/
import java.text.*; import java.text.*;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.fin.*; //import ibase.webitm.ejb.fin.*;
import ibase.webitm.utility.TransIDGenerator; //import ibase.webitm.utility.TransIDGenerator;
import ibase.webitm.ejb.ITMDBAccessEJB; //import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.*; //import ibase.webitm.ejb.dis.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import javax.ejb.*; /*import javax.ejb.*;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.ejb.Stateless; import javax.ejb.Stateless;*/
import org.apache.axis.client.Call; /*import org.apache.axis.client.Call;
import org.apache.axis.client.Service; import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType; import org.apache.axis.encoding.XMLType;*/
//import org.drools.runtime.pipeline.SmooksTransformerProvider; //import org.drools.runtime.pipeline.SmooksTransformerProvider;
import org.w3c.dom.*; //import org.w3c.dom.*;
import javax.xml.rpc.ParameterMode; /*import javax.xml.rpc.ParameterMode;
import javax.xml.transform.*; import javax.xml.transform.*;
import javax.xml.transform.dom.*; import javax.xml.transform.dom.*;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.parsers.*; import javax.xml.parsers.*;
*/
import java.text.SimpleDateFormat; /*import java.text.SimpleDateFormat;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
//import ibase.utility.GenericUtility; import ibase.utility.GenericUtility;
import ibase.webitm.ejb.E12CreateBatchLoadEjb; import ibase.webitm.ejb.E12CreateBatchLoadEjb;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon; import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.sys.CreateRCPXML; import ibase.webitm.ejb.sys.CreateRCPXML;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;*/
import java.rmi.RemoteException; //import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -59,7 +59,7 @@ import java.util.HashMap; ...@@ -59,7 +59,7 @@ import java.util.HashMap;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import ibase.system.config.ConnDriver; //import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ActionHandlerEJB; import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
...@@ -105,7 +105,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -105,7 +105,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{ {
PreparedStatement pstmtSql = null; PreparedStatement pstmtSql = null;
ResultSet rs = null; ResultSet rs = null;
FinCommon finCommon = null; //FinCommon finCommon = null;
// GenericUtility genericUtility = null; // GenericUtility genericUtility = null;
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
ValidatorEJB validatorEJB = null; ValidatorEJB validatorEJB = null;
...@@ -122,15 +122,15 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -122,15 +122,15 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{ {
if (conn == null) if (conn == null)
{ {
ConnDriver connDriver = null; //ConnDriver connDriver = null;
connDriver = new ConnDriver(); //connDriver = new ConnDriver();
// conn = connDriver.getConnectDB("DriverITM"); // conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; //connDriver = null;
connStatus = true; connStatus = true;
} }
finCommon = new FinCommon(); //finCommon = new FinCommon();
// genericUtility = new GenericUtility(); // genericUtility = new GenericUtility();
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB(); validatorEJB = new ValidatorEJB();
...@@ -337,7 +337,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -337,7 +337,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
String xtraParams) throws RemoteException, ITMException String xtraParams) throws RemoteException, ITMException
{ {
PreparedStatement pstmtSql = null, pstmtInsert = null, pstmtInner = null, pstmtLot=null; PreparedStatement pstmtSql = null, pstmtInsert = null, pstmtInner = null, pstmtLot=null;
ResultSet rs = null, rsInner = null, rsLot= null; ResultSet rs = null, rsInner = null, rsLot = null;
String dbName = ""; String dbName = "";
String sql = ""; String sql = "";
String retString = ""; String retString = "";
...@@ -379,12 +379,14 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -379,12 +379,14 @@ 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");
double minqtySplit = 0.0, maxqtySplit = 0.0, rate1Split = 0.0;
String ratetypeSplit = "", PriceListParent1Split = "", refNo1Split = "", refNoold1Split = "";
String updLotFrom = "", LotNoFromUpd="";
Timestamp efffromSplit = null, ValidUpToSplit = null;
String priceListOldFr = "",priceListOldto = "";
try try
{ {
System.out.println("----------------------------- Inside Insert Pricelist method ---------------"); System.out.println("----------------------------- Inside Insert Pricelist method ---------------");
...@@ -493,12 +495,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -493,12 +495,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
System.out.println("[orderType1]----[" + orderType1 + "]"); System.out.println("[orderType1]----[" + orderType1 + "]");
chgref1 = (String) PList.get("CHG_REF_NO"); chgref1 = (String) PList.get("CHG_REF_NO");
System.out.println("[chgref1]----[" + chgref1 + "]"); System.out.println("[chgref1]----[" + chgref1 + "]");
updLotFrom = lotnofrom;
pstmtInner.setString(1, plist); pstmtInner.setString(1, plist);
pstmtInner.setString(2, itemcode); pstmtInner.setString(2, itemcode);
rsInner = pstmtInner.executeQuery(); rsInner = pstmtInner.executeQuery();
// Pavan R 6may19 end // Pavan R 6may19 end
if (rsInner.next()) //if (rsInner.next())//Pavan R DEC19
while (rsInner.next())
{ {
ValidUpTo = rsInner.getTimestamp("valid_upto"); ValidUpTo = rsInner.getTimestamp("valid_upto");
System.out.println("Valid upto in price list" + ValidUpTo); System.out.println("Valid upto in price list" + ValidUpTo);
...@@ -512,11 +515,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -512,11 +515,7 @@ 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 + "]");
...@@ -524,7 +523,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -524,7 +523,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
{ {
System.out.println("In if condition@@@@@"); System.out.println("In if condition@@@@@");
if (LotFrBrow == lotnofrom && LotNoToBrow == lotnoto1) //if (LotFrBrow == lotnofrom && LotNoToBrow == lotnoto1) //Pavan R DEC19
if (LotFrBrow.equals(lotnofrom) && LotNoToBrow.equals(lotnoto1))
{ {
System.out.println("In if condition ######"); System.out.println("In if condition ######");
ValidUpTo = utilMethods.RelativeDate((java.sql.Timestamp) PList.get("EFF_FROM"), -1); ValidUpTo = utilMethods.RelativeDate((java.sql.Timestamp) PList.get("EFF_FROM"), -1);
...@@ -611,6 +611,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -611,6 +611,7 @@ 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 //Pavan Rane 09DEc19[to hold lot_no__to to update on splited price list] start
pstmtLot.setString(1, plist); pstmtLot.setString(1, plist);
pstmtLot.setString(2, itemcode); pstmtLot.setString(2, itemcode);
...@@ -630,7 +631,6 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -630,7 +631,6 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
rsLot = null; rsLot = null;
pstmtLot.clearParameters(); pstmtLot.clearParameters();
//Pavan Rane 09DEc19[to hold lot_no__to to update on splited price list] end //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());
left = 0; left = 0;
...@@ -734,11 +734,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -734,11 +734,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql.close(); pstmtSql.close();
pstmtSql = null; pstmtSql = null;
} }
updLotFrom = LotNoFrom;
if(priceListOldFr.compareTo(LotNoFrom) <= 0)
{
PList.put("LOT_NO__TO_OLD", LotNoFrom);
}
//} //}
}//count end }//count end
}//if (listtype.equalsIgnoreCase("B")) }//if (listtype.equalsIgnoreCase("B"))
...@@ -754,6 +750,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -754,6 +750,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtLot = null; pstmtLot = null;
} }
} // end autoexpire if } // end autoexpire if
/////////////// ///////////////
// astr_PL.list_type = 'B' // astr_PL.list_type = 'B'
...@@ -762,7 +759,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -762,7 +759,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
// change the valid upto date of price before the eff from date and batch no // change the valid upto date of price before the eff from date and batch no
// less then the // less then the
// plist1 = (String)PList.get("price_list"); // plist1 = (String)PList.get("price_list");
System.out.println("---PricelistGen["+PricelistGen+"]-Ctr["+PricelistGen.size()+"]"); System.out.println("---PricelistGen["+PricelistGen+"]-Ctr["+PricelistGen.size()+"]updLotFrom["+updLotFrom+"]");
for (pListCtr = 0; pListCtr < PricelistGen.size(); pListCtr++) for (pListCtr = 0; pListCtr < PricelistGen.size(); pListCtr++)
{ {
PList = (HashMap) PricelistGen.get(pListCtr); PList = (HashMap) PricelistGen.get(pListCtr);
...@@ -816,6 +813,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -816,6 +813,7 @@ 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)
{ {
//Modified By Pavan Rane 05dec19 start[issue as previous valid pricelist expired wrongly] //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 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 = ?"; 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 = ?";
...@@ -824,19 +822,22 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -824,19 +822,22 @@ 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.setDouble(6, minqty);
pstmtSql.setDouble(7, maxqty);
pstmtSql.setString(8, refNoold);*/
pstmtSql.setString(5, lotnofrom); pstmtSql.setString(5, lotnofrom);
pstmtSql.setString(6, listtype); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty); pstmtSql.setDouble(8, maxqty);
pstmtSql.setString(9, refNoold); 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();
...@@ -852,17 +853,19 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -852,17 +853,19 @@ 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.setDouble(6, minqty);
pstmtSql.setDouble(7, maxqty);*/
pstmtSql.setString(5, lotnofrom); pstmtSql.setString(5, lotnofrom);
pstmtSql.setString(6, listtype); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty); pstmtSql.setDouble(8, maxqty);
rs = pstmtSql.executeQuery(); rs = pstmtSql.executeQuery();
//Modified By Pavan Rane 05dec19 end[issue as previous valid pricelist expired wrongly] System.out.println("COUNT" + countup);
//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();
...@@ -882,13 +885,16 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -882,13 +885,16 @@ 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.setDouble(6, minqty);
pstmtSql.setDouble(7, maxqty);
pstmtSql.setString(8, refNoold);*/
pstmtSql.setString(5, lotnofrom); pstmtSql.setString(5, lotnofrom);
pstmtSql.setString(6, listtype); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty); pstmtSql.setDouble(8, maxqty);
pstmtSql.setString(9, refNoold); 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);
...@@ -913,11 +919,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -913,11 +919,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.setDouble(6, minqty);
pstmtSql.setDouble(7, maxqty);*/
pstmtSql.setString(5, lotnofrom); pstmtSql.setString(5, lotnofrom);
pstmtSql.setString(6, listtype); pstmtSql.setString(6, listtype);
pstmtSql.setDouble(7, minqty); pstmtSql.setDouble(7, minqty);
pstmtSql.setDouble(8, maxqty); 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);
...@@ -1082,6 +1090,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1082,6 +1090,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql.close(); pstmtSql.close();
pstmtSql = null; pstmtSql = null;
} }
} }
} else } else
...@@ -1126,6 +1135,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1126,6 +1135,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtSql = null; pstmtSql = null;
} }
} }
updLotFrom = LotNoFrom;
} }
} }
} }
...@@ -1135,21 +1145,16 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1135,21 +1145,16 @@ 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);
//Modified By Pavan Rane 05dec19 start[split logic to be checked for given case] pstmtSql.setString(5, LotFrBrow);
//pstmtSql.setString(5, LotFrBrow);
//pstmtSql.setString(6, LotNoToBrow); //pstmtSql.setString(6, LotNoToBrow);
pstmtSql.setString(5, LotNoFrom); pstmtSql.setString(6, updLotFrom);
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();
...@@ -1171,29 +1176,23 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1171,29 +1176,23 @@ 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;
//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 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"; 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, updLotFrom);
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"); currentlotnofr = rs.getString("lot_no__from");
currentlotnoto = rs.getString("lot_no__to"); currentlotnoto = rs.getString("lot_no__to");
efffromSplit = rs.getTimestamp("eff_from"); efffromSplit = rs.getTimestamp("eff_from");
...@@ -1207,12 +1206,10 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1207,12 +1206,10 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
refNoold1Split = rs.getString("ref_no_old"); 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;
//************Pavan R start
/* Len = currentlotnofr.trim().length(); /* Len = currentlotnofr.trim().length();
Ctr = 1; Ctr = 1;
OrigStr = ""; OrigStr = "";
...@@ -1221,16 +1218,15 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1221,16 +1218,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("@@@@@y" + y); System.out.println("@@@@@x" + 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') {
* *
...@@ -1250,7 +1246,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1250,7 +1246,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
* nextlotnofr; * nextlotnofr;
int length = currentlotnofr.trim().length(); int length = currentlotnofr.trim().length();
System.out.println("x.compareTo(y) loop: s2=" + s2); System.out.println("s22222222222222" + s2);
// char right= s2.charAt(s2.length()-1); // char right= s2.charAt(s2.length()-1);
...@@ -1304,7 +1300,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1304,7 +1300,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);
...@@ -1333,15 +1329,12 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1333,15 +1329,12 @@ 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("s2" + s2); System.out.println("s22222222222222" + s2);
if (q.compareTo(p) < 0) if (q.compareTo(p) < 0)
{ {
...@@ -1380,7 +1373,6 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1380,7 +1373,6 @@ 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--)
{ {
...@@ -1434,8 +1426,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1434,8 +1426,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
} }
}*/ }
*/
String s2 = LotNoTo.trim(); String s2 = LotNoTo.trim();
System.out.println("Lotnumber " + s2.length()); System.out.println("Lotnumber " + s2.length());
...@@ -1521,6 +1513,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1521,6 +1513,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
String a2 = Integer.toString(OrgSub); String a2 = Integer.toString(OrgSub);
System.out.println("NewStr" + NewStr); System.out.println("NewStr" + NewStr);
nextlotnofr = testSub1.trim() + NewStr.trim() + a2; nextlotnofr = testSub1.trim() + NewStr.trim() + a2;
}
int temp = 0; int temp = 0;
if (currentlotnofrtemp != LotNoFrom) { if (currentlotnofrtemp != LotNoFrom) {
...@@ -1536,13 +1529,6 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1536,13 +1529,6 @@ 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);
...@@ -1555,13 +1541,17 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1555,13 +1541,17 @@ 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#1394@@@@@@@" + LineNo); System.out.println("line no@@@@@@@" + LineNo);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmtSql.close(); pstmtSql.close();
pstmtSql = null; pstmtSql = null;
//if (LineNo == 0) { //if (LineNo == 0) {
LotNoFromUpd = (String) PList.get("LOT_NO__FROM");
//LotNoToUpd = (String) PList.get("LOT_NO__TO");
if(LotNoFromUpd.compareTo(priceListOldto) < 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 )"
...@@ -1595,8 +1585,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1595,8 +1585,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
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]
} }
} }
} }
...@@ -1636,7 +1626,6 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1636,7 +1626,6 @@ 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.close();
rs = null; rs = null;
pstmtSql.close(); pstmtSql.close();
...@@ -1828,7 +1817,6 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca ...@@ -1828,7 +1817,6 @@ 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