IDEMPIERE-568 Review proper closing of JDBC statements and resultsets
This commit is contained in:
parent
9b0c13b9f5
commit
cb10e71ad0
|
@ -2698,15 +2698,22 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
List<MOrderLine> result = new Vector<MOrderLine>();
|
List<MOrderLine> result = new Vector<MOrderLine>();
|
||||||
Properties ctx = Env.getCtx();
|
Properties ctx = Env.getCtx();
|
||||||
MOrderLine line;
|
MOrderLine line;
|
||||||
PreparedStatement ps = conn.prepareStatement(OrderLinesToAllocate);
|
PreparedStatement ps = null;
|
||||||
ps.setInt(1, productId);
|
ResultSet rs = null;
|
||||||
ResultSet rs = ps.executeQuery();
|
try {
|
||||||
while(rs.next()) {
|
ps = conn.prepareStatement(OrderLinesToAllocate);
|
||||||
line = new MOrderLine(ctx, rs, trxName);
|
ps.setInt(1, productId);
|
||||||
result.add(line);
|
rs = ps.executeQuery();
|
||||||
|
while(rs.next()) {
|
||||||
|
line = new MOrderLine(ctx, rs, trxName);
|
||||||
|
result.add(line);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, ps);
|
||||||
|
rs = null; ps = null;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2735,23 +2742,28 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
"(QtyOrdered-QtyDelivered)>0 AND (QtyOrdered-QtyDelivered)>C_OrderLine.QtyAllocated)" +
|
"(QtyOrdered-QtyDelivered)>0 AND (QtyOrdered-QtyDelivered)>C_OrderLine.QtyAllocated)" +
|
||||||
"group by M_Product_ID " +
|
"group by M_Product_ID " +
|
||||||
"order by M_Product_ID";
|
"order by M_Product_ID";
|
||||||
|
PreparedStatement ps = null;
|
||||||
PreparedStatement ps = conn.prepareStatement(query1);
|
ResultSet rs = null;
|
||||||
ps.setInt(1, WarehouseID);
|
try {
|
||||||
ps.setInt(2, WarehouseID);
|
ps = conn.prepareStatement(query1);
|
||||||
ResultSet rs = ps.executeQuery();
|
ps.setInt(1, WarehouseID);
|
||||||
|
ps.setInt(2, WarehouseID);
|
||||||
while(rs.next()) {
|
rs = ps.executeQuery();
|
||||||
si = new StockInfo();
|
while(rs.next()) {
|
||||||
si.productId = rs.getInt(1);
|
si = new StockInfo();
|
||||||
si.qtyOnHand = rs.getBigDecimal(2);
|
si.productId = rs.getInt(1);
|
||||||
si.qtyReserved = rs.getBigDecimal(3);
|
si.qtyOnHand = rs.getBigDecimal(2);
|
||||||
si.qtyAvailable = si.qtyOnHand.subtract(si.qtyReserved);
|
si.qtyReserved = rs.getBigDecimal(3);
|
||||||
si.qtyAllocated = rs.getBigDecimal(4);
|
si.qtyAvailable = si.qtyOnHand.subtract(si.qtyReserved);
|
||||||
result.add(si);
|
si.qtyAllocated = rs.getBigDecimal(4);
|
||||||
|
result.add(si);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, ps);
|
||||||
|
rs = null; ps = null;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue