Commit b422ad91 authored by dsawant's avatar dsawant

stock revaluation adjustment transaction updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94517 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 893b3cb5
This diff is collapsed.
package ibase.webitm.ejb.fin;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerEJB;
import java.sql.*;
import java.util.Map;
import java.util.StringTokenizer;
import javax.ejb.Stateless;
import java.rmi.RemoteException;
@Stateless
public class StockValAdjTranConf extends ActionHandlerEJB implements StockValAdjTranConfLocal,StockValAdjTranConfRemote {
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
System.out.println("--------------confirm method of StockValAdjTranConf ------------- : "+tranId);
String retString = "";
try
{
retString = confirmTran(tranId,xtraParams,forcedFlag);
}
catch(Exception e)
{
System.out.println("Exception :StockValAdjTranConf :confirm():" + e.getMessage() + ":");
retString = GenericUtility.getInstance().createErrorString(e);
e.printStackTrace();
}
return retString;
}
private String confirmTran(String tranId,String xtraParams,String forcedFlag)
{
System.out.println("---------Class : StockValAdjTranConf-->> confirm method called-----------");
ResultSet rs=null;
Connection conn=null;
String confirmed = "";
PreparedStatement pstmt=null;
String errString="",sql="";
ConnDriver ConnDriver = new ConnDriver();
int updCnt=0;
ITMDBAccessLocal itmdbAccess=new ITMDBAccessEJB();
try
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverValidator");
conn.setAutoCommit(false);
sql = "select confirmed from stock_val_adj WHERE tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if( rs.next() )
{
confirmed =rs.getString(1) == null ? "N":rs.getString(1);
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( rs != null )
{
rs.close();
rs = null;
}
if( confirmed != null && confirmed.equalsIgnoreCase("Y") )
{
System.out.println("transaction is already confirmmmm");
//if already confirm then show error
errString = itmdbAccess.getErrorString("", "VTALCONF", "", "", conn);
return errString;
}
GenericUtility genericUtility=new GenericUtility();
String loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
System.out.println("Login Code ------->> "+loginCode);
sql="update stock_val_adj set confirmed = ?,conf_date = ?, emp_code__aprv = ? where tran_id = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setDate(2, new java.sql.Date(System.currentTimeMillis()));
pstmt.setString(3,loginCode);
pstmt.setString(4, tranId);
updCnt=pstmt.executeUpdate();
if (updCnt > 0)
{
System.out.println("successfully confirmed");
conn.commit();
errString = itmdbAccess.getErrorString("", "VTCONSUCC", "", "", conn);
return errString;
}
}catch(SQLException se)
{
System.out.println("SQLException : class StockValAdjTranConf : ");
se.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e){
System.out.println("Exception : Occure during rollback........");e.printStackTrace();
}
}
catch(Exception e)
{
try
{
conn.rollback();
}
catch (Exception e1)
{
}
e.printStackTrace();
System.out.println("Exception Class [StockValAdjTranConf]::"+e.getMessage());
}
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn!=null)
{
conn.close();
conn=null;
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
System.out.println("[StockValAdjTranConf]errstring :"+errString);
return errString;
}
public int updateStockRateAsPerPriceListRate(Connection conn,Map<String,String> updateStockMap){
PreparedStatement pstmt=null;
String sql="";
int count=0;
try{
sql="update stock set rate = ? where item_code= ? and site_code = ? and loc_code = ? "
+ "and lot_no = ? and lot_sl = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setDouble(1,Double.parseDouble(updateStockMap.get("price_list_rate")));
pstmt.setString(2,updateStockMap.get("item_code"));
pstmt.setString(3,updateStockMap.get("site_code"));
pstmt.setString(4,updateStockMap.get("loc_code"));
pstmt.setString(5,updateStockMap.get("lot_no"));
pstmt.setString(6,updateStockMap.get("lot_sl"));
count=pstmt.executeUpdate();
}
catch(Exception e){
System.out.println("Exception in updateStockRateAsPerPriceListRate----------");
e.printStackTrace();
}
return count;
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
@Local
public interface StockValAdjTranConfLocal extends ActionHandlerLocal
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
import java.rmi.RemoteException;
@Remote
public interface StockValAdjTranConfRemote {
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
@Local
public interface StockValAdjTranLocal extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
@Remote
public interface StockValAdjTranRemote extends ValidatorRemote
{
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
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