Commit 5c23cfd2 authored by mjadhav's avatar mjadhav

update item and itemLotInfo hold flag 'Y' for lot and item level lock


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96835 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 0e96ae62
...@@ -82,7 +82,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -82,7 +82,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "",lockLevel="";
ConnDriver connDriver = null; ConnDriver connDriver = null;
String loginEmpCode = null; String loginEmpCode = null;
...@@ -117,7 +117,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -117,7 +117,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
PreparedStatement pUpdate = null; PreparedStatement pUpdate = null;
PreparedStatement pSelStck = null; PreparedStatement pSelStck = null;
PreparedStatement pstmtInsert = null; PreparedStatement pstmtInsert = null;
PreparedStatement pHoldDet = null; PreparedStatement pHoldDet = null,pHoldDet1=null;
ResultSet rsHoldDet = null; ResultSet rsHoldDet = null;
ResultSet rsSelStck = null; ResultSet rsSelStck = null;
...@@ -207,7 +207,23 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -207,7 +207,23 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
} }
rs.close(); rs = null; rs.close(); rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
/*------changes on 18-NOV-14 by mahendra-----------*/
System.out.println("lockCode :"+lockCode);
sql = "select lock_level from inv_lock where lock_code= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lockCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
lockLevel = rs.getString("lock_level");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
System.out.println("lockLevel : "+lockLevel);
sqlUpdate = "UPDATE STOCK SET HOLD_QTY = ? WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? "; sqlUpdate = "UPDATE STOCK SET HOLD_QTY = ? WHERE ITEM_CODE = ? AND SITE_CODE = ? AND LOC_CODE = ? AND LOT_NO = ? AND LOT_SL = ? ";
//pUpdate = conn.prepareStatement ( sqlUpdate );by chandrashekar on 17-11-14 //pUpdate = conn.prepareStatement ( sqlUpdate );by chandrashekar on 17-11-14
...@@ -221,7 +237,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -221,7 +237,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
pHoldDet = conn.prepareStatement(sqlHoldDet); pHoldDet = conn.prepareStatement(sqlHoldDet);
pHoldDet.setString(1,tranId); pHoldDet.setString(1,tranId);
rsHoldDet = pHoldDet.executeQuery(); rsHoldDet = pHoldDet.executeQuery();
pHoldDet.clearParameters(); // pHoldDet.clearParameters();
while ( rsHoldDet.next() ) while ( rsHoldDet.next() )
{ {
...@@ -231,7 +247,38 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -231,7 +247,38 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
lotNo = checkNull(rsHoldDet.getString("LOT_NO")); lotNo = checkNull(rsHoldDet.getString("LOT_NO"));
lotSl = checkNull(rsHoldDet.getString("LOT_SL")); lotSl = checkNull(rsHoldDet.getString("LOT_SL"));
lineNoSl = checkNull(rsHoldDet.getString("LINE_NO_SL")); lineNoSl = checkNull(rsHoldDet.getString("LINE_NO_SL"));
System.out.println("itemCode : "+itemCode);
System.out.println("lotNo : "+lotNo);
if(lockLevel.equalsIgnoreCase("I"))
{
sql = "update item set HOLD_FLAG = 'Y' where ITEM_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
int row = pstmt.executeUpdate();
System.out.println("updated rows@@@ =="+row);
//conn.commit();
pstmt.close();
pstmt = null;
System.out.println("For Item level(item master),Updated hold flag 'Y' for item_code:"+itemCode);
}
if(lockLevel.equalsIgnoreCase("L"))
{
sql = "update item_lot_info set HOLD_FLAG = 'Y' where ITEM_CODE = ? and LOT_NO =? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,lotNo);
int row = pstmt.executeUpdate();
System.out.println("updated rows@@@ =="+row);
//conn.commit();
pstmt.close();
pstmt = null;
System.out.println("For Lot level(item lot info master),Updated hold flag 'Y' for item_code:"+itemCode);
}
System.out.println("1111111");
if( lineNoSl != null && lineNoSl.trim().length() > 0 ) //i.e. Line_sl is present if( lineNoSl != null && lineNoSl.trim().length() > 0 ) //i.e. Line_sl is present
{ {
//tranIdTrace = generateTranId("w_inv_hold_rel_trace", conn); //tranIdTrace = generateTranId("w_inv_hold_rel_trace", conn);
...@@ -262,7 +309,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -262,7 +309,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
} }
//pSelStck.clearParameters(); //pSelStck.clearParameters();
System.out.println("2222222");
if(holdQty != stockQty) if(holdQty != stockQty)
{ {
holdQty = holdQty + qtyPerArt; holdQty = holdQty + qtyPerArt;
...@@ -307,8 +354,10 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -307,8 +354,10 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
} }
else //i.e. line_sl is not found else //i.e. line_sl is not found
{ {
pHoldDet.setString( 1, tranId ); System.out.println("333333");
rsNoSl = pHoldDet.executeQuery(); pHoldDet1 = conn.prepareStatement(sqlHoldDet);
pHoldDet1.setString( 1, tranId );
rsNoSl = pHoldDet1.executeQuery();
while ( rsNoSl.next() ) while ( rsNoSl.next() )
{ {
HashMap pkKeyValMap = new HashMap(); HashMap pkKeyValMap = new HashMap();
...@@ -347,7 +396,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -347,7 +396,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
pkList.add("LOT_SL"); pkList.add("LOT_SL");
} }
System.out.println("pkKeyValMap :"+pkKeyValMap); System.out.println("pkKeyValMap :"+pkKeyValMap);
System.out.println("4444444");
String key = ""; String key = "";
for ( int i = 0; i < pkList.size(); i++ ) for ( int i = 0; i < pkList.size(); i++ )
{ {
...@@ -385,7 +434,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -385,7 +434,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
System.out.println("Quantity :" + stockQty ); System.out.println("Quantity :" + stockQty );
holdQty = rsStock.getDouble("HOLD_QTY"); holdQty = rsStock.getDouble("HOLD_QTY");
qtyPerArt = rsStock.getDouble("QTY_PER_ART"); qtyPerArt = rsStock.getDouble("QTY_PER_ART");
System.out.println("555552");
if(holdQty < stockQty ) if(holdQty < stockQty )
{ {
pUpdate = conn.prepareStatement ( sqlUpdate );//Addded by chadra shekar on 17-nov-14 pUpdate = conn.prepareStatement ( sqlUpdate );//Addded by chadra shekar on 17-nov-14
...@@ -448,7 +497,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -448,7 +497,7 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
rsNoSl.close(); rsNoSl.close();
rsNoSl = null; rsNoSl = null;
} }
pHoldDet1.close();
}//end of else }//end of else
if( rs != null ) if( rs != null )
...@@ -456,6 +505,8 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I ...@@ -456,6 +505,8 @@ public class InvHoldConf extends ActionHandlerEJB implements InvHoldConfLocal ,I
rs.close(); rs.close();
rs = null; rs = null;
} }
System.out.println("end of while!!!!");
}//end of while() }//end of while()
if(pHoldDet != null) if(pHoldDet != null)
{ {
......
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