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,15 +64,16 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -64,15 +64,16 @@ 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",""); if (refNo == null || refNo.trim().length() == 0)
} {
else errString = itmDBAccessLocal.getErrorString("", "VTNULREFNO", "");
} else
{ {
if ("Y".equalsIgnoreCase(confirmed)) if ("Y".equalsIgnoreCase(confirmed))
{ {
errString = itmDBAccessLocal.getErrorString("","VTINVCONF2",""); errString = itmDBAccessLocal.getErrorString("", "VTINVCONF2", "");
} else } else
{ {
...@@ -85,8 +86,7 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -85,8 +86,7 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
System.out.println(">>>>>>>>sysDate:" + sysDate); System.out.println(">>>>>>>>sysDate:" + sysDate);
System.out.println(">>>>>>>>loginEmpCode:" + loginEmpCode); System.out.println(">>>>>>>>loginEmpCode:" + loginEmpCode);
if ("S".equalsIgnoreCase(status))
{
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,25 +97,35 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -97,25 +97,35 @@ 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 } else
{ {
errString = itmDBAccessLocal.getErrorString("", "VTNSUBCON", ""); errString = itmDBAccessLocal.getErrorString("", "VTNSUBCON", "");
} }
} }
}
}
// 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,22 +133,11 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -123,22 +133,11 @@ 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--");
if(errString.indexOf("VCNFSUC1") > -1)
{ {
conn.commit(); conn.close();
System.out.println("--transaction commited--"); conn = null;
}
else
{
conn.rollback();
System.out.println("--transaction rollback--");
}
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
...@@ -148,8 +147,8 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -148,8 +147,8 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
{ {
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