Commit 231e873f authored by smestry's avatar smestry

W15FSUN008, Create transaction screen Palletization and palletization Confirm for AWMS.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98794 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 31923cc5
...@@ -57,7 +57,6 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -57,7 +57,6 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
{ {
System.out.println("::::::::::::::::: Inside postSave for palletization confirm :::::::::::::::: "); System.out.println("::::::::::::::::: Inside postSave for palletization confirm :::::::::::::::: ");
System.out.println("::::::::::::::::: Inside if loop for connection :::::::::::::::: ");
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
...@@ -395,9 +394,78 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -395,9 +394,78 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return tranId; return tranId;
} }
/*
public HashMap getInterface2Data(String itemCode, Connection conn, String siteCode) throws ITMException, SQLException
{
HashMap hm = new HashMap();
PreparedStatement pstmt=null;
ResultSet rs = null;
String sql = "";
String familyGrp = "", qcType = "", stroPref = "";
try
{
sql = "SELECT LOC_ZONE__PREF, PROC_MTH, ANALYSIS_CLASS 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())
{
familyGrp = rs.getString("LOC_ZONE__PREF");
qcType = rs.getString("PROC_MTH");
stroPref = rs.getString("ANALYSIS_CLASS");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
sql = "SELECT LOC_ZONE__PREF, PROC_MTH, ANALYSIS_CLASS FROM ITEM WHERE ITEM_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
if(familyGrp == null || familyGrp.length() <= 0)
{
familyGrp = rs.getString("LOC_ZONE__PREF");
}
if(qcType == null || qcType.length() <= 0)
{
qcType = rs.getString("PROC_MTH");
}
if(stroPref == null || stroPref.length() <= 0)
{
stroPref = rs.getString("ANALYSIS_CLASS");
}
}
rs.close();rs = null;
pstmt.close();pstmt = null;
hm.put("LOC_ZONE__PREF", familyGrp);
hm.put("PROC_MTH", qcType);
hm.put("ANALYSIS_CLASS", stroPref);
}
catch(Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
}
return hm;
}
*/
private void confirm( String tranId, String siteCode, Connection conn ) throws ITMException, SQLException private void confirm( String tranId, String siteCode, Connection conn ) throws ITMException, SQLException
{ {
String errString = "", sql = "", interfaceTranId = "", tranDate = "", objName = "", invStat = "", available = ""; String errString = "", sql = "", interfaceTranId = "", tranDate = "", objName = "", invStat = "", available = "", familyGrp = "", qcType = "",
stroPref = "";
double quantity = 0, holdQuantity = 0; double quantity = 0, holdQuantity = 0;
PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null, pstmt3 = null; PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null, pstmt3 = null;
ResultSet rs = null, rs1 = null, rs2 = null, rs3 = null; ResultSet rs = null, rs1 = null, rs2 = null, rs3 = null;
...@@ -431,7 +499,6 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -431,7 +499,6 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
pstmt.setTimestamp(2, new Timestamp(System.currentTimeMillis())); pstmt.setTimestamp(2, new Timestamp(System.currentTimeMillis()));
pstmt.setString(3, tranId); pstmt.setString(3, tranId);
pstmt.executeUpdate(); pstmt.executeUpdate();
System.out.println("Confirmed the transaction in pallet_hdr table for tran_id ::::::::: " + tranId);
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -444,11 +511,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -444,11 +511,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
while(rs.next()) while(rs.next())
{ {
sql = "select hold_qty from stock where quantity > 0 and site_code = ? and loc_code = ? and " sql = "select hold_qty from stock where quantity > 0 and site_code = ? and loc_code = ? and "
+ "item_code = ? "; + "item_code = ? and lot_no = ? and lot_sl = ? ";
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("SITE_CODE")); pstmt1.setString(1, rs.getString("SITE_CODE"));
pstmt1.setString(2, rs.getString("LOC_CODE")); pstmt1.setString(2, rs.getString("LOC_CODE"));
pstmt1.setString(3, rs.getString("ITEM_CODE")); pstmt1.setString(3, rs.getString("ITEM_CODE"));
pstmt1.setString(4, rs.getString("LOT_NO"));
pstmt1.setString(5, rs.getString("LOT_SL"));
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if (rs1.next()) if (rs1.next())
{ {
...@@ -459,8 +528,8 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -459,8 +528,8 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
pstmt1 = null; pstmt1 = null;
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
if(holdQuantity > 0) if(holdQuantity >= 0)
{ {
System.out.println("inside hold quantity greater than zero :::::::::::::::::: "); System.out.println("inside hold quantity greater than zero :::::::::::::::::: ");
...@@ -505,62 +574,23 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -505,62 +574,23 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
System.out.println("invStat in 3rd if::::::::::::: " + invStat); System.out.println("invStat in 3rd if::::::::::::: " + invStat);
} }
} }
System.out.println("invStat final ::::::::::::: " + invStat); else
/*sql = "select available from invstat where inv_stat = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("INV_STAT"));
rs1 = pstmt1.executeQuery();
if (rs1.next())
{ {
available = checkNullAndTrim(rs1.getString("available"));
}
System.out.println("available ::::::::::::: " + available);
pstmt1.close();
pstmt1 = null;
rs1.close();
rs1 = null;*/
/*
sql = "select sum(quantity) as QTY, sum(hold_qty) as HOLD_QTY from stock where quantity > 0 and site_code = ? and loc_code = ? and "
+ "item_code = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, rs.getString("SITE_CODE"));
pstmt1.setString(2, rs.getString("LOC_CODE"));
pstmt1.setString(3, rs.getString("ITEM_CODE"));
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
quantity = rs1.getDouble("QTY");
holdQuantity = rs1.getDouble("HOLD_QTY");
}
System.out.println("quantity ::::::::::::: " + quantity);
System.out.println("holdQuantity ::::::::::::: " + holdQuantity);
pstmt1.close();
pstmt1 = null;
rs1.close();
rs1 = null;*/
/*
if("Y".equalsIgnoreCase(available) && quantity == holdQuantity)
{
System.out.println("invStat in 1st if ::::::::::::: " + invStat);
invStat = "H";
}
else if("Y".equalsIgnoreCase(available))
{
System.out.println("invStat in 2nd if::::::::::::: " + invStat);
invStat = "A"; invStat = "A";
System.out.println("inside else :::::::::::::::::: ");
} }
else if(quantity == holdQuantity) System.out.println("invStat final ::::::::::::: " + invStat);
{
System.out.println("invStat in 3rd if ::::::::::::: " + invStat);
invStat = "H";
}*/
interfaceTranId = generateTranTd("w_interface2", tranDate, siteCode, conn); interfaceTranId = generateTranTd("w_interface2", tranDate, siteCode, conn);
System.out.println("interface2TranId ::::::::::::: " + interfaceTranId); System.out.println("interface2TranId ::::::::::::: " + interfaceTranId);
HashMap hm = new HashMap(); HashMap hm = new HashMap();
/*HashMap hm1 = new HashMap();
hm1 = getInterface2Data(rs.getString("ITEM_CODE"), conn, siteCode);
familyGrp = (String) hm1.get("LOC_ZONE__PREF");
qcType = (String) hm1.get("PROC_MTH");
stroPref = (String) hm1.get("ANALYSIS_CLASS");*/
hm.put("IN_OUT", "I"); hm.put("IN_OUT", "I");
hm.put("ERR_COD", ""); hm.put("ERR_COD", "");
...@@ -590,7 +620,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -590,7 +620,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
hm.put("REF_LINE_NO", ""); hm.put("REF_LINE_NO", "");
interfaceArrList.add(hm); interfaceArrList.add(hm);
} }
commonWmsUtility.updateAwmsInterface(interfaceArrList, conn); commonWmsUtility.updateAwmsInterface(interfaceArrList, conn);
System.out.println("Inserted into interface2 table ::::::::::::: "); System.out.println("Inserted into interface2 table ::::::::::::: ");
......
/**
* PURPOSE : PalletizationConfIC component
* AUTHOR : Sneha Mestry
* DATE : 12-10-2015
*/
package ibase.webitm.ejb.wms;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.*;
import org.w3c.dom.*;
@javax.ejb.Stateless
public class PalletizationConfIC extends ValidatorEJB implements PalletizationICLocal, PalletizationICRemote
{
/**
* The method is defined without any parameter and returns blank string
*/
@Override
public String wfValData() throws RemoteException, ITMException
{
return "";
}
/**
* The public method is used for converting the current form data into a document(DOM)
* The dom is then given as argument to the overloaded function wfValData to perform validation
* Returns validation string if exists else returns null in XML format
* @param xmlString contains the current form data in XML format
* @param xmlString1 contains all the header information in the XML format
* @param xmlString2 contains the data of all the forms in XML format
* @param objContext represents the form number
* @param editFlag represents the mode of transaction(A-Add or E-Edit)
* @param xtraParams contains additional information such as loginEmpCode,loginCode,chgTerm etc
*/
@Override
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
System.out.println( "xmlString ::" + xmlString);
System.out.println( "xmlString1 ::" + xmlString1);
System.out.println( "xmlString2 ::" + xmlString2);
if(xmlString != null && xmlString.trim().length()!= 0)
{
dom = genericUtility.parseString(xmlString);
}
if(xmlString1 != null && xmlString1.trim().length()!= 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if(xmlString2 != null && xmlString2.trim().length()!= 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
System.out.println ( "Calling itemChanged( dom, dom1, dom2, objContext, xtraParams )");
errString = wfValData( dom, dom1, dom2, objContext, xtraParams);
System.out.println( "ErrString: " + errString);
}
catch(Exception e)
{
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
return (errString);
}
/**
* The public overloaded method takes a document as input and is used for the validation of required fields
* Returns validation string if exist otherwise returns null in XML format
* @param currFormDataDom contains the current form data as a document object model
* @param hdrDataDom contains all the header information
* @param allFormDataDom contains the field data of all the forms
* @param objContext represents form number
* @param editFlag represents the mode of transaction(A-Add or E-Edit)
* @param xtraParams contains additional information such as loginEmpCode,loginCode,chgTerm etc
*/
@Override
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String xtraParams) throws RemoteException, ITMException
{
Connection conn = null;
GenericUtility genericUtility;
String errString = "";
int currentFormNo = 0;
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
try
{
System.out.println("::::::::::::::::: Inside wfValData :::::::::::::::: ");
genericUtility = GenericUtility.getInstance();
System.out.println("xtraParam----->>["+xtraParams+"]");
System.out.println("DOM---->>["+genericUtility.serializeDom(dom).toString()+"]");
System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]");
System.out.println("DOM2----->>["+genericUtility.serializeDom(dom2).toString()+"]");
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch ( currentFormNo )
{
case 1:
System.out.println("------in detail1 validation----------------");
System.out.println("DOM---->>["+genericUtility.serializeDom(dom).toString()+"]");
System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]");
System.out.println("DOM2----->>["+genericUtility.serializeDom(dom2).toString()+"]");
break;
}//End of switch statement
}
catch ( Exception e )
{
System.out.println ( "Exception: PalletizationConfIC: wfValData( Document currFormDataDom ): " + e.getMessage() + ":" );
//throw new ITMException(e);
e.printStackTrace();
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println( "Exception : PalletizationConfIC:wfValData : " + e.getMessage() );
throw new ITMException(e);
}
}
System.out.println( "errString>>>>>>>::" + errString );
return errString;
}
private String errorType( Connection conn , String errorCode )
{
String msgType = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
try
{
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
while( rs.next() )
{
msgType = rs.getString("MSG_TYPE");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
catch ( Exception e )
{
e.printStackTrace();
}
}
return msgType;
}
/**
* The public method is defined without any parameters and returns blank string
*/
@Override
public String itemChanged() throws RemoteException, ITMException
{
return "";
}
/**
* The public method is used for converting the current form data into a document(dom)
* The dom is then given as argument to the overloaded function wfValData to perform validation
* Returns validation string if exists else returns null in XML format
* @param xmlString contains the current form data in XML format
* @param xmlString1 contains all the header information in the XML format
* @param xmlString2 contains the data of all the forms in XML format
* @param objContext represents the form number
* @param editFlag represents the mode of transaction(A-Add or E-Edit)
* @param xtraParams contains additional information such as loginEmpCode,loginCode,chgTerm etc
*/
@Override
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document currFormDataDom = null;
Document hdrDataDom = null;
Document allFormDataDom = null;
String errString = null;
GenericUtility genericUtility = GenericUtility.getInstance();
System.out.println("xmlString ["+xmlString+"]");
System.out.println("xmlString1 ["+xmlString1+"]");
System.out.println("xmlString2 ["+xmlString2+"]");
try
{
if (xmlString != null && xmlString.trim().length()!=0)
{
currFormDataDom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length()!=0)
{
hdrDataDom = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length()!=0)
{
allFormDataDom = genericUtility.parseString(xmlString2);
}
System.out.println ( "Calling itemChanged( currFormDataDom, hdrDataDom, allFormDataDom, objContext, currentColumn, editFlag, xtraParams )");
errString = itemChanged( currFormDataDom, hdrDataDom, allFormDataDom, objContext, currentColumn, editFlag, xtraParams );
System.out.println ( "ErrString :" + errString);
}
catch (Exception e)
{
System.out.println ( "Exception :PalletizationConfIC : itemChanged(String,String):" + e.getMessage() + ":" );
throw new ITMException(e);
}
System.out.println ( "returning from PalletizationConfIC itemChanged \n[" + errString + "]" );
return errString;
}
/**
* The public overloaded method takes a document as input and is used for the validation of required fields
* Returns validation string if exist otherwise returns null in XML format
* @param currFormDataDom contains the current form data as a document object model
* @param hdrDataDom contains all the header information
* @param allFormDataDom contains the field data of all the forms
* @param objContext represents form number
* @param currentColumn represents the current field
* @param editFlag represents the mode of transaction(A-Add or E-Edit)
* @param xtraParams contains additional information
*/
@Override
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
StringBuffer valueXmlString = new StringBuffer();
Connection conn = null;
int currentFormNo = 0;
ConnDriver connDriver = new ConnDriver();
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver=null;
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
switch(currentFormNo)
{
case 1 :
{
valueXmlString.append("<Detail1 domID='1' selected=\"N\">\r\n");
valueXmlString.append("</Detail1>");
}
break;
}
valueXmlString.append("</Root>");
System.out.println("=================["+valueXmlString+"]");
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Exception ::"+e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if(conn!=null)
{
if(conn != null)
{
conn.close();
conn = null;
}
}
}
catch(Exception d)
{
d.printStackTrace();
}
}
return valueXmlString.toString();
}
}
/**
* PURPOSE : Local Interface for PalletizationConfIC component
* AUTHOR : Sneha Mestry
* DATE : 12-10-2015
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import javax.ejb.*;
@javax.ejb.Local
public interface PalletizationConfICLocal extends ValidatorLocal
{
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 currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, 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 currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String currentColumn,String editFlag, String xtraParams ) throws RemoteException, ITMException;
}
/**
* PURPOSE : Remote Interface for PalletizationConfIC component
* AUTHOR : Sneha Mestry
* DATE : 12-10-2015
*/
package ibase.webitm.ejb.wms;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import javax.ejb.*;
@javax.ejb.Remote
public interface PalletizationConfICRemote extends ValidatorRemote
{
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 currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, 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 currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String currentColumn,String editFlag, String xtraParams ) throws RemoteException, ITMException;
}
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