Commit 72f53ebd authored by caluka's avatar caluka

open () is added for open rejected transactions[F14ISUN014]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98651 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9f6ca7eb
...@@ -25,14 +25,16 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -25,14 +25,16 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
public String confirm(String tranId, String xtraParams, String forcedFlag)throws RemoteException, ITMException public String confirm(String tranId, String xtraParams, String forcedFlag)throws RemoteException, ITMException
{ {
System.out.println(">>>>>>>>>>>>>>>>>>EcollectionConf confirm called>>>>>>>>>>>>>>>>>>>"); System.out.println(">>>>>>>>>>>>>>>>>>EcollectionConf confirm called>>>>>>>>>>>>>>>>>>>");
String confirmed = ""; String confirmed = "",siteCode="",bankCode="";
String sql = ""; String sql = "";
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
String errString = null; String errString = null;
ResultSet rs = null; ResultSet rs = null;
String loginEmpCode="",status="",refNo=""; String loginEmpCode="",status="",refNo="",tranIdRcp="",custCode="";
int cnt = 0; int cnt = 0;
int rcpformCnt=0,rcpCnt=0;
Timestamp rfDate=null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
Timestamp sysDate = null; Timestamp sysDate = null;
E12GenericUtility genericUtility= new E12GenericUtility(); E12GenericUtility genericUtility= new E12GenericUtility();
...@@ -49,7 +51,7 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -49,7 +51,7 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
{ {
System.out.println("@@@@@tranId"+tranId+"]"); System.out.println("@@@@@tranId"+tranId+"]");
sql = " select confirmed,status,ref_no from receipt_form where tran_id = ? "; sql = " select confirmed,status,ref_no,site_code,bank_code,cust_code,ref_date from receipt_form where tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -59,6 +61,10 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -59,6 +61,10 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
confirmed = rs.getString("confirmed"); confirmed = rs.getString("confirmed");
status = rs.getString("status"); status = rs.getString("status");
refNo = rs.getString("ref_no"); refNo = rs.getString("ref_no");
siteCode = rs.getString("site_code");
bankCode = rs.getString("bank_code");
custCode = rs.getString("cust_code");
rfDate = rs.getTimestamp("ref_date");
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -69,11 +75,87 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -69,11 +75,87 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
if (refNo == null || refNo.trim().length() == 0) if (refNo == null || refNo.trim().length() == 0)
{ {
errString = itmDBAccessLocal.getErrorString("", "VTNULREFNO", ""); errString = itmDBAccessLocal.getErrorString("", "VTNULREFNO", "");
}else if (rfDate == null)
{
errString = itmDBAccessLocal.getErrorString("", "VTNULREFDT", "");
} else } else
{ {
sql = " select count(*) as cnt from receipt_form where site_code = ? and bank_code=? and ref_no=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, bankCode);
pstmt.setString(3, refNo);
rs = pstmt.executeQuery();
if (rs.next())
{
rcpformCnt = rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
if( rcpformCnt > 1 )
{
errString = itmDBAccessLocal.getErrorString("", "VTINVREF", "");
return errString;
}
sql = "select tran_id from receipt where cust_code=? and ref_no=? and ref_date=? and tran_id <> ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, refNo);
pstmt.setTimestamp(3, rfDate);
pstmt.setString(4, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
tranIdRcp=checkNull(rs.getString("tran_id"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (tranIdRcp != null && tranIdRcp.trim().length()>0)
{
/**
* Existing receipt found
* for above combination
* check the record from table rcpdishnr
* where receipt_no=tranIdRcp
* */
sql = "select count(*) as cnt from rcpdishnr where receipt_no=? and confirmed='N' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranIdRcp);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt=rs.getInt("cnt");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("@V@ Dishponer cnt :- ["+cnt+"]");
if(cnt==0)
{
/**
* Unconfirmed record found
* ERROR (Duplicate utr_no found)
* */
errString = itmDBAccessLocal.getErrorString("", "VTUTRDUPL", "");
return errString;
}
}
System.out.println("@V@ Tran id receipt :- ["+tranIdRcp+"]");
if ("Y".equalsIgnoreCase(confirmed)) if ("Y".equalsIgnoreCase(confirmed))
{ {
errString = itmDBAccessLocal.getErrorString("", "VTINVCONF2", ""); errString = itmDBAccessLocal.getErrorString("", "VTINVCONF2", "");
return errString;
} else } else
{ {
...@@ -84,9 +166,6 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -84,9 +166,6 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
System.out.println("Now the date is :=> " + sysDateStr); System.out.println("Now the date is :=> " + sysDateStr);
sysDate = Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0"); 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);
...@@ -272,4 +351,118 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf ...@@ -272,4 +351,118 @@ public class EcollectionConf extends ActionHandlerEJB implements EcollectionConf
return errString; return errString;
} }
public String open(String tranId, String xtraParams, String forcedFlag)throws RemoteException, ITMException
{
System.out.println(">>>>>>>>>>>>>>>>>>EcollectionConf open called>>>>>>>>>>>>>>>>>>>");
String sql = "",status="";
Connection conn = null;
PreparedStatement pstmt = null;
String errString = null;
ResultSet rs = null;
int cnt = 0;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
try
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
if (tranId != null && tranId.trim().length() > 0)
{
System.out.println("tranId>>>["+tranId+"]");
sql = " select status from receipt_form where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
status = rs.getString("status");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if ("R".equalsIgnoreCase(status))
{
sql = " update receipt_form set status = 'E' where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
cnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
if (cnt > 0)
{
conn.commit();
errString = itmDBAccessLocal.getErrorString("", "VTECOLOPEN", "");
}
}else
{
errString = itmDBAccessLocal.getErrorString("","VTECNOTREJ","");
}
}
// end if errstrng
} catch (Exception e)
{
if(conn!=null)
{
try {
conn.rollback();
} catch (SQLException ex) {
e.printStackTrace();
throw new ITMException(e);
}
}
e.printStackTrace();
throw new ITMException(e);
} finally
{
try
{
if(conn != null && !conn.isClosed())
{
conn.close();
conn = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
} catch (Exception e)
{
System.out.println("Exception : " + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return errString;
}
private String checkNull(String str)
{
if(str == null)
{
return "";
}
else
{
return str ;
}
}
} }
\ No newline at end of file
...@@ -19,5 +19,6 @@ public interface EcollectionConfLocal extends ActionHandlerLocal ...@@ -19,5 +19,6 @@ public interface EcollectionConfLocal extends ActionHandlerLocal
{ {
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException; public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String submit(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException; public String submit(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String open(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
} }
...@@ -17,4 +17,5 @@ public interface EcollectionConfRemote extends ActionHandlerRemote ...@@ -17,4 +17,5 @@ public interface EcollectionConfRemote extends ActionHandlerRemote
{ {
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException; public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String submit(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException; public String submit(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String open(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
} }
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