Commit e76858a6 authored by smestry's avatar smestry

W15FSUN008, Updated class file for Palletization.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99366 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1d38b880
...@@ -488,6 +488,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -488,6 +488,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{ {
try try
{ {
if (conn != null) if (conn != null)
{ {
conn.close(); conn.close();
...@@ -519,7 +520,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -519,7 +520,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
while( rs.next() ) while( rs.next() )
{ {
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -628,6 +631,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -628,6 +631,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{ {
count = rs.getInt(1); count = rs.getInt(1);
} }
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -670,6 +675,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -670,6 +675,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{ {
count = rs.getInt(1); count = rs.getInt(1);
} }
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -715,7 +722,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -715,7 +722,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
lotNoDB = checkNullAndTrim(rs.getString("lot_no")); lotNoDB = checkNullAndTrim(rs.getString("lot_no"));
lotSlDB = checkNullAndTrim(rs.getString("lot_sl")); lotSlDB = checkNullAndTrim(rs.getString("lot_sl"));
} }
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
hm.put("ITEM_CODE", itemCodeDB); hm.put("ITEM_CODE", itemCodeDB);
hm.put("LOT_NO", lotNoDB); hm.put("LOT_NO", lotNoDB);
hm.put("LOT_SL", lotSlDB); hm.put("LOT_SL", lotSlDB);
...@@ -764,6 +773,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -764,6 +773,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{ {
status = checkNullAndTrim(rs.getString("status")); status = checkNullAndTrim(rs.getString("status"));
} }
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -1204,6 +1215,16 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1204,6 +1215,16 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{ {
try try
{ {
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
if ( conn != null ) if ( conn != null )
{ {
conn.close(); conn.close();
...@@ -1250,41 +1271,64 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1250,41 +1271,64 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
String sql = ""; String sql = "";
int lineNo = 0; int lineNo = 0;
if( tranId != null && tranId.trim().length() > 0 ) // edit mode try
{ {
sql = "select max(line_no)+1 as line_no from pallet_det where tran_id = ? "; if( tranId != null && tranId.trim().length() > 0 ) // edit mode
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs= pstmt.executeQuery();
if(rs.next())
{ {
lineNo = rs.getInt("line_no"); sql = "select max(line_no)+1 as line_no from pallet_det where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs= pstmt.executeQuery();
if(rs.next())
{
lineNo = rs.getInt("line_no");
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
} }
if(pstmt != null) { pstmt.close(); pstmt = null; } else // add mode
if(rs != null) { rs.close(); rs = null; } {
sql = "select max(line_no)+1 as line_no from pallet_det det, pallet_hdr hdr where "
+ " hdr.pallet_no = ? and hdr.confirmed = ? and hdr.site_code = ? and hdr.tran_id = det.tran_id ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, "N");
pstmt.setString(3, siteCode);
rs= pstmt.executeQuery();
if(rs.next())
{
lineNo = rs.getInt("line_no");
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
}
if(lineNo == 0)
{
lineNo = 1;
}
} }
else // add mode catch(Exception e)
{ {
sql = "select max(line_no)+1 as line_no from pallet_det det, pallet_hdr hdr where " System.out.println("Exception in getItemQcStatus ::::::: " + e);
+ " hdr.pallet_no = ? and hdr.confirmed = ? and hdr.site_code = ? and hdr.tran_id = det.tran_id "; e.printStackTrace();
pstmt = conn.prepareStatement(sql); throw new Exception(e);
pstmt.setString(1, palletNo); }
pstmt.setString(2, "N"); finally
pstmt.setString(3, siteCode); {
rs= pstmt.executeQuery(); if(rs!=null)
if(rs.next())
{ {
lineNo = rs.getInt("line_no"); rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
} }
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
} }
if(lineNo == 0)
{
lineNo = 1;
}
System.out.println("return lineNo from getMaxLineNo :::::::::::::::::; "+lineNo); System.out.println("return lineNo from getMaxLineNo :::::::::::::::::; "+lineNo);
return lineNo; return lineNo;
} }
......
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