Commit 8edbf7a2 authored by mchauhan's avatar mchauhan

Purchase receipt - Validation for blank lot number to be incorporated in entry...

Purchase receipt - Validation for blank lot number to be incorporated in entry level validation, all logic to consider lot auto generation, QC creation setting 

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203416 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 66746911
......@@ -20,7 +20,6 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -104,8 +103,6 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
String status="",empCodeaprv="",ordDate1="",lsconfirmed="",lsproviid="",lspotype="",tranType="",cwipTranType="",porcpTranType="";
String lsitemcode="",prdCode="",siteCodlogin="",statFin="",errorType="";
String itemSer="",grNo="",tranidGno="",currCode="",tranCode="",dcNo="";
String qtyStr = "", qtyStdStr = ""; // Added by Mahesh Saggam on 04/07/19
double dqty = 0, dqtyStduom = 0;
double llquantity=0,llrate=0;
String lsmsg="",lsmsg1="",startStr="",endStr="",descrStr="",descrStart="",descrEnd="",value="";
ArrayList lcstdqty = null;
......@@ -2194,39 +2191,11 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
convQtyStduomStr = checkNull(genericUtility.getColumnValue("conv__qty_stduom", dom));
unit = checkNull(genericUtility.getColumnValue("unit",dom));
unitStd = checkNull(genericUtility.getColumnValue("unit__std", dom));
if(convQtyStduomStr != null && convQtyStduomStr.trim().length() > 0)
if(convQtyStduomStr != null&& convQtyStduomStr.trim().length() > 0)
{
convQtyStduom = convQtyStduomStr == null ? 0 : Double.parseDouble(convQtyStduomStr);
}
// Added by Mahesh Saggam on 04/07/2019 Start [if conv_qty__stduom is 1 then quantiy and quantity__stduom should be same]
if(convQtyStduom == 1)
{
qtyStr = checkNull(genericUtility.getColumnValue("quantity", dom));
qtyStdStr = checkNull(genericUtility.getColumnValue("quantity__stduom", dom));
System.out.println("quantity = "+qtyStr+" std quantity = "+qtyStdStr);
if (qtyStr != null && qtyStr.trim().length() > 0)
{
dqty = Double.parseDouble(qtyStr);
}
if (qtyStdStr != null && qtyStdStr.trim().length() > 0)
{
dqtyStduom = Double.parseDouble(qtyStdStr);
}
if(dqty != dqtyStduom)
{
System.out.println("Error occured in validating quantity");
errCode = "VTINVQTTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
// Added by Mahesh Saggam on 04/07/2019 end
if (unitStd == null || unitStd.length() == 0)
{
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
......@@ -2262,8 +2231,6 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
{
String unit="",unitStd="",convRtuomStduomStr="",itemCode="",lcconvqtystduom1="";
double convRtuomStduom=0;
String rateStr = "", ratestdStr = ""; // added by mahesh saggam on 04/07/2019
double pordRate = 0, stdRate = 0;
System.out.println("@@@@@ validation of conv__rtuom_stduom executed......");
convRtuomStduomStr = checkNull(genericUtility.getColumnValue("conv__rtuom_stduom", dom));
unit = checkNull(genericUtility.getColumnValue("unit__rate", dom));
......@@ -2274,34 +2241,6 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
convRtuomStduom = convRtuomStduomStr == null ? 0: Double.parseDouble(convRtuomStduomStr);
}
// Added by Mahesh Saggam on 04/07/2019 Start [if conv_rate__stduom is 1 then rate and rate__stduom should be same]
if(convRtuomStduom == 1)
{
rateStr = checkNull(genericUtility.getColumnValue("rate", dom));
ratestdStr = checkNull(genericUtility.getColumnValue("rate__stduom", dom));
System.out.println("rate = "+rateStr+" std rate = "+ratestdStr);
if (rateStr != null && rateStr.trim().length() > 0)
{
pordRate = Double.parseDouble(rateStr);
}
if (ratestdStr != null && ratestdStr.trim().length() > 0)
{
stdRate = Double.parseDouble(ratestdStr);
}
if(pordRate != stdRate)
{
System.out.println("Error occured in validating rate");
errCode = "VTINVRTE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
// Added by Mahesh Saggam on 04/07/2019 end
if (unitStd == null || unitStd.length() == 0)
{
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
......@@ -2311,7 +2250,7 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
unitStd = unitStd == null ? "" : unitStd.trim();
System.out.println("@@@@@1 unitRate[" + unit+ "]::unitStd[" + unitStd + "]::convRtuomStduom["
+ convRtuomStduom + "]");
if ((unit.equalsIgnoreCase(unitStd)) && (convRtuomStduom != 1))
if ((unit.equalsIgnoreCase(unitStd))&& (convRtuomStduom != 1))
{
errCode = "VTUCON1";
errList.add(errCode);
......@@ -2612,7 +2551,6 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
rs = pstmt.executeQuery();
if (rs.next())
{
lsfacisitecode = rs.getString(1);
}
System.out.println("facility_code from site**********-->["+lsfaciloccode+"]");
......@@ -2638,17 +2576,50 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
}//end case loc code
if (childNodeName.equalsIgnoreCase("lot_no"))
{
String lotno="",lotnoType="",itemcode="",lsstkopt="",lssitecode="",lsloccode="", suppCode = "", useSuppLot = "";
//COMMENTED BY MUKESH CHAUHAN ON 05/07/19 START
String lotno="",lotnoType="",itemcode="",lsstkopt="",sitecode="",loccode="", suppCode = "", useSuppLot = "", lsitemser="", lsgenlotauto="",lsqcreqd="",lsautogeneratelotno="",lsdis="",lssite="";
lotno = genericUtility.getColumnValue("lot_no", dom);
lotnoType = discommon.getDisparams("999999", "PO_RECEIPT_LOT", conn);
System.out.println("lotnoType"+lotnoType);
if(!"A".equalsIgnoreCase(lotnoType))
System.out.println("lotnoType>>>>>>>>>>>"+lotnoType);
itemcode = genericUtility.getColumnValue("item_code",dom);
lsautogeneratelotno =discommon.getDisparams("999999","GENERATE_LOT_NO_AUTO", conn);
sitecode = checkNull(genericUtility.getColumnValue("site_code", dom1));
suppCode = checkNull(genericUtility.getColumnValue("supp_code", dom1));
loccode = genericUtility.getColumnValue("loc_code",dom);
sql="select ITEM_SER from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemcode);
rs = pstmt.executeQuery();
if (rs.next())
{
//removed trim function by Varsha V for allowing space
//if(lotno == null || lotno.trim().length() == 0)
if(lotno == null || lotno.length() == 0)
lsitemser = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql="Select auto_gen_lot from itemser where item_ser = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsitemser);
rs = pstmt.executeQuery();
if (rs.next())
{
lsgenlotauto = rs.getString(1);
System.out.println("Lot auto_gen>>>>>>>>>>>...."+lsgenlotauto);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(!"A".equalsIgnoreCase(lotnoType) || "N".equalsIgnoreCase(lsgenlotauto))
{
if(lotno == null || lotno.trim().length() == 0) //COMMENTED BY MUKESH CHAUHAN ON 05/07/19 END
{
itemcode = genericUtility.getColumnValue("item_code",dom);
sql="select stk_opt from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemcode);
......@@ -2669,19 +2640,16 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else
{
lssitecode = genericUtility.getColumnValue("site_code",dom1);
lsitemcode = genericUtility.getColumnValue("item_code",dom);
lsloccode = genericUtility.getColumnValue("loc_code",dom);
sql="select count(*) from stock where site_code = ? " +
"and item_code = ? and loc_code = ? and lot_no =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lssitecode);
pstmt.setString(2, lsitemcode);
pstmt.setString(3, lsloccode);
pstmt.setString(1, sitecode);
pstmt.setString(2, itemcode);
pstmt.setString(3, loccode);
pstmt.setString(4, lotno);
rs = pstmt.executeQuery();
if (rs.next())
......@@ -2699,15 +2667,12 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
errCode = "VTNEWLOT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}//Added else block by Varsha V on 30-10-18 if stkopt is 2 and use_supplier_lot is Y the lot_no is mandatory
else
{
suppCode = checkNull(genericUtility.getColumnValue("supp_code", dom1));
itemcode = checkNull(genericUtility.getColumnValue("item_code",dom));
if(lotno == null || lotno.trim().length() == 0)
{
lsstkopt = "";
......@@ -2750,6 +2715,72 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
}
}
}
if(!"N".equalsIgnoreCase(lsgenlotauto))//COMMENTED BY MUKESH CHAUHAN ON 05/07/19 START
{
if("M".equalsIgnoreCase(lsautogeneratelotno))
{
sql="select qc_reqd from siteitem where item_code = ? and site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemcode);
pstmt.setString(2, sitecode);
rs = pstmt.executeQuery();
if (rs.next())
{
lsqcreqd = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(lsqcreqd == null || lsqcreqd.trim().length() == 0)
{
sql="select (case when qc_reqd is null then 'N' else qc_reqd end) from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemcode);
rs = pstmt.executeQuery();
if (rs.next())
{
lsqcreqd = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if(lsqcreqd == null || lsqcreqd.trim().length() == 0)
{
lsqcreqd="N";
}
if(!"Y".equalsIgnoreCase(lsqcreqd))
{
if(lotno == null || lotno.trim().length() == 0)
{
itemcode = genericUtility.getColumnValue("item_code",dom);
sql="select stk_opt from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemcode);
rs = pstmt.executeQuery();
if (rs.next())
{
lsstkopt = rs.getString(1);
}
System.out.println("lsstkopt**********-->"+lsstkopt);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if("2".equalsIgnoreCase(lsstkopt))
{
errCode = "VTLOTEMPTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
} //COMMENTED BY MUKESH CHAUHAN ON 05/07/19 END
}//Ended else block by Varsha V on 30-10-18 if stkopt is 2 and use_supplier_lot is Y the lot_no is mandatory
}// end lot no case
if (childNodeName.equalsIgnoreCase("acct_code__dr"))
......@@ -6273,8 +6304,6 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
lcstdrate = 0 ,mCancperc = 0 , lcconvtemp= 0 ,lctemp = 0 ,lcconv = 0 ,mDlvQty = 0 ,lcrealisedqty = 0 , lcgrosswt = 0 ,lctarewt = 0 ,
lcnetwt= 0 ;// = 0 , = 0 , = 0;
String projectCode = ""; // Added by sarita on 29 MARCH 2019
String grossWeight="",netWeight="",netWtItem="", netWt="", integrlQty="",lcMode="";
double mGrossWeight=0d, mNetWeight=0d, mGrosswt=0d,mNetWt=0d, mTareWt=0d,mNoart=0d, mNetWtItem=0d, mIntegrlQty=0d;
try {
......@@ -6458,7 +6487,6 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
{
lsgenlotauto = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
......@@ -9547,216 +9575,8 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
System.out.println("rate__stduom inputQty=["+inputQty+"]");
valueXmlString.append("<conv__rtuom_stduom >").append("<![CDATA[" + lcrtconv1 + "]]>").append("</conv__rtuom_stduom>");
valueXmlString.append("<rate__stduom >").append("<![CDATA[" + ratestduom + "]]>").append("</rate__stduom>");
//Pavan R 10jul19 start [no of art to consider from item_lot_packsize, item and if not found then packing master]
double noOfArt = 0d, shipperSize = 0d;
double mCapacity=0d;
System.out.println("Pavan Rane DOM[ "+genericUtility.serializeDom(dom)+"]\n\n\n");
System.out.println("Quantity["+lcqty+"]ItemCode["+mitem+"]mlotno["+mlotno+"]lspack["+lspack+"]");
sql = "select (case when shipper_size is null then 0 else shipper_size end) as shipper_size, "
+ "(case when gross_weight is null then 0 else gross_weight end) as lc_gross_weigth, "
+ "(case when net_weight is null then 0 else net_weight end) as lc_net_weight "
+ "from item_lot_packsize where item_code = ? "
+ "and ? >= lot_no__from and ? <= lot_no__to";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, mitem);
pstmt.setString(2, mlotno);
pstmt.setString(3, mlotno);
rs = pstmt.executeQuery();
if(rs.next())
{
shipperSize = rs.getDouble("shipper_size");
mGrossWeight= rs.getDouble("LC_GROSS_WEIGTH");
mNetWeight= rs.getDouble("LC_NET_WEIGHT");
System.out.println("Pavan R shipperSize["+shipperSize+"] grossWeight [ "+mGrossWeight+" ] netWeight[ "+mNetWeight+" ]");
if (shipperSize > 0)
{
double mod = lcqty/shipperSize;
noOfArt = getRndamt(mod , "X", 1);
System.out.println("noOfArt["+noOfArt+"]");
valueXmlString.append("<no_art><![CDATA[").append(noOfArt).append("]]></no_art>\r\n");
if(noOfArt > 0)
{
mGrosswt = ((mGrossWeight/shipperSize) * lcqty);
mNetWt = ((mNetWeight/shipperSize) * lcqty);
System.out.println("mGrosswt [ "+mGrosswt+" ]");
if(mGrossWeight > 0)
{
valueXmlString.append("<gross_weight ><![CDATA[").append(getRequiredDecimal(mGrosswt,3)).append("]]></gross_weight>\r\n");
valueXmlString.append("<net_weight ><![CDATA[").append(getRequiredDecimal(mNetWt,3)).append("]]></net_weight>\r\n");
mTareWt=mGrosswt - mNetWt;
System.out.println("mGrossWeight > 0 mTareWt [ "+mTareWt+" ]");
valueXmlString.append("<tare_weight ><![CDATA[").append(getRequiredDecimal(mTareWt, 3)).append("]]></tare_weight>\r\n");
}
} //if(noOfArt > 0)
}//if(shipperSize > 0)
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(shipperSize == 0)
{
System.out.println("Pavan Rane After ShipperSize ==0 PackingCode ["+lspack+"]");
if(lspack != null && lspack.trim().length()>0)
{
double mlcMode = 0d;
sql="select capacity from packing where pack_code = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,lspack);
rs = pstmt.executeQuery();
if( rs.next())
{
mCapacity= rs.getDouble("capacity");
System.out.println("Capacity::["+mCapacity+"]");
}
rs.close();
rs = null;
pstmt.close();
pstmt=null;
}
if((lspack!=null && lspack.trim().length()>0) && (mCapacity > 0))
{
double mod = lcqty/mCapacity;
mNoart = getRndamt(mod, "X", 1);
System.out.println("Pavan R mNoart["+mNoart+"]");
valueXmlString.append("<no_art ><![CDATA[").append(mNoart).append("]]></no_art>\r\n");
if(( mNoart > 0))
{
sql="SELECT (CASE WHEN GROSS_WEIGHT IS NULL THEN 0 ELSE GROSS_WEIGHT END) AS LC_GROSS_WEIGTH, (CASE WHEN NET_WEIGHT IS NULL THEN 0 ELSE NET_WEIGHT END) AS LC_NET_WEIGHT FROM ITEM_LOT_PACKSIZE WHERE ITEM_CODE = ? AND ? BETWEEN LOT_NO__FROM AND LOT_NO__TO ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,mitem);
pstmt.setString(2,mlotno);
rs = pstmt.executeQuery();
if( rs.next())
{
grossWeight= checkNull(rs.getString("LC_GROSS_WEIGTH"));
netWeight= checkNull(rs.getString("LC_NET_WEIGHT"));
System.out.println("Pavan Rane grossWeight ["+grossWeight+"]netWeight["+netWeight+"]");
}
rs.close();
rs = null;
pstmt.close();
pstmt=null;
if(grossWeight.trim().length() > 0)
{
mGrossWeight=Double.parseDouble(grossWeight);
}
if(netWeight.trim().length() > 0)
{
mNetWeight=Double.parseDouble(netWeight);
}
mGrosswt = ((mGrossWeight/mCapacity) * lcqty);
mNetWt = ((mNetWeight/mCapacity) * lcqty);
//mGrosswt= mNoart * mGrossWeight;
System.out.println("Pavan Rane total mGrosswt["+mGrosswt+"] mGrossWeight["+mGrossWeight+"]");
if(mGrossWeight > 0)
{
valueXmlString.append("<gross_weight ><![CDATA[").append(getRequiredDecimal(mGrosswt, 3)).append("]]></gross_weight>\r\n");
valueXmlString.append("<net_weight ><![CDATA[").append(getRequiredDecimal(mNetWt, 3)).append("]]></net_weight>\r\n");
mTareWt=mGrosswt - mNetWt;
valueXmlString.append("<tare_weight ><![CDATA[").append(getRequiredDecimal(mTareWt, 3)).append("]]></tare_weight>\r\n");
}
}
}
else
{
sql="SELECT (CASE WHEN NET_WEIGHT IS NULL THEN 0 ELSE NET_WEIGHT END) AS NET_WT_ITEM, INTEGRAL_QTY FROM ITEM WHERE ITEM_CODE = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,mitem);
rs = pstmt.executeQuery();
if( rs.next())
{
netWtItem= checkNull(rs.getString("NET_WT_ITEM"));
integrlQty= checkNull(rs.getString("INTEGRAL_QTY"));
System.out.println("Pavan Rane else netWtItem["+netWtItem+"] integrlQty["+integrlQty+"]");
}
rs.close();
rs = null;
pstmt.close();
pstmt=null;
sql="SELECT (CASE WHEN NET_WEIGHT IS NULL THEN 0 ELSE NET_WEIGHT END) AS NET_WT FROM ITEM_LOT_PACKSIZE WHERE ITEM_CODE = ? AND ? BETWEEN LOT_NO__FROM AND LOT_NO__TO ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,mitem);
pstmt.setString(2,mlotno);
rs = pstmt.executeQuery();
if( rs.next())
{
netWt= checkNull(rs.getString("NET_WT"));
System.out.println("Pavan Rane netWt["+netWt+"]");
}
rs.close();
rs = null;
pstmt.close();
pstmt=null;
if(netWtItem.trim().length() > 0)
{
mNetWtItem=Double.parseDouble(netWtItem);
}
if(netWt.trim().length() > 0)
{
mNetWt=Double.parseDouble(netWt);
}
if(integrlQty.trim().length()>0)
{
mIntegrlQty=Double.parseDouble(integrlQty);
}
if(mNetWt==0)
{
mNetWt=mNetWtItem;
}
if(mNetWt==0)
{
}
else
{
mNetWt=mNetWt * lcqty;
if(mIntegrlQty>0)
{
sql="SELECT FN_MOD( ? ,? ) AS LC_MODE FROM DUAL ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,lcqty1);
pstmt.setString(2,integrlQty);
rs = pstmt.executeQuery();
if( rs.next())
{
lcMode= checkNull(rs.getString("LC_MODE"));
System.out.println("intered in rs item descr hhho.."+lcMode);
}
rs.close();
rs = null;
pstmt.close();
pstmt=null;
if(lcMode.length()>0)
{
mNoart=(lcqty / mIntegrlQty) + 1; //in pb int is used before open brackets
}
else
{
mNoart=(lcqty / mIntegrlQty) ; //in pb int is used before open brackets
}
}
else
{
mNoart=lcqty;
}
}
valueXmlString.append("<gross_weight ><![CDATA[").append(getRequiredDecimal(mNetWt, 3)).append("]]></gross_weight>\r\n");
valueXmlString.append("<net_weight ><![CDATA[").append(getRequiredDecimal(mNetWt, 3)).append("]]></net_weight>\r\n");
valueXmlString.append("<tare_weight ><![CDATA[").append("0").append("]]></tare_weight>\r\n");
valueXmlString.append("<no_art ><![CDATA[").append(mNoart).append("]]></no_art>\r\n");
}
}
//Pavan R 10jul19 end
}
else if(currentColumn.trim().equalsIgnoreCase("lot_sl"))
{
......@@ -11345,74 +11165,5 @@ public class PoReceiptIc extends ValidatorEJB implements PoReceiptIcLocal,PoRec
return cpFlag;
}
//Pavan Rane 11jun19 end
//Pavan R 10jul19 start [below method added for no of art to consider from item_lot_packsize, item and if not found then packing master]
public double getRndamt(double newQty, String round, double roundTo) {
System.out.println(newQty+"~~~"+round+"~~~"+roundTo);
double lcMultiply = 1;
try {
round = round.toUpperCase();
if (newQty < 0) {
lcMultiply = -1;
newQty = Math.abs(newQty);
} else if (newQty == 0) {
return newQty;
} else if (round.trim().equals("N")) {
return newQty;
} else if (roundTo == 0) {
return newQty;
}
if (round.trim().equals("X")) {
if(newQty == (newQty - (newQty % roundTo)))
{
return newQty;
}
else
{
newQty = ((newQty - (newQty % roundTo)) + roundTo);
}
}
if (round.trim().equals("P")) {
newQty = (newQty - (newQty % roundTo));
}
if (round.trim().equals("R")) {
if ((newQty % roundTo) < (roundTo / 2)) {
newQty = (newQty - (newQty % roundTo));
} else {
newQty = (newQty - (newQty % roundTo) + roundTo);
}
}
System.out.println("newQty[" + newQty + "]");
System.out.println("lcMultiply[" + lcMultiply + "]");
newQty = newQty * lcMultiply;
System.out.println("newQty * lcMultiply[" + newQty + "]");
return newQty;
} catch (Exception e) {
System.out.println("Exception :Conversion Qty ::" + e.getMessage()
+ ":");
}
if (roundTo == 1) {
newQty = getRequiredDecimal(newQty, 0);
} else if (roundTo == .1) {
newQty = getRequiredDecimal(newQty, 1);
} else if (roundTo == .01) {
newQty = getRequiredDecimal(newQty, 2);
} else if (roundTo == .001) {
newQty = getRequiredDecimal(newQty, 3);
} else if (roundTo == .0001) {
newQty = getRequiredDecimal(newQty, 4);
}
return newQty;
}
public double getRequiredDecimal(double actVal, int prec) {
NumberFormat numberFormat = NumberFormat.getIntegerInstance();
Double DoubleValue = new Double(actVal);
numberFormat.setMaximumFractionDigits(3);
String strValue = numberFormat.format(DoubleValue);
strValue = strValue.replaceAll(",", "");
double reqVal = Double.parseDouble(strValue);
return reqVal;
}
//Pavan R 10jul19 end
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment