Commit 86091bf9 authored by msharma's avatar msharma

Sales Return Amendment Transaction Done by Kunal


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91647 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7647b52a
This diff is collapsed.
/********************************************************
Title : SReturnAmdConf
Date : 04/03/2012
Author: Kunal
********************************************************/
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.*;
import java.sql.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless;
import java.util.Date;
@Stateless
public class SReturnAmdConf extends ActionHandlerEJB implements SReturnAmdConfLocal,SReturnAmdConfRemote
{
public String actionHandler() throws RemoteException,ITMException
{
//System.out.println("item actionHandler() called.............");
return "";
}
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException, ITMException
{
//System.out.println("item actionHandler(...) called............");
String str = "";
System.out.println("actionType---"+actionType);
System.out.println("xmlString---"+xmlString);
System.out.println("objContext---"+objContext);
System.out.println("xtraParams---"+xtraParams);
return str;
}
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
System.out.println("SReturnAmd confirm called..............");
String lrNo = "";
String transMode = "";
String lorryNo = "";
String frtType = "";
String refId = "";
String confirmed = "";
String sql = "";
String sql1 = "";
int status = 0;
double frtAmt = 0.0;
Date lrDate = null;
Connection conn = null;
PreparedStatement pstmt = null;
PreparedStatement pstmt1 = null;
ITMDBAccessEJB itmDBAccessEJB = null;
String errString = null;
ResultSet rs = null;
ResultSet rs1 = null;
System.out.println("Confirm Action Called for Train Id =:::"+tranId);
try
{
itmDBAccessEJB = new ITMDBAccessEJB();
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
if( errString == null || errString.trim().length() == 0 )
{
sql1 = "select (case when confirmed is null then 'N' else confirmed end)AS confirmed from sreturn_amd where tran_id = ?";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1,tranId);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
System.out.println("Tranc Check ");
confirmed = rs1.getString("confirmed");
System.out.println("confirmed ="+confirmed);
if(confirmed.equals("Y"))
{
System.out.println("Not Update");
errString = itmDBAccessEJB.getErrorString("","VTCONF8 ","","",conn);
}
else
{
System.out.println("Update");
sql = "select (case when lr_no is null then ' ' else lr_no end)AS lr_no,lr_date,(case when trans_mode is null then ' ' else trans_mode end)AS trans_mode,(case when lorry_no is null then ' ' else lorry_no end)as lorry_no,(case when frt_type is null then ' 'else frt_type end)as frt_type,(case when frt_amt is null then 0 else frt_amt end)as frt_amt,ref_id from sreturn_amd where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
System.out.println("Inside REsult");
lrNo = rs.getString("lr_no");
lrDate = rs.getDate("lr_date");
transMode = rs.getString("trans_mode");
lorryNo = rs.getString("lorry_no");
frtType = rs.getString("frt_type");
frtAmt = rs.getDouble("frt_amt");
refId = rs.getString("ref_id");
System.out.println("LrNO="+lrNo);
System.out.println("LrDate="+lrDate);
System.out.println("transMode="+transMode);
System.out.println("lorryNO="+lorryNo);
System.out.println("Frt Type="+frtType);
System.out.println("Frt Amt="+frtAmt);
System.out.println("Ref Id ="+refId);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
//
sql = "update SRETURN set LR_NO = ? ,LR_DATE = ? ,LORRY_NO= ? ,TRANS_MODE= ?,FRT_TYPE =?,FRT_AMT = ? WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lrNo);
if(lrDate == null)
{
pstmt.setDate(2,null);
}
else
{
pstmt.setDate(2,new java.sql.Date(lrDate.getTime()));
}
pstmt.setString(3,lorryNo);
pstmt.setString(4, transMode);
pstmt.setString(5, frtType);
pstmt.setDouble(6, frtAmt);
pstmt.setString(7, refId);
status = pstmt.executeUpdate();
System.out.println("nO OF ROWS UPADTE="+status);
conn.commit();
pstmt.close();
pstmt = null;
if(status == 1)
{
sql = "update sreturn_amd set confirmed = 'Y',conf_date = sysdate where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
System.out.println("nO OF transaction conf is ="+pstmt.executeUpdate());
//conn.commit();
pstmt.close();
pstmt = null;
errString = itmDBAccessEJB.getErrorString("","VMSRETAMDC","","",conn);
}
}
}
pstmt1.close();
pstmt1 = null;
rs1.close();
rs1 = null;
}
}
catch( Exception e)
{
if(conn!=null)
{
try {
conn.rollback();
} catch (SQLException ex) {
Logger.getLogger(SReturnAmdConf.class.getName()).log(Level.SEVERE, null, ex);
}
}
e.printStackTrace();
}
finally
{
if(conn!=null)
{
try {
conn.commit();
conn.close();
conn = null;
} catch (SQLException ex) {
Logger.getLogger(SReturnAmdConf.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
return errString;
}
}
\ No newline at end of file
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface SReturnAmdConfLocal extends ActionHandlerLocal
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface SReturnAmdConfRemote extends ActionHandlerRemote
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
@Local
public interface SReturnAmdLocal extends ValidatorRemote
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface SReturnAmdRemote extends ValidatorRemote
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) 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