Commit f1850874 authored by caluka's avatar caluka

CustStockGWTPrvIC.java component removed for unused in secondary sales


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99811 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b6d15115
package ibase.webitm.ejb.dis;
/*
* Request Id : D15ESUN013
* Developer : Mahendra Jadhav
* Functionality : Migrate Cust Stock Replenishment in GWT.
*
*
*/
import ibase.system.config.AppConnectParm;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.utility.GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.ejb.Stateless;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.berryworks.edireader.EDIAbstractReader;
@Stateless
public class CustStockGWTPrvIC extends ValidatorEJB implements CustStockGWTICLocal,CustStockGWTICRemote //implements SessionBean
{
GenericUtility genericUtility = GenericUtility.getInstance();
UtilMethods utilMethod = new UtilMethods();
ibase.webitm.ejb.dis.DistCommon dist = new ibase.webitm.ejb.dis.DistCommon();
java.sql.Timestamp prdFrmDateTstmp =null;
java.sql.Timestamp prdtoDateTstmp =null;
public String wfValData() throws RemoteException,ITMException
{
return "";
}
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
throw new ITMException( e );
}
return (errString);
}
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = null;
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0 )
{
dom2 = parseString("<Root>" + xmlString2+ "</Root>");
}
System.out.println("xmlString2>>>>>>>>"+xmlString2);
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
throw new ITMException( e );
}
return (errString);
}
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
StringBuffer valueXmlString = new StringBuffer();
String frmDateStr = "",trandateStr="",statusCust="",todateStr="",invoiceId="",itemCode="",lineNo="",orderType="",period="",tranIdLast="";
String siteCode = "",custCode="",userId="",sql="",tranId="",errCode="",errorType="",errString="",itemSer="",stmtDateStr="";
String custType="",custType1="";
String fromDateStr ="",toDateStr="",custTypeDom="";
String loginSiteCode="",periodStatus="";
int ctr = 0,currentFormNo=0,cnt=0,countCustRef=0,refSerCnt=0,childNodeListLength=0,invCnt=0,clStockInteger=0;
int custstockCnt=0;
double clStock=0.0,opStockDom=0.0,purRcpDom=0.0;
double opStock=0.0,purRcpQty=0.0,secSales=0.0,purcRetQty=0.0,priSales=0.0,netAmt=0.0;
Date frmdate = null,todate = null;
java.util.Date tranDate = null;
java.sql.Timestamp FromDate=null,ToDate=null,prdFrmDate=null,prdFrom=null,prdTo=null,stmtDateTmstp=null;
Boolean isOrdType = false;
Boolean isClStockInt= true;
Node parentNode1 = null;
Node childNode1 = null;
int parentNodeListLength = 0,transitCnt=0,siteCnt=0;;
SimpleDateFormat sdf = null;
Connection conn = null;
PreparedStatement pstmt = null,pstmt1 = null,pstmt2 = null,pstmt3 = null,pstmt4 = null,pstmt5 = null,pstmt6 = null;
ResultSet rs = null,rs1 = null,rs2 = null,rs3 = null,rs4 = null,rs5 = null,rs6 = null,rs7 = null;
Document domAll = null;
ConnDriver connDriver = new ConnDriver();
Date currentDate = new Date();
ArrayList errList = new ArrayList();
ArrayList errItemList = new ArrayList();
ArrayList errFields = new ArrayList();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try
{
System.out.println("CustStockGWTPrvIC : wfValData called!!!!");
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = connDriver.getConnectDB("DriverITM");
DistCommon distCommon = new DistCommon();
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
loginSiteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"));
System.out.println("userId :"+userId);
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:
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("wfValData : case 1 called!!!!");
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
}
break;
case 2:
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("editFlag@@@@@@@@@@@@"+editFlag);
if("E".equalsIgnoreCase(editFlag) || "E".equalsIgnoreCase(editFlag))
{
System.out.println("show error msg@@@@@@@@@@");
}
System.out.println("wfValData : case 2 called!!!!");
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName in case 2:"+childNodeName);
if (childNodeName.equalsIgnoreCase("tran_id"))
{
tranId = checkNull(this.genericUtility.getColumnValue("tran_id",dom));
System.out.println("tranId>>>>>>>>>"+tranId);
if(tranId != null && tranId.trim().length()>0)
{
System.out.println("show error msg@@@@@@@@@@");
errCode = "VTINVPRV";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
}
int errListSize = errList.size();
cnt = 0;
String errFldName = null;
if ((errList != null) && (errListSize > 0))
{
for (cnt = 0; cnt < errListSize; cnt++)
{
errCode = (String)errList.get(cnt);
errFldName = (String)errFields.get(cnt);
errString = getErrorString(errFldName, errCode, userId);
errorType = errorType(conn, errCode);
if(errItemList.size()>0 && errString.length() > 0)
{
String begPart = errString.substring( 0, errString.indexOf("]]></description>") );
String mainStr="";
for(int i=0;i<errItemList.size();i++)
{
mainStr=mainStr+ errItemList.get(i)+",";
}
String endPart=errString.substring( errString.indexOf("]]></description>"), errString.length() );
mainStr=" for following Items "+mainStr.substring(0,mainStr.length()-1);
errString = begPart+mainStr + endPart;
}
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") +
8, errString.indexOf("<trace>"));
bifurErrString = bifurErrString +
errString.substring(errString.indexOf("</trace>") +
8, errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
errString = "";
}
if (errorType.equalsIgnoreCase("E"))
{
break;
}
}
errStringXml.append("</Errors> </Root> \r\n");
}
else
{
errStringXml = new StringBuffer("");
}
}
catch (Exception e)
{
e.printStackTrace();
errString = e.getMessage();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;
}
catch (Exception d)
{
d.printStackTrace();
throw new ITMException(d);
}
}
errString = errStringXml.toString();
return errString;
}//wfValData
private String checkNull(String input)
{
if (input == null)
{
input="";
}
return input;
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
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();
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
}
\ No newline at end of file
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