Commit ee5dce63 authored by msingh's avatar msingh

Changed by Manish on 21/04/16


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@101348 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d93ac192
......@@ -2,10 +2,10 @@ package ibase.webitm.ejb.wms;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.reports.utility.XSDParser;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import java.io.File;
......@@ -93,7 +93,8 @@ public class ConsolidatToDoc {
Timestamp mfgDate = null, expDate = null, retestDate = null;
DistCommon disCommon = new DistCommon();
ConnDriver connDriver = null;
Connection tempConn = null; //Added by Manish on 19/04/16
try
{
System.out.println("*********inside try block** CONSOLIDATE TO DOCK *****");
......@@ -1069,13 +1070,19 @@ public class ConsolidatToDoc {
//Changed by Dhanraj on 19-SEP-14 for update despatch tare and filler weight [W14FSUN003]
System.out.println("PTCN ======For updatedespatch method====>> "+ptcn);
errString = updatedespatch(ptcn, conn);
//Changed by Manish on 19/04/16 [start]
connDriver = new ConnDriver();
tempConn = connDriver.getConnectDB("DriverITM");
connDriver = null;
errString = updatedespatch(ptcn, tempConn);
//Changed by Manish on 19/04/16 [end]
//Changed by Dharnaj on 19-SEP-14 for [W14FSUN003]
//sqlHdr = "update despatch set gross_weight = ?, tare_weight = ? ,nett_weight = ?, no_art = ? where desp_id = ? "; //added by Kunal on 08/09/12 as per S Manoharan Sir instruction
sqlHdr = "update despatch set gross_weight = ?, tare_weight = tare_weight + ? ,nett_weight = ?, no_art = ? where desp_id = ? "; //added by Kunal on 08/09/12 as per S Manoharan Sir instruction
pstmtHdr = conn.prepareStatement(sqlHdr);
sqlHdr = "update despatch set gross_weight = ?, tare_weight = tare_weight + ? ,nett_weight = ?, no_art = ? where desp_id = ? "; //added by Kunal on 08/09/12 as per S Manoharan Sir instruction
// pstmtHdr = conn.prepareStatement(sqlHdr);
pstmtHdr = tempConn.prepareStatement(sqlHdr);
pstmtHdr.setDouble(1, totalGrossWeight);
pstmtHdr.setDouble(2, totalTareWeight);
pstmtHdr.setDouble(3, totalNetWeight);
......@@ -1083,9 +1090,18 @@ public class ConsolidatToDoc {
pstmtHdr.setString(5, despId);
int upctr = pstmtHdr.executeUpdate();
System.out.println("NO OF ROW UPDATED = "+upctr);
if(upctr>0)
{
tempConn.commit();
}
else
{
tempConn.rollback();
}
pstmtHdr.close();
pstmtHdr = null;
tempConn.close();
tempConn = null;
System.out.println("***************START***********************");
//Changed by Rohan on 10-06-12 to get reports for hazardous material.start
......@@ -1155,7 +1171,34 @@ public class ConsolidatToDoc {
tempList1 = (ArrayList)dataMap.get(keyList);
pstmt2 = conn.prepareStatement(sql2);
//Changed by Manish on 19/04/16 [start]
sqlTran = "SELECT TRANS_MODE FROM DESPATCH WHERE DESP_ID IN(SELECT REF_ID FROM WAVE_TASK_DET "
+" WHERE WAVE_ID = ? AND REF_SER = ? AND PTCN = ? )";
pstmtitem = conn.prepareStatement(sqlTran);
pstmtitem.setString(1,waveId);
pstmtitem.setString(2,"S-DSP");
pstmtitem.setString(3,ptcn);
rsitem = pstmtitem.executeQuery();
if(rsitem.next())
{
tranMode = rsitem.getString("TRANS_MODE") == null?"":rsitem.getString("TRANS_MODE");
System.out.println("tranMode*****"+tranMode);
}
if(pstmtitem != null)
{
pstmtitem.close();
pstmtitem = null;
}
if(rsitem != null)
{
rsitem.close();
rsitem = null;
}
//Changed by Manish on 19/04/16 [end]
int orderLen = tempList1.size();
if ( orderLen > 0 )
{
......@@ -1197,7 +1240,7 @@ public class ConsolidatToDoc {
}
//to check item is hazarous.end
//to check transporter mode.start
sqlTran = "SELECT TRANS_MODE FROM DESPATCH WHERE DESP_ID IN(SELECT REF_ID FROM WAVE_TASK_DET "
/*sqlTran = "SELECT TRANS_MODE FROM DESPATCH WHERE DESP_ID IN(SELECT REF_ID FROM WAVE_TASK_DET "
+" WHERE WAVE_ID = ? AND REF_SER = ? AND PTCN = ? )";
pstmtitem = conn.prepareStatement(sqlTran);
......@@ -1221,7 +1264,7 @@ public class ConsolidatToDoc {
{
rsitem.close();
rsitem = null;
}
}*/
//to check transporter mode.end
if("Y".equalsIgnoreCase(hazMaterial) && "A".equalsIgnoreCase(tranMode))
{
......@@ -1837,6 +1880,7 @@ public class ConsolidatToDoc {
String outputFilename = "";
TreeMap argMap = null;
DistCommon discommon = new DistCommon();
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
......
......@@ -10,11 +10,12 @@ import ibase.webitm.ejb.*;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.dis.InvAllocTraceBean;
import ibase.webitm.ejb.dis.StockUpdate;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import java.io.*;
import java.rmi.RemoteException;
......@@ -56,6 +57,7 @@ public class DockTranConf extends ValidatorEJB implements DockTranConfLocal,Dock
java.sql.Timestamp expDate = null,mfgDate = null,restestDate = null;
Document dom = null;
E12GenericUtility genericUtility = new E12GenericUtility();
java.util.Date currDate1 = new java.util.Date();
......@@ -399,8 +401,10 @@ public class DockTranConf extends ValidatorEJB implements DockTranConfLocal,Dock
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(quantity));
strAllocate.put("chg_user",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
/*strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));*/
strAllocate.put("chg_user",new E12GenericUtility().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",new E12GenericUtility().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","w_pick_iss");
//}
......@@ -824,6 +828,13 @@ public class DockTranConf extends ValidatorEJB implements DockTranConfLocal,Dock
pstmtUpd.setString(2, pickisstranId);
pstmtUpd.setInt(3, lineNo);
updCnt = pstmtUpd.executeUpdate();
//Changes by Manish on 21/04/16 [start]
if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
//Changes by Manish on 21/04/16 [end]
}
if(rs != null)
{
......
......@@ -16,13 +16,13 @@ import ibase.webitm.ejb.dis.StockUpdate;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.ejb.fin.adv.ReceiptAdvConfLocal;
import ibase.webitm.reports.utility.XSDParser;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.TransIDGenerator;
import ibase.webitm.utility.wms.CommonWmsUtil;
import ibase.webitm.utility.wms.SagePayParameters;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import java.io.*;
import java.net.InetAddress;
......@@ -65,7 +65,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
{
System.out.println( "Calling DockTranPos.........................................." );
String forcedFlag = "false" ;
String forcedFlag = "false" ,tranIdRcp = "";
String errString = "";
String sql = "";
String pickOrder = "";
......@@ -110,7 +110,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
PreparedStatement despPstmt = null;
HashMap invoiceDetailsMap = new HashMap();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ReceiptAdvConfLocal receiptAdvConfLocal = null;
//ReceiptAdvConfLocal receiptAdvConfLocal = null;
//Changes by Dadaso pawar on [24/02/15] (Confirmed dispatch) [End]
//Changed By Samadhan on 15/07/2015 D15CKAT015
String ptcnPalletNo = "",tokenInfo = "";
......@@ -122,7 +122,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
// Changed by Sneha on 16-03-2016, [Start]
int receiptCount = 0;
// Changed by Sneha on 16-03-2016, [End]
//Added by Manish on 04/04/2016
DespatchConfirmLocal despatchConfirmLocal = null;
try
......@@ -293,7 +293,15 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
InitialContext ctx = new InitialContext(p);
DockTranConfLocal docktranConfLocal = null;
docktranConfLocal = (DockTranConfLocal)ctx.lookup("ibase/DockTranConf/local");
long startTime = System.currentTimeMillis();
System.out.println("START TIME ON DOCK_TRAN CONFIRM IN SECONDS:::["+startTime/1000+"]");
errString = docktranConfLocal.confirm(domString,docktranID,editFlag,xtraParams,conn );
long endTime = System.currentTimeMillis();
System.out.println("END TIME ON DOCK_TRAN CONFIRM IN SECONDS:::["+endTime/1000+"]");
System.out.println("DIFFERANCE IN TIME ON DOCK_TRAN CONFIRM IN SECONDS:::["+(endTime-startTime)/1000+"]for tran_id["+docktranID+"]");
System.out.println(" ************ errString@@@ ******** ["+errString+"]");
if(errString == null || errString.trim().length() == 0 )
......@@ -369,6 +377,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//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);
tranIdRcp = getColumnDescr(conn, "TRAN_ID__RCP", "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]
......@@ -389,8 +398,16 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//Changed by manish to check token_info is present or not on 09/03/16 [start]
//if(tokenInfo == null || tokenInfo.trim().length() == 0 ||( tokenInfo != null && tokenInfo.indexOf("OK") < -1) )
if(tokenInfo == null || tokenInfo.trim().length() == 0 || ( tokenInfo != null && tokenInfo.indexOf("OK") == -1) )
{
{
long startTime5 = System.currentTimeMillis();
System.out.println("START TIME ON SEGPAY AUTHORIZATION CONFIRM IN SECONDS:::["+startTime5/1000+"]");
segPayStatus = authoriseSagePay(ptcn, conn);
long endTime5 = System.currentTimeMillis();
System.out.println("END TIME ON SEGPAY AUTHORIZATION IN SECONDS:::["+endTime5/1000+"]");
System.out.println("DIFFERANCE IN TIME ON SEGPAY AUTHORIZATION IN SECONDS:::["+(endTime5-startTime5)/1000+"]for desp_id["+despId+"]");
segPayStatus = segPayStatus == null ? "" : segPayStatus.trim();
System.out.println("segPayStatus@@------->>["+segPayStatus+"]");
......@@ -412,14 +429,24 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
// 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);
// 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);
// tokenInfo = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
// Changed by Manish on 15-04-2016 to getting token info [Start]
tokenInfo = getSagePayTokenInfo(segPayStatus);
// Changed by Manish on 15-04-2016 to getting token info, [end]
updateDespatch(despId,tokenInfo, tranIdRcp, null);
/*String vps = "";
if(specReason != null && specReason.length() > 0)
{
......@@ -449,6 +476,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("OK") > 0 && receiptCount <= 0)
// Changed by Sneha on 16-03-2016, calling isReceiptGeneration method [End]
{
System.out.println("inside if block when token info is correct for sagepay");
isReceiptGen = true ;
Document dom1 = genericUtility.parseString(tokenInfo);
vps= genericUtility.getColumnValue("VPSTXID", dom1);
......@@ -515,13 +543,23 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
// 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);
//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);
tokenInfo = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
// tokenInfo = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
// Changed by Manish on 15-04-2016 to getting token info, [Start]
tokenInfo = getPayPalTokenInfo(payPalStatus);
// Changed by Manish on 15-04-2016 to getting token info, [end]
updateDespatch(despId,tokenInfo, tranIdRcp, null);
/*String vps = "";
if(tokenInfoPayPal != null && tokenInfoPayPal.length() > 0)
{
......@@ -543,6 +581,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("Success") > 0 && receiptCount <= 0)
// Changed by Sneha on 16-03-2016, calling isReceiptGeneration method [End]
{
System.out.println("inside if block when token info is correct for Paypal");
isReceiptGen = true ;
Document dom1 = genericUtility.parseString(tokenInfo);
vps= genericUtility.getColumnValue("TRANSACTIONID", dom1);
......@@ -680,42 +719,97 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("invoiceDetailsMap from custDetail------>>"+invoiceDetailsMap);
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
String trDate = sdf1.format(currDate).toString();
tranId = generateTranTd("w_receipt_adv",trDate,siteCode,conn);
System.out.println("TranId :::::::::::::::::; "+tranId);
invoiceDetailsMap.put("tran_id",tranId);
System.out.println("invoiceDetailsMap from invoicedetails------>>"+invoiceDetailsMap);
// tranId = generateTranTd("w_receipt_adv",trDate,siteCode,conn);
//Changed by Manish on 14/04/16 for taken TRAN_ID__RCP from despatch and retry for tran id[start]
//tranIdRcp = getColumnDescr(conn, "TRAN_ID__RCP", "DESPATCH", "DESP_ID", despId);
int count = insertReceiptHdr(invoiceDetailsMap, conn);
System.out.println("count from insertReceiptHdr------->>["+count+"]");
if(count == 0)
String termId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "termId" );
System.out.println("Tran Id before for Receipt is :::["+tranIdRcp+"]termId:::["+termId+"]");
if(tranIdRcp == null || tranIdRcp.trim().length() == 0)
{
conn.rollback();
isError = true;
errString= itmDBAccessEJB.getErrorString("","VTRCPGN0","","",conn);
return errString;
}
else
{
ctx = new InitialContext(appConnect.getProperty());
receiptAdvConfLocal = (ReceiptAdvConfLocal)ctx.lookup("ibase/ReceiptAdvConf/local");
errString = receiptAdvConfLocal.confirm(tranId, xtraParams, "",conn);
System.out.println("errString After confirmed------>>["+errString+"]");
if(errString.indexOf("VTCICONF3") > -1)
/*for (int callCount = 0; callCount <= 5; callCount++)
{
//conn.commit();
System.out.println("Advanced receipt generated or confirmed successfully..................");
}
try
{
tranIdRcp = generateTranTd("w_receipt_adv",trDate,siteCode,conn);
}
catch (Exception e)
{
System.out.println("getClass() is ---["+e.getClass()+"]");
System.out.println("getMessage is :::::["+e.getMessage()+"]");
System.out.println("Error in generate tran id callCount["+callCount+"]termId===["+termId+"]");
continue;
}
if(tranIdRcp != null && tranIdRcp.trim().length() > 0)
{
break;
}
}*/
//Changed by Manish on 14/04/16 for taken TRAN_ID__RCP from despatch and retry for tran id[start]
/*if(tranIdRcp != null && tranIdRcp.trim().length() > 0)
{*/
//invoiceDetailsMap.put("tran_id",tranIdRcp);
System.out.println("invoiceDetailsMap from invoicedetails------>>"+invoiceDetailsMap);
invoiceDetailsMap.put("errString","");
long startTime3 = System.currentTimeMillis();
System.out.println("START TIME ON RECEIPT GENERATION IN SECONDS:::["+startTime3/1000+"]for tran_id["+tranIdRcp+"]");
invoiceDetailsMap = insertReceiptHdr(invoiceDetailsMap, trDate, xtraParams);
long endTime3 = System.currentTimeMillis();
System.out.println("END TIME ON RECEIPT GENERATION IN SECONDS:::["+endTime3/1000+"]");
System.out.println("DIFFERANCE IN TIME ON RECEIPT GENERATION IN SECONDS:::["+(endTime3-startTime3)/1000+"]for tran_id["+tranIdRcp+"]");
System.out.println("After invoiceDetailsMap from invoicedetails------>>"+invoiceDetailsMap);
tranIdRcp = (String) invoiceDetailsMap.get("tran_id");
errString = (String) invoiceDetailsMap.get("errString");
if(tranIdRcp == null || tranIdRcp.trim().length() == 0 || errString.trim().length() > 0)
{
conn.rollback();
isError = true;
errString= itmDBAccessEJB.getErrorString("","VTRCPGN0","","",conn);
return errString;
}
else
{
updateDespatch(despId,tokenInfo, tranIdRcp, null);
}
/*else
{
ctx = new InitialContext(appConnect.getProperty());
receiptAdvConfLocal = (ReceiptAdvConfLocal)ctx.lookup("ibase/ReceiptAdvConf/local");
errString = receiptAdvConfLocal.confirm(tranIdRcp, xtraParams, "",conn);
System.out.println("errString After confirmed------>>["+errString+"]===termId["+termId+"]");
if(errString.indexOf("VTCICONF3") > -1)
{
//conn.commit();
//invoiceDetailsMap.put("tran_id",tranIdRcp);
System.out.println("Advanced receipt generated or confirmed successfully..................");
}
else
{
conn.rollback();
isError = true;
return errString;
}
} */
/*}
else
{
conn.rollback();
isError = true;
errString= itmDBAccessEJB.getErrorString("","VTIARO","","",conn);
return errString;
}
}
}*/
}
}//End receipt Generation
......@@ -753,9 +847,9 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//Changed by samadhan on 01/06/2015 for status tracking update in magento system.end
//conn.commit();
//Added by Santosh on 01-04-2016 for Exchange rate [Start]
sql = " SELECT FIN_ENTITY FROM SITE WHERE SITE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
......@@ -769,7 +863,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
rs = null;
pstmt.close();
pstmt = null;
sql = " SELECT CURR_CODE FROM FINENT WHERE FIN_ENTITY = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,finEntity1);
......@@ -805,24 +899,40 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("Exch Rate from FinnCommon="+exchRate);
if(exchRate != null && exchRate.equals(""))
{
System.out.println("exchn rate ..............");
exchRate = getColumnDescr(conn, "std_exrt", "currency", "curr_code", currCode);
}
}
Connection tempConn = null;
ConnDriver connDriver = null;
connDriver = new ConnDriver();
tempConn = connDriver.getConnectDB("DriverITM");
connDriver = null;
System.out.println("next to update exchrate=======");
sql = " UPDATE DESPATCH SET EXCH_RATE = " + exchRate + ", EXCH_RATE__FRT = " + exchRate + ", EXCH_RATE__INS = " + exchRate + " WHERE DESP_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt = tempConn.prepareStatement(sql);
pstmt.setString(1,despId);
updCnt = pstmt.executeUpdate();
if(updCnt > 0)
{
tempConn.commit();
System.out.println("Despatch Header Updated successfully with exchage rate [ "+exchRate +"]");
}
}
else
{
tempConn.rollback();
}
pstmt.close();
pstmt = null;
tempConn.close();
tempConn = null;
//conn.commit();
//Added by Santosh on 01-04-2016 for Exchange rate [End]
//Changed By Manish To check the desp conf flag 08/03/16.start
......@@ -856,18 +966,26 @@ 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);
//Changed By Manish to call confirm method for despatch confirm 08/04/16.start
System.out.println(" ========calling despatch confirm ========");
long startTime2 = System.currentTimeMillis();
System.out.println("START TIME ON DESPATCH CONFIRM IN SECONDS:::["+startTime2/1000+"]");
errString = despatchConfirmLocal.confirm( despId, xtraParams, "", conn);
long endTime2 = System.currentTimeMillis();
System.out.println("END TIME ON DESPATCH CONFIRM IN SECONDS:::["+endTime2/1000+"]");
System.out.println("DIFFERANCE IN TIME ON DESPATCH CONFIRM IN SECONDS:::["+(endTime2-startTime2)/1000+"] for desp_id ["+despId+"]");
System.out.println("errString After Despatch Confirmed------>>["+errString+"]");
//Changed By Manish to call confirm method for despatch confirm 08/04/16.end
//Added by santosh on 05-04-2016 [Start]
String invoiceId = "";
sql = "SELECT INVOICE_ID FROM INVOICE WHERE DESP_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, despId);
rs = pstmt.executeQuery();
......@@ -887,70 +1005,80 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
rs = null;
}
//Added by santosh on 05-04-2016 [Start]
//if(errString != null && errString.indexOf("VTSUCC1") > 0)
if(errString != null && errString.indexOf("VTPOSTDES") != -1)
//if(errString != null && errString.indexOf("VTSUCC1") > 0)
if(errString != null && errString.indexOf("VTPOSTDES") != -1)
{
System.out.println("----------"+despId+" Despatch confirmed successfully.................");
updateSql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y', WAVE_STATUS = 'V' WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(updateSql);
pstmt.setString(1, despId);
updCnt = pstmt.executeUpdate();
if( updCnt > 0 )
{
System.out.println( updCnt + " rows updated successfully " );
}
pstmt.close();pstmt = null;
//Changed by Manish on 01/04/2016 for status tracking update in magento system after despatch confirm.[start]
System.out.println("status tracking update in magento start");
ShipmentStatus objShipment = new ShipmentStatus();
CommonWmsUtil wmsUtil = new CommonWmsUtil();
String apiShipUrl = wmsUtil.getDDSalesConfig("SHIP_STATUS_URL");
//Changed by wasim on 14-08-2015 to get api Key for magento [START]
String apiKey = wmsUtil.getDDSalesConfig("API_KEY");
objShipment.setApiKey(apiKey);
//Changed by wasim on 14-08-2015 to get api Key for magento [END]
objShipment.setOrderID(saleOrderL);
objShipment.setStatus("complete");
objShipment.setTrackingNumbers(wmsUtil.getTrackingNo(ptcn, conn));
objShipment.setComment("Sale Order Complete");
wmsUtil.CallTrackShipStatus(objShipment, apiShipUrl);
System.out.println("status tracking update in magento END");
//Changed by Manish on 01/04/2016 for status tracking update in magento system after despatch confirm.[end]
//Changed by Manish on [12/05/15] start
String printer = "";
printer = genericUtility.getColumnValue( "printer_name", dom );
System.out.println("Printer Name="+printer);
errString = "";
// Changed by Sneha on 08/03/2016 [Start]
//generateInvoiceReport(ptcn, despId, printer, conn, xtraParams);
//System.out.println(" ------------- Calling Receipt detail method in finally ------------ ");
// insertReceiptDetailsinDespatch(despId, tranIdRcp, conn, false);
invoicePrint = distCommonObj.getDisparams("999999", "IS_PRINT_INVOICE_ON", conn);
if("Y".equalsIgnoreCase(invoicePrint))
{
System.out.println("----------"+despId+" Despatch confirmed successfully.................");
updateSql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y', WAVE_STATUS = 'V' WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(updateSql);
pstmt.setString(1, despId);
updCnt = pstmt.executeUpdate();
if( updCnt > 0 )
{
System.out.println( updCnt + " rows updated successfully " );
}
pstmt.close();pstmt = null;
//Changed by Manish on 01/04/2016 for status tracking update in magento system after despatch confirm.[start]
System.out.println("status tracking update in magento start");
ShipmentStatus objShipment = new ShipmentStatus();
CommonWmsUtil wmsUtil = new CommonWmsUtil();
String apiShipUrl = wmsUtil.getDDSalesConfig("SHIP_STATUS_URL");
//Changed by wasim on 14-08-2015 to get api Key for magento [START]
String apiKey = wmsUtil.getDDSalesConfig("API_KEY");
objShipment.setApiKey(apiKey);
//Changed by wasim on 14-08-2015 to get api Key for magento [END]
objShipment.setOrderID(saleOrderL);
objShipment.setStatus("complete");
objShipment.setTrackingNumbers(wmsUtil.getTrackingNo(ptcn, conn));
objShipment.setComment("Sale Order Complete");
wmsUtil.CallTrackShipStatus(objShipment, apiShipUrl);
System.out.println("status tracking update in magento END");
//Changed by Manish on 01/04/2016 for status tracking update in magento system after despatch confirm.[end]
//Changed by Manish on [12/05/15] start
String printer = "";
printer = genericUtility.getColumnValue( "printer_name", dom );
System.out.println("Printer Name="+printer);
errString = "";
// Changed by Sneha on 08/03/2016 [Start]
//generateInvoiceReport(ptcn, despId, printer, conn, xtraParams);
invoicePrint = distCommonObj.getDisparams("999999", "IS_PRINT_INVOICE_ON", conn);
if("Y".equalsIgnoreCase(invoicePrint))
{
generateInvoiceReport(ptcn, despId, printer, conn, xtraParams);
}
//added by santosh on 05-04-2016 to confirm Invoice
confirmInvoice("invoice", invoiceId, xtraParams, "", conn);
System.out.println("just after confirmInvoice========");
//break;
// Changed by Sneha on 08/03/2016 [End]
//Changed by Manish on [12/05/15] END
}
else
{
return errString;
//throw new Exception(errString);
}
// }
generateInvoiceReport(ptcn, despId, printer, conn, xtraParams);
}
//added by santosh on 05-04-2016 to confirm Invoice
long startTime4 = System.currentTimeMillis();
System.out.println("START TIME ON INVOICE CONFIRM IN SECONDS:::["+startTime4/1000+"]");
confirmInvoice("invoice", invoiceId, xtraParams, "", conn);
long endTime4 = System.currentTimeMillis();
System.out.println("END TIME ON INVOICE CONFIRM IN SECONDS:::["+endTime4/1000+"]");
System.out.println("DIFFERANCE IN TIME ON INVOICE CONFIRM IN SECONDS:::["+(endTime4-startTime4)/1000+"] for invoice_id ["+invoiceId+"]");
System.out.println("just after confirmInvoice========");
//break;
// Changed by Sneha on 08/03/2016 [End]
//Changed by Manish on [12/05/15] END
}
else
{
//errString= itmDBAccessEJB.getErrorString("",errString,"","",conn);
return errString;
//throw new Exception(errString);
}
// }
}
else
{
......@@ -1302,21 +1430,28 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
// Changed by Sneha on 12-03-2016, calling SagePay and PayPal method in finally [Start]
if(isError)
{
// 16-apr-16 manoharan commented and update of tran_id__rcp also included in existing method insertSagePayDetailsinDespatch/insertPayPalDetailsinDespatch
//System.out.println(" ------------- Calling Receipt detail method in finally ------------ ");
//insertReceiptDetailsinDespatch(despId, tranIdRcp, null, true);
System.out.println(" ------------- Calling SagePay and PayPal method in finally ------------ ");
System.out.println("rcpMode =============>> " + rcpMode);
updateDespatch(despId,tokenInfo, tranIdRcp, null);
/*
if("S".equalsIgnoreCase(rcpMode))
{
System.out.println(" ------------- Calling SagePay method in finally ------------ ");
insertSagePayDetailsinDespatch(despId, segPayStatus, cardType, null, true);
insertSagePayDetailsinDespatch(despId, tokenInfo, cardType, null, true,tranIdRcp);
System.out.println(" errString from SagePay method ==========>>" + errString);
}
if("P".equalsIgnoreCase(rcpMode))
{
System.out.println(" ------------- Calling PayPal method in finally ------------ ");
insertPayPalDetailsinDespatch(despId, payPalStatus, cardType, null, true);
insertPayPalDetailsinDespatch(despId, tokenInfo, cardType, null, true,tranIdRcp);
System.out.println(" errString from PayPal method ==========>>" + errString);
}
*/
}
// Changed by Sneha on 12-03-2016, calling SagePay and PayPal method in finally [End]
......@@ -1336,8 +1471,126 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
throw new ITMException(e);
}
}
System.out.println("post save end error string is :"+errString);
return errString;
}
private String updateDespatch(String despId,String tokenInfo, String tranIdRcp, Connection conn) throws Exception ,ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",retString = "";
int rowCnt = 0;
System.out.println("insertPayPalDetailsinDespatch---->>["+tokenInfo+"");
StringBuffer payPalInfo = new StringBuffer();
HashMap <String,String> payPalDetailMap = new HashMap <String,String>();
//Connection conn = null;
ConnDriver connDriver = null;
boolean isCommit = false;
boolean lockSuccess = false;
try
{
if(conn == null)
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
isCommit = true;
}
// 16-apr-16 manoharan check for tran_id__rcp also
if((tokenInfo != null && tokenInfo.length() > 0) || (tranIdRcp != null && tranIdRcp.length() > 0))
{
sql = " SELECT TOKEN_INFO FROM DESPATCH WHERE DESP_ID = ? FOR UPDATE NOWAIT";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, despId);
rs = pstmt.executeQuery();
if(rs.next())
{
lockSuccess = true;
System.out.println("TOKEN_INFO ["+rs.getString(1)+"]");
}
else
{
lockSuccess = false;
System.out.println("TOKEN_INFO ["+rs.getString(1)+"]");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//
if(lockSuccess)
{
sql = "UPDATE DESPATCH SET TOKEN_INFO = ?, tran_id__rcp = ? WHERE DESP_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tokenInfo);
pstmt.setString(2, tranIdRcp); // 16-apr-16 manoharan
pstmt.setString(3, 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 .............");
}
}
}
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(isCommit)
{
if(conn != null)
{
conn.close();
conn = null;
}
}
}
return retString;
}
//Changed By Pragyan to get itm data 06/DEC/14.start
......@@ -1438,23 +1691,35 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
}
//Changed By Pragyan to get itm data 06/DEC/14.end
private int insertReceiptHdr(HashMap insertMap ,Connection conn) throws ITMException
private HashMap insertReceiptHdr(HashMap insertMap, String trDate, String xtraParams) throws ITMException
{
String sql = "";
String sql = "", errString = "";
PreparedStatement pstmt = null;
String tranId = "",siteCode = "",custCode = "",acctCodeAr = "",cctrCodeAr = "",currCode = "",rcpMode = "";
String tranId = "",siteCode="",custCode = "",acctCodeAr = "",cctrCodeAr = "",currCode = "",rcpMode = "";
String acctCodeAdv = "",cctrCodeAdv = "",finEntity = "",acctPrd = "",bankName = "",acctCodeBal = "",bankCode = "";
String cctrCodeBal = "",acctCodeCf = "",cctrCodeCf = "",chgUser = "",chgTerm = "",custBankRef = "",refNo = "";
//String remarks = "AUTO-RECEIPT GENERATION";
String remarks = "",tranType = "",itemSer = "",exchRateS = "",saleOrder = "";
double exchRate = 0,chqAmt = 0;
int count = 0;
double initialValue=0.0;
double initialValue=0.0;
ConnDriver connDriver = null;
Connection conn = null;
boolean isError = false;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
AppConnectParm appConnect = new AppConnectParm();
ReceiptAdvConfLocal receiptAdvConfLocal = null;
try
{
System.out.println("The values in HashMap for RECEIPT are : "+insertMap.toString());
java.sql.Timestamp currentDate = new Timestamp(System.currentTimeMillis());
tranId = (String)insertMap.get("tran_id");
{
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
refNo = (String)insertMap.get("ref_no");
siteCode = (String)insertMap.get("site_code");
custCode = (String)insertMap.get("cust_code");
......@@ -1481,6 +1746,36 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
tranType = (String)insertMap.get("tran_type");
System.out.println("remarks:::"+remarks);
for (int callCount = 0; callCount <= 5; callCount++)
{
try
{
tranId = generateTranTd("w_receipt_adv",trDate,siteCode,conn);
}
catch (Exception e)
{
System.out.println("getClass() is ---["+e.getClass()+"]");
System.out.println("getMessage is :::::["+e.getMessage()+"]");
System.out.println("Error in generate tran id callCount["+callCount+"]");
continue;
}
if(tranId != null && tranId.trim().length() > 0)
{
break;
}
}
if(tranId == null || tranId.trim().length() == 0)
{
errString= itmDBAccessEJB.getErrorString("","VTIARO","","",conn);
insertMap.put("errString", errString);
return insertMap;
}
System.out.println("The values in HashMap for RECEIPT are : "+insertMap.toString());
java.sql.Timestamp currentDate = new Timestamp(System.currentTimeMillis());
//tranId = (String)insertMap.get("tran_id");
chqAmt = ((Double)insertMap.get("chq_amt")).doubleValue();
System.out.println("The TranId while inserting the record :::::::: "+tranId);
......@@ -1545,17 +1840,43 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
pstmt.close();
pstmt = null;
if(count > 0)
{
ctx = new InitialContext(appConnect.getProperty());
receiptAdvConfLocal = (ReceiptAdvConfLocal)ctx.lookup("ibase/ReceiptAdvConf/local");
errString = receiptAdvConfLocal.confirm(tranId, xtraParams, "",conn);
System.out.println("errString After confirmed------>>["+errString+"]");
if(errString.indexOf("VTCICONF3") > -1)
{
conn.commit();
insertMap.put("tran_id",tranId);
System.out.println("Advanced receipt generated or confirmed successfully..................");
}
else
{
conn.rollback();
isError = true;
insertMap.put("errString",errString);
return insertMap;
}
}
}
catch (SQLException ex)
{
System.out.println("Exception ::" +sql+ ex.getMessage() + ":");
ex.printStackTrace();
isError = true;
throw new ITMException(ex);
}
catch (Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
isError = true;
throw new ITMException(e);
}
}
......@@ -1563,36 +1884,44 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
isError = true;
throw new ITMException(e);
}
return count;
finally
{
try
{
if(conn != null)
{
if(!isError)
{
conn.commit();
}
else
{
conn.rollback();
}
conn.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return insertMap;
}
// 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]
// Changed by Manish on 15-04-2016 to getting token info [Start]
private String getSagePayTokenInfo(String sagePayStr) throws Exception ,ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",retString = "";
int rowCnt = 0;
System.out.println("insertSagePayDetailsinDespatch---->>["+sagePayStr+"");
String tokenInfo = "";
System.out.println("getSagePayTokenInfo---->>["+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)
{
......@@ -1643,107 +1972,64 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
sagePayInfo.append("<CARDTYPE>"+cardType);
sagePayInfo.append("</CARDTYPE>");
}
sagePayInfo.append("</ROOT>");
System.out.println("sagePayInfo : "+sagePayInfo.toString());
if(sagePayInfo != null && sagePayInfo.length() > 0)
{
//
/*boolean lockSuccess = false;
sql = " SELECT TOKEN_INFO FROM DESPATCH WHERE DESP_ID = ? FOR UPDATE NOWAIT";
pstmt = conn.prepareStatement(sql);
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(lockSuccess)
{*/
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
{
System.out.println("Despatch Table is locked");
}*/
}
tokenInfo = sagePayInfo.toString();
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
return tokenInfo;
}
private String getPayPalTokenInfo(String payPalStr) throws Exception ,ITMException
{
String tokenInfo = "";
System.out.println("getPayPalTokenInfo---->>["+payPalStr+"");
StringBuffer payPalInfo = new StringBuffer();
HashMap <String,String> payPalDetailMap = new HashMap <String,String>();
try
{
if(isCommit)
payPalInfo.append("<ROOT>");
if(payPalStr != null && payPalStr.length() > 0)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(isCommit)
String params[] = payPalStr.split("&");
for(int i=0;i<params.length;i++)
{
if(conn != null)
String param[] = params[i].split("=");
if(param.length>1)
{
conn.close();
conn = null;
payPalInfo.append("<"+param[0]+">"+param[1]);
payPalInfo.append("</"+param[0]+">");
}
}
}
}
payPalInfo.append("</ROOT>");
System.out.println("PayPalInfo : "+payPalInfo.toString());
if(payPalInfo != null && payPalInfo.length() > 0)
{
tokenInfo = payPalInfo.toString();
}
}
return retString;
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return tokenInfo;
}
// Changed by Manish on 15-04-2016 to getting token info [end]
private int insertReceiptDtl(HashMap insertMap,String invoiceID,Connection conn)throws ITMException
{
java.sql.Timestamp refDate = null,dueDate = null;
......@@ -2131,7 +2417,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
System.out.println("Confirm Complete @@@@@@@@@@@ Return string from NVO is:==>["+retString+"]");*/
//Commented by santosh on 05-04-2016 [End]
//Added by Santosh on 05-04-2016[Start]
final Service finalService = service;
final String finalServiceURI = serviceURI;
......@@ -2141,7 +2427,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
final String finalTranIdFr = tranIdFr;
final String finalXtraParams = xtraParams;
final String finalForcedFlag = forcedFlag;
Thread confirmDespatchThread = new Thread()
{
public void run()
......@@ -2154,12 +2440,12 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
call.setUseSOAPAction(true);
call.setSOAPActionURI(finalActionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(finalCompName);
aobj[1] = new String(finalTranIdFr);
aobj[2] = new String(finalXtraParams);
......@@ -2167,9 +2453,9 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//System.out.println("@@@@@@@@@@loginEmpCode:" +genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")+":");
System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
call.setReturnType(XMLType.XSD_STRING);
final String finalRetString = (String)call.invoke(aobj);
System.out.println("Confirm Complete confirmDespatchThread Return string from NVO is:==>["+finalRetString+"]");
}
catch (Exception e) {
......@@ -2432,7 +2718,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
String errString = "";
String loginCode = "";
String loginSite = "", custCodeFr = "00", custCodeTo = "ZZ", invoiceIdFr = "00", invoiceIdTo = "ZZ";
//Added by Nasruddin on 11-04-2016 for filtering data in reports
java.util.Date invoiceDate = null;
java.util.Date currDate = null ;
......@@ -2483,6 +2769,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
{
invoiceIdFr = rs.getString(1);
invoiceDate = rs.getDate(2);//Added by nasruddin on 11-04-2016
}
if(pstmt != null)
{
......@@ -2552,19 +2839,17 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
"<argType>java.lang.String</argType>" +
"<value>"+invoiceIdFr+"</value>" +
"</Argument>" +
//Commented by Nasruddin on 11-04-2016 [Start]
/*"<Argument id=\"arg1\" name=\"as_date_fr\">" +
"<argType>java.util.Date</argType>" +
"<value>"+currDateStr+"</value>" +
"</Argument>" +
"<Argument id=\"arg1\" name=\"as_date_to\">" +
"<argType>java.util.Date</argType>" +
"<value>"+currDateStr+"</value>" +
"</Argument>" +*/
//Commented by Nasruddin on 11-04-2016 [End]
//Added by Nasruddin on 11-04-2016 [Start]
"<Argument id=\"arg1\" name=\"as_tran_dt_fr\">" +
"<argType>java.util.Date</argType>" +
"<value>"+dateFormat.format(invoiceDate)+"</value>" +
......@@ -2573,8 +2858,6 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
"<argType>java.util.Date</argType>" +
"<value>"+dateFormat.format(invoiceDate)+"</value>" +
"</Argument>" +
//Added by Nasruddin on 11-04-2016 [End]
"<Argument id=\"arg8\" name=\"x_path\">" +
"<argType>java.lang.String</argType>" +
"<value>/DocumentRoot/d_invoice_rev</value>" +
......@@ -2644,15 +2927,15 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
pstmt = conn.prepareStatement(sql1);
pstmt.setString(1,ptcn);
rs = pstmt.executeQuery();
if(rs.next()){
count = rs.getInt("PRINT_COUNT");
System.out.println("RS.GETINT : "+rs.getInt("PRINT_COUNT"));
}
System.out.println("Count : ["+count+"]");
if(count>=1){
if(count >= 1){
System.out.println("Inside print count 2");
printCount = 2;
}
......@@ -2669,7 +2952,6 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, loginCode, printer.trim(), 1, conn);
//Added by Nasruddin on 12-04-2016 [End]
System.out.println("DONE");
}
catch(Exception e)
......@@ -3275,13 +3557,13 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
return responseStr;
}
private String insertPayPalDetailsinDespatch(String despId,String payPalStr,String cardType, Connection conn, boolean isCommit) throws Exception ,ITMException
private String insertPayPalDetailsinDespatch(String despId,String tokenInfo,String cardType, Connection conn, boolean isCommit, String tranIdRcp) throws Exception ,ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",retString = "";
int rowCnt = 0;
System.out.println("insertPayPalDetailsinDespatch---->>["+payPalStr+"");
System.out.println("insertPayPalDetailsinDespatch---->>["+tokenInfo+"");
StringBuffer payPalInfo = new StringBuffer();
HashMap <String,String> payPalDetailMap = new HashMap <String,String>();
//Connection conn = null;
......@@ -3298,7 +3580,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
}
// Changed by Sneha on 12-03-2016, [End]
payPalInfo.append("<ROOT>");
/*payPalInfo.append("<ROOT>");
if(payPalStr != null && payPalStr.length() > 0)
{
String params[] = payPalStr.split("&");
......@@ -3314,8 +3596,9 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
}
payPalInfo.append("</ROOT>");
System.out.println("PayPalInfo : "+payPalInfo.toString());
if(payPalInfo != null && payPalInfo.length() > 0)
System.out.println("PayPalInfo : "+payPalInfo.toString());*/
// 16-apr-16 manoharan check for tran_id__rcp also
if((tokenInfo != null && tokenInfo.length() > 0) || (tranIdRcp != null && tranIdRcp.length() > 0))
{
//
......@@ -3343,10 +3626,11 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//
if(lockSuccess)
{*/
sql = "UPDATE DESPATCH SET TOKEN_INFO = ? WHERE DESP_ID = ?";
sql = "UPDATE DESPATCH SET TOKEN_INFO = ?, tran_id__rcp = ? WHERE DESP_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, payPalInfo.toString());
pstmt.setString(2, despId);
pstmt.setString(2, tranIdRcp); // 16-apr-16 manoharan
pstmt.setString(3, despId);
rowCnt = pstmt.executeUpdate();
System.out.println("DESPATCH rowCnt: "+rowCnt);
if(pstmt != null)
......@@ -3462,7 +3746,268 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
}
// Changed by Sneha on 16-03-2016, set blank values for global variable [End]
// 16-apr-16 manoharan included alsong with token_info in other 2 methods
/*private String insertReceiptDetailsinDespatch(String despId, String tranId, Connection conn, boolean isCommit) throws Exception ,ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",retString = "";
int rowCnt = 0;
System.out.println("insertReceiptDetailsinDespatch---->>["+tranId+"");
StringBuffer sagePayInfo = new StringBuffer();
HashMap <String,String> sagePayDetailMap = new HashMap <String,String>();
ConnDriver connDriver = null;
try
{
if(isCommit)
{
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
}
sql = "UPDATE DESPATCH SET TRAN_ID__RCP = ? WHERE DESP_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setString(2, despId);
rowCnt = pstmt.executeUpdate();
System.out.println("DESPATCH rowCnt: "+rowCnt);
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(isCommit)
{
if(rowCnt > 0)
{
conn.commit();
retString = "Success";
System.out.println("Receipt details updated successfully.............");
}
else
{
conn.rollback();
retString = "Error";
}
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(isCommit)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(isCommit)
{
if(conn != null)
{
conn.close();
conn = null;
}
}
}
}
return retString;
}
*/
private String insertSagePayDetailsinDespatch(String despId,String tokenInfo,String cardType, Connection conn, boolean isCommit, String tranIdRcp) 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---->>["+tokenInfo+"");
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)
{
sagePayStr = sagePayStr.replaceFirst("VPSProtocol", ",VPSProtocol");
sagePayStr = sagePayStr.replaceFirst("Status", ",Status");
sagePayStr = sagePayStr.replaceFirst("StatusDetail", ",StatusDetail");
sagePayStr = sagePayStr.replaceFirst("VPSTxId", ",VPSTxId");
sagePayStr = sagePayStr.replaceFirst("SecurityKey", ",SecurityKey");
sagePayStr = sagePayStr.replaceFirst("TxAuthNo", ",TxAuthNo");
sagePayStr = sagePayStr.replaceFirst("AVSCV2", ",AVSCV2");
sagePayStr = sagePayStr.replaceFirst("CV2Result", ",CV2Result");
sagePayStr = sagePayStr.replaceFirst("AddressResult", ",AddressResult");
sagePayStr = sagePayStr.replaceFirst("DeclineCode", ",DeclineCode");
sagePayStr = sagePayStr.replaceFirst("BankAuthCode", ",BankAuthCode");
sagePayStr = sagePayStr.substring(1,sagePayStr.length());
System.out.println("after substr sagePayStr["+sagePayStr+"]");
String[] dataStr = sagePayStr.split(",");
System.out.println("dataStr["+dataStr.toString()+"]");
for(String token:dataStr)
{
System.out.println("token["+token+"]");
String [] data = token.split("=");
sagePayDetailMap.put(data[0], data[1]);
}
System.out.println("sagePayDetailMap["+sagePayDetailMap.toString()+"]");
sagePayInfo.append("<VPSPROTOCOL>"+sagePayDetailMap.get("VPSProtocol"));
sagePayInfo.append("</VPSPROTOCOL>");
sagePayInfo.append("<STATUS>"+sagePayDetailMap.get("Status"));
sagePayInfo.append("</STATUS>");
sagePayInfo.append("<STATUSDETAIL>"+sagePayDetailMap.get("StatusDetail"));
sagePayInfo.append("</STATUSDETAIL>");
sagePayInfo.append("<VPSTXID>"+sagePayDetailMap.get("VPSTxId"));
sagePayInfo.append("</VPSTXID>");
sagePayInfo.append("<SECURITYKEY>"+sagePayDetailMap.get("SecurityKey"));
sagePayInfo.append("</SECURITYKEY>");
sagePayInfo.append("<TXAUTHNO>"+sagePayDetailMap.get("TxAuthNo"));
sagePayInfo.append("</TXAUTHNO>");
sagePayInfo.append("<BANKAUTHCODE>"+sagePayDetailMap.get("BankAuthCode"));
sagePayInfo.append("</BANKAUTHCODE>");
sagePayInfo.append("<CARDTYPE>"+cardType);
sagePayInfo.append("</CARDTYPE>");
}
sagePayInfo.append("</ROOT>");
System.out.println("sagePayInfo : "+sagePayInfo.toString());*/
// 16-apr-16 manoharan check and update tran_id__rcp also
if((tokenInfo != null && tokenInfo.length() > 0) || (tranIdRcp != null && tranIdRcp.length() > 0))
{
//
/*boolean lockSuccess = false;
sql = " SELECT TOKEN_INFO FROM DESPATCH WHERE DESP_ID = ? FOR UPDATE NOWAIT";
pstmt = conn.prepareStatement(sql);
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(lockSuccess)
{*/
sql = "UPDATE DESPATCH SET TOKEN_INFO = ?, tran_id__rcp = ? WHERE DESP_ID = ?";
pstmt = conn.prepareStatement(sql);
// pstmt.setString(1, sagePayInfo.toString());
pstmt.setString(1, tokenInfo);
pstmt.setString(2, tranIdRcp); // 16-apr-16 manoharan
pstmt.setString(3, 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
{
System.out.println("Despatch Table is locked");
}*/
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(isCommit)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(isCommit)
{
if(conn != null)
{
conn.close();
conn = null;
}
}
}
}
return retString;
}
}
......@@ -6,6 +6,7 @@ package ibase.webitm.ejb.wms;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.bean.wms.ShipmentStatus;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal;
......@@ -14,7 +15,6 @@ import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.dis.InvAllocTraceBean;
import ibase.webitm.ejb.fin.FinCommon;
import ibase.webitm.reports.utility.XSDParser;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
import ibase.webitm.utility.wms.CommonWmsUtil;
......@@ -6316,8 +6316,10 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(lotQtyToBeAllocated));
strAllocate.put("chg_user",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
/*strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));*/
strAllocate.put("chg_user",new E12GenericUtility().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",new E12GenericUtility().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win","W_WAVEGEN");
......@@ -7192,7 +7194,13 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
}
//Changes by Dadaso pawar on 17/03/15 [End]
pstmt.executeUpdate();
//Changes by Manish on 21/04/16 [start]
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//Changes by Manish on 21/04/16 [End]
System.out.println("Start Wave Genartion.......................");
invStatLoc = discommon.getDisparams("999999","RESERV_LOCATION",conn);
......@@ -17342,7 +17350,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
boolean isOdd = false;
int sumOdd = 0, sumEven = 0;
String inputStr = "", sscc18 = "", runNumberStr =""; //mfgCode = "0351672",
//ibase.utility.E12GenericUtility genUtility = ibase.utility.new E12GenericUtility();
//ibase.utility.GenericUtility genUtility = ibase.utility.GenericUtility.getInstance();
int ctr, curDigit = 0, chkDigit = 0, padLen = 0; // runNumber = 4967235
try
{
......
package ibase.webitm.utility.wms;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.utility.EMail;
import ibase.webitm.bean.wms.Attribute;
import ibase.webitm.bean.wms.PaypalParameters;
import ibase.webitm.bean.wms.PaypalRefundParams;
import ibase.webitm.bean.wms.Product;
import ibase.webitm.bean.wms.ShipmentStatus;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator;
......@@ -1390,12 +1390,14 @@ public class CommonWmsUtil {
try
{
System.out.println("@@@@ in try bilock===");
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
response = new StringBuilder();
while ((inputLine = in.readLine()) != null)
{
System.out.println("@@@@ inputLine===");
response.append(inputLine);
}
responseShipTrack = response.toString();
......
......@@ -10,6 +10,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
......@@ -26,11 +27,11 @@ import org.w3c.dom.Document;
import ibase.scheduler.utility.interfaces.Schedule;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
import ibase.webitm.bean.wms.ShipmentStatus;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.wms.UploadOrderEJB;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException;
public class DDUpdTrackSchedule implements Schedule
......@@ -79,6 +80,10 @@ public class DDUpdTrackSchedule implements Schedule
ResultSet rs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
java.util.Date currDate = new java.util.Date();
Calendar cal = Calendar.getInstance();
cal.setTime(currDate);
cal.add(Calendar.DATE, -1);
java.util.Date prvDate = cal.getTime();// One Day before current date
try
{
ConnDriver connDriver = new ConnDriver();
......@@ -89,8 +94,9 @@ public class DDUpdTrackSchedule implements Schedule
String applDateFormat = genericUtility.getApplDateFormat();
String dbDateFormat = genericUtility.getDBDateFormat();
SimpleDateFormat sdf = new SimpleDateFormat(applDateFormat);
String currDateStr = sdf.format(currDate);
java.sql.Timestamp tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString( currDateStr , applDateFormat, dbDateFormat ) + " 00:00:00.0") ;
//String currDateStr = sdf.format(currDate);
String prvDateStr = sdf.format(prvDate);
java.sql.Timestamp tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString( prvDateStr , applDateFormat, dbDateFormat ) + " 00:00:00.0") ;
ShipmentStatus objShipment = new ShipmentStatus();
CommonWmsUtil wmsUtil = new CommonWmsUtil();
......@@ -111,14 +117,15 @@ public class DDUpdTrackSchedule implements Schedule
saleOrd = rs.getString(1);
ptcn = rs.getString(2);
errString = updateTracking(saleOrd, ptcn, apiShipUrl, apiKey, objShipment, wmsUtil, conn);
writeLog(saleOrd,sw.toString());
System.out.println("RETURN STRING FROM updateTracking IS====["+errString+"]");
writeLog(errString);
}
catch(Exception ex)
{
System.out.println("Exception caught for SaleOrder["+saleOrd+"] so rollbacking and going for next despatch");
conn.rollback();
ex.printStackTrace(pw);
writeLog(saleOrd,sw.toString());
writeLog(errString);
continue;
}
}
......@@ -178,7 +185,8 @@ public class DDUpdTrackSchedule implements Schedule
objShipment.setStatus("complete");
objShipment.setTrackingNumbers(wmsUtil.getTrackingNo(ptcn, conn));
objShipment.setComment("Sale Order Complete");
retString = wmsUtil.CallTrackShipStatus(objShipment, apiShipUrl);
retString = wmsUtil.CallTrackShipStatus(objShipment, apiShipUrl);
System.out.println("RETURN STRING FROM CallTrackShipStatus IS====["+retString+"]");
System.out.println("status tracking update in magento END");
}
catch(Exception e)
......@@ -219,14 +227,21 @@ public class DDUpdTrackSchedule implements Schedule
return xtraParamsBuff.toString();
}
public void writeLog(String saleOrder,String errString) throws Exception
public void writeLog(String errString) throws Exception
{
FileOutputStream fos1 = null;
String fileName = "";
final Logger logger = Logger.getLogger(DDUpdTrackSchedule.class.getName());
java.util.Date currDate = new java.util.Date();
// SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
try
{
fileName = "DDUPDTRACK_"+saleOrder+"_ORDERSTATUS";
String time = sdf.format(currDate);
time = time.replaceAll(":", "-");
System.out.println("currDate is :::"+time);
fileName = "SHIPSTATUS_"+time;
System.out.println("Schdular Log Name is ="+fileName);
......
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