Commit c1675276 authored by arane's avatar arane

Issues In Bank Related Transactions

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@214832 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 63d55e89
...@@ -56,66 +56,85 @@ public class SupplierBankConf extends ActionHandlerEJB implements SupplierBankCo ...@@ -56,66 +56,85 @@ public class SupplierBankConf extends ActionHandlerEJB implements SupplierBankCo
private String confirmSuppBank(String tranId, String xtraParams,String forcedFlag) throws RemoteException,ITMException private String confirmSuppBank(String tranId, String xtraParams,String forcedFlag) throws RemoteException,ITMException
{ {
System.out.println("SuppBankConf>>>> confirm method called>>>>>>>"); System.out.println("SuppBankConf>>>> confirm method called>>>>>>>");
String suppCode = ""; String suppCode = "", bankCode = "", runMode = "", ediOption = "", dataStr = "", confirmed = "";
String bankCode = "";
String runMode = "", ediOption = "", dataStr = "", confirmed = "";
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
boolean isPreExist=false; boolean isPreExist=false;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
String errString = "", retString = "", sql = "", empCodeAprv = "", activeYn = ""; String errString = "", retString = "", sql = "", empCodeAprv = "", activeYn = "", effFromStr="",validUptoStr="";
String effFromStr="",validUptoStr="";
SimpleDateFormat sdf = null,sdf1=null; SimpleDateFormat sdf = null,sdf1=null;
Timestamp preTmstp=null,effFromTmstp=null,validUptoTmstp=null,effFromTmstp1=null,validUptoTmstp1=null; Timestamp preTmstp=null,effFromTmstp=null,validUptoTmstp=null,effFromTmstp1=null,validUptoTmstp1=null;
Timestamp validUptoDt=null,validUpto=null,effFromDt=null; Timestamp validUptoDt=null,validUpto=null,effFromDt=null;
Date effFrom=null,prevDate=null,validUptoNew=null,effFromNew=null; Date effFrom=null,prevDate=null,validUptoNew=null,effFromNew=null;
Date validUptoDate=null,effFromDate=null; Date validUptoDate=null,effFromDate=null;
int updateCount = 0, updateCount1=0,ediOpt = 0; int updateCount = 0, updateCount1=0,ediOpt = 0;
String effFromStr1="",validUptoSrt1=""; String effFromStr1="",validUptoSrt1="";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try try
{ {
//Changes and Commented By Bhushan on 06-06-2016 :START //Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
//Changes and Commented By Bhushan on 06-06-2016 :END //Changes and Commented By Bhushan on 06-06-2016 :END
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; connDriver = null;
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String[] pkValuesArr = string2StringArray(tranId, ":"); String[] pkValuesArr = string2StringArray(tranId, ":");
suppCode = checkNull(pkValuesArr[0]).trim(); // Modified by Anagha Rane 09JAN2019 start [to get primary fields columns]
/*suppCode = checkNull(pkValuesArr[0]).trim();
effFromStr = checkNull(pkValuesArr[1]).trim(); effFromStr = checkNull(pkValuesArr[1]).trim();
validUptoStr = pkValuesArr[2].trim(); validUptoStr = pkValuesArr[2].trim();*/
if(pkValuesArr.length > 0) {
effFromDt = Timestamp.valueOf(genericUtility.getValidDateString(effFromStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0"); suppCode = checkNull(pkValuesArr[0]).trim();
validUptoDt = Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0"); }
if(pkValuesArr.length > 1)
{
bankCode = checkNull(pkValuesArr[1]).trim();
}
if(pkValuesArr.length > 2)
{
effFromStr = checkNull(pkValuesArr[2]).trim();
}
if(effFromStr != null && effFromStr.trim().length() > 0)
{
effFromDt = Timestamp.valueOf(genericUtility.getValidDateString(effFromStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
}
/*if(validUptoStr != null && validUptoStr.trim().length() > 0)
{
validUptoDt = Timestamp.valueOf(genericUtility.getValidDateString(validUptoStr,genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat())+ " 00:00:00.0");
}*/
// Modified by Anagha Rane 09JAN2019 end [to get primary fields columns]
System.out.println("Effective from TimeStamp pkvalues>>>>>>>>"+effFromDt); System.out.println("Effective from TimeStamp pkvalues>>>>>>>>"+effFromDt);
System.out.println("Valid from TimeStamp pkvalues>>>>>>>>"+validUptoDt); //System.out.println("Valid from TimeStamp pkvalues>>>>>>>>"+validUptoDt);
empCodeAprv = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"); empCodeAprv = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
runMode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"runMode"); runMode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"runMode");
System.out.println("Employee Code ------->> " + empCodeAprv+"Run Mode>>>" + runMode); System.out.println("Employee Code ------->> " + empCodeAprv+"Run Mode>>>" + runMode);
Date currdt = new java.sql.Date(new java.util.Date().getTime()); Date currdt = new java.sql.Date(new java.util.Date().getTime());
System.out.println("Date>>>>>>>>>>" + currdt); //System.out.println("Date>>>>>>>>>>" + currdt);
sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat()); sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
Timestamp currDate = java.sql.Timestamp.valueOf(sdf1.format(currdt).toString() + " 00:00:00.0"); Timestamp currDate = java.sql.Timestamp.valueOf(sdf1.format(currdt).toString() + " 00:00:00.0");
System.out.println("TimeStamp currDate>>>"+currDate); System.out.println("TimeStamp currDate>>>"+currDate +"Tran ID>>>>>>>>"+tranId+"Supplier Code>>>>>>>>"+suppCode);
System.out.println("Tran ID>>>>>>>>"+tranId); /*System.out.println("Tran ID>>>>>>>>"+tranId);
System.out.println("Supplier Code>>>>>>>>"+suppCode); System.out.println("Supplier Code>>>>>>>>"+suppCode);
*/
sql = "select confirmed, active_yn from supplier_bank where supp_code= ? and eff_from = ? and valid_upto = ?"; // Modified by Anagha Rane 09JAN2019 start [to update primary fields columns]
//sql = "select confirmed, active_yn from supplier_bank where supp_code= ? and eff_from = ? and valid_upto = ?";
sql = "select confirmed, active_yn from supplier_bank where supp_code= ? and bank_code__ben= ? and eff_from = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, suppCode); pstmt.setString(1, suppCode);
pstmt.setTimestamp(2, effFromDt); /*pstmt.setTimestamp(2, effFromDt);
pstmt.setTimestamp(3, validUptoDt); pstmt.setTimestamp(3, validUptoDt);*/
// Modified by Anagha Rane 09JAN2019 end [to update primary fields columns]
pstmt.setString(2, bankCode);
pstmt.setTimestamp(3, effFromDt);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
...@@ -126,61 +145,71 @@ conn = getConnection(); ...@@ -126,61 +145,71 @@ conn = getConnection();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("Confirm>>>>>>>>>" + confirmed); System.out.println("Confirm>>>>>>>>>" + confirmed);
System.out.println("ActiveYn>>>>>>>>" + activeYn); System.out.println("ActiveYn>>>>>>>>" + activeYn);
if (confirmed != null && confirmed.equalsIgnoreCase("Y")) if (confirmed != null && confirmed.equalsIgnoreCase("Y"))
{ {
System.out.println("This tansaction is already confirmed"); //System.out.println("This tansaction is already confirmed");
errString = itmDBAccessEJB.getErrorString("", "VTINVCONF2", "","", conn); errString = itmDBAccessEJB.getErrorString("", "VTINVCONF2", "","", conn);
System.out.println("ErrorString inside Confirmed YES"+errString); //System.out.println("ErrorString inside Confirmed YES"+errString);
return errString; return errString;
} }
else else
{ {
sql="select eff_from,valid_upto from supplier_bank where supp_code = ?" + // Modified by Anagha Rane 09JAN2019 start [to update primary fields columns]
" and active_yn = 'N' and confirmed= 'N' "; //sql="select eff_from,valid_upto from supplier_bank where supp_code = ?" +
sql="select eff_from,valid_upto from supplier_bank where supp_code = ? and bank_code__ben = ? and eff_from = ? " +
" and active_yn = 'N' and confirmed= 'N' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, suppCode); pstmt.setString(1, suppCode);
pstmt.setString(2, bankCode);
pstmt.setTimestamp(3, effFromDt);
// Modified by Anagha Rane 09JAN2019 end [to update primary fields columns]
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
effFromTmstp1 = rs.getTimestamp("eff_from"); effFromTmstp1 = rs.getTimestamp("eff_from");
validUptoTmstp1 = rs.getTimestamp("valid_upto"); validUptoTmstp1 = rs.getTimestamp("valid_upto");
System.out.println("Effective effFromTmstp1>>>>>"+effFromTmstp1); System.out.println("Effective effFromTmstp1>>>>>"+effFromTmstp1+"Valid upto validUptoTmstp1>>>>>"+validUptoTmstp1);
System.out.println("Valid upto validUptoTmstp1>>>>>"+validUptoTmstp1); //System.out.println("Valid upto validUptoTmstp1>>>>>"+validUptoTmstp1);
} }
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
validUptoDt = validUptoTmstp1;
if(effFromTmstp1.after(validUptoTmstp1)) if(effFromTmstp1.after(validUptoTmstp1))
{ {
System.out.println("Active_N $ Confirm_N>>>"); System.out.println("Active_N $ Confirm_N>>>");
errString = itmDBAccessEJB.getErrorString("", "VMSDLTED","", "", conn); errString = itmDBAccessEJB.getErrorString("", "VMSDLTED","", "", conn);
return errString; return errString;
} }
/** /**
* To get eff_from & valid_upto from previous saved record if any * To get eff_from & valid_upto from previous saved record if any
* */ * */
// Modified by Anagha Rane 09JAN2019 start [to update primary fields columns]
sql="select eff_from,valid_upto from supplier_bank where supp_code = ?" + //sql="select eff_from,valid_upto from supplier_bank where supp_code = ?" +
sql="select eff_from,valid_upto from supplier_bank where supp_code = ? and bank_code__ben = ? and eff_from <> ? " +
" and active_yn = 'Y' and confirmed= 'Y' "; " and active_yn = 'Y' and confirmed= 'Y' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, suppCode); pstmt.setString(1, suppCode);
pstmt.setString(2, bankCode);
pstmt.setTimestamp(3, effFromDt);
// Modified by Anagha Rane 09JAN2019 end [to update primary fields columns]
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
effFromTmstp = rs.getTimestamp("eff_from"); effFromTmstp = rs.getTimestamp("eff_from");
validUptoTmstp = rs.getTimestamp("valid_upto"); validUptoTmstp = rs.getTimestamp("valid_upto");
isPreExist=true; isPreExist=true;
System.out.println("Effective Date>>>>>"+effFromTmstp); System.out.println("Effective Date>>>>>"+effFromTmstp+"Valid upto Date>>>>>"+validUptoTmstp+"isPreExist>>>>>"+isPreExist);
System.out.println("Valid upto Date>>>>>"+validUptoTmstp); /*System.out.println("Valid upto Date>>>>>"+validUptoTmstp);
System.out.println("isPreExist>>>>>"+isPreExist); System.out.println("isPreExist>>>>>"+isPreExist);*/
} }
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -189,25 +218,30 @@ conn = getConnection(); ...@@ -189,25 +218,30 @@ conn = getConnection();
if(effFromTmstp == null && validUptoTmstp == null) if(effFromTmstp == null && validUptoTmstp == null)
{ {
System.out.println("Inside if(effFromTmstp==null && validUptoTmstp==null)"); System.out.println("Inside if(effFromTmstp==null && validUptoTmstp==null)");
// /** // /**
// * update the current record with confirmed='Y' and active_yn='Y' // * update the current record with confirmed='Y' and active_yn='Y'
// //
// sql = "update supplier_bank set confirmed = 'Y', wf_status='C', active_yn='Y', conf_date = ?,emp_code__aprv = ?, eff_from =?, status_date= ? where supp_code = ? and eff_from = ? and valid_upto= ?"; // sql = "update supplier_bank set confirmed = 'Y', wf_status='C', active_yn='Y', conf_date = ?,emp_code__aprv = ?, eff_from =?, status_date= ? where supp_code = ? and eff_from = ? and valid_upto= ?";
sql = "update supplier_bank set confirmed = 'Y', wf_status='C', active_yn='Y', conf_date = ?,emp_code__aprv = ?, eff_from =?, status_date= ? where supp_code = ? and eff_from = ? and valid_upto= ?";
// Modified by Anagha Rane 09JAN2019 start [to update primary fields columns]
//sql = "update supplier_bank set confirmed = 'Y', wf_status='C', active_yn='Y', conf_date = ?,emp_code__aprv = ?, eff_from =?, status_date= ? where supp_code = ? and eff_from = ? and valid_upto= ?";
sql = "update supplier_bank set confirmed = 'Y', wf_status='C', active_yn='Y', conf_date = ?,emp_code__aprv = ?, eff_from =?, status_date= ? where supp_code = ? and bank_code__ben = ? and eff_from = ? and valid_upto= ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, currDate); pstmt.setTimestamp(1, currDate);
pstmt.setString(2, empCodeAprv); pstmt.setString(2, empCodeAprv);
pstmt.setTimestamp(3, currDate); pstmt.setTimestamp(3, currDate);
pstmt.setTimestamp(4, currDate); pstmt.setTimestamp(4, currDate);
pstmt.setString(5, suppCode); pstmt.setString(5, suppCode);
pstmt.setTimestamp(6, effFromDt); pstmt.setString(6, bankCode);
pstmt.setTimestamp(7, validUptoDt); pstmt.setTimestamp(7, effFromDt);
pstmt.setTimestamp(8, validUptoDt);
// Modified by Anagha Rane 09JAN2019 end [to update primary fields columns]
updateCount = pstmt.executeUpdate(); updateCount = pstmt.executeUpdate();
System.out.println("no of row update updateCount: " + updateCount); System.out.println("no of row update updateCount: " + updateCount);
System.out.println("Confirm Date>>>>>" + currDate); /*System.out.println("Confirm Date>>>>>" + currDate);
System.out.println("Employee Approved Code>>> " + empCodeAprv); System.out.println("Employee Approved Code>>> " + empCodeAprv);
System.out.println("Supplier Code>>>>" + suppCode); System.out.println("Supplier Code>>>>" + suppCode);
System.out.println("new java.sql.Date(new java.util.Date().getTime())"+new java.sql.Date(new java.util.Date().getTime())); System.out.println("new java.sql.Date(new java.util.Date().getTime())"+new java.sql.Date(new java.util.Date().getTime()));*/
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if (updateCount > 0) if (updateCount > 0)
...@@ -217,137 +251,150 @@ conn = getConnection(); ...@@ -217,137 +251,150 @@ conn = getConnection();
errString = itmDBAccessEJB.getErrorString("", "VTCONSUCF","", "", conn); errString = itmDBAccessEJB.getErrorString("", "VTCONSUCF","", "", conn);
System.out.println("ErrorString inside 1st Confirm"+errString); System.out.println("ErrorString inside 1st Confirm"+errString);
return errString; return errString;
} }
} }
else else
{ {
System.out.println("Inside ELSE OF (effFromTmstp==null && validUptoTmstp==null)"); System.out.println("Inside ELSE OF (effFromTmstp==null && validUptoTmstp==null)");
//Updating the field confirmed = 'Y', active_yn='Y', conf_date,emp_code__aprv, eff_from //Updating the field confirmed = 'Y', active_yn='Y', conf_date,emp_code__aprv, eff_from
sql = "update supplier_bank set confirmed = 'Y', wf_status='C', active_yn='Y', conf_date = ?,emp_code__aprv = ?, eff_from =?, status_date= ? where supp_code = ? and eff_from = ? and valid_upto= ?"; // Modified by Anagha Rane 09JAN2019 start [to update primary fields columns]
sql = "update supplier_bank set confirmed = 'Y', wf_status='C', active_yn='Y', conf_date = ?,emp_code__aprv = ?, eff_from =?, status_date= ? where supp_code = ? and bank_code__ben = ? and eff_from = ? and valid_upto= ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
// pstmt.setTimestamp(1, currDate); // pstmt.setTimestamp(1, currDate);
pstmt.setTimestamp(1, currDate); pstmt.setTimestamp(1, currDate);
pstmt.setString(2, empCodeAprv); pstmt.setString(2, empCodeAprv);
pstmt.setTimestamp(3, currDate); pstmt.setTimestamp(3, currDate);//???eff_from
pstmt.setTimestamp(4, currDate); pstmt.setTimestamp(4, currDate);
pstmt.setString(5, suppCode); pstmt.setString(5, suppCode);
pstmt.setTimestamp(6, effFromDt); pstmt.setString(6, bankCode);
pstmt.setTimestamp(7, validUptoDt); pstmt.setTimestamp(7, effFromDt);
pstmt.setTimestamp(8, validUptoDt);
// Modified by Anagha Rane 09JAN2019 end [to update primary fields columns]
updateCount = pstmt.executeUpdate(); updateCount = pstmt.executeUpdate();
System.out.println("no of row update: " + updateCount); System.out.println("no of row update: " + updateCount);
System.out.println("Confirm Date>>>>>" + currDate); /*System.out.println("Confirm Date>>>>>" + currDate);
System.out.println("Employee Approved Code>>> " + empCodeAprv); System.out.println("Employee Approved Code>>> " + empCodeAprv);
System.out.println("Supplier Code>>>>" + suppCode); System.out.println("Supplier Code>>>>" + suppCode);*/
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if (updateCount > 0) if (updateCount > 0)
{ {
System.out.println("The selected transaction is confirmed successfully"); System.out.println("The selected transaction is confirmed successfully");
System.out.println("validUptoTmstp>>>>>"+validUptoTmstp); System.out.println("validUptoTmstp>>>>>"+validUptoTmstp+"effFromDt>>>>>"+effFromDt);
System.out.println("effFromDt>>>>>"+effFromDt); //System.out.println("effFromDt>>>>>"+effFromDt);
if(isPreExist) if(isPreExist)
{ {
/** if validUptoTmstp(Saved Record) is greater than Effective date(Current Record) if(effFromTmstp != null && validUptoTmstp != null) // Added by Anagha Rane 09JAN2019 start [to handle NPE]
* then previous date of Confirmation date will be saved*/
if(validUptoTmstp.after(effFromDt) || validUptoTmstp.before(effFromDt))
{
System.out.println("Inside Previous Date ");
prevDate=this.getPreDate(currDate, 1);
System.out.println("Previous date>>>>>"+prevDate);
sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
preTmstp = java.sql.Timestamp.valueOf(sdf.format(prevDate).toString() + " 00:00:00.0");
System.out.println("Previous date in Timestamp>>>>>"+preTmstp);
}
else
{
System.out.println("Previous date inside else>>>>>"+validUptoTmstp);
preTmstp = validUptoTmstp;
System.out.println("Previous date inside else>>>>>"+preTmstp);
}
//If validUptoTmstp(preTmstp) is less than Effective Date(Previous Record)
if(preTmstp.before(effFromTmstp))
{ {
System.out.println("if(preTmstp.before(effFromTmstp))"); /** if validUptoTmstp(Saved Record) is greater than Effective date(Current Record)
System.out.println("preTmstp < effFromTmstp : "+preTmstp+" < "+effFromTmstp); * then previous date of Confirmation date will be saved*/
System.out.println("Previous date inside else>>>>>"+preTmstp); if(validUptoTmstp.after(effFromDt) || validUptoTmstp.before(effFromDt))
System.out.println("Effective from date(Database)>>>>>"+effFromTmstp); {
System.out.println("Inside Previous Date ");
// conn.rollback(); prevDate=this.getPreDate(currDate, 1);
System.out.println("Commited after previous"); System.out.println("Previous date>>>>>"+prevDate);
errString = itmDBAccessEJB.getErrorString("", "VTINVPREDT","", "", conn);
System.out.println("if(preTmstp.before(currDate)) Error String"+errString); sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
System.out.println("ErrorString inside if(preTmstp.before(effFromTmstp))"+errString); preTmstp = java.sql.Timestamp.valueOf(sdf.format(prevDate).toString() + " 00:00:00.0");
return errString; System.out.println("Previous date in Timestamp>>>>>"+preTmstp);
}
else
{
System.out.println("Previous date inside else>>>>>"+validUptoTmstp);
preTmstp = validUptoTmstp;
System.out.println("Previous date inside else>>>>>"+preTmstp);
}
//If validUptoTmstp(preTmstp) is less than Effective Date(Previous Record)
if(preTmstp.before(effFromTmstp))
{
/*System.out.println("if(preTmstp.before(effFromTmstp))");
System.out.println("preTmstp < effFromTmstp : "+preTmstp+" < "+effFromTmstp);
System.out.println("Previous date inside else>>>>>"+preTmstp);
System.out.println("Effective from date(Database)>>>>>"+effFromTmstp);
*/
// conn.rollback();
//System.out.println("Commited after previous");
errString = itmDBAccessEJB.getErrorString("", "VTINVPREDT","", "", conn);
/*System.out.println("if(preTmstp.before(currDate)) Error String"+errString);
System.out.println("ErrorString inside if(preTmstp.before(effFromTmstp))"+errString);*/
return errString;
}
//Updating previous saved to active_yn = 'N', valid_upto=preTmstp
// Modified by Anagha Rane 09JAN2019 start [to update primary fields columns]
//sql="update supplier_bank set active_yn = 'N', valid_upto= ? where trim(supp_code)=? and and trim(eff_from) = ? and trim(valid_upto)= ?";
sql="update supplier_bank set active_yn = 'N', valid_upto= ? where trim(supp_code)=? and bank_code__ben = ? and trim(eff_from) = ? and trim(valid_upto)= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setTimestamp(1, preTmstp);
pstmt.setString(2, suppCode);
pstmt.setString(3, bankCode);
// Modified by Anagha Rane 09JAN2019 end [to update primary fields columns]
pstmt.setTimestamp(4, effFromTmstp);
pstmt.setTimestamp(5, validUptoTmstp);
updateCount1 = pstmt.executeUpdate();
System.out.println("no of row update: " + updateCount1);
/*System.out.println("Valid Upto New (Previous Date)>>>>>" + preTmstp);
System.out.println("Supplier Code>>>>" + suppCode);
System.out.println("Effective Date in TimeStamp>>>>" + effFromTmstp);
System.out.println("Valid Upto Date in TimeStamp>>>>" + validUptoTmstp);
*/
pstmt.close();
pstmt = null;
} }
//Updating previous saved to active_yn = 'N', valid_upto=preTmstp
sql="update supplier_bank set active_yn = 'N', valid_upto= ? where trim(supp_code)=? and trim(eff_from) = ? and trim(valid_upto)= ?";
pstmt=conn.prepareStatement(sql);
pstmt.setTimestamp(1, preTmstp);
pstmt.setString(2, suppCode);
pstmt.setTimestamp(3, effFromTmstp);
pstmt.setTimestamp(4, validUptoTmstp);
updateCount1 = pstmt.executeUpdate();
System.out.println("no of row update: " + updateCount1);
System.out.println("Valid Upto New (Previous Date)>>>>>" + preTmstp);
System.out.println("Supplier Code>>>>" + suppCode);
System.out.println("Effective Date in TimeStamp>>>>" + effFromTmstp);
System.out.println("Valid Upto Date in TimeStamp>>>>" + validUptoTmstp);
pstmt.close();
pstmt = null;
} }
if (updateCount1 > 0) //if (updateCount1 > 0) // Modified by Anagha Rane 09JAN2019 end [to return confirm msg on update count]
if (updateCount1 > 0)
{ {
System.out.println(">>The selected transaction is confirmed"); System.out.println(">>The selected transaction is confirmed");
errString = itmDBAccessEJB.getErrorString("","VTCONSUCF","","",conn); errString = itmDBAccessEJB.getErrorString("","VTCONSUCF","","",conn);
return errString; return errString;
} }
}
} }
} System.out.println("Run Mode>>>>>>" + runMode);
System.out.println("Run Mode>>>>>>" + runMode); if (runMode != "I" && (errString == null || (errString.trim().length() == 0)))
if (runMode != "I" && (errString == null || (errString.trim().length() == 0)))
{
sql = "select edi_option from transetup where tran_window = 'w_supplier_bank' ";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if (rs.next())
{ {
ediOption = rs.getString("edi_option"); sql = "select edi_option from transetup where tran_window = 'w_supplier_bank' ";
System.out.println("Edi OPtion>>>>>>"+ediOption); pstmt = conn.prepareStatement(sql);
} rs = pstmt.executeQuery();
rs.close(); if (rs.next())
rs = null; {
pstmt.close(); ediOption = rs.getString("edi_option");
pstmt = null; System.out.println("Edi OPtion>>>>>>"+ediOption);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
ediOption = (ediOption) != null ? ediOption : "0"; ediOption = (ediOption) != null ? ediOption : "0";
ediOpt = Integer.parseInt(ediOption); ediOpt = Integer.parseInt(ediOption);
System.out.println("Edit Opt (Integer)>>>>>>>>>>" + ediOpt); System.out.println("Edit Opt (Integer)>>>>>>>>>>" + ediOpt);
if (ediOpt > 0) if (ediOpt > 0)
{ {
CreateRCPXML createRCPXML = new CreateRCPXML("w_supplier_bank", "tran_id"); CreateRCPXML createRCPXML = new CreateRCPXML("w_supplier_bank", "tran_id");
dataStr = createRCPXML.getTranXML(tranId, conn); dataStr = createRCPXML.getTranXML(tranId, conn);
System.out.println("dataStr =[ " + dataStr + "]"); System.out.println("dataStr =[ " + dataStr + "]");
Document ediDataDom = genericUtility.parseString(dataStr); Document ediDataDom = genericUtility.parseString(dataStr);
E12CreateBatchLoadEjb e12CreateBatchLoad = new E12CreateBatchLoadEjb(); E12CreateBatchLoadEjb e12CreateBatchLoad = new E12CreateBatchLoadEjb();
retString = e12CreateBatchLoad.createBatchLoad(ediDataDom,"w_supplier_bank", "" + ediOpt, xtraParams, conn); retString = e12CreateBatchLoad.createBatchLoad(ediDataDom,"w_supplier_bank", "" + ediOpt, xtraParams, conn);
createRCPXML = null; createRCPXML = null;
e12CreateBatchLoad = null; e12CreateBatchLoad = null;
if (retString != null && "SUCCESS".equals(retString)) if (retString != null && "SUCCESS".equals(retString))
{ {
System.out.println("retString = [" + retString + "]"); System.out.println("retString = [" + retString + "]");
}
} }
} }
} }
} }
}
catch (SQLException se) catch (SQLException se)
{ {
System.out.println("SQLException : class SupplierBankConf : "); System.out.println("SQLException : class SupplierBankConf : "+ se.getMessage());
se.printStackTrace(); se.printStackTrace();
try try
{ {
...@@ -355,10 +402,11 @@ conn = getConnection(); ...@@ -355,10 +402,11 @@ conn = getConnection();
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception : Occured during rollback........"); System.out.println("Exception : Occured during rollback........"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);//exception thrown by AnaghaRane 06/01/2020 throw new ITMException(e);//exception thrown by AnaghaRane 06/01/2020
} }
throw new ITMException(se);//
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -439,7 +487,7 @@ conn = getConnection(); ...@@ -439,7 +487,7 @@ conn = getConnection();
} }
return input; return input;
}// end of checkNull }// end of checkNull
private Date getPreDate(Date currDate, int noOfMonths) private Date getPreDate(Date currDate, int noOfMonths)
{ {
java.util.Date preDate=null; java.util.Date preDate=null;
...@@ -448,9 +496,9 @@ conn = getConnection(); ...@@ -448,9 +496,9 @@ conn = getConnection();
cal.add(Calendar.DAY_OF_MONTH , -1); cal.add(Calendar.DAY_OF_MONTH , -1);
preDate = cal.getTime(); preDate = cal.getTime();
System.out.println(">>>>Previous Date:"+ preDate); System.out.println(">>>>Previous Date:"+ preDate);
return preDate; return preDate;
} }
} }
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