Commit 49a0cdff authored by arawankar's avatar arawankar

Changes made in distCommon.java

-Added method to calculate rate
-Added method to parse string into double and timestamp

Changes made in PriceListConf.java
-Changes made to fix bugs in price list confirmation component

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@183514 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 80aa9e1b
......@@ -10,18 +10,34 @@ Modification:-
.............................................*/
package ibase.webitm.ejb.dis;
import java.io.ByteArrayInputStream;
import java.io.OutputStreamWriter;
import java.rmi.RemoteException;
import java.sql.*;
import java.util.*;
import java.text.NumberFormat;
import java.text.DecimalFormat;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.*;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.fin.FinCommon;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import ibase.webitm.ejb.sys.UtilMethods;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.ibm.db2.jcc.a.p;
public class DistCommon {
E12GenericUtility genericUtility = new E12GenericUtility();
......@@ -11577,7 +11593,8 @@ public class DistCommon {
}
public String checkNull(String input) {
public String checkNull(String input)
{
if (input == null) {
input = "";
}
......@@ -11586,4 +11603,204 @@ public class DistCommon {
// Added by kaustubh 14 Nov 2017 End
//Added by Anjali R. on[13/04/2018][To calculate rate][Start]
public HashMap<String, String> calcRate (String priceListTar , HashMap<String, Object> calcRate , String calcMethod , String errCode ,Connection conn)
{
ArrayList inputVal = null;
ArrayList temp = null;
String sqlStmt = "" , sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
HashMap< String , String> errMap = new HashMap<String, String>();
String varName = "";
String varExpr = "";
String varInput = "";
String varSrc = "";
String finalRate = "";
//HashMap<String,String> sqlInputDataMap = new HashMap<String, String>();
GenericUtility genericUtility ;
try
{
System.out.println("-----------------------------Inside calc method---------------------------");
genericUtility = new GenericUtility();
inputVal = new ArrayList();
temp = new ArrayList();
if(errCode.trim().length() == 0 || errCode == null)
{
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine exprsEngine = manager.getEngineByName("js");
sqlStmt = "select var_name, var_expr, var_source, var_input from calc_method_var where calc_method = ? order by calc_seq ";
pstmt = conn.prepareStatement(sqlStmt);
pstmt.setString(1, calcMethod);
rs = pstmt.executeQuery();
while(rs.next())
{
varName = checkNull(rs.getString("var_name"));
varExpr = checkNull(rs.getString("var_expr"));
varSrc = checkNull(rs.getString("var_source"));
varInput = checkNull(rs.getString("var_input"));
String inputValues[] = null;
System.out.println("varName["+varName+"]varSrc["+varSrc+"]varInput["+varInput+"]varExpr--["+varExpr+"]");
if((varName != null && varName.trim().length() > 0) && (varExpr != null && varExpr.trim().length() > 0))
{
varExpr = varExpr.trim();
sql = "";
inputVal = temp;
if(varSrc.equalsIgnoreCase("S"))
{
if(varInput != null && varInput.trim().length() > 0)
{
PreparedStatement exprPsmt = null;
ResultSet exprRs = null;
exprPsmt = conn.prepareStatement(varExpr);
inputValues = varInput.split(",");
int index = 1;
for(String eachSqlInput : inputValues)
{
System.out.println("[inputValues]------------["+inputValues+"]");
String var = eachSqlInput.toUpperCase().trim();
System.out.println("Variable Name---["+var+"]Variable Value--["+calcRate.get(var)+"]");
if(calcRate.containsKey(var))
{
if( "EFF_FROM".equalsIgnoreCase(var) )
{
exprPsmt.setTimestamp(index++, (Timestamp) calcRate.get("EFF_FROM"));
}
else if("VALID_UPTO".equalsIgnoreCase(var))
{
exprPsmt.setTimestamp(index++, (Timestamp) calcRate.get("VALID_UPTO"));
}
else
{
exprPsmt.setString(index++, (String) calcRate.get(var));
}
}
else
{
exprPsmt.setString(index++, "");
}
}
exprRs = exprPsmt.executeQuery();
if(exprRs.next())
{
finalRate = E12GenericUtility.checkNull(exprRs.getString(1));
exprsEngine.put(varName, getDoubleValue(finalRate));
}
else
{
exprsEngine.put(varName, 0);
}
}
}
else if("E".equalsIgnoreCase(varSrc))
{
if( varExpr.indexOf("ROUND(") != -1 )
{
varExpr = varExpr.replaceAll("ROUND\\(", "Math.round(");
System.out.println("in 1st if updated varExpr["+varExpr+"]");
}
else if( varExpr.indexOf("ROUND (") != -1 )
{
varExpr = varExpr.replaceAll("ROUND \\(", "Math.round(");
System.out.println("in 2nd if updated varExpr["+varExpr+"]");
}
finalRate = String.valueOf(exprsEngine.eval(varExpr));
System.out.println("inside E :::"+varName+"=["+finalRate+"]");
if("NaN".equalsIgnoreCase(finalRate))
{
exprsEngine.put(varName, 0);
}
else
{
exprsEngine.put(varName, getDoubleValue(finalRate));
}
}
}
}
if(getDoubleValue(finalRate) <= 0)
{
errCode = "VTRATE2";
errMap.put("error", errCode);
}
}
}
catch(Exception e)
{
System.out.println("Exception in calcRate-------["+e.getMessage()+"]");
}
if(errCode == null || errCode.trim().length() == 0)
{
errMap.put("rate", finalRate);
}
return errMap;
}
//Added by Anjali R. on[13/04/2018][To calculate rate][End]
//Added by Anjali R. on[13/04/2018][To parse string value into Timestamp][Start]
private java.sql.Timestamp getTimeStamp(String dateStr) throws ITMException, Exception
{
String dbDateStr = "";
if(dateStr != null && !dateStr.equals(""))
{
if(dateStr.indexOf(":") != -1)
{
System.out.println("inside logic"+dateStr);
return java.sql.Timestamp.valueOf(dateStr);
}
else
{
System.out.println("inside ");
dbDateStr = genericUtility.getValidDateTimeString(dateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateTimeFormat());
return java.sql.Timestamp.valueOf(dbDateStr);
}
}
else
{
java.util.Date today = new java.util.Date();
System.out.println(new java.sql.Timestamp(today.getTime()));
java.sql.Timestamp dateTime = (new java.sql.Timestamp(today.getTime()));
return dateTime;
}
}
//Added by Anjali R. on[13/04/2018][To parse string value into Timestamp][End]
//Added by Anjali R. on[13/04/2018][To parse string value into double][Start]
private double getDoubleValue(String input) throws Exception
{
double value = 0.0;
try
{
if(input == null)
{
value = 0.0;
}
else
{
if(input.trim().length() > 0)
{
value = Double.valueOf(E12GenericUtility.checkNull(input));
}
}
System.out.println("retutn value["+value+"]");
}
catch(Exception e)
{
System.out.println("PriceListGenEJB.getDoubleValue()["+e.getMessage()+"]");
throw e;
}
return value;
}
//Added by Anjali R. on[13/04/2018][To parse string value into double][End]
}// class
\ No newline at end of file
......@@ -59,9 +59,13 @@ import java.util.HashMap;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import com.ibm.db2.jcc.b.SQLException;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.utility.ITMException;
@Stateless
public class PriceListConf extends ActionHandlerEJB implements PriceListConfLocal, PriceListConfRemote
{
......@@ -427,12 +431,12 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
termId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "termId" );
try
{
System.out.println("----------------------------- Inside Insert Pricelist method ---------------");
DistCommon distCommon = new DistCommon();
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
dbName = CommonConstants.DB_NAME;
System.out.println("Insert Price List@@@@@@@@@@@");
AutoExpire=distCommon.getDisparams("999999","AUTO_EXPIRE_PL", conn);
System.out.println("Autoexpire Value is:"+AutoExpire);
System.out.println("Autoexpiry Value is: ["+AutoExpire+"]");
if (AutoExpire == null)
{
......@@ -440,40 +444,45 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
}
else if(AutoExpire.equalsIgnoreCase("Y"))
{
System.out.println("Insert Autoexpire@@@@@@@@@");
//PList=new HashMap();
plist = (String)PList.get("price_list");
System.out.println("Price list value is"+plist);
itemcode = (String)PList.get("item_code");
System.out.println("item code in price list"+itemcode);
unit = (String)PList.get("unit");
listtype = (String)PList.get("list_type");
//rate1=(Double)PList.get("rate");
//ratetype=(String)PList.get("rate_type");
//minrate=(Double)PList.get("min_rate");
//maxrate1=(Double)PList.get("max_rate");
PricelistGen.add(PList);
System.out.println("------------------------ Insert Auto Expiry ------------------");
//PricelistGen.add(PList);
System.out.println("List Size------["+PricelistGen.size()+"]");
System.out.println("PList---["+PList+"]");
plist = (String)PList.get("PRICE_LIST");
System.out.println("Price list value is"+plist);
itemcode = (String)PList.get("ITEM_CODE");
System.out.println("item code in price list"+itemcode);
unit = (String)PList.get("UNIT");
listtype = (String)PList.get("LIST_TYPE");
System.out.println("List size is"+PricelistGen);
lotnofrom=(String)PList.get("lot_no__from");
System.out.println("lot no from "+lotnofrom);
lotnoto1=(String)PList.get("lot_no__to");
System.out.println("lot no to "+lotnoto1);
efffrom=(java.sql.Timestamp)PList.get("eff_from");
System.out.println("List Sizeeeeeee"+PricelistGen.size());
minqty=(Double)PList.get("min_qty");
lotnofrom = (String)PList.get("LOT_NO__FROM");
System.out.println("lot no from [ "+ lotnofrom + "]");
lotnoto1 = (String)PList.get("LOT_NO__TO");
System.out.println("lot no to ["+lotnoto1 + "]");
efffrom = (java.sql.Timestamp)PList.get("EFF_FROM");
System.out.println("[efffrom]----["+efffrom+"]");
minqty = (Double)PList.get("MIN_QTY");
System.out.println("min qty in list"+minqty);
maxqty=(Double)PList.get("max_qty");
rate1=(Double)PList.get("rate");
ratetype=(String)PList.get("rate_type");
minrate=(Double)PList.get("min_rate");
maxrate1=(Double)PList.get("max_rate");
refNo1=(String)PList.get("ref_No");
refNoold1=(String)PList.get("ref_No_old");
PriceListParent1=(String)PList.get("Price_List__Parent");
orderType1=(String)PList.get("order_Type");
chgref1=(String)PList.get("chg_ref_no");
maxqty = (Double)PList.get("MAX_QTY");
System.out.println("[maxqty]----["+maxqty+"]");
rate1 = (Double) PList.get("RATE");
System.out.println("[rate1]-----["+rate1+"]");
ratetype = (String)PList.get("RATE_TYPE");
System.out.println("[ratetype]-----["+ratetype+"]");
minrate = (Double)PList.get("MIN_RATE");
System.out.println("[minrate]----["+minrate+"]");
maxrate1 = (Double)PList.get("MAX_RATE");
System.out.println("[maxrate1]---["+maxrate1+"]");
refNo1 = (String)PList.get("REF_NO");
System.out.println("[refNo1]---["+refNo1+"]");
refNoold1 = (String)PList.get("REF_NO_OLD");
System.out.println("refNoold1----["+refNoold1+"]");
PriceListParent1 = (String)PList.get("PRICE_LIST__PARENT");
System.out.println("[PriceListParent1]------["+PriceListParent1+"]");
orderType1 = (String)PList.get("ORDER_TYPE");
System.out.println("[orderType1]----["+orderType1+"]");
chgref1 = (String)PList.get("CHG_REF_NO");
System.out.println("[chgref1]----["+chgref1+"]");
sql="select valid_upto,eff_from,slab_no,lot_no__from,lot_no__to,min_qty,max_qty from pricelist where price_list=? and item_code=? ";
......@@ -485,8 +494,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
for (Ctr =0; Ctr < PricelistGen.size(); Ctr++)
{
System.out.println("Insert For loooopppp");
PList=new HashMap();
System.out.println("Insert For loop.....................................");
PList=new HashMap<String, Object>();
PList = (HashMap)PricelistGen.get(Ctr);
if(rs.next())
{
......@@ -494,7 +503,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
System.out.println("Valid upto in price list"+ValidUpTo);
EffDate=rs.getTimestamp("eff_from");
SlabNo=rs.getDouble("slab_no");
System.out.println("slabbbb_no1111111111111111111111"+SlabNo);
System.out.println("slab No ----["+SlabNo+"]");
LotFrBrow=rs.getString("lot_no__from");
System.out.println("Lots Number from brow window"+LotFrBrow);
LotNoToBrow=rs.getString("lot_no__to");
......@@ -502,10 +511,10 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
MinQtyBrow=rs.getDouble("min_qty");
MaxQtyBrow=rs.getDouble("max_qty");
System.out.println("Minimum value is@@@@@@@@@"+MinQtyBrow);
}
System.out.println("check if conditionn");
System.out.println("---------------------- Check if Conditon -----------------------");
DayDiff=(int)utilMethods.DaysAfter(ValidUpTo,EffDate);
System.out.println("check"+DayDiff);
System.out.println("DayDiff-----------["+DayDiff+"]");
if(DayDiff<=0 )
{
System.out.println("In if condition@@@@@");
......@@ -513,7 +522,7 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
if(LotFrBrow == lotnofrom && LotNoToBrow ==lotnoto1)
{
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 );
if( dbName.equalsIgnoreCase("db2"))
{
validupto=(ValidUpTo);
......@@ -557,17 +566,17 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
}
}
}
}// for end
}// end autoexpire if
///////////////
// astr_PL.list_type = 'B'
listtype = (String)PList.get("list_type");
System.out.println("check price listttttttttttttttt type"+listtype);
listtype = (String)PList.get("LIST_TYPE");
System.out.println("check price listttttttttttttttt type"+listtype);
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);
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);
......@@ -782,11 +791,11 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//to expire the pricelist in case of revise circular of old circular.
//change the valid upto date of price before the eff from date and batch no less then the
//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);
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);
if(refNoold !=null && refNoold.trim().length() > 0)
{
......@@ -978,7 +987,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
//char right= s2.charAt(s2.length()-1);
System.out.println("right s22222222222222"+right);
if(isnumberStr(s2))
{
if(isNumber(s2.charAt(s2.length()-1)))
{
......@@ -1033,6 +1043,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
System.out.println("NewStr"+NewStr);
LotNoFrom = testSub1.trim()+NewStr.trim()+a2 ;
System.out.println("LotNoFrom1@@@@LotNoFrom@@@@:"+LotNoFrom);
}
}
if( dbName.equalsIgnoreCase("db2"))
{
validupto=(ValidUpTo);
......@@ -1128,14 +1140,13 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
}
}
}
}
}
//split the batch if the entered batch no is already existing in the master pricelist
recordfound = false;
if(listtype.equalsIgnoreCase("B"))
{
LotNoFrom=(String)PList.get("lot_no__from");
LotNoFrom=(String)PList.get("LOT_NO__FROM");
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 >= ?";
pstmtSql=conn.prepareStatement(sql);
......@@ -1167,8 +1178,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
if(cnt > 0)
{
LotNoFrom=(String)PList.get("lot_no__from");
LotNoTo=(String)PList.get("lot_no__to");
LotNoFrom=(String)PList.get("LOT_NO__FROM");
LotNoTo=(String)PList.get("LOT_NO__TO");
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";
pstmtSql=conn.prepareStatement(sql);
......@@ -1334,8 +1345,9 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
String q=LotNoTo.trim();
s2=currentlotnoto.trim();
int length = currentlotnoto.trim().length();
System.out.println("p--["+ p +"]q--["+ q +"]");
System.out.println("s22222222222222"+s2);
if(p.compareTo(q)<0)
if(q.compareTo(p) < 0)
{
/*char right4= y.charAt(y.length()-1);
if(Character.isDigit(right4) )
......@@ -1549,8 +1561,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
pstmtInsert.setString(3, unit);
pstmtInsert.setString(4, listtype);
pstmtInsert.setDouble(5, LineNo);
pstmtInsert.setTimestamp(6, (Timestamp)PList.get("eff_from"));
pstmtInsert.setTimestamp(7, (Timestamp)PList.get("valid_upto"));
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);
......@@ -1635,7 +1647,8 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
int lineno=0;
String loginEmpCode = "";
ArrayList PricelistGen = new ArrayList();
HashMap PList=null;
HashMap<String ,Object> PList=null;
double finalRate = 0.0;
try
{
DistCommon distCommon = new DistCommon();
......@@ -1698,29 +1711,29 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
rs = pstmtSql.executeQuery();
while ( rs.next() )
{
PList = new HashMap();
PList.put("item_code",itemCode=rs.getString("item_code"));
PList.put("lot_no__from",lotNoForm=rs.getString("lot_no__from"));
PList.put("lot_no__to",lotNoTo=rs.getString("lot_no__to"));
PList.put("rate",rate = rs.getDouble("rate"));
PList.put("rate_type",rateType=rs.getString("rate_type"));
PList.put("min_rate",minrate=rs.getDouble("min_rate"));
PList.put("max_rate",maxrate=rs.getDouble("max_rate"));
PList.put("chg_ref_no",chgref=rs.getString("chg_ref_no"));
PList.put("eff_from",efffrom=rs.getTimestamp("eff_from"));
PList.put("valid_upto",validup=rs.getTimestamp("valid_upto"));
PList.put("price_list",PriceList=rs.getString("price_list"));
PList.put("list_type",listType=rs.getString("list_type"));
PList.put("price_list__parent",PriceListParent=rs.getString("price_list__parent"));
PList.put("order_type",orderType=rs.getString("order_type"));
PList.put("manage_type",manageType =rs.getString("manage_type"));
PList.put("min_qty",minqty=rs.getDouble("min_qty"));
PList.put("max_qty",maxqty=rs.getDouble("max_qty"));
PList.put("unit",unit=rs.getString("unit"));
PList.put("line_no",lineno=rs.getInt("line_no"));
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<String, Object>();
PList.put("ITEM_CODE",itemCode=rs.getString("item_code"));
PList.put("LOT_NO__FROM",lotNoForm=rs.getString("lot_no__from"));
PList.put("LOT_NO__TO",lotNoTo=rs.getString("lot_no__to"));
PList.put("RATE",rate = rs.getDouble("rate"));
PList.put("RATE_TYPE",rateType=rs.getString("rate_type"));
PList.put("MIN_RATE",minrate=rs.getDouble("min_rate"));
PList.put("MAX_RATE",maxrate=rs.getDouble("max_rate"));
PList.put("CHG_REF_NO",chgref=rs.getString("chg_ref_no"));
PList.put("EFF_FROM",efffrom=rs.getTimestamp("eff_from"));
PList.put("VALID_UPTO",validup=rs.getTimestamp("valid_upto"));
PList.put("PRICE_LIST",PriceList=rs.getString("price_list"));
PList.put("LIST_TYPE",listType=rs.getString("list_type"));
PList.put("PRICE_LIST__PARENT",PriceListParent=rs.getString("price_list__parent"));
PList.put("ORDER_TYPE",orderType=rs.getString("order_type"));
PList.put("MANAGE_TYPE",manageType =rs.getString("manage_type"));
PList.put("MIN_QTY",minqty=rs.getDouble("min_qty"));
PList.put("MAX_QTY",maxqty=rs.getDouble("max_qty"));
PList.put("UNIT",unit=rs.getString("unit"));
PList.put("LINE_NO",lineno=rs.getInt("line_no"));
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();
......@@ -1744,40 +1757,55 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
PList.put(refNoold,"ref_no_old");
PList.put(calc,"calc_basis");*/
PricelistGen.add(PList);
System.out.println("@@@@@@@@@@@@@Price list@@@@@@@@@@@@@@@@"+PricelistGen);
System.out.println("[PricelistGen----------------][" + PricelistGen + "]");
retString = insertPricelist(tranId,PList,PricelistGen, conn,xtraParams);
if ( retString != null && retString.trim().length() > 0)
{
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();
/*while ( rs.next() )
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(plisttar,"price_list__tar");
PList.put(PriceListParent,"price_list__parentfrom");
// PList.put(PriceListParent,"rate");
PList.put("PRICE_LIST__TAR",plisttar);
PList.put("PRICE_LIST__PARENT",PriceListParent);
HashMap<String, String> calcRate = null;
calcRate = distCommon.calcRate(plisttar, PList, calcmeth, retString, conn);
if(calcRate != null)
{
if(calcRate.containsKey("error"))
{
retString = itmDBAccessLocal.getErrorString("", calcRate.get("error"), "");
return retString;
}
else
{
finalRate = Double.parseDouble(calcRate.get("rate"));
System.out.println("[finalRate]---["+finalRate+"]");
}
}
PList.put("RATE",finalRate);
//retString= CalcRate(plisttar,data,calcmeth,errCode);
retString= insertPricelist(tranId, PList, PricelistGen, conn, xtraParams);
System.out.println("retString--------------------["+retString+"]");
if ( retString != null && retString.trim().length() > 0)
{
return retString;
}
}*/
}
}
rs.close();
rs = null;
pstmtSql.close();
......@@ -1811,5 +1839,20 @@ public class PriceListConf extends ActionHandlerEJB implements PriceListConfLoca
}
}
public boolean isnumberStr( String str )
{
int val;
try
{
val = Integer.parseInt( str );
}catch( NumberFormatException nex )
{
return false;
}catch( Exception ex )
{
return false;
}
return true;
}
}
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