Commit c692d96e authored by manohar's avatar manohar

locking of stock before update of alloc_qty implemented


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93836 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 086c12c1
...@@ -16,6 +16,7 @@ public class InvAllocTraceBean ...@@ -16,6 +16,7 @@ public class InvAllocTraceBean
public String updateInvallocTrace(HashMap invallocTraceMap, Connection conn) throws ITMException,Exception public String updateInvallocTrace(HashMap invallocTraceMap, Connection conn) throws ITMException,Exception
{ {
String fileDest = ""; String fileDest = "";
double tempAllocQty = 0;
try try
{ {
//changes by gulzar on 12/12/2011 to write the log file in jboss log location //changes by gulzar on 12/12/2011 to write the log file in jboss log location
...@@ -65,7 +66,7 @@ public class InvAllocTraceBean ...@@ -65,7 +66,7 @@ public class InvAllocTraceBean
java.sql.Date chgDate = new java.sql.Date(System.currentTimeMillis()); java.sql.Date chgDate = new java.sql.Date(System.currentTimeMillis());
java.sql.Date tranDate = new java.sql.Date(System.currentTimeMillis()); java.sql.Date tranDate = new java.sql.Date(System.currentTimeMillis());
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rSet = null ; ResultSet rSet = null, rs = null ;
Statement stmt = null ; Statement stmt = null ;
String tranId = null ; String tranId = null ;
...@@ -90,6 +91,56 @@ public class InvAllocTraceBean ...@@ -90,6 +91,56 @@ public class InvAllocTraceBean
stmt.close(); stmt.close();
rSet = null; rSet = null;
stmt = null; stmt = null;
// 31/10/13 manoharan locking to be done before allocation
if (CommonConstants.DB_NAME.equalsIgnoreCase("DB2") || CommonConstants.DB_NAME.equalsIgnoreCase("MYSQL") ){
sql =" select alloc_qty from stock where item_code = ?"
+" and site_code = ?"
+" and loc_code = ?"
+" and lot_no = ?"
+"and lot_sl = ? for update ";
}
else if (CommonConstants.DB_NAME.equalsIgnoreCase("MSSQL")){
sql =" select alloc_qty from stock (updlock) where item_code = ?"
+" and site_code = ?"
+" and loc_code = ?"
+" and lot_no = ?"
+"and lot_sl = ? ";
}
else
{
sql =" select alloc_qty from stock where item_code = ?"
+" and site_code = ?"
+" and loc_code = ?"
+" and lot_no = ?"
+"and lot_sl = ? for update nowait ";
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setString(2,siteCode);
pstmt.setString(3,locCode);
pstmt.setString(4,lotNo);
pstmt.setString(5,lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
tempAllocQty = rs.getDouble(1);
}
else
{
errString = "VTLCKERR";
}
pstmt.close();
rs.close();
if (errString != null && errString.trim().length() > 0)
{
return errString;
}
// end
f.write(keyString + " " + keyCol + " " + tranSer1+ "\r\n"); f.write(keyString + " " + keyCol + " " + tranSer1+ "\r\n");
System.out.println("keyString :"+ keyString); System.out.println("keyString :"+ keyString);
System.out.println("keyCol :"+ keyCol); System.out.println("keyCol :"+ keyCol);
......
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