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
/********************************************************
Title : SReturnAmd
Date : 09/01/12
Developer: Kunal Mandhre
********************************************************/
package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.util.*;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class SReturnAmd extends ValidatorEJB implements SReturnAmdLocal,SReturnAmdRemote
{
GenericUtility genericUtility = GenericUtility.getInstance();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
System.out.println("wfValData() called from SReturnEjb... ");
String errString = "";
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
System.out.println("Val xmlString :: " + xmlString);
System.out.println("Val xmlString1 :: " + xmlString1);
System.out.println("Val xmlString2 :: " + xmlString2 );
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0 )
{
dom2 = parseString("<Root>" + xmlString2+ "</Root>");
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams);
}
catch(Exception e)
{
throw new ITMException(e);
}
return(errString);
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String refId = "";
String siteCode = "";
String custCode = "";
String childNodeName = null;
String errString = "";
String errCode = "";
String userId = "";
String sql = "";
String errorType = "";
String tranDate = "";
Date refDate = null;
SimpleDateFormat sdf2 = new SimpleDateFormat("dd/mm/yy");
int cnt = 0;
int ctr=0;
int currentFormNo = 0;
int childNodeListLength;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
Connection conn = null;
PreparedStatement pstmt = null ;
ResultSet rs = null;
ConnDriver connDriver = new ConnDriver();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
System.out.println("Station Val Start");
try
{
conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if(objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch(currentFormNo)
{
case 1 :
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("ref_id"))//START
{
refId = checkNull(genericUtility.getColumnValue("ref_id", dom));
System.out.println("Ref Id="+refId);
if(refId == null || refId.trim().length() == 0)
{
System.out.println("REF ID BLANK");
errCode = "VMREFIDBK ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
else if(refId != null && refId.trim().length() > 0)
{
sql = "SELECT count(*) FROM SRETURN where tran_id = ? and status <> 'X'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
System.out.println("COUNT = "+cnt);
}
if(cnt == 0)
{
errCode = "VMREFIDCN";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT count(*) FROM SRETURN where tran_id = ? and status <> 'X' and confirmed = 'Y'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
System.out.println("COUNT = "+cnt);
}
if(cnt == 0)
{
errCode = "VMREFIDCON";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
sql = "SELECT count(*) FROM SRETURN where tran_id = ? and status <> 'X' and confirmed = 'Y' and ret_opt = 'R' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,refId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
System.out.println("COUNT = "+cnt);
}
if(cnt == 0)
{
errCode = "VMREFIDREP";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
}
/*else if(childNodeName.equalsIgnoreCase("tran_id"))
{
tranId = checkNull(genericUtility.getColumnValue("tran_id", dom));
System.out.println("TRAN Id="+tranId);
if(tranId == null || tranId.trim().length() == 0)
{
errCode = "VMTRANID";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}*/
else if(childNodeName.equalsIgnoreCase("tran_date"))
{
/*
try
{
tranDate = sdf2.parse(genericUtility.getColumnValue("tran_date", dom));
System.out.println("tranDate="+tranDate);
}
catch (Exception e)
{
errCode = "VMTRANDT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}*/
//tranDate = sdf2.parse(genericUtility.getColumnValue("tran_date", dom));
tranDate= genericUtility.getColumnValue("tran_date", dom);
//tranDate1 = getDate(genericUtility.getColumnValue("tran_date", dom));
//System.out.println("tranDate="+tranDate1);
if(tranDate == null)
{
errCode = "VMTRANDT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("ref_date"))
{
try
{
refDate = sdf2.parse(genericUtility.getColumnValue("ref_date", dom));
System.out.println("ref_date="+refDate);
}
catch (Exception e)
{
errCode = "VTSUBRRDN ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
/*
refDate = sdf2.parse(genericUtility.getColumnValue("ref_date", dom));
System.out.println("ref_date="+refDate);
if(refDate == null)
{
errCode = "VTSUBRRDN ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}*/
}
else if(childNodeName.equalsIgnoreCase("site_code"))
{
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
System.out.println("sitecode="+siteCode);
if(siteCode == null || siteCode.trim().length() == 0)
{
errCode = "VTMNULSITE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if(childNodeName.equalsIgnoreCase("cust_code"))
{
custCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
System.out.println("custCode="+custCode);
if(custCode == null || custCode.trim().length() == 0)
{
errCode = "VMCUSTCD ";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
}
int errListSize = errList.size();
cnt = 0;
String errFldName = null;
if(errList != null && errListSize > 0)
{
for(cnt = 0; cnt < errListSize; cnt ++)
{
errCode = errList.get(cnt);
errFldName = errFields.get(cnt);
System.out.println("errCode .........." + errCode);
System.out.println("errCode="+errCode);
System.out.println("errFldName="+errFldName);
System.out.println("userId="+userId);
errString = getErrorString(errFldName, errCode, userId);
errorType = errorType(conn , errCode);
if(errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
errString = "";
}
if(errorType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors> </Root> \r\n");
}
else
{
errStringXml = new StringBuffer("");
}
}
catch(Exception e)
{
e.printStackTrace();
errString = e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
errString = errStringXml.toString();
return errString;
}
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
System.out.println("itemChanged() SReturnAmd called ..........................");
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String valueXmlString = "";
try
{
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
if(xmlString2.trim().length() > 0)
{
dom2 = parseString(xmlString2);
}
valueXmlString = itemChanged(dom, dom1, dom2, objContext, currentColumn, editFlag, xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : [SReturnAmd][itemChanged( String, String )] :==>\n" + e.getMessage());
}
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
String refId = "";
String custCode = "";
String siteCode = "";
String descr = "";
String custName = "";
String lrNo = "";
String transMode = "";
String lorryNo = "";
String frtType = "";
String frtAmt = "";
String childNodeName = null;
String sql = "";
StringBuffer valueXmlString = new StringBuffer();
int ctr = 0;
int currentFormNo = 0;
Date today = new Date();
Date refDate = null;
Date lrDate = null;
SimpleDateFormat sdf2 = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver();
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
sdf2 = new SimpleDateFormat(genericUtility.getApplDateFormat());
if(objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>");
switch(currentFormNo)
{
case 1 :
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>");
int childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
valueXmlString.append("<tran_date>").append("<![CDATA[" + sdf2.format(today) + "]]>").append("</tran_date>");
}
else if(currentColumn.trim().equalsIgnoreCase("ref_id"))
{
refId = checkNull(genericUtility.getColumnValue("ref_id", dom));
System.out.println("Ref Id ="+refId);
sql = "select tran_date,(case when site_code is null then ' ' else site_code end) as site_code,"+
"(case when cust_code is null then ' ' else cust_code end) as cust_code,lr_date,"+
"(case when lr_no is null then ' ' else lr_no end) as lr_no,"+
"(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 from sreturn where tran_id = ?";
System.out.println("sql for tran date["+sql+"]");
pstmt =conn.prepareStatement(sql);
pstmt.setString(1,refId);
rs = pstmt.executeQuery();
if(rs.next())
{
refDate = rs.getDate("tran_date");
siteCode = rs.getString("site_code");
custCode = rs.getString("cust_code");
lrDate = rs.getDate("lr_date");
lrNo = rs.getString("lr_no");
transMode = rs.getString("trans_mode");
lorryNo = rs.getString("lorry_no");
frtType = rs.getString("frt_type");
frtAmt = rs.getString("frt_amt");
System.out.println("Value come ffrom item ch:");
System.out.println("ref id ="+refId);
System.out.println("ref date ="+refDate);
System.out.println("site code ="+siteCode);
System.out.println("cust code ="+custCode);
System.out.println("lr date "+lrDate);
System.out.println("lr no ="+lrNo);
System.out.println("trans mode ="+transMode);
System.out.println("lorry no ="+lorryNo);
System.out.println("frt type ="+frtType);
System.out.println("frt amd ="+frtAmt);
valueXmlString.append("<ref_date>").append("<![CDATA[" + sdf2.format(refDate) +"]]>").append("</ref_date>");
valueXmlString.append("<site_code>").append("<![CDATA[" + siteCode +"]]>").append("</site_code>");
valueXmlString.append("<cust_code>").append("<![CDATA[" + custCode +"]]>").append("</cust_code>");
if(lrDate != null)
{
valueXmlString.append("<lr_date__o>").append("<![CDATA[" + sdf2.format(lrDate) +"]]>").append("</lr_date__o>");
valueXmlString.append("<lr_date>").append("<![CDATA[" + sdf2.format(lrDate) +"]]>").append("</lr_date>");
}
else
{
valueXmlString.append("<lr_date__o>").append("<![CDATA[]]>").append("</lr_date__o>");
valueXmlString.append("<lr_date>").append("<![CDATA[]]>").append("</lr_date>");
}
valueXmlString.append("<lr_no__o>").append("<![CDATA[" + lrNo +"]]>").append("</lr_no__o>");
valueXmlString.append("<lr_no>").append("<![CDATA[" + lrNo +"]]>").append("</lr_no>");
valueXmlString.append("<trans_mode__o>").append("<![CDATA[" + transMode +"]]>").append("</trans_mode__o>");
valueXmlString.append("<trans_mode>").append("<![CDATA[" + transMode +"]]>").append("</trans_mode>");
valueXmlString.append("<lorry_no__o>").append("<![CDATA[" + lorryNo +"]]>").append("</lorry_no__o>");
valueXmlString.append("<lorry_no>").append("<![CDATA[" + lorryNo +"]]>").append("</lorry_no>");
valueXmlString.append("<frt_type>").append("<![CDATA[" + frtType +"]]>").append("</frt_type>");
valueXmlString.append("<frt_amt>").append("<![CDATA[" + frtAmt +"]]>").append("</frt_amt>");
valueXmlString.append("<frt_type__o>").append("<![CDATA[" + frtType +"]]>").append("</frt_type__o>");
valueXmlString.append("<frt_amt__o>").append("<![CDATA[" + frtAmt +"]]>").append("</frt_amt__o>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("SITE CODE="+siteCode);
sql = "select descr from site where site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1);
valueXmlString.append("<descr>").append("<![CDATA[" + descr +"]]>").append("</descr>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("CUST CODE="+custCode);
sql = "select cust_name from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
custName = rs.getString(1);
valueXmlString.append("<cust_name>").append("<![CDATA[" + custName +"]]>").append("</cust_name>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
/*else if(currentColumn.trim().equalsIgnoreCase("site_code"))
{
System.out.println("case for site code");
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
System.out.println("274 SiteCode"+siteCode);
sql = "select descr from site where site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(1);
valueXmlString.append("<site_descr>").append("<![CDATA[" + descr +"]]>").append("</site_descr>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
else if (currentColumn.trim().equalsIgnoreCase("cust_code"))
{
custCode = checkNull(genericUtility.getColumnValue("cust_code",dom));
System.out.println("Cusst Code="+custCode);
sql = "select cust_name from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
custName = rs.getString(1);
valueXmlString.append("<customer_cust_name>").append("<![CDATA[" + custName +"]]>").append("</customer_cust_name>");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}*/
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception ::"+ e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if(conn != null)
{
if(pstmt != null)
pstmt.close();
if(rs != null)
rs.close();
rs = null;
pstmt = null;
conn.close();
conn = null;
}
}
catch(Exception d)
{
d.printStackTrace();
}
}
return valueXmlString.toString();
}
private String checkNull(String input)
{
if(input == null)
{
input = "";
}
return input;
}
private Date getDate(String input)
{
try
{
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yy");
return (sdf.parse(input));
}
catch(Exception e)
{
return null;
}
}
private String errorType(Connection conn , String errorCode)
{
String msgType = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
try
{
String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,errorCode);
rs = pstmt.executeQuery();
while(rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
return msgType;
}
}
/********************************************************
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