Commit b2d6ed7a authored by manohar's avatar manohar

This commit was generated by cvs2svn to compensate for changes in r106,

which included commits to RCS files with non-trunk default branches.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91171 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ed01a83f
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.lang.String;
import java.sql.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import java.util.HashMap;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class PurcRetnUpdateAllocPos extends ValidatorEJB implements PurcRetnUpdateAllocPosLocal,PurcRetnUpdateAllocPosRemote //SessionBean
{
/*public void ejbCreate() throws RemoteException, CreateException
{
System.out.println("ejbCreate() method calling........");
}
public void ejbRemove()
{
System.out.println("ejbRemeove() method calling........");
}
public void ejbActivate()
{
System.out.println("ejbActivate() method calling........");
}
public void ejbPassivate()
{
System.out.println("ejbPassivate() method calling........");
}*/
public String postSaveRec()throws RemoteException,ITMException
{
return "";
}
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException
{
Document dom = null;
System.out.println("PurcRetnUpdateAllocPosEJB called");
//System.out.println("xmlString1 called"+xmlString1);
System.out.println("domId called"+domId);
try
{
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
executepostSaveRec(dom,domId,objContext,editFlag,xtraParams,conn);
}
}
catch(Exception e)
{
System.out.println("Exception :PurcRetnUpdateAllocPosEJB ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return "";
}
private String executepostSaveRec(Document dom, String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException
{
HashMap hashMap = new HashMap();
String lineNo = "", tranId = "", tranSer = "P-RET", line = "", updateStatus = "";
String siteCode = "", itemCode = "", quantity = "", locCode = "", lotNo = "", lotSl = "";
String errInvAllocTrace = ""; // add on 09/10/09
//DistStkUpdLocal distStkUpd = null; // comment on 09/10/09
NodeList hdrDom = null;
Node currDetail = null;
try
{
//distStkUpd = getComponent("DistStkUpd"); // comment on 09/10/09
InvAllocTraceBean invAllocTraceBean = null;
hdrDom = dom.getElementsByTagName("Detail1");
siteCode = GenericUtility.getInstance().getColumnValueFromNode("site_code",hdrDom.item(0));
tranId = GenericUtility.getInstance().getColumnValueFromNode("tran_id",hdrDom.item(0));
System.out.println("tran_id : " + tranId);
currDetail = getCurrentDetailFromDom(dom,domID);
updateStatus = getCurrentUpdateFlag(currDetail);
System.out.println("updateStatus[[[["+updateStatus);
if (currDetail != null && !updateStatus.equalsIgnoreCase("D"))
{
itemCode = GenericUtility.getInstance().getColumnValueFromNode("item_code",currDetail);
locCode = GenericUtility.getInstance().getColumnValueFromNode("loc_code",currDetail);
lotNo = GenericUtility.getInstance().getColumnValueFromNode("lot_no",currDetail);
lotSl = GenericUtility.getInstance().getColumnValueFromNode("lot_sl",currDetail);
quantity = GenericUtility.getInstance().getColumnValueFromNode("quantity",currDetail);
lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
System.out.println("lineNo :"+lineNo+" itemCode :"+itemCode+" locCodeFr :"+locCode+" lotNoFr :"+lotNo+" lotSlFr :"+lotSl+" quantity :"+quantity);
String stlOption = chkStockOption(itemCode, siteCode);
System.out.println("stlOption :"+stlOption);
if (!stlOption.equals("0"))
{
if (quantity == null)
{
quantity = "0.000";
}
hashMap.put("tran_date", new java.sql.Date(System.currentTimeMillis()));
hashMap.put("ref_ser",tranSer);
hashMap.put("ref_id", tranId);
hashMap.put("ref_line", lineNo);
hashMap.put("item_code", itemCode);
hashMap.put("site_code", siteCode);
hashMap.put("loc_code",locCode);
hashMap.put("lot_no",lotNo);
hashMap.put("lot_sl",lotSl);
hashMap.put("alloc_qty", new Double(quantity.trim().length() == 0?"0":quantity));
hashMap.put("chg_win","W_PRETURN");
hashMap.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
hashMap.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams, "termId"));
//Calling DistStkUpdEJB
//connent on 09/10/09
/*
System.out.println("Calling DistStkUpdEJB.....");
if (distStkUpd.updAllocTrace(hashMap, conn) > 0)
{
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
}
*/
invAllocTraceBean = new InvAllocTraceBean();
errInvAllocTrace = invAllocTraceBean.updateInvallocTrace(hashMap, conn);
if(errInvAllocTrace.trim().length()>0)
{
System.out.println("invAllocTraceBeanupdateInvallocTrace(hashMap, conn) : Sucessuful");
}
// end of code
}//end if
}//end if
}//end try
catch(Exception e)
{
System.out.println("Exception : PurcRetnUpdateAllocPosEJB : actionHandler :" +e.getMessage());
throw new ITMException(e);
}
return "";
}
private String chkStockOption(String itemCode, String siteCode)throws RemoteException,ITMException
{
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null ;
ResultSet rs = null;
String sql = "", stkOption = "";
ConnDriver connDriver = new ConnDriver();
try
{
conn = connDriver.getConnectDB("DriverITM");
//stmt = conn.createStatement();
sql = "SELECT CASE WHEN STK_OPT IS NULL THEN 'N' ELSE STK_OPT END "
+"FROM SITEITEM "
+"WHERE ITEM_CODE = ? "
+"AND SITE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,siteCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stkOption = rs.getString(1);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
if (stkOption == null || stkOption.equals("N"))
{
sql = "SELECT CASE WHEN STK_OPT IS NULL THEN '0' ELSE STK_OPT END "
+"FROM ITEM "
+"WHERE ITEM_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = stmt.executeQuery(sql);
if (rs.next())
{
stkOption = rs.getString(1);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}//end if
}//end try
catch(SQLException e)
{
throw new ITMException(e);
}
catch(Exception e)
{
throw new ITMException(e);
}
finally
{
try
{
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
}
}
return stkOption;
}
private Node getCurrentDetailFromDom(Document dom,String domId)
{
NodeList detailList = null;
Node currDetail = null,reqDetail = null;
String currDomId = "";
int detailListLength = 0;
detailList = dom.getElementsByTagName("Detail2");
detailListLength = detailList.getLength();
System.out.println("detailListLength[[["+detailListLength);
System.out.println("domId[[["+domId);
for (int ctr = 0;ctr < detailListLength;ctr++)
{
currDetail = detailList.item(ctr);
currDomId = currDetail.getAttributes().getNamedItem("domID").getNodeValue();
if (currDomId.equals(domId))
{
reqDetail = currDetail;
break;
}
}
return reqDetail;
}
private String getCurrentUpdateFlag(Node currDetail)
{
NodeList currDetailList = null;
String updateStatus = "",nodeName = "";
int currDetailListLength = 0;
currDetailList = currDetail.getChildNodes();
currDetailListLength = currDetailList.getLength();
for (int i=0;i< currDetailListLength;i++)
{
nodeName = currDetailList.item(i).getNodeName();
if (nodeName.equalsIgnoreCase("Attribute"))
{
updateStatus = currDetailList.item(i).getAttributes().getNamedItem("updateFlag").getNodeValue();
break;
}
}
return updateStatus;
}
/*private DistStkUpdLocal getComponent(String componentName)throws Exception
{
DistStkUpdLocal comp = null;
try
{
System.out.println("Looking For Component.... :: " + componentName);
AppConnectParm appConnect = new AppConnectParm();
java.util.Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
comp = (DistStkUpdLocal)ctx.lookup("ibase/DistStkUpd/local"); // for ejb3
//comp = distStkUpdHome.create();
System.out.println(componentName+" Found.....");
}
catch(Exception e)
{
throw e;
}
return comp;
}*/
}
\ No newline at end of file
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.sql.Connection;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ValidatorLocal;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface PurcRetnUpdateAllocPosLocal extends ValidatorLocal //, EJBObject
{
public String postSaveRec()throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.dis;
import java.rmi.RemoteException;
import java.sql.Connection;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ValidatorRemote;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface PurcRetnUpdateAllocPosRemote extends ValidatorRemote //, EJBObject
{
public String postSaveRec()throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
This diff is collapsed.
package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ValidatorLocal;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface PurcRetnUpdateAllocPrsLocal extends ValidatorLocal //, EJBObject
{
public String preSaveRec()throws RemoteException,ITMException;
public String preSaveRec(String xmlString,String xmlString1,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.dis;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ValidatorRemote;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface PurcRetnUpdateAllocPrsRemote extends ValidatorRemote //, EJBObject
{
public String preSaveRec()throws RemoteException,ITMException;
public String preSaveRec(String xmlString,String xmlString1,String objContext,String editFlag, String xtraParams, Connection conn)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