Commit a3a8c646 authored by vdhoble's avatar vdhoble

add changes for D14LSUN009-Unfreezing Despatch Record


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97775 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d6439104
...@@ -214,6 +214,131 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D ...@@ -214,6 +214,131 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
//End of method actionHandler with three parameters //End of method actionHandler with three parameters
//**************Added by Vishakha For D14LSUN009 (Unfreezing Despatch) 06-APR-2015**************
public String actionHandlerUnfreeze(String tranId, String forcedFlag,String xtraParams) throws RemoteException,ITMException
{
String retString = "";
System.out.println("Call new method actionHandlerUnfreeze with three parameters");
System.out.println("Tran_ID="+tranId);
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String status="";
String confirmed="";
int upcount=0;
String sql="";
java.sql.Timestamp currDate=new java.sql.Timestamp(System.currentTimeMillis());
System.out.println("GET TIME===="+currDate);
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
try {
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
sql="SELECT STATUS,CONFIRMED FROM DESPATCH WHERE DESP_ID= ?";
// (STATUS='O' OR STATUS=NULL) AND (CONFIRMED='N' OR CONFIRMED=NULL) AND;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if ( rs.next() )
{
status = rs.getString("STATUS");
confirmed = rs.getString("CONFIRMED");
}
status =((status==null)?"":status.trim());
confirmed =((confirmed==null)?"":confirmed.trim());
rs.close();
rs=null;
pstmt.close();
pstmt=null;
if ((status.equalsIgnoreCase("H") || status.equalsIgnoreCase("")) && (confirmed.equalsIgnoreCase("N") || confirmed.equalsIgnoreCase("")) )
{
sql="UPDATE DESPATCH SET STATUS='O',status_date= ? WHERE DESP_ID= ?";
pstmt =conn.prepareStatement(sql);
pstmt.setTimestamp(1,currDate);
pstmt.setString(2,tranId);
upcount =pstmt.executeUpdate();
pstmt.close();
pstmt=null;
if(upcount>0){
retString = itmDBAccess.getErrorString("","VTDESREL ","","",conn);//depatch released successfully
}
}
else
{
retString = itmDBAccess.getErrorString("","INVTRHLD","","",conn);//invalid status transaction should be unconfirmed
}
}
catch(SQLException e)
{
System.out.println("Exception : Dispatch : actionHandlerUnfreeze " +e.getMessage());
try {
conn.rollback();
} catch (SQLException e1) {
e1.printStackTrace();
}
throw new ITMException(e);
}
catch (Exception e)
{
System.out.println("Exception : Dispatch : actionHandlerUnfreeze " +e.getMessage());
try {
conn.rollback();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
throw new ITMException(e);
}
finally
{
try
{
if(conn!=null)
{
if(upcount>0)
{
conn.commit();
}
conn.close();
conn = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if( rs != null)
{
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.out.println("Exception :Dispatch :actionHandlerUnfreeze(String xmlString):" + e.getMessage() + ":");
throw new ITMException(e);
}
}
return retString;
}
//*********END of Unfreeze method**************
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException
{ {
Document dom = null; Document dom = null;
......
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