Commit 8f5a88e7 authored by rtiwari's avatar rtiwari

inv hold rel gen process


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93046 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 924739aa
/* develop by Ritesh on 08/05/13
purpose : set default value in inv hold process */
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.rmi.RemoteException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import javax.ejb.Stateless; // added for ejb3
import java.text.SimpleDateFormat;
import java.util.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@Stateless // added for ejb3
public class IncHoldRelGenIC extends ValidatorEJB implements IncHoldRelGenICLocal,IncHoldRelGenICRemote
{
public String itemChanged(String xmlString,String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
System.out.println("@@@@@@@ default itemChanged called");
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String valueXmlString = "";
try
{
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
dom2 = parseString(xmlString2);
valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : [TrainingEJB][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
{
System.out.println("@@@@@@@ itemChanged called");
StringBuffer valueXmlString = new StringBuffer();
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null ;
String childNodeName = null;
GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver();
int currentFormNo =0;
int childNodeListLength = 0;
int ctr=0;
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver=null;
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext.trim());
}
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
System.out.println("**********ITEMCHANGE FOR CASE"+currentFormNo+"**************");
switch(currentFormNo)
{
case 1:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail1>");
childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDate = sdf.format(currentDate.getTime());
System.out.println("Now the date is :=> " + sysDate);
valueXmlString.append( "<tran_id__from><![CDATA[" ).append( "00").append( "]]></tran_id__from>\r\n" );
valueXmlString.append( "<tran_id__to><![CDATA[" ).append("ZZ").append( "]]></tran_id__to>\r\n" );
valueXmlString.append( "<ref_id__from><![CDATA[" ).append( "00").append( "]]></ref_id__from>\r\n" );
valueXmlString.append( "<ref_id__to><![CDATA[" ).append("ZZ").append( "]]></ref_id__to>\r\n" );
valueXmlString.append( "<lock_code__from><![CDATA[" ).append( "00").append( "]]></lock_code__from>\r\n" );
valueXmlString.append( "<lock_code__to><![CDATA[" ).append("ZZ").append( "]]></lock_code__to>\r\n" );
valueXmlString.append( "<auto_confirmed><![CDATA[" ).append("Yes").append( "]]></auto_confirmed>\r\n" );
}
valueXmlString.append("</Detail1>");
}
valueXmlString.append("</Root>");
}// end try
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception ::"+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();
}
}
return valueXmlString.toString();
}
}
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 // added for ejb3
public interface IncHoldRelGenICLocal extends ValidatorLocal
{
public String wfValData() throws RemoteException,ITMException;
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() 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.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Remote;
@Remote // added for ejb3
public interface IncHoldRelGenICRemote extends ValidatorRemote
{
public String wfValData() throws RemoteException,ITMException;
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() 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;
}
\ No newline at end of file
......@@ -22,15 +22,18 @@ public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, Inv
DistCommon distCommonObj = new DistCommon();
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
@Override
public String process() throws RemoteException,ITMException
{
return "";
}
//getData Method
@Override
public String process(Document dom, Document dom2, String windowName,
String xtraParams) throws RemoteException, ITMException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException
{
......@@ -87,7 +90,7 @@ public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, Inv
StringBuffer retTabSepStrBuff = new StringBuffer();
int cnt=0,count=0,i=5;
String sql="";
String tranIdFrom = "",tranIdTo="",refIdFrom="",refIdTo="",autoConfirmed="",schRelDateFromstr="",schRelDateTostr="";
String lockCodeFrom = "",lockCodeTo = "",tranIdFrom = "",tranIdTo="",refIdFrom="",refIdTo="",autoConfirmed="",schRelDateFromstr="",schRelDateTostr="";
Timestamp schRelDateFrom=null,schRelDateTo=null;
......@@ -115,6 +118,8 @@ public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, Inv
schRelDateTostr = genericUtility.getColumnValue("sch_rel_date__to",headerDom);
refIdFrom = genericUtility.getColumnValue("ref_id__from",headerDom);
refIdTo = genericUtility.getColumnValue("ref_id__to",headerDom);
lockCodeFrom = genericUtility.getColumnValue("lock_code__from",headerDom); //added by Ritesh on 08/05/13
lockCodeTo = genericUtility.getColumnValue("lock_code__to",headerDom); //added by Ritesh on 08/05/13
autoConfirmed = genericUtility.getColumnValue("auto_confirmed",headerDom);
......@@ -137,7 +142,8 @@ public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, Inv
System.out.println("refIdFrom =>"+refIdFrom);
System.out.println("refIdTo =>"+refIdTo);
System.out.println("autoConfirmed =>"+autoConfirmed);
System.out.println("lockCodeFrom=>"+lockCodeFrom); //added by Ritesh on 08/05/13
System.out.println("lockCodeTo=>"+lockCodeTo); //added by Ritesh on 08/05/13
if ( tranIdFrom == null || tranIdFrom.trim().length() == 0 )
{
System.out.println("tran id from is Null...");
......@@ -304,9 +310,9 @@ public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, Inv
" case when ihd.hold_status is null then 'H' else ihd.hold_status end as hold_status ," +
" ihd.item_code,ihd.loc_code,ihd.site_code,ihd.status_date,ihd.reas_code,ihd.sch_rel_date," +
" ih.ref_id,ih.confirmed from inv_hold_det ihd,inv_hold ih where ( ihd.tran_id = ih.tran_id )" +
" and ( ihd.tran_id >= ? and ihd.tran_id <= ? ) and ( ihd.sch_rel_date between ? and ? )" +
" and ihd.hold_status <> 'R' ";
" and ( ihd.tran_id >= ? and ihd.tran_id <= ? ) and ( ih.lock_code >= ? and ih.lock_code <= ? )" +
" and ( ihd.sch_rel_date between ? and ? ) and ihd.hold_status <> 'R' ";
//and ( ihd.lock_code between ? and ? )
if(refIdFrom != null )
{
getDataSql = getDataSql + " and ( ih.ref_id >= ? or ih.ref_id is null ) ";
......@@ -324,8 +330,10 @@ public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, Inv
pstmt = conn.prepareStatement(getDataSql);
pstmt.setString(1,tranIdFrom);
pstmt.setString(2,tranIdTo);
pstmt.setTimestamp(3,schRelDateFrom);
pstmt.setTimestamp(4,schRelDateTo);
pstmt.setString(3,lockCodeFrom); //added by Ritesh on 08/05/13
pstmt.setString(4,lockCodeTo); //added by Ritesh on 08/05/13
pstmt.setTimestamp(5,schRelDateFrom);
pstmt.setTimestamp(6,schRelDateTo);
if(refIdFrom != null )
{
......@@ -683,7 +691,7 @@ public String process(String xmlString, String xmlString2, String windowName, St
if("Y".equalsIgnoreCase(autoConfirmed))
{
InvHoldRelConf invHoldRelConf = new InvHoldRelConf();
errString = invHoldRelConf.confirm(tranIdGenerate,xtraParams, "N" , conn,false);
errString = invHoldRelConf.confirm(tranIdGenerate,xtraParams, "N" , conn);
invHoldRelConf = null;
if (errString.indexOf("VTCNFSUCC") > -1)
{
......@@ -843,4 +851,6 @@ private String generateTranId( String windowName, String siteCode, String tranDa
return tranId;
}
}
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