Commit 0668a982 authored by msingh's avatar msingh

Added Pack Label Wizard by Manish on 21/10/16


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103763 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 444e8b52
/*
* Author: Wasim Ansari
* Date: 08-AUG-2016
* Request: S16EBAS006 (ASN Wizard)
*/
package ibase.webitm.bean.wms;
import java.io.File;
import ibase.system.config.AppConnectParm;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.wms.DDPorderWizEJBRemote;
import ibase.webitm.ejb.wms.PackLabelWizEJBRemote;
import ibase.webitm.ejb.wms.PackLabelWizPosEJBRemote;
import ibase.webitm.utility.ITMException;
import ibase.utility.E12GenericUtility;
import javax.naming.InitialContext;
import javax.servlet.http.HttpSession;
public class PackLabelWizBean
{
E12GenericUtility genericUtility = new E12GenericUtility();
private ibase.utility.UserInfoBean userInfo = null;
private HttpSession sessionCtx = null;
private String objName = "";
private String user_lang ="en";
private String user_country = "US";
public PackLabelWizBean(String objName, HttpSession sessionCtx) throws ITMException
{
try
{
this.objName = objName;
this.sessionCtx = sessionCtx;
this.userInfo = ( ibase.utility.UserInfoBean ) this.sessionCtx.getAttribute("USER_INFO");
}
catch (Exception e)
{
throw new ITMException(e);
}
}
public PackLabelWizBean() {
// TODO Auto-generated constructor stub
}
public String getList( String loginCode, String field, String[] values) throws ITMException
{
String List = "";
PackLabelWizEJBRemote packWizRemote = null;
try
{
InitialContext ctx = new InitialContext( new AppConnectParm().getProperty() );
packWizRemote = (ibase.webitm.ejb.wms.PackLabelWizEJBRemote) ctx.lookup("ibase/PackLabelWizEJB/remote");
List = packWizRemote.getList(loginCode,field,values);
String xslFileName = getXSLFileName( "packLabelWiz_List_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
List = (genericUtility).transformToString( xslFileName, List, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
}
catch (Exception e)
{
throw new ITMException(e);
}
finally
{
if ( packWizRemote != null )
{
packWizRemote = null;
}
}
return List;
}
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"+ File.separator + "Galaxy");
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;
}
/**
* go to prevoius form
* @param formNo
* @param xmlData
* @return
* @throws ITMException
*/
public String previousForm( String formNo, String xmlData ) throws ITMException
{
String retHtmlData = null;
try
{
System.out.println("In Method : [previousForm]"+xmlData);
String xslFileName = getXSLFileName( this.objName + formNo + "_wiz_" + this.user_lang + "_" + this.user_country + "_" + "A" + ".xsl" );
retHtmlData = (genericUtility).transformToString( xslFileName, xmlData, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
}
catch (Exception e)
{
throw new ITMException(e);
}
finally
{
}
return retHtmlData;
}
public String getPoDetails( String objName) throws ITMException
{
String details = null;
PackLabelWizPosEJBRemote packLabelWizPosEJBRemote = null;
try
{
System.out.println("*******In Method : [nextForm]************");
InitialContext ctx = new InitialContext( new AppConnectParm().getProperty() );
packLabelWizPosEJBRemote = (ibase.webitm.ejb.wms.PackLabelWizPosEJBRemote) ctx.lookup("ibase/PackLabelWizPosEJB/remote");
details = packLabelWizPosEJBRemote.getPoDetails(objName);
String xslFileName = getXSLFileName( "packLabelWiz_Finish_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
details = (genericUtility).transformToString( xslFileName, details, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
}
catch (Exception e)
{
throw new ITMException(e);
}
finally
{
if ( packLabelWizPosEJBRemote != null )
{
packLabelWizPosEJBRemote = null;
}
}
return details;
}
}
This diff is collapsed.
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Local;
import org.w3c.dom.Document;
@Local
public interface PackLabelWizEJBLocal extends ValidatorLocal
{
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(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 getList(String loginCode, String field, String[] values) throws RemoteException,ITMException;
public String insertCaseLabel(String itemCode1, String lotNo1, String qty,
String ordNo) throws RemoteException,ITMException ;
}
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import org.w3c.dom.Document;
@Remote
public interface PackLabelWizEJBRemote extends ValidatorRemote
{
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(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 getList(String loginCode, String field, String[] values) throws RemoteException,ITMException;
public String insertCaseLabel(String itemCode1, String lotNo1, String qty,
String ordNo) throws RemoteException,ITMException ;
}
This diff is collapsed.
/*
* Author:Wasim Ansari
* Date:02-FEB-15
* Request ID:D14IKAT004 (Pack Label Wizard)
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
import org.w3c.dom.Document;
@Local
public interface PackLabelWizPosEJBLocal extends ValidatorLocal
{
public String postSave(String xmlStringAll, String tranId, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
public String getPoDetails(String obj) throws RemoteException,ITMException;
}
/*
* Author:Wasim Ansari
* Date:02-FEB-15
* Request ID:D14IKAT004 (Pack Label Wizard)
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
import org.w3c.dom.Document;
@Local
public interface PackLabelWizPosEJBRemote extends ValidatorRemote
{
public String postSave(String xmlStringAll, String tranId, String editFlag, String xtraParams, Connection conn) throws RemoteException,ITMException;
public String getPoDetails(String obj) throws RemoteException,ITMException;
}
/*
* Author: Wasim Ansari
* Date: 08-AUG-2016
* Request: S16EBAS006 (Pack Label Wizard)
*/
package ibase.webitm.servlet.wms;
import ibase.system.config.AppConnectParm;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.wms.PackLabelWizEJB;
import ibase.webitm.ejb.wms.PackLabelWizEJBRemote;
import ibase.webitm.servlet.Messages;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.GZIPOutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PackLabelWizHandlerServlet extends HttpServlet
{
/**
*
*/
private static final long serialVersionUID = 1L;
InitialContext ctx = null;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
doPost( request, response );
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try
{
System.out.println("XXXXXXXXXXXXXXXXXXXXXX[ PackLabelWizHandlerServlet ]XXXXXXXXXXXXXXXXXXXX");
request.setCharacterEncoding(CommonConstants.ENCODING);
PackLabelWizEJBRemote packLabelWizEJBRemote = null;
String htmlData = ""; //$NON-NLS-1$
String retStr = "";
//Changed by manish on 07/10/16[Start]
String actionPrint = request.getParameter("ACTION");
System.out.println("PackLabelWizHandlerServlet ACTION ["+actionPrint+"]");
if("PRINT".equalsIgnoreCase(actionPrint))
{
String itemCodeCaseLabel = checkNullAndTrim(request.getParameter("ITEM_CODE"));
String lotNoCaseLabel = checkNullAndTrim(request.getParameter("LOT_NO"));
String qtyCaseLabel = checkNullAndTrim(request.getParameter("QUANTITY"));
String PurcOrdNoCaseLabel = checkNullAndTrim(request.getParameter("ORDER_NO"));
ctx = getInitialContext();
packLabelWizEJBRemote = (ibase.webitm.ejb.wms.PackLabelWizEJBRemote) ctx.lookup("ibase/PackLabelWizEJB/remote");
retStr = packLabelWizEJBRemote.insertCaseLabel(itemCodeCaseLabel,lotNoCaseLabel,qtyCaseLabel,PurcOrdNoCaseLabel);
System.out.println("retStr ====>> ["+retStr+"]");
response.setContentType("text/xml");
if(CommonConstants.CONTENT_ENCODING != null && CommonConstants.CONTENT_ENCODING.equalsIgnoreCase("gzip"))
{
response.setHeader("Content-Encoding", "gzip");
GZIPOutputStream gzOutStream = new GZIPOutputStream(response.getOutputStream());
gzOutStream.write(retStr.toString().getBytes());
gzOutStream.flush();
gzOutStream.close();
}
else
{
response.setHeader("Content-Encoding", "");
OutputStream outStream = response.getOutputStream();
outStream.write(retStr.toString().getBytes());
outStream.flush();
outStream.close();
}
}
//Changed by manish on 07/10/16[end]
else{
String itemCode = checkNullAndTrim(request.getParameter("ITEM_CODE"));
String lotNo = checkNullAndTrim(request.getParameter("LOT_NO"));
if(itemCode.length() != 0 && lotNo.length() != 0)
{
PackLabelWizEJB packLabel = new PackLabelWizEJB();
String shipperSize = packLabel.getItemLotPackSize(itemCode,lotNo);
response.setContentType("text/xml");
if(CommonConstants.CONTENT_ENCODING != null && CommonConstants.CONTENT_ENCODING.equalsIgnoreCase("gzip"))
{
response.setHeader("Content-Encoding", "gzip");
GZIPOutputStream gzOutStream = new GZIPOutputStream(response.getOutputStream());
gzOutStream.write(shipperSize.toString().getBytes());
gzOutStream.flush();
gzOutStream.close();
}
else
{
response.setHeader("Content-Encoding", "");
OutputStream outStream = response.getOutputStream();
outStream.write(shipperSize.toString().getBytes());
outStream.flush();
outStream.close();
}
}
else
{
ibase.utility.UserInfoBean userInfo = ( ibase.utility.UserInfoBean )request.getSession().getAttribute( "USER_INFO" ); //$NON-NLS-1$
if(userInfo != null)
{
String objName = request.getParameter("OBJ_NAME");//Storing ObjectName //$NON-NLS-1$
String formNo = request.getParameter("FORM_NO");//Storing Current FormNo //$NON-NLS-1$
String action = request.getParameter("action");//Which actions is performed e.g. 'Next','Previous','Finish' //$NON-NLS-1$
//String formType = request.getParameter("formType");//Type of form to implement MultipleForms //$NON-NLS-1$
//String forceSave = request.getParameter("forceSave");//To override Warnings from Business Components //$NON-NLS-1$
String preFormVal = request.getParameter("PRE_FORM_VAL");
System.out.println("preFormVal==========["+preFormVal+"]");
String editorId = (String) request.getSession().getAttribute( "WIZARD_BEAN_ID_" + objName );
System.out.println(" ITMWizardHandlerServlet :: editorId["+editorId+"]" );
if (request.getSession().getAttribute("WIZARD_BEAN_" + editorId) != null)
{
System.out.println(" Wizard Object Found ");
if ("previous".equalsIgnoreCase(action) && "2".equalsIgnoreCase(formNo))
{
response.sendRedirect("/ibase/webitm/jsp/packLabelWiz.jsp?OBJ_NAME=" + objName + "&PRE_FORM_VAL=" + preFormVal);
}
}
}
else
{
htmlData = Messages.getString("ITMWizardHandlerServlet_notLoggedIn")+"\n"+Messages.getString("ITMWizardHandlerServlet_pleaseReLogin"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
}
}
catch (Exception e) {
// TODO: handle exception
}
}
private static String checkNullAndTrim(String input)
{
if (input==null)
{
input="";
}
return input.trim();
}
protected InitialContext getInitialContext()throws ITMException
{
InitialContext ctx = null;
try
{
AppConnectParm appConnect = new AppConnectParm();
ctx = new InitialContext(appConnect.getProperty());
}
catch(ITMException itme)
{
System.out.println("CrossDockAllocServlet.getInitialContext()");
throw itme;
}
catch(Exception e)
{
System.out.println("CrossDockAllocServlet.getInitialContext()"+e.getMessage());
throw new ITMException(e);
}
return ctx;
}
}
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