Commit e7494dc1 authored by cpatil's avatar cpatil

modify for lookup n pop help


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95271 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6675eeab
......@@ -3,6 +3,7 @@ package ibase.webitm.ejb.mfg;
import java.util.*;
import java.sql.*;
import java.sql.Date;
import org.w3c.dom.*;
......@@ -26,17 +27,22 @@ public class MrpWizPrsSaveBean
{
public String preSaveForm(String xmlString1 )throws ITMException
public String preSaveForm(String xmlString1 , String chgUser , String chgTerm )throws ITMException
{
Document dom = null;
System.out.println("@@@@@@@@@---------MrpWizPrsSaveBean EJB called...");
try
{
System.out.println("@@@@@@@xmlString1["+xmlString1+"]@@@@@@@");
System.out.println("@@@@@@ in bean chgUser["+chgUser+"]::chgTerm["+chgTerm+"]");
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom = GenericUtility.getInstance().parseString(xmlString1);
executepreSaveForm(dom);
executepreSaveForm(dom,chgUser,chgTerm);
}
}
catch(Exception e)
......@@ -48,7 +54,7 @@ public class MrpWizPrsSaveBean
return "";
}
private String executepreSaveForm(Document dom )throws ITMException
private String executepreSaveForm(Document dom , String chgUser , String chgTerm )throws ITMException
{
PreparedStatement pstmt = null;
String sql = "", itemCode = "", effDate = "", itemSer = "";
......@@ -70,6 +76,7 @@ public class MrpWizPrsSaveBean
InvAllocTrace invallocTrace = new InvAllocTrace();
StockAllocationPrc stockAllocationPrc = new StockAllocationPrc() ;
//String chgUser =" " , chgTerm = " ";
try
{
......@@ -165,19 +172,11 @@ public class MrpWizPrsSaveBean
allocQty = allocQtyStr==null?0:Double.parseDouble(allocQtyStr);
}
/*
HashMap stkUpdMap = new HashMap();
stkUpdMap.put("sorder_no", saleOrder);
stkUpdMap.put("site_code", siteCode);
stkUpdMap.put("item_code", itemCode);
stkUpdMap.put("lot_no", lotNo);
stkUpdMap.put("lot_sl", lotSl);
stkUpdMap.put("loc_code", locCode);
stkUpdMap.put("tran_ser", tranSer);
stkUpdMap.put("line_no", lineNo);
stkUpdMap.put("quantity", allocQty);
*/
java.util.Date currentDate = new java.util.Date();
// SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
// Timestamp newsysDate = java.sql.Timestamp.valueOf( sdf.format(currentDate)+" 00:00:00.0");
// System.out.println("Now the date is :=> ["+newsysDate+"]");
java.sql.Date date = new java.sql.Date(currentDate.getTime());
invallocTrace.setRefSer("MRPWIZ");
invallocTrace.setRefId(saleOrder);
......@@ -188,8 +187,9 @@ public class MrpWizPrsSaveBean
invallocTrace.setLotNo(lotNo);
invallocTrace.setLotSl(lotSl);
invallocTrace.setAllocQty(allocQty);
//invallocTrace.setChgUser(chgUser);
//invallocTrace.setChgTerm(chgTerm);
invallocTrace.setChgUser(chgUser);
invallocTrace.setChgTerm(chgTerm);
invallocTrace.setChgDate( date );
//invallocTrace.setChgWin("W_SORDALLOC" );
errString = stockAllocationPrc.updateInvallocTrace(invallocTrace, conn);
......
......@@ -7959,7 +7959,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//sourceSupplyMap.put("wip", "W");
}
/*
if( isBomReplace )
{
System.out.println("@@@@@@@@ tran ser isBomReplace["+tranSer2+"]tranSer["+tranSer+"]");
......@@ -7972,7 +7972,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
sourceSupplyFlag = sourceSupplyFlag + "S";
}
}
*/
valueXmlString.append("<source_supply protect = '1'>").append("<![CDATA[" + sourceSupplyFlag + "]]>").append("</source_supply>\r\n");
System.out.println("@@@@@@@@@@@@@@@["+itemCode+"] sourceSupplyFlag["+sourceSupplyFlag+"] ");
......
......@@ -336,6 +336,18 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
valueXmlString.append("<date_to>").append(toDate).append("</date_to>");
valueXmlString.append("<site_code__from>").append("00").append("</site_code__from>");
valueXmlString.append("<site_code__to>").append("ZZ").append("</site_code__to>");
// 16/06/14 added for change user n term at the time of allocation
String chgUser="", chgTerm="" ;
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgUser");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm");
System.out.println("@@@@@@ chgUser["+chgUser+"] chgTerm["+chgTerm+"]");
valueXmlString.append("<chg_user>").append(chgUser).append("</chg_user>");
valueXmlString.append("<chg_term>").append(chgTerm).append("</chg_term>");
// finish
/*
valueXmlString.append("<item_code__from>").append("0").append("</item_code__from>");
......@@ -444,6 +456,10 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
siteCodeTo = genericUtility.getColumnValue("site_code__to",dom1);
siteCodeFr = genericUtility.getColumnValue("site_code__from",dom1);
System.out.println("siteCodeTo="+siteCodeTo+ " siteCodeFr ="+siteCodeFr);
......@@ -525,6 +541,7 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
mrpGetData = runMRPObj.getData(argDom, dom2, winName, xtraParams);
System.out.println("mrpGetData =[" + mrpGetData + "]");
if( mrpGetData != null )
......@@ -533,6 +550,8 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
return mrpGetData;
}
//System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ cp code----start@@@@@@@@@");
/*
System.out.println("@@@@@@@@@@@@@@@@@@@final mrpGetData =[" + mrpGetData + "]@@@@@@@@@@@@@@@@@@@@@@");
......@@ -962,6 +981,85 @@ public class RunMRPWiz extends ValidatorEJB implements RunMRPWizLocal, RunMRPWiz
System.out.println(" Object Name is==>" + objName);
return "w_" + objName;
}
public String getBomCodeList(String itemCode,String dbID) throws ITMException
{
System.out.println("itemCode cal------------------["+itemCode+"]");
System.out.println("dbID cal------------------["+dbID+"]");
String sql = "";
String selectSql = "";
int detCnt=0;
double quantity=0,batchQty=0,batchReq=0;
StringBuffer valueXmlString = new StringBuffer("<Root>\r\n");
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
//if(itemCode == null || itemCode.trim().length() == 0)
//{
selectSql = " select bom_code,descr from bom " +
" where active = 'Y' and confirmed = 'Y' and item_code = ? order by bom_code ";
System.out.println("sql:::"+selectSql);
pstmt = conn.prepareStatement(selectSql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
int num = 1;
while (rs.next())
{
valueXmlString.append("<BOM domID='" + num + "' selected = 'N'>\r\n");
valueXmlString.append("<BOM_CODE>").append("<![CDATA[" + rs.getString("bom_code") + "]]>").append("</BOM_CODE>\r\n");
valueXmlString.append("<BOM_CODE_DESCR protect = '1'>").append("<![CDATA[" + rs.getString("descr") + "]]>").append("</BOM_CODE_DESCR>\r\n");
valueXmlString.append("<DOMID><![CDATA[").append(dbID).append("]]></DOMID>\r\n");
valueXmlString.append("</BOM>\r\n");
num++;
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception :BOM :getBOMCodeList(String,String):" + e.getMessage() + ":");
valueXmlString = valueXmlString.append(genericUtility.createErrorString(e));
}
finally
{
try
{
if (conn != null && !conn.isClosed())
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception :BOM :getBomCodeList(String,String) :==>\n"+ e.getMessage());
throw new ITMException(e);
}
}
valueXmlString.append("</Root>\r\n");
System.out.println("\n****ValueXmlString ::" + valueXmlString.toString() + ":********");
return valueXmlString.toString();
}
//}
//}
//}
......
......@@ -19,4 +19,5 @@ public interface RunMRPWizLocal extends ValidatorLocal
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String getBomCodeList( String itemCode , String dbID) throws RemoteException,ITMException;
}
......@@ -19,4 +19,5 @@ public interface RunMRPWizRemote extends ValidatorRemote
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String getBomCodeList( String itemCode , String dbID) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.mfg;
import ibase.utility.*;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.mfg.RequirementICRemote;
import ibase.webitm.utility.*;
import javax.servlet.http.*;
import java.io.*;
import javax.naming.InitialContext;
public class RunMrpBomPopHelpBean
{
private ibase.utility.UserInfoBean userInfo = null;
private HttpSession sessionCtx = null;
ITMWizardStatefulRemote itmWizardRemote = null;
private String objName = "";
private String user_lang ="en";
private String user_country = "US";
public RunMrpBomPopHelpBean ( String objName, HttpSession sessionCtx ) throws ITMException
{
try
{
this.objName = objName;
this.sessionCtx = sessionCtx;
this.userInfo = ( ibase.utility.UserInfoBean ) this.sessionCtx.getAttribute("USER_INFO");
this.user_lang = this.userInfo.getUserLanguage();
this.user_country = this.userInfo.getUserCountry();
if( this.itmWizardRemote == null )
{
InitialContext ctx = new InitialContext( new AppConnectParm().getProperty() );
this.itmWizardRemote = (ibase.webitm.ejb.ITMWizardStatefulRemote)ctx.lookup("ibase/ITMWizardStatefulEJB/remote");
this.itmWizardRemote.setUserInfo( this.userInfo );
this.itmWizardRemote.loadFormsMetaData( this.objName, "1", this.objName+"21", this.userInfo.getEmpCode(), this.userInfo.getProfileId() );
}
}
catch (ITMException itme)
{
itmWizardRemote.remove();
itmWizardRemote = null;
throw itme;
}
catch (Exception e)
{
itmWizardRemote.remove();
itmWizardRemote = null;
throw new ITMException(e);
}
}
public RunMrpBomPopHelpBean () throws ITMException
{
}
//get item code pop help
public String getBomCodeList( String itemCode , String dbID ) throws ITMException
{
String bomCodeData = "";
RunMRPWizRemote runMRPWizRemote = null;
try
{
InitialContext ctx = new InitialContext( new AppConnectParm().getProperty() );
runMRPWizRemote = (ibase.webitm.ejb.mfg.RunMRPWizRemote)ctx.lookup("ibase/RunMRPWiz/remote");
bomCodeData = runMRPWizRemote.getBomCodeList( itemCode ,dbID );
runMRPWizRemote = null;
System.out.println("bomCodeData=="+bomCodeData);
String xslFileName = getXSLFileName( "mrp_bom_code_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
//String xslFileName = getXSLFileName( "requirement_item_code_wiz_en_US.xsl" );
bomCodeData = ( new ibase.webitm.utility.GenericUtility() ).transformToString( xslFileName, bomCodeData, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
System.out.println("bomCodeData==="+bomCodeData);
}
catch ( Exception e )
{
throw new ITMException(e);
}
finally
{
if ( runMRPWizRemote != null )
{
runMRPWizRemote = null;
}
}
return bomCodeData;
}
private String getXSLFileName( String xslFileName )throws ITMException
{
String retFileName = null;
try
{
String defaultPath = null;
if( CommonConstants.APPLICATION_CONTEXT != null )
{
defaultPath = CommonConstants.APPLICATION_CONTEXT + CommonConstants.ITM_CONTEXT + File.separator;
}
else
{
defaultPath = ".." + File.separator + "webapps" + File.separator + "ibase" + File.separator + CommonConstants.ITM_CONTEXT + File.separator;
}
File xslPath = new File( defaultPath + File.separator + "xsl" + File.separator + CommonConstants.THEME + File.separator + "WIZARD");
if ( !xslPath.exists() )
{
xslPath.mkdir();
}
System.out.println( " xslPath [" + xslPath +"] xslFileName ["+xslFileName +"]");
File xslFile = new File(xslPath , xslFileName);
if( xslFile.exists() )
{
retFileName = xslFile.getAbsolutePath();
}
else
{
throw new ITMException( new Exception( retFileName + " Wizard XSL file Not Found") );
}
}
catch (Exception e)
{
throw new ITMException(e);
}
return retFileName;
}
}
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