Commit 0b2b9b92 authored by ngadkari's avatar ngadkari

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@209408 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3b2d6d49
......@@ -66,6 +66,7 @@ public class BusinessLogicChkOverride extends ActionHandlerEJB{
//double totAmt = 0.0d;
Timestamp today = null;
String errString = "";
String tranType="";//added by nandkumar gadkari on 01/10/19
try
{
conn = getConnection();
......@@ -77,7 +78,7 @@ public class BusinessLogicChkOverride extends ActionHandlerEJB{
String empCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginEmpCode" );
userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
System.out.println("Pavan Transaction Id::["+tranId+"]userId["+userId+"]empCode["+empCode+"]");
sql = "select aprv_stat, sale_order, cr_policy, amd_no from business_logic_check where tran_id = ?";
sql = "select aprv_stat, sale_order, cr_policy, amd_no,tran_type from business_logic_check where tran_id = ?";//tran type added by nandkumar gadkari on 01/10/19
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
......@@ -87,6 +88,7 @@ public class BusinessLogicChkOverride extends ActionHandlerEJB{
sorder = checkNull(rs.getString("sale_order"));
crPolicy = checkNull(rs.getString("cr_policy"));
amdNo = checkNull(rs.getString("amd_no"));
tranType = checkNull(rs.getString("tran_type"));//tran type added by nandkumar gadkari on 01/10/19
}
rs.close();
rs = null;
......@@ -183,42 +185,62 @@ public class BusinessLogicChkOverride extends ActionHandlerEJB{
}
else
{
sql = "select (case when confirmed is null then 'N' else confirmed end) as CONFIRMED from sorder where sale_order = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
rs = pstmt.executeQuery();
if (rs.next())
{
confirmed = checkNull(rs.getString("CONFIRMED"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "select count(*) as cnt from business_logic_check where sale_order = ? and aprv_stat = 'F'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
rs = pstmt.executeQuery();
if (rs.next())
{
overrideCnt = rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( overrideCnt == 0 )
{
if(!"C".equalsIgnoreCase(tranType))//condition added by nandkumar gadkari on 01/10/19
{
sql = "select (case when confirmed is null then 'N' else confirmed end) as CONFIRMED from sorder where sale_order = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
rs = pstmt.executeQuery();
if (rs.next())
{
confirmed = checkNull(rs.getString("CONFIRMED"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "update sorder set cr_check_stat = 'O' where sale_order = ?";
sql = "select count(*) as cnt from business_logic_check where sale_order = ? and aprv_stat = 'F'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
rs = pstmt.executeQuery();
if (rs.next())
{
overrideCnt = rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( overrideCnt == 0 )
{
sql = "update sorder set cr_check_stat = 'O' where sale_order = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
updCnt = pstmt.executeUpdate();
System.out.println("");
pstmt.close();
pstmt = null;
System.out.println("BUSINESS_LOGIC_CHECK 4rd updCnt[ "+updCnt+" ]");
}
}
else//condition added by nandkumar gadkari on 01/10/19
{
sql = "select (case when confirmed is null then 'N' else confirmed end) as confirmed from charge_back where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sorder);
updCnt = pstmt.executeUpdate();
System.out.println("");
rs = pstmt.executeQuery();
if (rs.next())
{
confirmed = checkNull(rs.getString("CONFIRMED"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("BUSINESS_LOGIC_CHECK 4rd updCnt[ "+updCnt+" ]");
}
if("N".equals(confirmed))
......@@ -238,9 +260,12 @@ public class BusinessLogicChkOverride extends ActionHandlerEJB{
System.out.println("unconfirmed cnt "+cnt);
if( cnt == 0 )
{
sordConf = new SorderConf();
errString = sordConf.confirmSorder(sorder, "", xtraParams, conn);
sordConf = null;
if(!"C".equalsIgnoreCase(tranType))//condition added by nandkumar gadkari on 01/10/19
{
sordConf = new SorderConf();
errString = sordConf.confirmSorder(sorder, "", xtraParams, conn);
sordConf = null;
}
System.out.println("Sorder Confirm returning... ["+errString+"]");
if (errString.indexOf("VTCNFSUCC") > 0 || errString.trim().length() == 0)
{
......
......@@ -119,7 +119,9 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
// added by nandkumar gadkari on 1/10/19
String mrpRateStr="",custCodeStk="",siteCodePbus="",settleMethod="";
double mrpRate=0,dRate=0;
try
{
System.out.println("wfValData called");
......@@ -180,6 +182,47 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
// break;
// return errString;
}
else//else added by nandkumar gadkari on 1/10/19
{
settleMethod=genericUtility.getColumnValue("settle_mth", dom2,"1");
if("Q".equalsIgnoreCase(settleMethod) || "V".equalsIgnoreCase(settleMethod))
{
sql = " SELECT SITE_CODE__PBUS FROM CUSTOMER WHERE CUST_CODE=? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, custCode.trim());
rs = pStmt.executeQuery();
if (rs.next())
{
siteCodePbus = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
sql = " SELECT CUST_CODE FROM CUSTOMER WHERE SITE_CODE=? AND CHANNEL_PARTNER=? ";
pStmt = conn.prepareStatement(sql);
pStmt.setString(1, siteCodePbus);
pStmt.setString(2, "Y");
rs = pStmt.executeQuery();
if (rs.next())
{
custCodeStk = rs.getString(1);
}
rs.close();
rs = null;
pStmt.close();
pStmt = null;
if(custCodeStk == null || custCodeStk.trim().length() == 0)
{
errCode = "VTSUPCUST";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
}
}
......@@ -899,13 +942,17 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
if(childNodeName.equalsIgnoreCase("item_code"))
{
itemCode1= E12GenericUtility.checkNull(genericUtility.getColumnValue("item_code", dom));
System.out.println("Item code1 in vaildation:"+itemCode1);
settlemth=genericUtility.getColumnValue("settle_mth", dom2,"1");//settleMth added by nandkumar gadkari on 01/10/19
System.out.println("Item code1 in vaildation:"+itemCode1+settlemth);
if(E12GenericUtility.checkNull(itemCode1).length()<=0)
{
errCode = "VTITMNUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
if(!"V".equalsIgnoreCase(settlemth))//condition added by nandkumar gadkari on 01/10/19
{
errCode = "VTITMNUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
else
{
......@@ -936,12 +983,13 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
else if(childNodeName.equalsIgnoreCase("rate"))
{
rate=E12GenericUtility.checkNull(genericUtility.getColumnValue("rate", dom));
int rate1=0;
settlemth=genericUtility.getColumnValue("settle_mth", dom2,"1");//settleMth added by nandkumar gadkari on 01/10/19
double rate1=0;
if(rate.length()>0)
{
try
{
rate1=Integer.parseInt(rate);
rate1=Double.parseDouble(rate);// change int to double by nandkumar gadkari on 01/10/19
System.out.println("rate for the validation"+rate1);
}
catch(NumberFormatException nm)
......@@ -959,20 +1007,26 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
}
else
{
errCode = "INVRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
if(!"V".equalsIgnoreCase(settlemth))//condition added by nandkumar gadkari on 01/10/19
{
errCode = "INVRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("quantity"))
{
quantity=E12GenericUtility.checkNull(genericUtility.getColumnValue("quantity", dom));
int quantity1=0;
settlemth=genericUtility.getColumnValue("settle_mth", dom2,"1");//settleMth added by nandkumar gadkari on 01/10/19
double quantity1=0;
if(quantity.length()>0)
{
try
{
quantity1=Integer.parseInt(quantity);
quantity1=Double.parseDouble(quantity);// change int to double by nandkumar gadkari on 01/10/19
System.out.println("Quantity for the validation:"+quantity1);
}
catch(NumberFormatException nm)
......@@ -990,9 +1044,12 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
}
else
{
errCode = "INVQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
if(!"V".equalsIgnoreCase(settlemth))//condition added by nandkumar gadkari on 01/10/19
{
errCode = "INVQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.equalsIgnoreCase("free_value"))
......@@ -1045,11 +1102,11 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
errList.add("INFREEVAL");
errFields.add(childNodeName.toLowerCase());
}
else if(freeValue1 > limitAmount)
/*else if(freeValue1 > limitAmount) COMMENTED BY NANDKUMAR GADKARI ON 1/10/19
{
errList.add("MAXFREEVAL");
errFields.add(childNodeName.toLowerCase());
}
}*/
}
//Added by saiprasad G. on[17-1-19] END
}
......@@ -1123,7 +1180,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
double amount = 0, schemAmt = 0;
int disparmVl = 0;
double disparmVl = 0;
String schemAmount = "" ,sqlQuery = "",disparmVal = "";
String amountStr = E12GenericUtility.checkNull(genericUtility.getColumnValue("amount", dom));
......@@ -1174,7 +1231,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
disparmVal = resultSet.getString("VAR_VALUE");
if(disparmVal != null && disparmVal.trim().length() > 0 )
{
disparmVl = Integer.parseInt(disparmVal);
disparmVl = Double.parseDouble(disparmVal);// change int to double by nandkumar gadkari on 01/10/19
}
}
}
......@@ -1203,6 +1260,22 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
}
}
//Added by AMOL S on 01-JUL-2019 [D19CMES002] END
else if(childNodeName.equalsIgnoreCase("rate__count")) //VALIDATION ADDED BY NANDKUMAR GADKARI ON 1/10/19
{
settlemth = genericUtility.getColumnValue("settle_mth", dom2,"1");
if("Q".equalsIgnoreCase(settlemth))
{
mrpRateStr = genericUtility.getColumnValue("rate__count", dom);
mrpRate=mrpRateStr == null || mrpRateStr.trim().length() == 0 ? 0 : Double.parseDouble(mrpRateStr);
rate = genericUtility.getColumnValue("rate", dom);
dRate=rate == null || rate.trim().length() == 0 ? 0 : Double.parseDouble(rate);
if(mrpRate > dRate)
{
errList.add("VTMRPRATE");
errFields.add(childNodeName.toLowerCase());
}
}
}
}// End of for loop CASE3
//Added by Saiprasad G. [When the settle_mth change in edit case] START
......@@ -2568,6 +2641,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
{
Double totalAmount=0.0;
String offer = E12GenericUtility.checkNull(genericUtility.getColumnValue("offer", dom));
settleMethod = (E12GenericUtility.checkNull(genericUtility.getColumnValue("settle_mth", dom2))).trim();//settleMth added by nandkumar gadkari on 01/10/19
System.out.println("Offer selected:"+offer);
String sqlofSchAprv="select amount, tran_id from scheme_apprv where aprv_status='A' and scheme_code=?";
System.out.println("sqlofSchAprv:"+sqlofSchAprv);
......@@ -2589,7 +2663,7 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
valueXmlString.append("<limit_amt protect =\"1\"><![CDATA[").append(totalAmount.toString()).append("]]></limit_amt>");
//Added by AMOL S on 01-JUL-2019 [D19CMES002] START
valueXmlString = getOfferData(valueXmlString,conn,tranId);
valueXmlString = getOfferData(valueXmlString,conn,tranId,settleMethod);//settleMth added by nandkumar gadkari on 01/10/19
//Added by AMOL S on 01-JUL-2019 [D19CMES002] END
}
//Added by Saiprasad G. on[17-1-19]END
......@@ -3485,14 +3559,14 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
return countRate;
}
private StringBuffer getOfferData(StringBuffer valueXmlString, Connection conn, String tranId)
private StringBuffer getOfferData(StringBuffer valueXmlString, Connection conn, String tranId,String settleMth)
{
//offer means scheme_code
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String sqlQuery = "", itemCode = "", quantity ="", itemCodeRepl = "", freeQty = "", rateCount = "", itemDescr = "", itemReplDescr = "";
double amount = 0, freeQuntity = 0, rateCnt = 0;
sqlQuery ="SELECT ITEM_CODE,ITEM_CODE__REPL,QUANTITY,FREE_QTY,RATE FROM SCHEME_APPRV_DET WHERE TRAN_ID = ?";
sqlQuery ="SELECT ITEM_CODE,ITEM_CODE__REPL,QUANTITY,FREE_QTY,RATE,AMOUNT FROM SCHEME_APPRV_DET WHERE TRAN_ID = ?";//amount added by nandkumar gadkari on 01/10/19
try
{
......@@ -3506,6 +3580,8 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
quantity = resultSet.getString("QUANTITY");
freeQty = resultSet.getString("FREE_QTY");
rateCount = resultSet.getString("RATE");
amount = resultSet.getDouble("AMOUNT");//amount added by nandkumar gadkari on 01/10/19
}
if(freeQty != null && freeQty.trim().length() > 0)
......@@ -3546,18 +3622,24 @@ public class ChargeBackLoc extends ValidatorEJB implements ChargeBackLocLocal, C
{
closeResources(preparedStatement,resultSet);
}
amount = (freeQuntity * rateCnt);
valueXmlString.append("<item_code protect =\"1\"><![CDATA[").append(itemCode).append("]]></item_code>");
valueXmlString.append("<item_descr><![CDATA[").append(itemDescr).append("]]></item_descr>");
valueXmlString.append("<quantity protect =\"1\"><![CDATA[").append(quantity).append("]]></quantity>");
valueXmlString.append("<item_code__repl><![CDATA[").append(itemCodeRepl).append("]]></item_code__repl>");
valueXmlString.append("<item_repl_descr><![CDATA[").append(itemReplDescr).append("]]></item_repl_descr>");
valueXmlString.append("<rate><![CDATA[").append(0).append("]]></rate>");
valueXmlString.append("<free_qty><![CDATA[").append(freeQty).append("]]></free_qty>");
valueXmlString.append("<rate__count protect =\"1\"><![CDATA[").append(rateCount).append("]]></rate__count>");
valueXmlString.append("<amount protect =\"1\"><![CDATA[").append(amount).append("]]></amount>");
if(!"V".equalsIgnoreCase(settleMth))//condition added by nandkumar gadkari on 01/10/19
{
amount = (freeQuntity * rateCnt);
valueXmlString.append("<item_code protect =\"1\"><![CDATA[").append(itemCode).append("]]></item_code>");
valueXmlString.append("<item_descr><![CDATA[").append(itemDescr).append("]]></item_descr>");
valueXmlString.append("<quantity protect =\"1\"><![CDATA[").append(quantity).append("]]></quantity>");
valueXmlString.append("<item_code__repl><![CDATA[").append(itemCodeRepl).append("]]></item_code__repl>");
valueXmlString.append("<item_repl_descr><![CDATA[").append(itemReplDescr).append("]]></item_repl_descr>");
valueXmlString.append("<rate><![CDATA[").append(0).append("]]></rate>");
valueXmlString.append("<free_qty><![CDATA[").append(freeQty).append("]]></free_qty>");
valueXmlString.append("<rate__count protect =\"1\"><![CDATA[").append(rateCount).append("]]></rate__count>");
valueXmlString.append("<amount protect =\"1\"><![CDATA[").append(amount).append("]]></amount>");
}
else
{
valueXmlString.append("<free_value><![CDATA[").append(amount).append("]]></free_value>");
}
return valueXmlString;
}
private void closeResources(PreparedStatement preparedStatement, ResultSet resultSet)
......
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