Commit 9a7e8520 authored by pjain's avatar pjain

Issue tracker point no 402


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95380 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a727804f
......@@ -17,6 +17,7 @@ import javax.print.PrintService;
import org.w3c.dom.*;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
......@@ -231,10 +232,37 @@ public class CheckSheetIC extends ValidatorEJB implements CheckSheetICLocal,Chec
}
}
//Changed by sumit on 16/11/12 validating printer service name with existing printer in system start.
else if ( "printer".equalsIgnoreCase( childNodeName ) )
//else if ( "printer".equalsIgnoreCase( childNodeName ) )
else if ( "printer_name".equalsIgnoreCase( childNodeName ) )
{
printer = checkNull(genericUtility.getColumnValue( "printer_name", currFormDataDom ));
System.out.println(" printer from input parameter ["+printer+"]");
System.out.println("CALLIN INSIDE printer from input parameter ["+printer+"]");
if(printer != null && printer.length() > 0)
{
//Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
sql="select printer_name from net_printers where printer_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, printer.trim());
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println("Printer Found in net_printers..........["+printer+"]");
}
else
{
errList.add( "INVPRINTER" );
errFields.add( childNodeName.toLowerCase() );
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
PrintService[] printServices = PrinterJob.lookupPrintServices();
ArrayList<String> arry = new ArrayList<String>();
if(printer.trim().length() > 0)
......@@ -253,6 +281,25 @@ public class CheckSheetIC extends ValidatorEJB implements CheckSheetICLocal,Chec
arry.clear();
}
}
}
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
}
//Changed by sumit on 16/11/12 validating printer service name with existing printer in system end.
}
} //End of case 1 Validation
......@@ -839,6 +886,44 @@ public class CheckSheetIC extends ValidatorEJB implements CheckSheetICLocal,Chec
* If null, the function returns blank string otherwise trim the input string and return.
* @param input
*/
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
}
......@@ -385,7 +385,17 @@ public class CheckSheetPos extends ValidatorEJB implements CheckSheetPosLocal, C
"</Argument>" +
"</Arguments>";
System.out.println(" XSD parser **->["+xsdString+"]");
//changed by sankara on 24/06/14 call report from remote
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, loginCode, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, loginCode, printer.trim(), 1, conn);
}
//errString = jrGenerator.printReport(reportObjName, xsdString, loginCode, printer.trim(), 1, conn);
}
catch(Exception e)
......@@ -404,5 +414,45 @@ public class CheckSheetPos extends ValidatorEJB implements CheckSheetPosLocal, C
}
return str;
}
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
}
......@@ -591,6 +591,27 @@ etc
else
{
System.out.println(" in inside if");
//Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
sql="select printer_name from net_printers where printer_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, printer.trim());
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println("Printer Found in net_printers..........["+printer+"]");
}
else
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
for (PrintService printService : printServices)
{
String name = printService.getName();
......@@ -604,6 +625,24 @@ etc
}
arry.clear();
}
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
}
}
}
} //End of case 1 Validation
......@@ -900,4 +939,44 @@ etc
///return cartonMasterTranCode;
}
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
}
......@@ -1730,7 +1730,17 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
"</Argument>" +
"</Arguments>";
System.out.println(" XSD parser **->["+xsdString+"]");
//changed by sankara on 24/06/14 call report from remote
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
//errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
System.out.println(" PRINTING task completed--------**------->");
//}
......@@ -1743,6 +1753,46 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
return errString;
}
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
}
......@@ -1256,7 +1256,27 @@ etc
}
else if(printer.trim().length() > 0 && "Y".equalsIgnoreCase(printLabel))
{
System.out.println(" in inside if");
//Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
if(isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn))
{
sql="select printer_name from net_printers where printer_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, printer.trim());
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println("Printer Found in net_printers..........["+printer+"]");
}
else
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
for (PrintService printService : printServices)
{
String name = printService.getName();
......@@ -1270,6 +1290,26 @@ etc
}
arry.clear();
}
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
}
}
//Changed by sumit on 03/10/12 validating printer service name with existing printer in system end.
//Changed by sumit on 17/11/12 validating sale order on hold start.
......@@ -1702,4 +1742,43 @@ etc
return dataVolumeMap;
}
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
DistCommon discommon = new DistCommon();
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
}
......@@ -205,7 +205,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
Shipment2 shipment2 = null;
//Changed By Pragyan 18-DEC-13 To check ADSI Connection is required.(KB/Ashish mail Dt.121413)
String isADSIConnReq = "N";
boolean isRemotePrintRptSrvCofigur = false;
public String process() throws RemoteException,ITMException
{
......@@ -2991,6 +2991,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
//changed by sankara on 24/09/13 for update status in sorddet end.
try
{
//Changed By Pragyan 30JUN14 to take the connection above
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
//Changed sumit on 25/08/12
waveId = "";
//Changed by sumit on 14/12/12 getting value of printer start
......@@ -3001,6 +3006,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
PrintService[] printServices = PrinterJob.lookupPrintServices();
ArrayList<String> arry = new ArrayList<String>();
//Changed by sumit on 24/11/12 adding print label condition
isRemotePrintRptSrvCofigur = isRemotePrintSrvCofigured("IS_REMOTE_PRNTSRV_CONFIGRD",conn);
if(printer.trim().length() == 0 && "Y".equalsIgnoreCase(printLabel))
{
......@@ -3011,6 +3017,30 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
return errString;
}
else if(printer.trim().length() > 0 && "Y".equalsIgnoreCase(printLabel))
{
//Changed by Dhanraj on 27JUN14 to validate printer name from net printers table.start
if(isRemotePrintRptSrvCofigur)
{
sql="select printer_name from net_printers where printer_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, printer.trim());
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println("Printer Found in net_printers..........["+printer+"]");
}
else
{
errString="INVPRINTER";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
return errString;
}
pstmt.close();pstmt = null;
rs.close(); rs = null;
}
else
{
for (PrintService printService : printServices)
{
......@@ -3026,6 +3056,24 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
}
arry.clear();
}
//end Dhanraj 27Jun14
//hide by Dhanraj 27Jnn14
/*System.out.println(" in inside if");
for (PrintService printService : printServices)
{
String name = printService.getName();
System.out.println("printer service name --> "+name);
arry.add(name);
}
if( !arry.contains(printer.trim()))
{
errFields.add( childNodeName.toLowerCase() );
errList.add( "INVPRINTER" );
}
arry.clear(); */
//Changed by Dhanraj 27JUN14 to validate printer name from net printers table.end
}
//Changed by sumit on 14/12/12 getting value of printer end
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "termId");
......@@ -3035,10 +3083,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
shipType = genericUtility.getColumnValue("ship_type",headerDom);
directPickLoc = genericUtility.getColumnValue("direct_pick_loc",headerDom);
ConnDriver connDriver = new ConnDriver();
//Changed By Pragyan 30JUN14 to take the connection above
/*ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
connDriver = null;*/
shipment2 = null;
if(directPickLoc != null && directPickLoc.length() > 0)
......@@ -20353,9 +20402,19 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
jrGenerator.createReport(reportObjName , argMap, xsdParser, chgUser, outputFilename, conn);
}
else
{
//changed by sankara on 24/06/14 for report calling from remote
if(isRemotePrintRptSrvCofigur)
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
//errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
//Changed by sumit on 07/09/12 changed the method as per new requirement
......@@ -21718,7 +21777,16 @@ private String generatedLabelPrint(String waveId, String printer, Connection con
"</Argument>" +
"</Arguments>";
System.out.println(" XSD parser **->["+xsdString+"]");
//errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
if(isRemotePrintRptSrvCofigur)
{
errString = jrGenerator.callRemotePrintServlet(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
else
{
errString = jrGenerator.printReport(reportObjName, xsdString, chgUser, printer.trim(), 1, conn);
}
System.out.println(" PRINTING task completed--------**------->");
//}
......@@ -22492,4 +22560,44 @@ private String getInventoryStatus(String locCode,Connection conn) throws ITMExce
return invStat;
}
private boolean isRemotePrintSrvCofigured(String propertyName , Connection conn) throws ITMException
{
String sql = "";
String flagRemoteRptSrvltCofigured = "N";
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean isConfigured = false;
try
{
flagRemoteRptSrvltCofigured = discommon.getDisparams("999999",propertyName,conn);
if("Y".equalsIgnoreCase(flagRemoteRptSrvltCofigured))
{
return isConfigured = true;
}
else
{
return isConfigured;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
}
}
\ No newline at end of file
package ibase.webitm.wms.reports;
import ibase.system.config.ConnDriver;
import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.HashPrintServiceAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.attribute.PrintServiceAttributeSet;
import javax.print.attribute.standard.PrinterName;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter;
/**
* Servlet implementation class TestServlet
*/
public class ReportRequesthandlerServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Default constructor.
* @return
*/
public void RequestreportServlet()
{
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
// TODO Auto-generated method stub
res.setContentType("text/xml");
res.setHeader("Cache-Control", "no-store, no-cache");
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
String printerName = "";
Connection con = null;
String printServiceName = "";
JasperPrint jasperPrint = null;
String retString ="";
try
{
printServiceName = (String)req.getParameter("PRINTER_NAME");
System.out.println("Server Side getting printer BName ::::::::::::["+printServiceName+"]:::::::::::");
DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintServiceAttributeSet printServiceAttributeSet = new HashPrintServiceAttributeSet();
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
ObjectInputStream inputStream = null ;
Object objectS = null;
try {
System.out.println("Request URL " + req.getRequestURL());
System.out.println("Request URL " + req.getQueryString());
System.out.println("Avilable bytes " + req.getInputStream().available());
inputStream = new ObjectInputStream(req.getInputStream());
//objectS = (Object)inputStream.readObject();
System.out.println("------------------Reading Object================..");
while ((objectS = inputStream.readObject()) != null)
{
if (objectS instanceof JasperPrint) {
System.out.println("Found with Jasper Print Object");
jasperPrint = (JasperPrint)objectS;
}
}
} catch (EOFException ex) { //This exception will be caught when EOF is reached
System.out.println("End of file reached.");
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
//Close the ObjectInputStream
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
System.out.println("Total Page Size For Print["+jasperPrint.getPages().size() +"]");
PrinterName name = new PrinterName(printServiceName, null);
printServiceAttributeSet.add(name);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
exporter.setParameter
(JRPrintServiceExporterParameter.PRINT_REQUEST_ATTRIBUTE_SET,
printRequestAttributeSet);
exporter.setParameter
(JRPrintServiceExporterParameter.PRINT_SERVICE_ATTRIBUTE_SET,
printServiceAttributeSet);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PAGE_DIALOG,
Boolean.FALSE);
exporter.setParameter(JRPrintServiceExporterParameter.DISPLAY_PRINT_DIALOG,
Boolean.FALSE);
exporter.exportReport();
}
catch (Exception E)
{
E.printStackTrace();
}
finally
{
try
{
}
catch(Exception d)
{
d.printStackTrace();
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException
{
doPost(request,response);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Struts 2</display-name>
<servlet>
<servlet-name>ReportRequesthandlerServlet</servlet-name>
<servlet-class>ibase.webitm.wms.reports.ReportRequesthandlerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReportRequesthandlerServlet</servlet-name>
<url-pattern>/ReportRequesthandlerServlet</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
......@@ -45780,6 +45780,9 @@ VALUES (
'Base',
NULL,
NULL);
--Changed By Pragyan for report sql
INSERT INTO DISPARM DISPARM ( prd_code , var_name, var_type, var_value, descr , var_subs, chg_date, chg_user , chg_term ) VALUES ( '999999', 'IS_REMOTE_PRNTSRV_CONFIGRD', 'S', 'Y', 'FOR WMS TOMCAT SERVER INSTALLATION', 0, TO_DATE('30-06-2014 00:00:00','DD-MM-YYYY HH24:MI:SS'), 'PP', 'P');
commit;
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