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.*; ...@@ -13,6 +13,7 @@ import ibase.system.config.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
import ibase.webitm.ejb.dis.adv.*;
@Stateless @Stateless
public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, InvHoldRelGenRemote public class InvHoldRelGen extends ProcessEJB implements InvHoldRelGenLocal, InvHoldRelGenRemote
...@@ -526,6 +527,15 @@ public String process(String xmlString, String xmlString2, String windowName, St ...@@ -526,6 +527,15 @@ public String process(String xmlString, String xmlString2, String windowName, St
String userId = "",siteCode="",confirmed="",empCode="",tranIdGenerate="",lineNo="",remark="",tranIdRel="",lineNoRel=""; String userId = "",siteCode="",confirmed="",empCode="",tranIdGenerate="",lineNo="",remark="",tranIdRel="",lineNoRel="";
Document dom = null,headerDom=null,detailDom=null; Document dom = null,headerDom=null,detailDom=null;
ITMDBAccessEJB itmDBAccessLocal = new ITMDBAccessEJB(); 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 try
{ {
...@@ -583,8 +593,8 @@ public String process(String xmlString, String xmlString2, String windowName, St ...@@ -583,8 +593,8 @@ public String process(String xmlString, String xmlString2, String windowName, St
{ {
System.out.println( updCnt + "INV_HOLD_REL rows inserted successfully" ); System.out.println( updCnt + "INV_HOLD_REL rows inserted successfully" );
} }
// 09/09/12 manoharan commented and added new logical code
lineNo = genericUtility.getColumnValue("line_no",detailDom); /*lineNo = genericUtility.getColumnValue("line_no",detailDom);
sql = "select count(*) from inv_hold_det where tran_id = ?"; sql = "select count(*) from inv_hold_det where tran_id = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -629,55 +639,94 @@ public String process(String xmlString, String xmlString2, String windowName, St ...@@ -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" ); 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.executeBatch();
pRelDet.clearBatch(); pRelDet.clearBatch();
if("Y".equalsIgnoreCase(autoConfirmed)) if("Y".equalsIgnoreCase(autoConfirmed))
{ {
//sql = " update inv_hold set confirmed = 'Y', conf_date = ? where tran_id = ?"; InvHoldRelConf invHoldRelConf = new InvHoldRelConf();
sql = "update inv_hold_det set hold_status = 'R', status_date = ? where tran_id = ?"; errString = invHoldRelConf.confirm(tranIdGenerate,xtraParams, "N" , conn,false);
pstmt = conn.prepareStatement(sql); invHoldRelConf = null;
pstmt.setTimestamp(1,currDate); if (errString.indexOf("VTCNFSUCC") > -1)
pstmt.setString(2,tranId); {
int rowcnt = pstmt.executeUpdate(); errString = "";
pstmt.close(); }
pstmt = null; //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 = ?";
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........"); System.out.println("inv_hold_det transaction hold_status release succesfully........");
errString = itmDBAccessLocal.getErrorString("","VTMCONF2",""); errString = itmDBAccessLocal.getErrorString("","VTMCONF2","");
return errString;
} }
else
{
conn.rollback();
System.out.println("Process failed........");
errString = itmDBAccessLocal.getErrorString("","VTDESNCONF","");
} }
conn.commit();
} }
if(pRelHdr != null)
{
pRelHdr.close();
pRelHdr = null;
}
if(pRelDet != null)
{
pRelDet.close();
pRelDet = null;
}
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception :InvHoldRelGenEJB :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
errString = e.getMessage(); errString = e.getMessage();
e.printStackTrace(); e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1)
{
e1.printStackTrace();
}
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
...@@ -685,6 +734,16 @@ public String process(String xmlString, String xmlString2, String windowName, St ...@@ -685,6 +734,16 @@ public String process(String xmlString, String xmlString2, String windowName, St
try try
{ {
if(pRelHdr != null)
{
pRelHdr.close();
pRelHdr = null;
}
if(pRelDet != null)
{
pRelDet.close();
pRelDet = null;
}
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
...@@ -696,7 +755,7 @@ public String process(String xmlString, String xmlString2, String windowName, St ...@@ -696,7 +755,7 @@ public String process(String xmlString, String xmlString2, String windowName, St
ex.printStackTrace(); ex.printStackTrace();
} }
} }
return retStr; return errString;
} }
private String generateTranId( String windowName, String siteCode, String tranDateStr, Connection conn )throws ITMException 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