Commit 67b0399e authored by pchavan's avatar pchavan

Update SCMwebServices.java to set tran Id as receipt number while insertion of...

Update SCMwebServices.java to set tran Id as receipt number while insertion of records in to RCPDISHNR  table.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@183383 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5728cd7a
...@@ -4,6 +4,7 @@ package ibase.webitm.ejb.dis; ...@@ -4,6 +4,7 @@ package ibase.webitm.ejb.dis;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import java.io.BufferedWriter; import java.io.BufferedWriter;
...@@ -15,6 +16,7 @@ import java.util.HashMap; ...@@ -15,6 +16,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
...@@ -41,6 +43,11 @@ public class SCMWebServiceDao extends ValidatorEJB ...@@ -41,6 +43,11 @@ public class SCMWebServiceDao extends ValidatorEJB
StringBuffer retSBuff = new StringBuffer("<Root>"); StringBuffer retSBuff = new StringBuffer("<Root>");
File dumpDir = null; File dumpDir = null;
File logDumpDir = null; File logDumpDir = null;
Connection conn = null;
String sql = "" , tranid ="";
PreparedStatement pstmt = null ;
ResultSet rs = null ;
boolean isError = false ;
try try
{ {
System.out.println("SCMWebServiceDao.addTransaction().dataXML["+dataXML+"]"); System.out.println("SCMWebServiceDao.addTransaction().dataXML["+dataXML+"]");
...@@ -56,6 +63,42 @@ public class SCMWebServiceDao extends ValidatorEJB ...@@ -56,6 +63,42 @@ public class SCMWebServiceDao extends ValidatorEJB
String objName = detail1Node.getAttributes().getNamedItem("objName").getNodeValue(); String objName = detail1Node.getAttributes().getNamedItem("objName").getNodeValue();
System.out.println("objName["+objName+"]"); System.out.println("objName["+objName+"]");
// Added By PriyankaC on 10April2018 [START].
if("rcpdishnr_adv".equalsIgnoreCase(objName))
{
System.out.println("In Side Receipt advance :");
String RefNo = (this.e12GenericUtility.getColumnValueFromNode("ref_no", detail1Node));
String CustCode = (this.e12GenericUtility.getColumnValueFromNode("cust_code", detail1Node));
this.setUserInfo(userInfoBean);
conn = getConnection();
sql = "select tran_id from receipt where ref_no = ? and cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, RefNo);
pstmt.setString(2, CustCode);
rs = pstmt.executeQuery();
if (rs.next())
{
tranid = E12GenericUtility.checkNull(rs.getString("tran_id"));
}
System.out.println("tranid["+tranid+"]");
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
System.out.println("Calling setNodeValue :");
setNodeValue( dataXMLDom, "receipt_no", tranid );
dataXML = e12GenericUtility.serializeDom(dataXMLDom);
}
// Added By PriyankaC on 10April2018 [END].
if( CommonConstants.UPLOAD_LOC == null && CommonConstants.J2EE_VERSION.equals( "1" )) if( CommonConstants.UPLOAD_LOC == null && CommonConstants.J2EE_VERSION.equals( "1" ))
{ {
System.out.println("UPLOAD_LOC is null"); System.out.println("UPLOAD_LOC is null");
...@@ -178,6 +221,22 @@ public class SCMWebServiceDao extends ValidatorEJB ...@@ -178,6 +221,22 @@ public class SCMWebServiceDao extends ValidatorEJB
System.out.println("SCMWebServiceDao.addTransaction()["+e.getMessage()+"]"); System.out.println("SCMWebServiceDao.addTransaction()["+e.getMessage()+"]");
throw new ITMException (e); throw new ITMException (e);
} }
finally
{
try
{
if(conn != null && !conn.isClosed() )
{
conn.close();
conn = null;
}
}
catch (SQLException sql1)
{
System.out.println("SQL Exception" +sql1.getMessage());
}
}
return retString; return retString;
} }
...@@ -331,5 +390,29 @@ public class SCMWebServiceDao extends ValidatorEJB ...@@ -331,5 +390,29 @@ public class SCMWebServiceDao extends ValidatorEJB
return gson.toJson(sh); return gson.toJson(sh);
} }
//Added by PriyankaC [ END ]
//Added By PriyankaC on 10April [START]
private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
{
Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
if( tempNode != null )
{
if( tempNode.getFirstChild() == null )
{
CDATASection cDataSection = dom.createCDATASection( nodeVal );
tempNode.appendChild( cDataSection );
}
else
{
tempNode.getFirstChild().setNodeValue(nodeVal);
}
}
else
{
dom.createElement(nodeName).setNodeValue(nodeVal);
}
tempNode = null;
}
//Added By PriyankaC on 10April [END]
} }
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