Commit 077270aa authored by caluka's avatar caluka

Changes done in E-Collection confirmation and submit


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97433 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 965bfebb
...@@ -64,29 +64,29 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -64,29 +64,29 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(refNo == null || refNo.trim().length() == 0) if ("S".equalsIgnoreCase(status))
{
errString = itmDBAccessLocal.getErrorString("","VTNULREFNO","");
}
else
{ {
if ("Y".equalsIgnoreCase(confirmed)) if (refNo == null || refNo.trim().length() == 0)
{ {
errString = itmDBAccessLocal.getErrorString("","VTINVCONF2",""); errString = itmDBAccessLocal.getErrorString("", "VTNULREFNO", "");
} else } else
{ {
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); if ("Y".equalsIgnoreCase(confirmed))
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime());
System.out.println("Now the date is :=> " + sysDateStr);
sysDate = Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println(">>>>>>>>sysDate:" + sysDate);
System.out.println(">>>>>>>>loginEmpCode:" + loginEmpCode);
if ("S".equalsIgnoreCase(status))
{ {
errString = itmDBAccessLocal.getErrorString("", "VTINVCONF2", "");
} else
{
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime());
System.out.println("Now the date is :=> " + sysDateStr);
sysDate = Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
System.out.println(">>>>>>>>sysDate:" + sysDate);
System.out.println(">>>>>>>>loginEmpCode:" + loginEmpCode);
sql = " update receipt_form set confirmed = 'Y',conf_date = ?, emp_code__aprv = ? ,status= 'C' where tran_id = ? "; sql = " update receipt_form set confirmed = 'Y',conf_date = ?, emp_code__aprv = ? ,status= 'C' where tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, sysDate); pstmt.setTimestamp(1, sysDate);
...@@ -97,18 +97,18 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -97,18 +97,18 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
pstmt = null; pstmt = null;
if (cnt > 0) if (cnt > 0)
{ {
errString = itmDBAccessLocal.getErrorString("", "VCNFSUC1", ""); errString = itmDBAccessLocal.getErrorString("", "VCNFSUC1", "");
conn.commit();
} else } else
{ {
errString = itmDBAccessLocal.getErrorString("", "VTNCONFT", ""); errString = itmDBAccessLocal.getErrorString("", "VTNCONFT", "");
} }
} else
{
errString = itmDBAccessLocal.getErrorString("", "VTNSUBCON", "");
} }
} }
} else
{
errString = itmDBAccessLocal.getErrorString("", "VTNSUBCON", "");
} }
} }
...@@ -116,6 +116,16 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -116,6 +116,16 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
// end if errstrng // end if errstrng
} catch (Exception e) } catch (Exception e)
{ {
if(conn!=null)
{
try {
conn.rollback();
} catch (SQLException ex) {
e.printStackTrace();
throw new ITMException(e);
}
}
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
...@@ -123,33 +133,22 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -123,33 +133,22 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
{ {
try try
{ {
if(errString != null && errString.trim().length() > 0) if(conn != null && !conn.isClosed())
{ {
System.out.println("--going to commit tranaction--"); conn.close();
if(errString.indexOf("VCNFSUC1") > -1) conn = null;
{
conn.commit();
System.out.println("--transaction commited--");
}
else
{
conn.rollback();
System.out.println("--transaction rollback--");
}
} }
if(rs != null)
if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
conn.close();
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -173,8 +172,6 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -173,8 +172,6 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
ResultSet rs = null; ResultSet rs = null;
int cnt = 0; int cnt = 0;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
//E12GenericUtility genericUtility= new E12GenericUtility();
try try
{ {
...@@ -220,6 +217,7 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -220,6 +217,7 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
if (cnt > 0) if (cnt > 0)
{ {
errString = itmDBAccessLocal.getErrorString("", "VTSTATSUBM", ""); errString = itmDBAccessLocal.getErrorString("", "VTSTATSUBM", "");
conn.commit();
} else } else
{ {
...@@ -231,38 +229,38 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -231,38 +229,38 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
// end if errstrng // end if errstrng
} catch (Exception e) } catch (Exception e)
{ {
if(conn!=null)
{
try {
conn.rollback();
} catch (SQLException ex) {
e.printStackTrace();
throw new ITMException(e);
}
}
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} finally } finally
{ {
try try
{ {
if (errString != null && errString.trim().length() > 0) if(conn != null && !conn.isClosed())
{ {
System.out.println("--going to commit tranaction--"); conn.close();
if (errString.indexOf("VTSTATSUBM") > -1) conn = null;
{
conn.commit();
System.out.println("--transaction commited--");
} else
{
conn.rollback();
System.out.println("--transaction rollback--");
}
} }
if(rs != null)
if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
conn.close();
} catch (Exception e) } catch (Exception e)
{ {
System.out.println("Exception : " + e); System.out.println("Exception : " + e);
......
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