Commit c5ab095c authored by manohar's avatar manohar

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

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

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91688 ce508802-f39f-4f6c-b175-0d175dae99d5
parent dd7e6850
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import javax.ejb.*;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.dis.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class WoEnchPos extends ValidatorEJB implements WoEnchPosLocal, WoEnchPosRemote //SessionBean
{
/*public void ejbCreate() throws RemoteException, CreateException
{ }
public void ejbRemove()
{ }
public void ejbActivate()
{ }
public void ejbPassivate()
{ }*/
public String postSave() throws RemoteException,ITMException
{
return "";
}
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException
{
System.out.println("WoEnchPosEJB called");
Document dom = null;
String errString = "";
try
{
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
errString = executePostSaveRec(dom,domId,objContext,editFlag,xtraParams, windowName, conn);
}
}
catch(Exception e)
{
System.out.println("Exception :WoEnchPosEJB ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}
private String executePostSaveRec(Document dom, String domID,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException
{
Statement stmt = null;
ResultSet rs = null;
String siteCodeReq = "", itemCode = "", lineNo = "",locCode = "", lotNo = "", lotSl = "";
String sql = "", line = "", errString = "";
HashMap strAllocate = null;
double quantity = 0d;
int updateCnt = 0, retVal = 0;
java.sql.Date tranDate = null;
String updateStatus = "",quantityStr = "",tranId = "";
NodeList hdrDom = null;
Node currDetail = null;
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
try
{
stmt = conn.createStatement();
tranDate = new java.sql.Date(System.currentTimeMillis());
System.out.println("\n tranDate :"+tranDate);
hdrDom = dom.getElementsByTagName("Detail1");
siteCodeReq = GenericUtility.getInstance().getColumnValueFromNode("site_code",hdrDom.item(0));
tranId = GenericUtility.getInstance().getColumnValueFromNode("tran_id",hdrDom.item(0));
System.out.println("\n tranId :"+tranId);
currDetail = getCurrentDetailFromDom(dom,domID);
updateStatus = getCurrentUpdateFlag(currDetail);
System.out.println("updateStatus :: "+updateStatus);
if (currDetail != null && !updateStatus.equalsIgnoreCase("D"))
{
lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
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);
quantityStr = GenericUtility.getInstance().getColumnValueFromNode("quantity",currDetail);
quantity = Double.parseDouble(quantityStr);
line = " " + lineNo;
System.out.println("line :"+line);
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","W-ENH");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",line.substring(line.length()-3));
strAllocate.put("site_code",siteCodeReq);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win",windowName);
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
System.out.println("errString ::: " + errString);
if (errString == "")
{
System.out.println("invAllocTrace.updateInvallocTrace : Sucessuful!");
}
}
}//try end
catch (SQLException sqx)
{
System.out.println("The SQLException occurs in WoEnchPosEJB :"+sqx);
sqx.printStackTrace();
errString = "ERROR";
throw new ITMException(sqx);
}
catch(Exception e)
{
System.out.println("The SQLException occurs in WoEnchPosEJB :"+e);
e.printStackTrace();
errString = "ERROR";
throw new ITMException(e);
}
finally
{
try
{
if(stmt != null)
{
stmt.close();
stmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.err.println("Exception :WoEnchPosEJB:\n"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}
//return errString;
}
private Node getCurrentDetailFromDom(Document dom,String domId) throws Exception
{
NodeList detailList = null;
Node currDetail = null,reqDetail = null;
String currDomId = "";
int detailListLength = 0;
try
{
detailList = dom.getElementsByTagName("Detail2");
detailListLength = detailList.getLength();
for (int ctr = 0;ctr < detailListLength;ctr++)
{
currDetail = detailList.item(ctr);
currDomId = currDetail.getAttributes().getNamedItem("domID").getNodeValue();
if (currDomId.equals(domId))
{
reqDetail = currDetail;
break;
}
}
}
catch(Exception e)
{
System.out.println("The Exception occurs in WoEnchPosEJB :"+e);
e.printStackTrace();
throw new ITMException(e);
}
return reqDetail;
}
private String getCurrentUpdateFlag(Node currDetail) throws Exception
{
NodeList currDetailList = null;
String updateStatus = "",nodeName = "";
int currDetailListLength = 0;
try
{
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;
}
}
}
catch(Exception e)
{
System.out.println("The Exception occurs in WoEnchPosEJB :"+e);
e.printStackTrace();
throw new ITMException(e);
}
return updateStatus;
}
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface WoEnchPosLocal extends ValidatorLocal//, EJBObject
{
public String postSave() throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface WoEnchPosRemote extends ValidatorRemote//, EJBObject
{
public String postSave() throws RemoteException,ITMException;
public String postSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import javax.ejb.*;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.dis.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class WoEnchPrs extends ValidatorEJB implements WoEnchPrsLocal, WoEnchPrsRemote //SessionBean
{
/*public void ejbCreate() throws RemoteException, CreateException
{ }
public void ejbRemove()
{ }
public void ejbActivate()
{ }
public void ejbPassivate()
{ }*/
public String preSave() throws RemoteException,ITMException
{
return "";
}
public String preSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException
{
System.out.println("WoEnchPrsEJB called");
Document dom = null;
String errString = "";
try
{
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
errString = executePreSaveRec(dom,domId,objContext,editFlag,xtraParams, windowName, conn);
}
}
catch(Exception e)
{
System.out.println("Exception :WoEnchPrsEJB ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}
private String executePreSaveRec(Document dom, String domID,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException
{
Statement stmt = null;
ResultSet rs = null;
String siteCodeReq = "", itemCode = "", lineNo = "",locCode = "", lotNo = "", lotSl = "";
String sql = "", line = "", tranType = "", errString = "";
HashMap strAllocate = null;
double quantity = 0d;
int updateCnt = 0, retVal = 0;
java.sql.Date tranDate = null;
String updateStatus = "",quantityStr = "",tranId = "";
NodeList hdrDom = null;
Node currDetail = null;
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
try
{
stmt = conn.createStatement();
tranDate = new java.sql.Date(System.currentTimeMillis());
System.out.println("\n tranDate :"+tranDate);
hdrDom = dom.getElementsByTagName("Detail1");
siteCodeReq = GenericUtility.getInstance().getColumnValueFromNode("site_code",hdrDom.item(0));
tranId = GenericUtility.getInstance().getColumnValueFromNode("tran_id",hdrDom.item(0));
System.out.println("\n tranId :"+tranId);
currDetail = getCurrentDetailFromDom(dom,domID);
updateStatus = getCurrentUpdateFlag(currDetail);
System.out.println("updateStatus :: "+updateStatus);
if (currDetail != null && !updateStatus.equalsIgnoreCase("A"))
{
lineNo = GenericUtility.getInstance().getColumnValueFromNode("line_no",currDetail);
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);
if (updateStatus.equalsIgnoreCase("E") || updateStatus.equalsIgnoreCase("D"))
{
sql = "SELECT QUANTITY from workorder_enhanc_det where TRAN_ID = '"+tranId+"' "
+ " AND LINE_NO = '"+lineNo+"' " ;
rs = stmt.executeQuery(sql);
if (rs.next())
{
quantityStr = rs.getString("QUANTITY");
}
}
quantity = Double.parseDouble(quantityStr);
line = " " + lineNo;
System.out.println("line :"+line);
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","W-ENH");
strAllocate.put("ref_id",tranId);
strAllocate.put("ref_line",line.substring(line.length()-3));
strAllocate.put("site_code",siteCodeReq);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code",locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty",new Double(-1*quantity));
strAllocate.put("chg_user",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term",GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win",windowName);
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
System.out.println("errString ::: " + errString);
if (errString == "")
{
System.out.println("invAllocTrace.updateInvallocTrace : Sucessuful!");
}
}
}//try end
catch (SQLException sqx)
{
System.out.println("The SQLException occurs in WoEnchPrsEJB :"+sqx);
sqx.printStackTrace();
errString = "ERROR";
throw new ITMException(sqx);
}
catch(Exception e)
{
System.out.println("The SQLException occurs in WoEnchPrsEJB :"+e);
e.printStackTrace();
errString = "ERROR";
throw new ITMException(e);
}
finally
{
try
{
if(stmt != null)
{
stmt.close();
stmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.err.println("Exception :WoEnchPrsEJB :\n"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}
//return errString;
}
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();
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;
}
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface WoEnchPrsLocal extends ValidatorLocal//, EJBObject
{
public String preSave() throws RemoteException,ITMException;
public String preSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, Connection conn)throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import java.sql.Connection;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface WoEnchPrsRemote extends ValidatorRemote//, EJBObject
{
public String preSave() throws RemoteException,ITMException;
public String preSaveRec(String xmlString1,String domId,String objContext,String editFlag, String xtraParams, String windowName, 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