Commit 208543d3 authored by cpatil's avatar cpatil

test for multiple tran id


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91880 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8cbc5ae7
......@@ -13,6 +13,7 @@ import ibase.system.config.*;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless; // added for ejb3
import ibase.webitm.ejb.dis.adv.*;
@Stateless
public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, InvHoldRelGenRemote
......@@ -527,6 +528,15 @@ public String process(String xmlString, String xmlString2, String windowName, St
Document dom = null,headerDom=null,detailDom=null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB();
int parentNodeListLength = 0;
int childNodeListLength = 0;
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = "";
try
{
System.out.println("method : process(xmlString, xmlString2, windowName, xtraParams,conn) called");
......@@ -583,8 +593,8 @@ public String process(String xmlString, String xmlString2, String windowName, St
{
System.out.println( updCnt + "INV_HOLD_REL rows inserted successfully" );
}
lineNo = genericUtility.getColumnValue("line_no",detailDom);
// 09/09/12 manoharan commented and added new logical code
/*lineNo = genericUtility.getColumnValue("line_no",detailDom);
sql = "select count(*) from inv_hold_det where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -629,55 +639,94 @@ public String process(String xmlString, String xmlString2, String windowName, St
System.out.println( updCnt + " INV_HOLD_REL_DET rows updated successfully" );
}
}
*/
// 09/09/12 manoharan commented upto here and added the following code
/////////////////////////////////////////////////////////////////////////
parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
//System.out.println("parentNodeListLength------------------->"+parentNodeListLength);
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength---->>> "+ childNodeListLength);
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName---->>> "+ childNodeName);
if (childNodeName.equals("tran_id"))
{
tranId = childNode.getFirstChild().getNodeValue();
}
if (childNodeName.equals("line_no"))
{
lineNo = childNode.getFirstChild().getNodeValue();
}
}
ctr++;
pRelDet.setString( 1, tranIdGenerate );
pRelDet.setInt( 2,ctr);
pRelDet.setString( 3, tranId );
pRelDet.setString( 4, lineNo );
pRelDet.setString( 5, remark );
pRelDet.addBatch();
//updCnt = pRelDet.executeUpdate();
pRelDet.clearParameters();
}
/////////////////////////////////////////////////////////////////////////
pRelDet.executeBatch();
pRelDet.clearBatch();
if("Y".equalsIgnoreCase(autoConfirmed))
{
InvHoldRelConf invHoldRelConf = new InvHoldRelConf();
errString = invHoldRelConf.confirm(tranIdGenerate,xtraParams, "N" , conn,false);
invHoldRelConf = null;
if (errString.indexOf("VTCNFSUCC") > -1)
{
errString = "";
}
//sql = " update inv_hold set confirmed = 'Y', conf_date = ? where tran_id = ?";
sql = "update inv_hold_det set hold_status = 'R', status_date = ? where tran_id = ?";
/*sql = "update inv_hold_det set hold_status = 'R', status_date = ? where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,currDate);
pstmt.setString(2,tranId);
int rowcnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
*/
conn.commit();
if(rowcnt == 0)
{
errString = itmDBAccessLocal.getErrorString("","VTMCONF9","");
return errString;
}
else
if (errString == null || errString.trim().length() == 0)
{
conn.commit();
System.out.println("inv_hold_det transaction hold_status release succesfully........");
errString = itmDBAccessLocal.getErrorString("","VTMCONF2","");
return errString;
}
}
conn.commit();
}
if(pRelHdr != null)
else
{
pRelHdr.close();
pRelHdr = null;
conn.rollback();
System.out.println("Process failed........");
errString = itmDBAccessLocal.getErrorString("","VTDESNCONF","");
}
if(pRelDet != null)
{
pRelDet.close();
pRelDet = null;
}
}
catch (Exception e)
{
System.out.println("Exception :InvHoldRelGenEJB :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
errString = e.getMessage();
e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1)
{
e1.printStackTrace();
}
throw new ITMException(e);
}
finally
......@@ -685,6 +734,16 @@ public String process(String xmlString, String xmlString2, String windowName, St
try
{
if(pRelHdr != null)
{
pRelHdr.close();
pRelHdr = null;
}
if(pRelDet != null)
{
pRelDet.close();
pRelDet = null;
}
if(conn != null)
{
conn.close();
......@@ -696,7 +755,7 @@ public String process(String xmlString, String xmlString2, String windowName, St
ex.printStackTrace();
}
}
return retStr;
return errString;
}
private String generateTranId( String windowName, String siteCode, String tranDateStr, Connection conn )throws 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