Commit 9c1b4ce2 authored by msingh's avatar msingh

Changed by Manish on 14/03/16 for DDUK.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100417 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4e45af91
......@@ -49,7 +49,11 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
double getwayAmount = 0;
String projectCode = "";
//Changed By Samadhan on 15/07/2015 D15CKAT015 End
// Changed by Sneha on 12-03-2016, declaration of global variable [Start]
String rcpMode = "", segPayStatus = "", payPalStatus = "", cardType = "", despId = "";
// Changed by Sneha on 12-03-2016, declaration of global variable [End]
public String postSave()throws RemoteException,ITMException
{
return "";
......@@ -95,9 +99,9 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
double shipperSize = 0.0;
HashMap itmVolumeMap = null;
//Changes by Dadaso pawar on [24/02/15] (Confirmed dispatch) [Start]
String despSql = "",despId = "",loginSiteCode = "",itemSer = "",tranSer = "",currCode = "",finEntity = "",
segPayStatus = "",saleOrderL = "",rcpMode = "",custCode = "",refNo = "",siteCodeDesp = "",
bankCode = "",cardType = "",modName = "",invoicePrint = "",isDespConfEnable = "";
String despSql = "",loginSiteCode = "",itemSer = "",tranSer = "",currCode = "",finEntity = "",
saleOrderL = "",custCode = "",refNo = "",siteCodeDesp = "",
bankCode = "",modName = "",invoicePrint = "",isDespConfEnable = "";
double sorderTotAmt = 0;
ResultSet despRs = null;
......@@ -107,7 +111,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
ReceiptAdvConfLocal receiptAdvConfLocal = null;
//Changes by Dadaso pawar on [24/02/15] (Confirmed dispatch) [End]
//Changed By Samadhan on 15/07/2015 D15CKAT015
String payPalStatus="",ptcnPalletNo = "";
String ptcnPalletNo = "",tokenInfo = "";
try
{
DistCommon distCommonObj = new DistCommon();
......@@ -350,51 +354,79 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("custCode-itemSer-currCode-->["+custCode+"]["+itemSer+"]["+currCode+"]");
//Changed By Prgayna not release sage pay before testing .start
//Changed by manish to check token_info is present or not on 09/03/16 [start]
tokenInfo = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
System.out.println("TOKEN_INFO is ::::"+tokenInfo);
//Changed by manish to check token_info is present or not on 09/03/16 [end]
if("S".equalsIgnoreCase(rcpMode))
{
try
{
segPayStatus = authoriseSagePay(ptcn, conn);
segPayStatus = segPayStatus == null ? "" : segPayStatus.trim();
System.out.println("segPayStatus@@------->>["+segPayStatus+"]");
if(segPayStatus.indexOf("INVALID") > 0)
//segPayStatus = authoriseSagePay(ptcn, conn);
//Changed by manish to check token_info is present or not on 09/03/16 [start]
if(tokenInfo == null || tokenInfo.trim().length() == 0 )
{
System.out.println("Sage Payment not successfully done....................");
throw new Exception("Invalid Sage Payment.....["+segPayStatus+"]");
}
else if(segPayStatus.indexOf("OK") > 0)
{
isReceiptGen = true ;
modName = "W_SAGEPAY"; //Changed by wasim
//Changed by samadhan on 08/07/2015 D15CKAT015 Start
//invoiceDetailsMap.put("chq_amt",sagePayAmount);
invoiceDetailsMap.put("chq_amt",getwayAmount);
//Changed by samadhan on 08/07/2015 D15CKAT015 End
errString = insertSagePayDetailsinDespatch(despId,segPayStatus,cardType,conn); //need to check (working or not)
System.out.println("After insertSagePayDetailsinDespatch--->>["+errString+"]");
//Changed by wasim on 08-07-2015 to get TOKEN_INFO [START]
//String specReason = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", despId, currCode); //Commented by Dadaso pawar on 20/08/15
String specReason = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
String vps = "";
if(specReason != null && specReason.length() > 0)
segPayStatus = authoriseSagePay(ptcn, conn);
segPayStatus = segPayStatus == null ? "" : segPayStatus.trim();
System.out.println("segPayStatus@@------->>["+segPayStatus+"]");
if(segPayStatus.indexOf("INVALID") > 0)
{
Document dom1 = genericUtility.parseString(specReason);
vps= genericUtility.getColumnValue("VPSTXID", dom1);
vps = vps.replace('{', ' ');
vps = vps.replace('}', ' ');
vps = vps == null ? "" : vps.trim();
isError = true;
System.out.println("Sage Payment not successfully done....................");
throw new Exception("Invalid Sage Payment.....["+segPayStatus+"]");
}
System.out.println("After insertSagePayDetailsinDespatch--->>["+errString+"]");
refNo = vps;
//refNo = saleOrderL; //need to discuss surendra--> (sale order no)
//Changed by wasim on 08-07-2015 to get TOKEN_INFO [END]
}
else
{
throw new Exception("Invalid Sage Payment.....["+segPayStatus+"]");
else if(segPayStatus.indexOf("OK") > 0)
{
isReceiptGen = true ;
modName = "W_SAGEPAY"; //Changed by wasim
//Changed by samadhan on 08/07/2015 D15CKAT015 Start
//invoiceDetailsMap.put("chq_amt",sagePayAmount);
invoiceDetailsMap.put("chq_amt",getwayAmount);
//Changed by samadhan on 08/07/2015 D15CKAT015 End
// changed by Sneha on 12-03-2016, [Start]
//errString = insertSagePayDetailsinDespatch(despId,segPayStatus,cardType); //need to check (working or not)
errString = insertSagePayDetailsinDespatch(despId, segPayStatus, cardType, conn, false);
// changed by Sneha on 12-03-2016, [End]
System.out.println("After insertSagePayDetailsinDespatch--->>["+errString+"]");
//Changed by wasim on 08-07-2015 to get TOKEN_INFO [START]
//String specReason = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", despId, currCode); //Commented by Dadaso pawar on 20/08/15
tokenInfo = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
/*String vps = "";
if(specReason != null && specReason.length() > 0)
{
Document dom1 = genericUtility.parseString(specReason);
vps= genericUtility.getColumnValue("VPSTXID", dom1);
vps = vps.replace('{', ' ');
vps = vps.replace('}', ' ');
vps = vps == null ? "" : vps.trim();
}
System.out.println("After insertSagePayDetailsinDespatch--->>["+errString+"]");
refNo = vps;*/
//refNo = saleOrderL; //need to discuss surendra--> (sale order no)
//Changed by wasim on 08-07-2015 to get TOKEN_INFO [END]
}
else
{
throw new Exception("Invalid Sage Payment.....["+segPayStatus+"]");
}
} //Changed by manish to check token_info is present or not on 09/03/16 [end]
String vps = "";
if(tokenInfo != null && tokenInfo.length() > 0)
{
Document dom1 = genericUtility.parseString(tokenInfo);
vps= genericUtility.getColumnValue("VPSTXID", dom1);
vps = vps.replace('{', ' ');
vps = vps.replace('}', ' ');
vps = vps == null ? "" : vps.trim();
}
System.out.println("After insertSagePayDetailsinDespatch--->>["+errString+"]");
refNo = vps;
}
catch(Exception e)
{
......@@ -421,39 +453,48 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("RCP MODE is PayPal.................");
try
{
payPalStatus = authorizePayPal(ptcn, conn);
payPalStatus = payPalStatus == null ? "" : payPalStatus.trim();
System.out.println("payPalStatus@@------->>["+payPalStatus+"]");
if(payPalStatus.indexOf("Error") > 0)
//payPalStatus = authorizePayPal(ptcn, conn);
//Changed by manish to check token_info is present or not on 09/03/16 [start]
if(tokenInfo == null || tokenInfo.trim().length() == 0)
{
System.out.println("payPal Payment not successfully done....................");
throw new Exception("Invalid payPal Payment.....["+payPalStatus+"]");
}
else if(payPalStatus.indexOf("Success") > 0)
{
isReceiptGen = true ;
System.out.println("refNo@@ :["+refNo+"]");
invoiceDetailsMap.put("chq_amt",getwayAmount);
errString = insertPayPalDetailsinDespatch(despId,payPalStatus,cardType,conn); //need to check (working or not)
System.out.println("After insertPayPalDetailsinDespatch--->>["+errString+"]");
//TRANSACTIONID
String tokenInfoPayPal = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
String vps = "";
if(tokenInfoPayPal != null && tokenInfoPayPal.length() > 0)
payPalStatus = authorizePayPal(ptcn, conn);
payPalStatus = payPalStatus == null ? "" : payPalStatus.trim();
System.out.println("payPalStatus@@------->>["+payPalStatus+"]");
if(payPalStatus.indexOf("Error") > 0)
{
Document dom1 = genericUtility.parseString(tokenInfoPayPal);
vps= genericUtility.getColumnValue("TRANSACTIONID", dom1);
System.out.println("payPal Payment not successfully done....................");
throw new Exception("Invalid payPal Payment.....["+payPalStatus+"]");
}
System.out.println("After insertPayPalDetailsinDespatch--->>["+errString+"]");
refNo = vps;
}
else
{
throw new Exception("Invalid PayPal Payment.....["+payPalStatus+"]");
}
else if(payPalStatus.indexOf("Success") > 0)
{
isReceiptGen = true ;
System.out.println("refNo@@ :["+refNo+"]");
invoiceDetailsMap.put("chq_amt",getwayAmount);
// changed by Sneha on 12-03-2016, [Start]
//errString = insertPayPalDetailsinDespatch(despId, payPalStatus, cardType, ); //need to check (working or not)
errString = insertPayPalDetailsinDespatch(despId, payPalStatus, cardType, conn, false);
// changed by Sneha on 12-03-2016, [End]
System.out.println("After insertPayPalDetailsinDespatch--->>["+errString+"]");
//TRANSACTIONID
String tokenInfoPayPal = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
String vps = "";
if(tokenInfoPayPal != null && tokenInfoPayPal.length() > 0)
{
Document dom1 = genericUtility.parseString(tokenInfoPayPal);
vps= genericUtility.getColumnValue("TRANSACTIONID", dom1);
}
System.out.println("After insertPayPalDetailsinDespatch--->>["+errString+"]");
refNo = vps;
}
else
{
throw new Exception("Invalid PayPal Payment.....["+payPalStatus+"]");
}
} //Changed by manish to check token_info is present or not on 09/03/16 [end]
}
catch(Exception e)
{
......@@ -659,7 +700,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
}
//Changed by Manish on 09/03/16 for retrying when got axis fault error [end]
System.out.println("------Commited all transaction before despatch confirmed.......");
// errString = confirmDespatch("despatch", despId, xtraParams, "", conn);
// errString = confirmDespatch("despatch", despId, xtraParams, "", conn);
System.out.println("errString After Despatch Confirmed------>>["+errString+"]");
if(errString != null && errString.indexOf("VTSUCC1") > 0)
......@@ -1019,6 +1060,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("commmit");
conn.commit();
}*/
if ( isError )
{
System.out.println("rollback");
......@@ -1044,6 +1086,26 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
pstmtUpd.close();
pstmtUpd = null;
}
// Changed by Sneha on 12-03-2016, calling SagePay and PayPal method in finally [Start]
if(isError)
{
System.out.println(" ------------- Calling SagePay and PayPal method in finally ------------ ");
System.out.println("rcpMode =============>> " + rcpMode);
if("S".equalsIgnoreCase(rcpMode))
{
System.out.println(" ------------- Calling SagePay method in finally ------------ ");
errString = insertSagePayDetailsinDespatch(despId, segPayStatus, cardType, null, true);
System.out.println(" errString from SagePay method ==========>>" + errString);
}
if("P".equalsIgnoreCase(rcpMode))
{
System.out.println(" ------------- Calling PayPal method in finally ------------ ");
errString = insertPayPalDetailsinDespatch(despId, payPalStatus, cardType, null, true);
System.out.println(" errString from PayPal method ==========>>" + errString);
}
}
// Changed by Sneha on 12-03-2016, calling SagePay and PayPal method in finally [End]
}
catch(Exception e)
{
......@@ -1283,16 +1345,32 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
}
return count;
}
private String insertSagePayDetailsinDespatch(String despId,String sagePayStr,String cardType, Connection conn) throws Exception ,ITMException
// Changed by Sneha on 12-03-2016, [Start]
//private String insertSagePayDetailsinDespatch(String despId,String sagePayStr,String cardType) throws Exception ,ITMException
private String insertSagePayDetailsinDespatch(String despId,String sagePayStr,String cardType, Connection conn, boolean isCommit) throws Exception ,ITMException
// Changed by Sneha on 12-03-2016, [End]
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",retString = "";
int rowCnt = 0;
System.out.println("insertSagePayDetailsinDespatch---->>["+sagePayStr+"");
StringBuffer sagePayInfo = new StringBuffer();
HashMap <String,String> sagePayDetailMap = new HashMap <String,String>();
//Connection conn = null;
ConnDriver connDriver = null;
try
{
// Changed by Sneha on 12-03-2016, [Start]
if(isCommit)
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
}
// Changed by Sneha on 12-03-2016, [End]
//
sagePayInfo.append("<ROOT>");
if(sagePayStr != null && sagePayStr.length() > 0)
{
......@@ -1351,27 +1429,64 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("sagePayInfo : "+sagePayInfo.toString());
if(sagePayInfo != null && sagePayInfo.length() > 0)
{
sql = "UPDATE DESPATCH SET TOKEN_INFO = ? WHERE DESP_ID = ?";
//
boolean lockSuccess = false;
sql = " SELECT TOKEN_INFO FROM DESPATCH WHERE DESP_ID = ? FOR UPDATE NOWAIT";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sagePayInfo.toString());
pstmt.setString(2, despId);
rowCnt = pstmt.executeUpdate();
System.out.println("DESPATCH rowCnt: "+rowCnt);
pstmt.setString(1, despId);
rs = pstmt.executeQuery();
if(rs.next())
{
lockSuccess = true;
System.out.println("TOKEN_INFO ["+rs.getString(1)+"]");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rowCnt > 0)
//
if(lockSuccess)
{
retString = "Success";
System.out.println("Sage Pay details updated successfully.............");
sql = "UPDATE DESPATCH SET TOKEN_INFO = ? WHERE DESP_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sagePayInfo.toString());
pstmt.setString(2, despId);
rowCnt = pstmt.executeUpdate();
System.out.println("DESPATCH rowCnt: "+rowCnt);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Changed by Sneha on 12-03-2016, need to commit/rollback if isCommit is true [Start]
if(isCommit)
{
if(rowCnt > 0)
{
conn.commit();
retString = "Success";
System.out.println("Sage Pay details updated successfully.............");
}
else
{
conn.rollback();
retString = "Error";
}
}
// Changed by Sneha on 12-03-2016, need to commit/rollback if isCommit is true [End]
}
else
{
retString = "Error";
System.out.println("Despatch Table is locked");
}
}
}
......@@ -1380,7 +1495,28 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(isCommit)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
}
return retString;
}
private int insertReceiptDtl(HashMap insertMap,String invoiceID,Connection conn)throws ITMException
......@@ -2667,17 +2803,29 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
return responseStr;
}
private String insertPayPalDetailsinDespatch(String despId,String payPalStr,String cardType, Connection conn) throws Exception ,ITMException
private String insertPayPalDetailsinDespatch(String despId,String payPalStr,String cardType, Connection conn, boolean isCommit) throws Exception ,ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",retString = "";
int rowCnt = 0;
System.out.println("insertPayPalDetailsinDespatch---->>["+payPalStr+"");
StringBuffer payPalInfo = new StringBuffer();
HashMap <String,String> payPalDetailMap = new HashMap <String,String>();
//Connection conn = null;
ConnDriver connDriver = null;
try
{
// Changed by Sneha on 12-03-2016, [Start]
if(isCommit)
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
}
// Changed by Sneha on 12-03-2016, [End]
payPalInfo.append("<ROOT>");
if(payPalStr != null && payPalStr.length() > 0)
{
......@@ -2697,27 +2845,65 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("PayPalInfo : "+payPalInfo.toString());
if(payPalInfo != null && payPalInfo.length() > 0)
{
sql = "UPDATE DESPATCH SET TOKEN_INFO = ? WHERE DESP_ID = ?";
//
boolean lockSuccess = false;
sql = " SELECT TOKEN_INFO FROM DESPATCH WHERE DESP_ID = ? FOR UPDATE NOWAIT";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, payPalInfo.toString());
pstmt.setString(2, despId);
rowCnt = pstmt.executeUpdate();
System.out.println("DESPATCH rowCnt: "+rowCnt);
pstmt.setString(1, despId);
rs = pstmt.executeQuery();
if(rs.next())
{
lockSuccess = true;
System.out.println("TOKEN_INFO ["+rs.getString(1)+"]");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rowCnt > 0)
//
if(lockSuccess)
{
retString = "Success";
System.out.println("PayPal details updated successfully.............");
sql = "UPDATE DESPATCH SET TOKEN_INFO = ? WHERE DESP_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, payPalInfo.toString());
pstmt.setString(2, despId);
rowCnt = pstmt.executeUpdate();
System.out.println("DESPATCH rowCnt: "+rowCnt);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Changed by Sneha on 12-03-2016, need to commit/rollback if isCommit is true [Start]
if(isCommit)
{
if(rowCnt > 0)
{
conn.commit();
retString = "Success";
System.out.println("paypal details updated successfully.............");
}
else
{
conn.rollback();
retString = "Error";
System.out.println("paypal details rollback .............");
}
}
// Changed by Sneha on 12-03-2016, need to commit/rollback if isCommit is true [End]
}
else
{
retString = "Error";
System.out.println("Despatch table is locked");
}
}
}
......@@ -2726,7 +2912,24 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
return retString;
}
//Changed by samadhan on 15/07/2015 D15CKAT015 for paypal End
......
......@@ -153,7 +153,7 @@ public class PickIssIC extends ValidatorEJB implements PickIssICLocal, PickIssIC
java.util.Date tranDate = null;
String prdCode = "";
//Chnaged by Rohan on 29-10-12 to define variable.end
int count = 0, cnt = 0;
int count = 0, cnt = 0, waveCnt = 0;
int rowCount = 0;
int noOfChilds = 0;
int noOfParent = 0;
......@@ -850,7 +850,27 @@ public class PickIssIC extends ValidatorEJB implements PickIssICLocal, PickIssIC
ptcn = checkNull(genericUtility.getColumnValue( "ptcn", currFormDataDom ));
pickOrder = checkNull(genericUtility.getColumnValue( "pick_order", currFormDataDom ));
//Changed by MANISH on 14/03/16 [Start]
sql = " SELECT COUNT(*) FROM WAVE_TASK_DET WHERE WAVE_STATUS = 'C' AND REF_ID =? AND PTCN = ?";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, pickOrder );
pstmt.setString( 2, ptcn );
rs = pstmt.executeQuery();
if( rs.next() )
{
waveCnt = rs.getInt(1);
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if(waveCnt == 0)
{
errList.add( "INVPKPTCN" );
errFields.add( childNodeName.toLowerCase() );
}
//Changed by MANISH on 14/03/16 [END]
//Changed by Dadaso pawar on 13/05/15 [Start]
//If sale order on hold then show error message.
sql = "SELECT SALE_ORDER FROM WAVE_TASK_DET WHERE PTCN = ? AND REF_ID = ?";
......@@ -910,7 +930,8 @@ public class PickIssIC extends ValidatorEJB implements PickIssICLocal, PickIssIC
pstmt.close(); pstmt = null;
//Changed by sumit on 04/04/13 adding validation , user can asign same pallet_no to other pick of same ptcn start.
sql = "SELECT DISTINCT PTCN FROM WAVE_TASK_DET WHERE REF_ID IN (SELECT DISTINCT PICK_ORDER FROM PICK_ISS_HDR WHERE PTCN = ?)";
// sql = "SELECT DISTINCT PTCN FROM WAVE_TASK_DET WHERE REF_ID IN (SELECT DISTINCT PICK_ORDER FROM PICK_ISS_HDR WHERE PTCN = ?)";
sql = "SELECT DISTINCT PTCN FROM PICK_ISS_HDR WHERE PICK_ORDER IN (SELECT DISTINCT REF_ID FROM WAVE_TASK_DET WHERE PTCN = ?)"; //Changed by MANISH on 14/03/16 [Start]
pstmt = conn.prepareStatement( sql );
pstmt.setString(1, ptcn);
rs = pstmt.executeQuery();
......
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