Commit 64e53f4e authored by manohar's avatar manohar

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

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

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91074 ce508802-f39f-4f6c-b175-0d175dae99d5
parent edf223eb
This diff is collapsed.
This diff is collapsed.
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface BatchsizeAprvICLocal extends ValidatorLocal//, EJBObject
{
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
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface BatchsizeAprvICRemote extends ValidatorRemote//, EJBObject
{
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
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import java.text.SimpleDateFormat;
import org.w3c.dom.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import ibase.system.config.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class DefaultLotIssued extends ActionHandlerEJB implements DefaultLotIssuedLocal,DefaultLotIssuedRemote // SessionBean
{
/*public void ejbCreate() throws RemoteException, CreateException {}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}*/
public String actionHandler() throws RemoteException,ITMException{return "";}
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException
{
String retString = "";
Document dom = null;
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
if(xmlString != null && xmlString.trim().length()!=0)
{
System.out.println("XML String :"+xmlString);
dom = genericUtility.parseString(xmlString);
}
}
catch(Exception e)
{
System.out.println("Exception :DefaultLotIssuedEJB :actionHandler(String xmlString):" + e.getMessage() + ":");
throw new ITMException(e);
}
return retString;
}
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException
{
Connection conn=null;
GenericUtility genericUtility = GenericUtility.getInstance();
Document dom = null;
Document dom1 = null;
String retString = null;
try
{
System.out.println("XML String1:::"+xmlString1);
System.out.println("XML String:::"+xmlString);
System.out.println("Default function executing in progress...................");
if(xmlString != null && xmlString.trim().length()!=0)
{
System.out.println("XML String:::"+xmlString);
dom = GenericUtility.getInstance().parseString(xmlString);
System.out.println("dom :"+dom);
}
if(xmlString1 != null && xmlString1.trim().length()!=0)
{
System.out.println("XML String1:::"+xmlString1);
dom1 = GenericUtility.getInstance().parseString(xmlString1);
System.out.println("dom1 :"+dom1);
}
System.out.println("actionType:::["+actionType+"]");
if (actionType.equalsIgnoreCase("Default"))
{
try
{
if(conn==null)
{
System.out.println("Getting Connection From Database......");
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
System.out.println("Connection Established......");
DatabaseMetaData dbmd = conn.getMetaData();
System.out.println("DriverName["+dbmd.getDriverName() );
System.out.println("DriverURI["+dbmd.getURL() );
System.out.println("DriverUSER["+dbmd.getUserName() );
//System.out.println("ApplDateFormat["+genericUtility. ());
System.out.println("DBDateFormat["+genericUtility.getDBDateFormat() );
connDriver = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
retString = actionDefault(dom, dom1, objContext, xtraParams);
}
}
catch(Exception e)
{
System.out.println("Exception :Dispatch :actionHandler(String xmlString):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning String from DefaultLotIssuedEJB : actionHandler"+retString);
return retString;
}
private String actionDefault(Document dom, Document dom1, String objContext, String xtraParams) throws RemoteException, ITMException
{
System.out.println("Calling the Default function.........");
GenericUtility genericUtility = GenericUtility.getInstance();
Connection conn = null;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null,rs1 = null;
StringBuffer valueXmlString = null;
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
String worder =null;
String operation = null;
int operation1 = 0;
String sql1 = null;
String sql2 = null;
int currentFormNo = 0;
String workorder = "";
int operation2 = 0;
double quantity = 0;
String lotNo ="",lotSl ="";
try
{
String detCnt = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"detCnt");
System.out.println("detCnt ...... :"+detCnt);
if(conn==null)
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver=null;
}
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("[] :currentFormNo ....." +currentFormNo);
if (dom != null)
{
worder = genericUtility.getColumnValue("work_order",dom);
String worder1 =genericUtility.getColumnValue("work_order",dom1);
System.out.println("worder1 is :"+worder1);
operation = genericUtility.getColumnValue("operation",dom1); //changes by rajendra
}
if(operation == null || operation.trim().length()==0)operation="0";
operation1 = Integer.parseInt(operation);
System.out.println("operation1 is :"+operation1);
System.out.println("work order & operations are"+worder+" , "+operation);
sql1 = "SELECT b.LOT_NO,b.LOT_SL,b.QUANTITY from workorder_iss a,workorder_issdet b "
+" where a.tran_id =b.tran_id and a.work_order = '"+worder+"' ";
System.out.println("sql1 is :"+sql1);
pstmt = conn.prepareStatement(sql1);
rs = pstmt.executeQuery();
while (rs.next())
{
lotNo = rs.getString(1) == null ? "" :rs.getString(1);
lotSl = rs.getString(2) == null ? "" :rs.getString(2);
quantity =rs.getDouble(3);
System.out.println("lotNo is :"+lotNo);
System.out.println("lotSl is :"+lotSl);
System.out.println("quantity is :"+quantity);
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<work_order>").append("<![CDATA[").append(worder.trim()).append("]]>").append("</work_order>\r\n");
valueXmlString.append("<lot_no>").append("<![CDATA[").append(lotNo).append("]]>").append("</lot_no>\r\n");
valueXmlString.append("<lot_sl>").append("<![CDATA[").append(lotSl).append("]]>").append("</lot_sl>\r\n");
valueXmlString.append("<iss_qty>").append("<![CDATA[").append(quantity).append("]]>").append("</iss_qty>\r\n");
valueXmlString.append("<no_art>").append("<![CDATA[").append("1").append("]]>").append("</no_art>\r\n");
valueXmlString.append("</Detail>\r\n");
}
pstmt.close();
valueXmlString.append("</Root>");
pstmt = null;
}//tryBase1 greyd
catch(SQLException sqx)
{
System.out.println("The Exception caught from DefaultLotIssuedEJB :"+sqx);
throw new ITMException(sqx);
}
catch(Exception e)
{
System.out.println("The Exception caught from DefaultLotIssuedEJB :"+e);
throw new ITMException(e);
}
finally
{
try
{
conn.close();
conn = null;
}catch(Exception e){}
}
System.out.println("valueXmlString.toString() :"+valueXmlString.toString());
return valueXmlString.toString();
}
}//end of Ejb
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerLocal;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface DefaultLotIssuedLocal extends ActionHandlerLocal//, EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerRemote;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface DefaultLotIssuedRemote extends ActionHandlerRemote//, EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
//import java.sql.Timestamp;
public class DistDemand
{
public String siteCode = "";
public String itemCode = "";
public String unit = "";
public String siteCodeSrc = "";
public String status = "T";
public String chgUser = "";
public String chgTerm = "";
public double qtyRequired = 0;
public java.sql.Timestamp tranDate = null;
public java.sql.Timestamp planDueDate = null;
public java.sql.Timestamp dueDateOrd = null;
public java.sql.Timestamp dueDate = null;
public java.sql.Timestamp chgDate = new java.sql.Timestamp(System.currentTimeMillis());
public DistDemand()
{
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface ForecastTechICLocal extends ValidatorLocal//, EJBObject
{
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
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface ForecastTechICRemote extends ValidatorRemote//, EJBObject
{
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
package ibase.webitm.ejb.mfg;
//import java.sql.Timestamp;
public class Indent
{
public String indNo = "";
final String indType = "M";
public String deptCode = "";
public String itemCode = "";
public String itemDescr= "";
public String unitInd = "";
public String unitStd = "";
public String siteCode = "";
public String siteCodeDlv = "";
public String siteCodeAcct = "";
public String siteCodeCust = "";
public String aprCode = "";
final String priority = "R";
public String acctCode = "";
public String cctrCode = "";
public String empCodePur = "";
public String empCodeReq = "";
public String suppCodePref = "";
public String packCode = "";
final String status = "T";
public String chgUser = "";
public String chgTerm = "";
public double purLeadTime = 0 ;
public double quantity = 0;
public double quantityStdUom = 0;
public double ordQuantity = 0;
public double purcRate = 0;
public double convQtyStdUom = 0;
public java.sql.Timestamp indDate = null;
public java.sql.Timestamp planDueDate = null;
public java.sql.Timestamp reqDate = null;
public java.sql.Timestamp chgDate = new java.sql.Timestamp(System.currentTimeMillis());
public Indent()
{
}
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
//import java.sql.Timestamp;
public class IndependentDemand
{
public String siteCode = "";
public String siteCodeCust = "";
public String itemCode = "";
public String unit = "";
public String unitStd = "";
public String status = "T";
public double quantity = 0;
public double quantityStdUom = 0;
public double convQtyStdUom = 1;
public java.sql.Timestamp tranDate = null;
public java.sql.Timestamp planDueDate = null;
public java.sql.Timestamp dueDate = null;
public IndependentDemand()
{
}
}
\ No newline at end of file
This diff is collapsed.
package ibase.webitm.ejb.mfg;
import java.util.ArrayList;
//import ibase.webitm.utility.ITMException;
//import ibase.webitm.utility.GenericUtility;
import java.sql.*;
public class InsertPlanTable
{
PreparedStatement pstmtPlanHdr = null;
PreparedStatement pstmtPlanDet = null;
String resultString = "";
String siteCode = "";
String siteCodeSupp = "";
String itemCode = "";
String itemSer = "";
String itemStru = "";
String masterSch = "";
String bomCode = "";
String suppSour = "";
String suppCodePref = "";
String orderOpt = "";
String dueDateStr = "";
String batchQtyType = "";
String empCodePur = "";
String packCode = "";
String unit = "";
String acctCodePh = "";
String acctCodeWp = "";
String cctrCodePh = "";
String aprCode = "";
String cctrCodeWp = "";
double demand = 0;
double supply = 0;
double planDemand = 0;
double planSupply = 0;
double runningDemand = 0;
double runningSupply = 0;
double runningPlanSupply = 0;
double independentDemand = 0;
double minOrderQty = 0;
double maxOrderQty = 0;
double integralQty = 0;
double maxQty = 0;
double maxStkQty = 0;
double minQty = 0;
double reorderQty = 0;
double yieldPerc = 100;
double minPlanPerc = 0;
double batchQty = 0;
double purcRate = 0;
int purLeadTime = 0;
int qcLeadTime = 0;
int mfgLeadTime = 0;
int minStkDay = 0;
int maxStkDay = 0;
boolean flag = true;
java.sql.Timestamp dueDate = null;
ADPElement adpElement = null;
public String InsertPlanHdrDet(ArrayList adpeList, Connection conn)
{
try
{
String sqlPlanHdr = "INSERT INTO PLAN_HDR(SITE_CODE, ITEM_CODE, ITEM_SER, SITE_CODE__SUPP, "
+ "SUPP_SOUR, BOM_CODE, MIN_QTY, MIN_ORDER_QTY, MIN_STK_DAY, MAX_QTY, "
+ "MAX_STK_DAY, ITEM_STRU, REO_QTY, PUR_LEAD_TIME, QC_LEAD_TIME, "
+ "MFG_LEAD_TIME, INTEGRAL_QTY, BATCH_QTY, BATCH_QTY_TYPE, MASTER_SCH, ORDER_OPT, "
+ "YIELD_PERC, MIN_PLAN_PERC, UNIT, APR_CODE, PACK_CODE, EMP_CODE__PUR, "
+ "SUPP_CODE__PREF, PURC_RATE, ACCT_CODE__PH, CCTR_CODE__PH, ACCT_CODE__WP, CCTR_CODE__WP) "
+ "VALUES( ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? ) ";
pstmtPlanHdr = conn.prepareStatement(sqlPlanHdr);
String sqlPlanDtl = "INSERT INTO PLAN_DTL(SITE_CODE, ITEM_CODE, DEMAND, SUPPLY, PLAN_SUPP, "
+ "RUNNING_DEMAND, RUNNING_SUPP, RUNNING_PLAN_SUPP, IND_DEMAND, DUE_DATE) "
+ "VALUES( ? , ? , ? , ? , ? , ? ,"
+ " ? , ? , ? , ? ) ";
pstmtPlanDet = conn.prepareStatement(sqlPlanDtl);
for(int adpeCount=0; adpeCount<adpeList.size(); adpeCount++)
{
flag = true;
adpElement = (ADPElement)adpeList.get(adpeCount);
siteCode = adpElement.getSiteCode();
itemCode = adpElement.getItemCode();
itemSer = adpElement.getItemSer();
siteCodeSupp = adpElement.getSiteCodeSupp();
suppSour = adpElement.getSuppSour();
bomCode = adpElement.getBomCode();
minQty = adpElement.getMinQty();
minOrderQty = adpElement.getMinOrderQty();
minStkDay = adpElement.getMinStkDay();
maxQty = adpElement.getMaxQty();
maxStkDay = adpElement.getMaxStkDay();
itemStru = adpElement.getItemStru();
reorderQty = adpElement.getReoQty();
purLeadTime = adpElement.getPurLeadTime();
qcLeadTime = adpElement.getQcLeadTime();
mfgLeadTime = adpElement.getMfgLeadTime();
integralQty = adpElement.getIntegralQty();
batchQty = adpElement.getBatchQty();
batchQtyType = adpElement.getBatchQtyType();
masterSch = adpElement.getMasterSch();
orderOpt = adpElement.getOrderOpt();
yieldPerc = adpElement.getYieldPerc();
minPlanPerc = adpElement.getMinPlanPerc();
unit = adpElement.getUnit();
aprCode = adpElement.getAprCode();
packCode = adpElement.getPackCode();
empCodePur = adpElement.getEmpCodePur();
suppCodePref = adpElement.getSuppCodePref();
purcRate = adpElement.getPurcRate();
acctCodePh = adpElement.getAcctCodePh();
cctrCodePh = adpElement.getCctrCodePh();
acctCodeWp = adpElement.getAcctCodeWp();
cctrCodeWp = adpElement.getCctrCodeWp();
ArrayList timeMRParr = adpElement.getTimeMrpList();
for (int timeCtr = 0; timeCtr < timeMRParr.size() ; timeCtr++)
{
TimeMRP timeMrp = (TimeMRP)timeMRParr.get(timeCtr);
demand = timeMrp.getDemand();
supply = timeMrp.getSupply();
planSupply = timeMrp.getPlanSupply();
runningDemand = timeMrp.getRunningDemand();
runningSupply = timeMrp.getRunningSupply();
runningPlanSupply = timeMrp.getRunningPlanSupply();
independentDemand = timeMrp.getIndependentDemand();
dueDate = timeMrp.getDueDate();
pstmtPlanDet.setString(1,siteCode);
pstmtPlanDet.setString(2,itemCode);
pstmtPlanDet.setDouble(3,demand);
pstmtPlanDet.setDouble(4,supply);
pstmtPlanDet.setDouble(5,planSupply);
pstmtPlanDet.setDouble(6,runningDemand);
pstmtPlanDet.setDouble(7,runningSupply);
pstmtPlanDet.setDouble(8,runningPlanSupply);
pstmtPlanDet.setDouble(9,independentDemand);
pstmtPlanDet.setTimestamp(10,dueDate);
pstmtPlanDet.addBatch();
}
pstmtPlanHdr.setString(1,siteCode);
pstmtPlanHdr.setString(2,itemCode);
pstmtPlanHdr.setString(3,itemSer);
pstmtPlanHdr.setString(4,siteCodeSupp);
pstmtPlanHdr.setString(5,suppSour);
pstmtPlanHdr.setString(6,bomCode);
pstmtPlanHdr.setDouble(7,minQty);
pstmtPlanHdr.setDouble(8,minOrderQty);
pstmtPlanHdr.setInt(9,minStkDay);
pstmtPlanHdr.setDouble(10,maxQty);
pstmtPlanHdr.setInt(11,maxStkDay);
pstmtPlanHdr.setString(12,itemStru);
pstmtPlanHdr.setDouble(13,reorderQty);
pstmtPlanHdr.setInt(14,purLeadTime);
pstmtPlanHdr.setInt(15,qcLeadTime);
pstmtPlanHdr.setInt(16,mfgLeadTime);
pstmtPlanHdr.setDouble(17,integralQty);
pstmtPlanHdr.setDouble(18,batchQty);
pstmtPlanHdr.setString(19,batchQtyType);
pstmtPlanHdr.setString(20,masterSch);
pstmtPlanHdr.setString(21,orderOpt);
pstmtPlanHdr.setDouble(22,yieldPerc);
pstmtPlanHdr.setDouble(23,minPlanPerc);
pstmtPlanHdr.setString(24,unit);
pstmtPlanHdr.setString(25,aprCode);
pstmtPlanHdr.setString(26,packCode);
pstmtPlanHdr.setString(27,empCodePur);
pstmtPlanHdr.setString(28,suppCodePref);
pstmtPlanHdr.setDouble(29,purcRate);
pstmtPlanHdr.setString(30,acctCodePh);
pstmtPlanHdr.setString(31,cctrCodePh);
pstmtPlanHdr.setString(32,acctCodeWp);
pstmtPlanHdr.setString(33,cctrCodeWp);
pstmtPlanHdr.addBatch();
}
pstmtPlanHdr.executeBatch();
pstmtPlanHdr.clearParameters();
pstmtPlanHdr.close();
pstmtPlanDet.executeBatch();
pstmtPlanDet.clearParameters();
pstmtPlanDet.close();
}
catch (SQLException se)
{
System.out.println("SQLException :RunMRPPrcEJB :InsertPlanTable():" + se.getMessage());
se.printStackTrace();
resultString = se.getMessage();
// throw new ITMException(e);
}
catch (Exception e)
{
System.out.println("Exception :RunMRPPrcEJB :InsertPlanTable():" + e.getMessage());
e.printStackTrace();
resultString = e.getMessage();
// throw new ITMException(e);
}
return resultString;
}
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
class InterSiteDistance
{
/*
site_code
site_code__from
distance
*/
/*
priority is to be implement
*/
private String siteCode;
private String siteCodeFrom;
private double distance = 0;
public void setSiteCode(String siteCode)
{
this.siteCode = siteCode;
}
public String getSiteCode()
{
return this.siteCode;
}
public void setSiteCodeFrom(String siteCodeFrom)
{
this.siteCodeFrom = siteCodeFrom;
}
public String getSiteCodeFrom()
{
return this.siteCodeFrom;
}
public void setDistance(double distance)
{
this.distance = distance;
}
public double getDistance()
{
return this.distance;
}
}
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import java.text.SimpleDateFormat;
import org.w3c.dom.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import ibase.system.config.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.annotation.*;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class InventoryAct extends ActionHandlerEJB implements InventoryActLocal,InventoryActRemote // SessionBean
{
GenericUtility genericUtility= GenericUtility.getInstance();
Connection conn=null;
Vector routeVec = null;
String tranId = null;
int lineNo = 0;
/*public void ejbCreate() throws RemoteException, CreateException {}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
*/
public String actionHandler() throws RemoteException,ITMException{return "";}
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException
{
String retString = "";
Document dom = null;
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
if(xmlString != null && xmlString.trim().length()!=0)
{
System.out.println("XML String :"+xmlString);
dom = genericUtility.parseString(xmlString);
}
}
catch(Exception e)
{
System.out.println("Exception :InventoryActEJB :actionHandler(String xmlString):" + e.getMessage() + ":");
throw new ITMException(e);
}
return retString;
}
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
String retString = null;
try
{
System.out.println("XML String1:::"+xmlString1);
System.out.println("XML String:::"+xmlString);
System.out.println("Default function executing in progress...................");
if(xmlString != null && xmlString.trim().length()!=0)
{
System.out.println("XML String:::"+xmlString);
dom = GenericUtility.getInstance().parseString(xmlString);
System.out.println("dom :"+dom);
}
if(xmlString1 != null && xmlString1.trim().length()!=0)
{
System.out.println("XML String1:::"+xmlString1);
dom1 = GenericUtility.getInstance().parseString(xmlString1);
System.out.println("dom1 :"+dom1);
}
System.out.println("actionType:::["+actionType+"]");
if (actionType.equalsIgnoreCase("Default"))
{
try
{
if(conn==null)
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
DatabaseMetaData dbmd = conn.getMetaData();
System.out.println("DriverName["+dbmd.getDriverName() );
System.out.println("DriverURI["+dbmd.getURL() );
System.out.println("DriverUSER["+dbmd.getUserName() );
System.out.println("ApplDateFormat["+genericUtility.getApplDateFormat());
System.out.println("DBDateFormat["+genericUtility.getDBDateFormat() );
connDriver = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
retString = actionDefault(dom, dom1, objContext, xtraParams);
}
}
catch(Exception e)
{
System.out.println("Exception :Dispatch :actionHandler(String xmlString):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
routeVec = null;
}
System.out.println("returning String from Despatch : actionHandler"+retString);
return retString;
}
private String actionDefault(Document dom, Document dom1, String objContext, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = null;
routeVec = new Vector();
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
NodeList parentNodeList = null;
NodeList childNodeList = null;
int parentNodeListLength=0;
int childNodeListLength = 0;
Node parentNode =null;
Node childNode =null;
String childNodeName = null;
PreparedStatement pstmt = null;
ResultSet rs =null;
String sql = null;
String workOrder = null;
String operation = null;
String routeCode = null;
String itemCode = null;
String QtyStr = null;
String unit = null;
String descr1 = null;
try
{
// *******************************
parentNodeList = dom1.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeListLength:::::::::"+parentNodeListLength);
for (int row = 0; row < parentNodeListLength; row++)
{
workOrder = null;
operation = null;
parentNode = parentNodeList.item(row);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength::: "+ childNodeListLength+"\n");
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
/*if (childNodeName.equals("route_code"))
{
if(childNode.getFirstChild()!=null)
{
routeCode = childNode.getFirstChild().getNodeValue();
//System.out.println("routeCode ::"+ routeCode ) ;
}
}*/
if (childNodeName.equals("work_order"))
{
if(childNode.getFirstChild()!=null)
{
workOrder = childNode.getFirstChild().getNodeValue();
}
}
}//end for
sql = "SELECT ROUTE_CODE FROM WORKORDER WHERE WORK_ORDER='"+workOrder+"'";
System.out.println("Sql:::["+sql+"]");
pstmt = conn.prepareStatement(sql);
rs= pstmt.executeQuery();
if(rs.next())
{
routeCode = ((rs.getString(1)==null)?" ":rs.getString(1));
}
rs.close();
pstmt.close();
System.out.println("WorkOrder :::["+workOrder+"] RouteCode["+routeCode+"]");
if(!routeVec.contains(routeCode))
{
routeVec.add(routeCode);
sql = "SELECT PROCROUTE_WIP.ITEM_CODE__WIP,PROCROUTE_WIP.PRC_OUTPUT_SIZE,ITEM.UNIT,ITEM.DESCR FROM PROCROUTE_WIP,ITEM WHERE ITEM.ITEM_CODE= PROCROUTE_WIP.ITEM_CODE__WIP AND PROCROUTE_WIP.ROUTE_CODE='"+routeCode+"'";
System.out.println("Sql:::["+sql+"]");
pstmt = conn.prepareStatement(sql);
rs= pstmt.executeQuery();
while(rs.next())
{
itemCode = (rs.getString(1)==null?" ":rs.getString(1));
QtyStr = (rs.getString(2)==null?" ":rs.getString(2));
unit = (rs.getString(3)==null?" ":rs.getString(3));
descr1 = (rs.getString(4)==null?" ":rs.getString(4));
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(itemCode).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<descr>").append("<![CDATA[").append(descr1).append("]]>").append("</descr>\r\n");
valueXmlString.append("<operation>").append("<![CDATA[").append("0").append("]]>").append("</operation>\r\n");
valueXmlString.append("<quantity>").append("<![CDATA[").append(QtyStr).append("]]>").append("</quantity>\r\n");
valueXmlString.append("<unit>").append("<![CDATA[").append(unit).append("]]>").append("</unit>\r\n");
valueXmlString.append("<reas_code>").append("<![CDATA[").append("").append("]]>").append("</reas_code>\r\n");
valueXmlString.append("<det_remarks>").append("<![CDATA[").append(" ").append("]]>").append("</det_remarks>\r\n");
valueXmlString.append("<loc_code>").append("<![CDATA[").append(" ").append("]]>").append("</loc_code>\r\n");
valueXmlString.append("<lot_no>").append("<![CDATA[").append(" ").append("]]>").append("</lot_no>\r\n");
valueXmlString.append("<lot_sl>").append("<![CDATA[").append(" ").append("]]>").append("</lot_sl>\r\n");
valueXmlString.append("</Detail>\r\n");
}
}//end if
}
valueXmlString.append("</Root>\r\n");
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.println("valueXmlString.toString() :"+valueXmlString.toString());
return valueXmlString.toString();
}
}//end of Ejb
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerLocal;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface InventoryActLocal extends ActionHandlerLocal//, EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerRemote;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface InventoryActRemote extends ActionHandlerRemote//, EJBObject
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
/********************************************************
Title : ItemDeptEJB
Date Of Modification : 18/07/07
Name of Developer : Imteyaz-ul haque
********************************************************/
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import org.w3c.dom.*;
import java.text.NumberFormat;
import java.io.*;
import javax.ejb.SessionBean;
import javax.ejb.CreateException;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.system.config.*;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class ItemDept extends ValidatorEJB implements ItemDeptLocal,ItemDeptRemote //SessionBean
{
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
java.sql.Connection conn=null;
GenericUtility genericUtility = GenericUtility.getInstance();
String sql = null;
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
/*public void ejbCreate() throws RemoteException, CreateException
{
System.out.println("<========= ITEM DEPT_EJB IS IN PROCESS ========>");
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}*/
public String itemChanged() throws RemoteException,ITMException
{
return "";
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
String valueXmlString = "";
try
{
dom = parseString(xmlString);
System.out.println("xmlString" + xmlString);
System.out.println("<========= ItemDeptEJB ItemChanged Called =========>");
dom = parseString(xmlString1);
if (xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
}
valueXmlString = itemChanged(dom,objContext,currentColumn,editFlag,xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : [ItemDeptEJB][itemChanged(String,String)] :==>\n"+e.getMessage());
}
return valueXmlString;
}
public String itemChanged(Document dom,String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
boolean isFound=false;
StringBuffer valueXmlString = new StringBuffer();
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String columnValue = "";
int ctr=0;
String ChgDate = "";
String ChgUser = "";
String ChgTerm = "";
String ItemCode="";
String ItDescr="";
String DpDescr="";
String DeptCode="";
int currentFormNo=0;
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
System.out.println("<=======[ItemDeptEJB]connection is opened =====>");
ChgDate = getValueFromXTRA_PARAMS(xtraParams, "chg_date");
ChgUser = getValueFromXTRA_PARAMS(xtraParams, "chg_user");
ChgTerm = getValueFromXTRA_PARAMS(xtraParams, "chg_term");
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("[ItemDeptEJB] [itemChanged] :currentFormNo ====>" +currentFormNo);
System.out.println("FORM NO ====>"+currentFormNo);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
try
{
// SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START
parentNodeList = dom.getElementsByTagName("Detail");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
ctr = 0;
int childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equals(currentColumn))
{
if (childNode.getFirstChild() != null)
{
columnValue=childNode.getFirstChild().getNodeValue().trim();
}
}
ctr++;
}while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
System.out.println("[ItemDeptEJB]Column Value ====>"+columnValue);
System.out.println("[ItemDeptEJB]currentColumn =====>"+currentColumn);
valueXmlString.append("<Detail>\r\n");
if (currentColumn.trim().equals("itm_default"))
{
valueXmlString.append("<chg_date>").append(ChgDate).append("</chg_date>\r\n");
valueXmlString.append("<chg_user>").append(ChgUser).append("</chg_user>\r\n");
valueXmlString.append("<chg_term>").append(ChgTerm).append("</chg_term>\r\n");
System.out.println("Chg Date:FROM Dom:::::["+ChgDate+"]");
System.out.println("Chg User:FROM Dom:::::["+ChgUser+"]");
System.out.println("Chg Term:FROM Dom:::::["+ChgTerm+"]");
}
if(currentColumn.trim().equalsIgnoreCase("item_code"))
{
ItemCode = getColumnValue("item_code",dom);
System.out.println("ITEM_CODE:FROM Dom ======>["+ItemCode+"]");
sql ="select DESCR from ITEM where item_code= '"+ItemCode+"'";
System.out.println("sql::::==" +sql);
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
ItDescr = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("ItDescr:::["+ItDescr+"]");
valueXmlString.append("<item_descr>").append(ItDescr).append("</item_descr>\r\n");
}
if(currentColumn.trim().equalsIgnoreCase("dept_code"))
{
DeptCode = getColumnValue("dept_code",dom);
System.out.println("DEPT_CODE:FROM Dom ======>["+DeptCode+"]");
sql ="select DESCR from DEPARTMENT where dept_code= '"+DeptCode+"'";
System.out.println("sql::::==" +sql);
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
DpDescr = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("DpDescr =====> ["+DpDescr+"]");
valueXmlString.append("<department_descr>").append(DpDescr).append("</department_descr>\r\n");
}
valueXmlString.append("</Detail>");
valueXmlString.append("</Root>");
}//end of Inner Try
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception ::"+e.getMessage());
throw new ITMException(e);
}
}//END OF OUTER TRY
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception ::"+e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if(conn!=null)
{
rs.close();
rs = null;
stmt.close();
stmt = null;
pstmt.close();
pstmt = null;
conn.close();
conn = null;
System.out.println("[ItemDeptEJB] CONNECTION IS CLOSED =====>");
}
}catch(Exception d){d.printStackTrace();}
System.out.println("[ItemDeptEJB] Connection is Closed");
}
System.out.println("valueXmlString:::::"+valueXmlString.toString());
return valueXmlString.toString();
}//END OF ITEMCHNGE
} // End Of Main
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.ValidatorLocal;
import java.rmi.RemoteException;
import javax.ejb.*;
import ibase.webitm.utility.*;
import org.w3c.dom.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface ItemDeptLocal extends ValidatorLocal//, EJBObject
{
public abstract String itemChanged() throws RemoteException, ITMException;
public abstract String itemChanged(String s,String s1, String s2, String s3, String s4, String s5, String s6) throws RemoteException, ITMException;
public abstract String itemChanged(Document dom,String s, String s1, String s2, String s3) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.ValidatorRemote;
import java.rmi.RemoteException;
import javax.ejb.*;
import ibase.webitm.utility.*;
import org.w3c.dom.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface ItemDeptRemote extends ValidatorRemote//, EJBObject
{
public abstract String itemChanged() throws RemoteException, ITMException;
public abstract String itemChanged(String s,String s1, String s2, String s3, String s4, String s5, String s6) throws RemoteException, ITMException;
public abstract String itemChanged(Document dom,String s, String s1, String s2, String s3) throws RemoteException, ITMException;
}
package ibase.webitm.ejb.mfg;
//import java.sql.Timestamp;
public class MPSOrder
{
public String tranId = "";
public String ordType = "";
public String itemCode = "";
public String siteCode = "";
public String mrpRunId = "";
public String addnOrder = "";
public String status = "";
public String routeCode = "";
public String bomCode = "";
public String projCode = "";
public String chgUser = "";
public String chgTerm = "";
public String unit = "";
public String acctCodeWp = "";
public String cctrCodeWp = "";
public double quantity = 0;
public double yieldPerc = 0 ;
public double curBatchQty = 0;
public java.sql.Timestamp ordDate = null;
public java.sql.Timestamp planDueDate = null;
public java.sql.Timestamp dueDate = null;
public java.sql.Timestamp statusDate = null;
public java.sql.Timestamp chgDate = new java.sql.Timestamp(System.currentTimeMillis());
public MPSOrder()
{
//System.out.println("MPSOrder Instantiated.......");
}
public void Test()
{
System.out.println("Inside Test().......");
}
}
\ No newline at end of file
/*
* Created on Mar 6, 2007
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package ibase.webitm.ejb.mfg;
import ibase.webitm.utility.GenericUtility;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
/**
* @author ashah
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class MfgCommon {
public String chkStkOpt(String siteCode, String itemCode, Connection conn) {
String stkOpt = "", sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
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);
System.out.println("Sql ::: " + sql);
System.out.println("Setting params -- itemCode :: " + itemCode + " siteCode :: " + siteCode);
rs = pstmt.executeQuery();
if (rs.next())
{
stkOpt = rs.getString(1);
System.out.println("stkOpt in chkStkOpt ::: " + stkOpt);
}
pstmt.close();
rs.close();
if (stkOpt.equalsIgnoreCase("N") || stkOpt == null)
{
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 = pstmt.executeQuery();
if (rs.next())
{
stkOpt = rs.getString(1);
}
pstmt.close();
rs.close();
}
}
catch(Exception e)
{}
System.out.println("stkOpt in chkStkOpt :: " + stkOpt);
return stkOpt;
}
public String chkQcReqd(String siteCode, String itemCode, Connection conn) {
String qcReqd = "", sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
System.out.println("In chkQcReqd :--: siteCode :: " + siteCode + " itemCode :: " + itemCode);
sql = " SELECT CASE WHEN QC_REQD IS NULL THEN 'N' ELSE QC_REQD 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())
{
qcReqd = rs.getString(1);
}
pstmt.close();
rs.close();
if (qcReqd.equalsIgnoreCase("N") || qcReqd == null)
{
sql = "SELECT CASE WHEN QC_REQD IS NULL THEN 'N' ELSE QC_REQD END FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
qcReqd = rs.getString(1);
}
pstmt.close();
rs.close();
}
}
catch(Exception e)
{
System.out.println("Exception in chkQcReqd" + e.getMessage());
}
return qcReqd;
}
public String chkAutoQcReqd(String siteCode, String itemCode, Connection conn) {
String autoQcReqd = "", sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
System.out.println("In chkAutoQcReqd :--: siteCode :: " + siteCode + " itemCode :: " + itemCode);
sql = " SELECT CASE WHEN AUTO_REQC IS NULL THEN 'Y' ELSE AUTO_REQC 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())
{
autoQcReqd = rs.getString(1);
}
pstmt.close();
rs.close();
if (autoQcReqd.equalsIgnoreCase("N") || autoQcReqd == null)
{
sql = "SELECT CASE WHEN AUTO_REQC IS NULL THEN 'Y' ELSE AUTO_REQC END FROM ITEM WHERE ITEM_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
autoQcReqd = rs.getString(1);
}
pstmt.close();
rs.close();
}
}
catch(Exception e)
{
System.out.println("Exception in chkAutoQcReqd" + e.getMessage());
}
return autoQcReqd;
}
private Timestamp getTimestampFormat(String stDate) {
Timestamp tsDate = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try {
System.out.println(" Before converting into Timestamp ::: " + stDate);
Object date = null;
SimpleDateFormat sdfApp = new SimpleDateFormat(genericUtility.getApplDateFormat());
date = sdfApp.parse(stDate);
SimpleDateFormat sdfDB = new SimpleDateFormat(genericUtility.getDBDateFormat());
tsDate = java.sql.Timestamp.valueOf(sdfDB.format(date).toString() + " 00:00:00.0");
} catch (Exception e) {
System.out.println("Exception in getTimestampFormat" + e.getMessage());
}
System.out.println(" After converted into Timestamp ::: " + tsDate);
return tsDate;
}
public String getEnvMfg(String prdCode, String varName, Connection conn)
{
String varValue = "";
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
try
{
System.out.println("In getEnvMfg ");
sql= "SELECT VAR_VALUE FROM MFGPARM WHERE PRD_CODE = ? AND VAR_NAME = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
pstmt.setString(2, varName);
rs = pstmt.executeQuery();
if(rs.next())
{
varValue =rs.getString(1);
System.out.println("In getEnvMfg varValue..." + varValue);
}
else
{
System.out.println("No record found for PRD_CODE ='"+prdCode+"' AND VAR_NAME ='"+varName+"'");
varValue = "NULLFOUND";
}
pstmt.close();
rs.close();
}
catch(Exception e)
{
System.out.println("Exception in ..getEnvMfg....");
e.printStackTrace();
}
return varValue;
}
}
This diff is collapsed.
package ibase.webitm.ejb.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface RcpBackflushMultiLocal extends ValidatorLocal//, EJBObject
{
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.mfg;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import javax.ejb.*;
import org.w3c.dom.*;
import javax.annotation.*;
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 RcpBackflushMultiPos extends ValidatorEJB implements RcpBackflushMultiPosLocal,RcpBackflushMultiPosRemote //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 for ejb3
{
System.out.println("RcpBackFlushMultiPosEJB called");
System.out.println("xmlString1:::::["+xmlString1+"]");
System.out.println("domId:::::["+domId+"]");
System.out.println("objContext:::::["+objContext+"]");
System.out.println("xtraParams:::::["+xtraParams+"]");
System.out.println("editFlag:::::["+editFlag+"]");
System.out.println("windowName:::::["+windowName+"]");
Document dom = null;
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 :RcpBackFlushMultiPosEJB ::" + e.getMessage() + ":");
e.printStackTrace();
//throw new ITMException(e); // for ejb3
}
return "";
}
private String executePostSaveRec(Document dom, String domID,String objContext,String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException
{
System.out.println("ExecutePostSaveRec *******************************************");
Statement stmt = null;
ResultSet rs = null;
String siteCodeReq = "", itemCode = "", lineNo = "",locCode = "", lotNo = "", lotSl = "";
String line = "", errString = "";
HashMap strAllocate = null;
double quantity = 0d;
java.sql.Date tranDate = null;
String updateStatus = "",quantityStr = "",tranId = "";
NodeList hdrDom = null;
Node currDetail = null;
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
String windowName = "W_RCP_BACKFLUSH";
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);
System.out.println("lineNo ["+lineNo+"]");
System.out.println("itemCode ["+itemCode+"]");
System.out.println("locCode ["+locCode+"]");
System.out.println("lotNo ["+lotNo+"]");
System.out.println("lotSl ["+lotSl+"]");
System.out.println("quantity ["+quantity+"]");
line = " " + lineNo;
System.out.println("line :"+line);
strAllocate = new HashMap();
strAllocate.put("tran_date",tranDate);
strAllocate.put("ref_ser","R-BFS");
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 RcpBackFlushMultiPosEJB :"+sqx);
sqx.printStackTrace();
throw new ITMException(sqx);
}
catch(Exception e)
{
System.out.println("The SQLException occurs in RcpBackFlushMultiPosEJB :"+e);
e.printStackTrace();
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 :RcpBackFlushMultiPosEJB:\n"+e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
}
return "";
}
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 RcpBackflushMultiPosLocal 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);
}
\ 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 RcpBackflushMultiPosRemote 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);
}
\ No newline at end of file
This diff is collapsed.
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 RcpBackflushMultiPrsLocal extends ValidatorLocal//, EJBObject
{
public String preSave() throws RemoteException,ITMException;
public String preSaveRec(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.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 RcpBackflushMultiPrsRemote extends ValidatorRemote//, EJBObject
{
public String preSave() throws RemoteException,ITMException;
public String preSaveRec(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.mfg;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface RcpBackflushMultiRemote extends ValidatorRemote //,EJBObject
{
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;
}
This diff is collapsed.
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 RcptBackFlushPosLocal 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 RcptBackFlushPosRemote 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
This diff is collapsed.
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 RcptBackFlushPrsLocal 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 RcptBackFlushPrsRemote 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
This diff is collapsed.
package ibase.webitm.ejb.mfg;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
//import javax.xml.parsers.*;
//import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface RunMRPLocal extends ValidatorLocal//, EJBObject
{
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;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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