Commit d5519262 authored by ssalve's avatar ssalve

Sarita: Done changes on 13 NOV 2018

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@192848 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0bb967ea
/** /**
* PURPOSE : Pre Save Logic * PURPOSE : Pre Save Logic
* AUTHOR : Priyanka Chavan. * AUTHOR : Priyanka Chavan.
*/ */
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -54,41 +54,64 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -54,41 +54,64 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
System.out.println("[Errorstring :::::::::["+errString+"]]"); System.out.println("[Errorstring :::::::::["+errString+"]]");
if (errString == null || errString.trim().length() == 0) if (errString == null || errString.trim().length() == 0)
{
errString = itmDBAccessEJB.getErrorString("", "VTAUTOSPLT", "", "", conn);
conn.commit();
/*if(conn != null)
{ {
conn.close(); conn.close();
conn = null; conn = null;
} else }*/
}
else
{
conn.rollback();
/*if(conn != null)
{ {
conn.close(); conn.close();
conn = null; conn = null;
return errString; }*/
//return errString;
} }
} }
catch(Exception e) catch(Exception e)
{ {
//Added by Anjali
try
{
conn.rollback();
}
catch (SQLException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
throw new ITMException(e1);
}
System.out.println("Exception Inside [SRLContainerSplit [confirm] Method] ::["+e+"]"); System.out.println("Exception Inside [SRLContainerSplit [confirm] Method] ::["+e+"]");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally { finally
{
try { try
if (conn != null) { {
System.out if (conn != null)
.println("InSide finally.. rollbacking >>>>>>>>>>>>>>>>> "); {
System.out.println("InSide finally.. rollbacking >>>>>>>>>>>>>>>>> ");
conn.rollback(); conn.rollback();
conn.close(); conn.close();
System.out System.out.println("InSide finally.. Connection has been closed >>>>>>>>>>>>>>>>>>>>>>>>> ");
.println("InSide finally.. Connection has been closed >>>>>>>>>>>>>>>>>>>>>>>>> ");
} }
conn = null; conn = null;
} catch (SQLException se) { }
System.out.println("SQL Exception in finaly >>>> " catch (SQLException se)
+ se.getMessage()); {
System.out.println("SQL Exception in finaly >>>> "+ se.getMessage());
throw new ITMException(se); throw new ITMException(se);
} catch (Exception d) { }
catch (Exception d)
{
d.printStackTrace(); d.printStackTrace();
throw new ITMException(d); throw new ITMException(d);
} }
...@@ -130,8 +153,9 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -130,8 +153,9 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
String avalibleFrLocCode = ""; String avalibleFrLocCode = "";
//Added by sarita on 29 OCT 2018 [END] //Added by sarita on 29 OCT 2018 [END]
//Added by sarita on 02 NOV 2018 [START] //Added by sarita on 02 NOV 2018 [START]
HashMap stockMap = new HashMap<>();
ArrayList stockDataList = new ArrayList(); ArrayList stockDataList = new ArrayList();
String refSer = "", autoConfirm = "", taxForm = "", chgTerm = "",wrkflwInit = "", wrkflwOpt = "", transactionID = ""; String refSer = "", chgTerm = "",wrkflwInit = "", wrkflwOpt = "", transactionID = "";
XML2DBEJB xml2DBLocal = new XML2DBEJB(); XML2DBEJB xml2DBLocal = new XML2DBEJB();
boolean isWrkflwToBeInitiated = false; boolean isWrkflwToBeInitiated = false;
UserInfoBean userInfo = null; UserInfoBean userInfo = null;
...@@ -215,9 +239,13 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -215,9 +239,13 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
while(rs.next()) while(rs.next())
{ {
stkCnt++; stkCnt++;
stockMap = new HashMap<>();
avalibleFrLocCode = rs.getString("available"); avalibleFrLocCode = rs.getString("available");
stockDataList.add(stkCnt); /*stockDataList.add(stkCnt);
stockDataList.add(avalibleFrLocCode); stockDataList.add(avalibleFrLocCode);*/
stockMap.put("count", stkCnt);
stockMap.put("available", avalibleFrLocCode);
stockDataList.add(stockMap);
//Added by sarita to store data into ArrayList on 02 NOV 2018 [END] //Added by sarita to store data into ArrayList on 02 NOV 2018 [END]
} }
System.out.println("[SRLContainerSplit] Count is ["+cnt+"] && Available in invstat is ["+avalibleFrLocCode+"]"); System.out.println("[SRLContainerSplit] Count is ["+cnt+"] && Available in invstat is ["+avalibleFrLocCode+"]");
...@@ -243,7 +271,7 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -243,7 +271,7 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
} }
//if(cnt > 1) -- Commented and Added by sarita on 02 NOV 2018 //if(cnt > 1) -- Commented and Added by sarita on 02 NOV 2018
if(stockDataList.size() > 2) if(stockDataList.size() > 1)
{ {
//retSting = itmDBAccessEJB.getErrorString("", "INVRCDSTOC", "");//itmDBAccessEJB.getErrorString("","VTBLNKDTL","","",conn); //retSting = itmDBAccessEJB.getErrorString("", "INVRCDSTOC", "");//itmDBAccessEJB.getErrorString("","VTBLNKDTL","","",conn);
retSting = itmDBAccessEJB.getErrorString("", "INVRCDSTOC", "", "", conn); retSting = itmDBAccessEJB.getErrorString("", "INVRCDSTOC", "", "", conn);
...@@ -261,10 +289,14 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -261,10 +289,14 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
}*/ }*/
else else
{ {
stkCnt = (Integer)stockDataList.get(0); HashMap newMap = new HashMap<>();
avalibleFrLocCode = (String)stockDataList.get(1); newMap = (HashMap) stockDataList.get(0);
/*stkCnt = (Integer)stockDataList.get(0);
avalibleFrLocCode = (String)stockDataList.get(1);*/
stkCnt = (int) newMap.get("count");
avalibleFrLocCode = (String) newMap.get("available");
System.out.println("avalibleFrLocCode ["+avalibleFrLocCode+"]"); System.out.println("avalibleFrLocCode ["+avalibleFrLocCode+"]");
if((stkCnt == 1) && ("N".equalsIgnoreCase(avalibleFrLocCode))) if("N".equalsIgnoreCase(avalibleFrLocCode))
{ {
retSting = itmDBAccessEJB.getErrorString("", "VTINVGIT", "", "", conn);//Please check the GIT Location Code, it does not exists or not for internal use. retSting = itmDBAccessEJB.getErrorString("", "VTINVGIT", "", "", conn);//Please check the GIT Location Code, it does not exists or not for internal use.
isError = true; isError = true;
...@@ -434,6 +466,19 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -434,6 +466,19 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
return retSting; return retSting;
} }
}//if(rsStock.next()) }//if(rsStock.next())
//Added by Anjali R. S
if(rsStock != null)
{
rsStock.close();
rsStock = null;
}
if(pstmtStock != null)
{
pstmtStock.close();
pstmtStock = null;
}
//Added by Anjali R. E
valueXmlforIssue.append("</Header0>\n"); valueXmlforIssue.append("</Header0>\n");
valueXmlforIssue.append("</group0>\n"); valueXmlforIssue.append("</group0>\n");
...@@ -545,8 +590,16 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -545,8 +590,16 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
valueXmlforReceipt.append("</Detail2>\n"); valueXmlforReceipt.append("</Detail2>\n");
cntRCP++; cntRCP++;
} }
if(rs != null){rs.close();rs = null;} if(rs != null)
if(pstmt != null){pstmt.close();pstmt = null;} {
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlforReceipt.append("</Header0>"); valueXmlforReceipt.append("</Header0>");
valueXmlforReceipt.append("</group0>"); valueXmlforReceipt.append("</group0>");
valueXmlforReceipt.append("</DocumentRoot>"); valueXmlforReceipt.append("</DocumentRoot>");
...@@ -605,14 +658,17 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -605,14 +658,17 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
System.out.println("Saving Data for Receipt"); System.out.println("Saving Data for Receipt");
//Commented and Added by sarit aon 02 NOV 2018 [START] //Commented and Added by sarit aon 02 NOV 2018 [START]
//retSting = saveData(siteCode,valueXmlforReceipt.toString(),conn,userId); //retSting = saveData(siteCode,valueXmlforReceipt.toString(),conn,userId);
String sql1 = "SELECT REF_SER, AUTO_CONFIRM, TAX_FORMS, WRKFLW_INIT, WORKFLOW_OPT FROM TRANSETUP WHERE TRAN_WINDOW = 'w_adj_rcp'" ; //Modified by Anjali.Start
//String sql1 = "SELECT REF_SER, AUTO_CONFIRM, TAX_FORMS, WRKFLW_INIT, WORKFLOW_OPT FROM TRANSETUP WHERE TRAN_WINDOW = 'w_adj_rcp'" ;
String sql1 = "SELECT REF_SER, WRKFLW_INIT, WORKFLOW_OPT FROM TRANSETUP WHERE TRAN_WINDOW = 'w_adj_rcp'" ;
//Modified by Anjali.End
pstmt = conn.prepareStatement(sql1); pstmt = conn.prepareStatement(sql1);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next() ) if( rs.next() )
{ {
refSer = checkNull(rs.getString( "REF_SER" )); refSer = checkNull(rs.getString( "REF_SER" ));
autoConfirm = checkNull(rs.getString( "AUTO_CONFIRM" )); //autoConfirm = checkNull(rs.getString( "AUTO_CONFIRM" ));//Commented by anjali
taxForm = checkNull(rs.getString( "TAX_FORMS" )); //taxForm = checkNull(rs.getString( "TAX_FORMS" ));//Commented by anjali
wrkflwInit = checkNull(rs.getString( "WRKFLW_INIT" )); wrkflwInit = checkNull(rs.getString( "WRKFLW_INIT" ));
wrkflwOpt = checkNull(rs.getString( "WORKFLOW_OPT" )); wrkflwOpt = checkNull(rs.getString( "WORKFLOW_OPT" ));
} }
...@@ -629,16 +685,17 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -629,16 +685,17 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
CommonDBAccessRemote dbAccessRemote = new CommonDBAccessEJB(); CommonDBAccessRemote dbAccessRemote = new CommonDBAccessEJB();
userInfo = dbAccessRemote.createUserInfo(userId); userInfo = dbAccessRemote.createUserInfo(userId);
HashMap totFormsMap = getTransInfo(conn); //HashMap totFormsMap = getTransInfo(conn);
formCnt = getTransInfo("w_adj_rcp",conn);
String totForms = (String)totFormsMap.get("TOTAL_FORMS"); /*if(totForms != null && totForms.trim().length() > 0)
if(totForms != null && totForms.length() > 0)
{ {
formCnt = Integer.parseInt(totForms); formCnt = Integer.parseInt(totForms);
} }*/
System.out.println("Form Count is == ["+formCnt+"]"); System.out.println("Form Count is == ["+formCnt+"]");
retSting = xml2DBLocal.saveXML2DB(refSer,valueXmlforReceipt.toString(),"adj_rcp", "A", formCnt, true, userId, "tran_id",false,xtraParams,null,wrkflwInit,isWrkflwToBeInitiated,wrkflwOpt,null,"","",false, conn, false, userInfo); retSting = xml2DBLocal.saveXML2DB(refSer,valueXmlforReceipt.toString(),"adj_rcp", "A", formCnt, true, userId, "tran_id",false,xtraParams,null,wrkflwInit,isWrkflwToBeInitiated,wrkflwOpt,null,"","",false, conn, false, userInfo);
transactionID = retSting; //transactionID = retSting;
System.out.println("Data Saved Successfully for Receipt" +retSting ); System.out.println("Data Saved Successfully for Receipt" +retSting );
//if(retSting.indexOf("Success") > -1) //if(retSting.indexOf("Success") > -1)
...@@ -647,7 +704,8 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -647,7 +704,8 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
//Added and Commented by sarita on 02 NOV 2018 [START] //Added and Commented by sarita on 02 NOV 2018 [START]
/*String[] arrayForTranId = retSting.split("<TranID>"); /*String[] arrayForTranId = retSting.split("<TranID>");
int endIndex = arrayForTranId[1].indexOf("</TranID>"); int endIndex = arrayForTranId[1].indexOf("</TranID>");
tranIdForReciept = arrayForTranId[1].substring(0,endIndex); System.out.println("tranIdForReciept["+tranIdForReciept+"]"); tranIdForReciept = arrayForTranId[1].substring(0,endIndex);
System.out.println("tranIdForReciept["+tranIdForReciept+"]");
//Commented by sarita on 19MARCH2018 //Commented by sarita on 19MARCH2018
//conn.commit();*/ //conn.commit();*/
tranIdForReciept = retSting; tranIdForReciept = retSting;
...@@ -723,8 +781,11 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -723,8 +781,11 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
//Commented by sarita on 14APR2018 [end] -- removed column status from srl_contents table //Commented by sarita on 14APR2018 [end] -- removed column status from srl_contents table
//Prompt messages showing transaction Splitted Successfullly!!!!! //Prompt messages showing transaction Splitted Successfullly!!!!!
//retSting = itmDBAccessEJB.getErrorString("", "VTAUTOSPLT", "");//itmDBAccessEJB.getErrorString("","VTBLNKDTL","","",conn); //retSting = itmDBAccessEJB.getErrorString("", "VTAUTOSPLT", "");//itmDBAccessEJB.getErrorString("","VTBLNKDTL","","",conn);
retSting = itmDBAccessEJB.getErrorString("", "VTAUTOSPLT", "", "", conn); //Modified by Anjali .S
return retSting; /*retSting = itmDBAccessEJB.getErrorString("", "VTAUTOSPLT", "", "", conn);
return retSting;*/
retSting = "";
//Modified by Anjali .E
} }
else else
{ {
...@@ -758,7 +819,8 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -758,7 +819,8 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
} }
else else
{ {
conn.commit(); //Modified by Anjali R. [Ideally connection commit will not happend here.Connection was not created in this method seems this method will not be commited the transaction]
//conn.commit();
System.out.println("SRLContainerSplit connection committed"); System.out.println("SRLContainerSplit connection committed");
} }
if(rs != null) if(rs != null)
...@@ -771,11 +833,24 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -771,11 +833,24 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(conn != null) //Added by Anjali R. S
if(rsStock != null)
{
rsStock.close();
rsStock = null;
}
if(pstmtStock != null)
{
pstmtStock.close();
pstmtStock = null;
}
/*if(conn != null)
{ {
conn.close(); conn.close();
conn = null; conn = null;
} }*/
//Added by Anjali R. E
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -832,19 +907,21 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -832,19 +907,21 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
public String confirmIssueAndReceipt(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn,String userId) throws ITMException public String confirmIssueAndReceipt(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn,String userId) throws ITMException
{ {
String methodName = ""; //Commented by Anjali R. Start[unused variables]
/*String methodName = "";
String compName = ""; String compName = "";
String retString = ""; String retString = "";
String serviceCode = ""; String serviceCode = "";
String serviceURI = ""; String serviceURI = "";
String actionURI = ""; String actionURI = "";
String sql = ""; String sql = "";*/
//Commented by Anjali R. End[unused variables]
String retString = "";
PreparedStatement pStmt = null; PreparedStatement pStmt = null;
ResultSet rs = null; ResultSet rs = null;
System.out.println("confirmIssueAndReceipt(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn) called >>><!@#>"); System.out.println("confirmIssueAndReceipt(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn) called >>><!@#>");
try try
{ {
CommonDBAccessEJB dbAccessRemote = new CommonDBAccessEJB(); CommonDBAccessEJB dbAccessRemote = new CommonDBAccessEJB();
UserInfoBean userInfo = dbAccessRemote.createUserInfo(userId); UserInfoBean userInfo = dbAccessRemote.createUserInfo(userId);
...@@ -886,23 +963,24 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -886,23 +963,24 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
return retString; return retString;
} }
//Added by method to get Total Forms Information on 02 NOV 2018 [START] //Added by sarita method to get Total Forms Information on 02 NOV 2018 [START]
public HashMap getTransInfo(Connection conn) throws ITMException public Integer getTransInfo(String winName , Connection conn) throws ITMException
{ {
PreparedStatement pstmtObj = null; PreparedStatement pstmtObj = null;
ResultSet rsObj = null; ResultSet rsObj = null;
int totalForms = 0; String totalForms = "";
HashMap objMap = new HashMap(); int totForms = 0;
//HashMap objMap = new HashMap();
try try
{ {
String winName = "w_adj_rcp"; //String winName = "w_adj_rcp";
String objFormSql = "SELECT COUNT(*) AS COUNT FROM OBJ_FORMS WHERE WIN_NAME = ?"; String objFormSql = "SELECT COUNT(*) AS COUNT FROM OBJ_FORMS WHERE WIN_NAME = ?";
pstmtObj = conn.prepareStatement(objFormSql); pstmtObj = conn.prepareStatement(objFormSql);
pstmtObj.setString(1,winName); pstmtObj.setString(1,winName);
rsObj = pstmtObj.executeQuery(); rsObj = pstmtObj.executeQuery();
if ( rsObj.next()) if ( rsObj.next())
{ {
totalForms = rsObj.getInt("COUNT"); totalForms = checkNull(rsObj.getString("COUNT"));
} }
if(rsObj != null) if(rsObj != null)
{ {
...@@ -914,7 +992,24 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -914,7 +992,24 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
pstmtObj.close(); pstmtObj.close();
pstmtObj = null; pstmtObj = null;
} }
objMap.put("TOTAL_FORMS", ""+totalForms); System.out.println("objMap ::"+objMap); if(totalForms == null || totalForms.trim().length() == 0)
{
totForms = 0;
}
else
{
try
{
totForms = Integer.parseInt(totalForms);
}
catch(Exception e)
{
System.err.println("getTransInfo--["+e.getMessage()+"]");
e.printStackTrace();
totForms = 0;
}
}
//objMap.put("TOTAL_FORMS", ""+totalForms); System.out.println("objMap ::"+objMap);
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -942,7 +1037,8 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS ...@@ -942,7 +1037,8 @@ public class SRLContainerSplit extends ActionHandlerEJB implements SRLContainerS
throw new ITMException(e1); throw new ITMException(e1);
} }
} }
return objMap; System.out.println("totForms--["+totForms+"]");
return totForms ;
} }
//Added by method to get Total Forms Information on 02 NOV 2018 [END] //Added by sarita method to get Total Forms Information on 02 NOV 2018 [END]
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment