Commit 8ea1c349 authored by manohar's avatar manohar

bug fixing for connection close


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91871 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 20d13d54
...@@ -826,7 +826,8 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -826,7 +826,8 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
if (errString != null && errString.trim().length() > 0) if (errString != null && errString.trim().length() > 0)
{ {
System.out.println("errString :::"+ errString ); System.out.println("manohar connection rolledback errString :::"+ errString );
conn.rollback()
return errString; return errString;
} }
...@@ -995,6 +996,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -995,6 +996,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
rs.close(); rs.close();
pstmtStock.clearParameters(); pstmtStock.clearParameters();
pstmtStock.close(); pstmtStock.close();
System.out.println("manohar connection commited errString :::"+ errString );
conn.commit(); conn.commit();
} }
catch(SQLException se) catch(SQLException se)
...@@ -1002,6 +1004,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1002,6 +1004,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
System.out.println("SQLException :" + se); System.out.println("SQLException :" + se);
se.printStackTrace(); se.printStackTrace();
errString = se.getMessage(); errString = se.getMessage();
System.out.println("manohar connection rolledback errString 3 :::"+ errString );
conn.rollback(); conn.rollback();
return errString; return errString;
} }
...@@ -1013,6 +1016,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1013,6 +1016,7 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
e.printStackTrace(); e.printStackTrace();
try try
{ {
System.out.println("manohar connection rolledback errString 2 :::"+ errString );
conn.rollback(); conn.rollback();
} }
catch(Exception e1) catch(Exception e1)
...@@ -1027,12 +1031,13 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1027,12 +1031,13 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
{ {
try try
{ {
if (errString == null || errString.trim().length() == 0)
{
System.out.println("manohar connection commited errString :::"+ errString );
conn.commit();
}
if(conn != null) if(conn != null)
{ {
if (errString == null || errString.trim().length() == 0)
{
conn.commit();
}
if(pstmtStock != null) if(pstmtStock != null)
{ {
pstmtStock.close(); pstmtStock.close();
...@@ -1167,18 +1172,18 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1167,18 +1172,18 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
System.out.println("insertion of sql inside updateInvallocTrace success on date "+ chgDate); System.out.println("insertion of sql inside updateInvallocTrace success on date "+ chgDate);
System.out.println("Stock Updated..............................."); System.out.println("Stock Updated...............................");
sqlUpdate = "UPDATE STOCK SET ALLOC_QTY =(CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END) + ? "
+"WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?";
pstmt = conn.prepareStatement(sqlUpdate);
pstmt.setDouble(1,allocQty);
pstmt.setString(2,itemCode);
pstmt.setString(3, siteCode);
pstmt.setString(4,locCode);
pstmt.setString(5,lotNo);
pstmt.setString(6,lotSl);
if(allocQty >= 0) if(allocQty >= 0)
{ {
sqlUpdate = "UPDATE STOCK SET ALLOC_QTY =(CASE WHEN ALLOC_QTY IS NULL THEN 0 ELSE ALLOC_QTY END) + ? "
+"WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ?";
pstmt = conn.prepareStatement(sqlUpdate);
pstmt.setDouble(1,allocQty);
pstmt.setString(2,itemCode);
pstmt.setString(3, siteCode);
pstmt.setString(4,locCode);
pstmt.setString(5,lotNo);
pstmt.setString(6,lotSl);
pstmt.executeUpdate(); pstmt.executeUpdate();
} }
System.out.println("Updated End."); System.out.println("Updated End.");
...@@ -1217,8 +1222,8 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1217,8 +1222,8 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
{ {
try try
{ {
if(conn != null) //if(conn != null)
{ //{
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
...@@ -1229,9 +1234,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc ...@@ -1229,9 +1234,9 @@ public class StockAllocationPrc extends ProcessEJB implements StockAllocationPrc
stmt.close(); stmt.close();
stmt = null; stmt = null;
} }
conn.close(); //conn.close();
conn = null; //conn = null;
} //}
} }
catch(Exception e) catch(Exception e)
{ {
......
...@@ -1673,7 +1673,7 @@ public class PoRcpConf extends ActionHandlerEJB implements PoRcpConfLocal, PoRcp ...@@ -1673,7 +1673,7 @@ public class PoRcpConf extends ActionHandlerEJB implements PoRcpConfLocal, PoRcp
} }
// 05/05/01 manoharan if all the PO Details are closed // 05/05/01 manoharan if all the PO Details are closed
// then close the PO Header also // then close the PO Header also
if(errString != null && errString.indexOf("Error") != -1 && purcOrder != null ) if(errString != null && errString.indexOf("Error") == -1 && purcOrder != null )
{ {
sql = "select count(1) from porddet where purc_order = ? And (case when status is null then ' ' else status end) <> 'C' " ; sql = "select count(1) from porddet where purc_order = ? And (case when status is null then ' ' else status end) <> 'C' " ;
pstmt1 = conn.prepareStatement(sql); pstmt1 = conn.prepareStatement(sql);
......
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