From b090c30bc600f7ef68d55a21996b28c75c367d4b Mon Sep 17 00:00:00 2001 From: usrdno Date: Thu, 24 Jun 2010 09:15:08 +0000 Subject: [PATCH] FR 3004020 - Delivery Policy Minor adjustments to comply with ABP. * Removed duplicate constants (replaced by the automatically generated ones) * Vector -> List Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3004020 --- .../adempiere/process/AllocateSalesOrders.java | 15 ++++++++------- .../validator/MaterialReceiptModelValidator.java | 3 ++- base/src/org/compiere/model/MClientInfo.java | 3 --- base/src/org/compiere/model/MInOut.java | 2 +- base/src/org/compiere/process/InOutGenerate.java | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/base/src/org/adempiere/process/AllocateSalesOrders.java b/base/src/org/adempiere/process/AllocateSalesOrders.java index d1f6bacc92..91541d30df 100644 --- a/base/src/org/adempiere/process/AllocateSalesOrders.java +++ b/base/src/org/adempiere/process/AllocateSalesOrders.java @@ -6,6 +6,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator; +import java.util.List; import java.util.Properties; import java.util.Vector; import java.util.logging.Level; @@ -78,8 +79,8 @@ public class AllocateSalesOrders extends SvrProcess { * @return Order lines to allocate products to. * @throws SQLException */ - public static Vector getOrderLinesToAllocate(Connection conn, int productId, String trxName) throws SQLException { - Vector result = new Vector(); + public static List getOrderLinesToAllocate(Connection conn, int productId, String trxName) throws SQLException { + List result = new Vector(); Properties ctx = Env.getCtx(); MOrderLine line; PreparedStatement ps = conn.prepareStatement(query); @@ -103,9 +104,9 @@ public class AllocateSalesOrders extends SvrProcess { * @return * @throws SQLException */ - public static Vector getProductsToAllocate(Connection conn, int WarehouseID) throws SQLException { + public static List getProductsToAllocate(Connection conn, int WarehouseID) throws SQLException { - Vector result = new Vector(); + List result = new Vector(); StockInfo si; String query1 = "select M_Product_ID, sum(qtyonhand), sum(qtyreserved), sum(m_Product_Stock_v.qtyallocated) " + "from M_Product_Stock_v " + @@ -143,9 +144,9 @@ public class AllocateSalesOrders extends SvrProcess { protected String doIt() throws Exception { Connection conn = DB.getConnectionRO(); - Vector products = AllocateSalesOrders.getProductsToAllocate(conn, m_warehouseId); + List products = AllocateSalesOrders.getProductsToAllocate(conn, m_warehouseId); conn.close(); - Vector lines; + List lines; MOrderLine line; BigDecimal lineAllocate; BigDecimal toAllocate; @@ -158,7 +159,7 @@ public class AllocateSalesOrders extends SvrProcess { // Make sure we have settings that needs allocation MWarehouse warehouse = new MWarehouse(getCtx(), m_warehouseId, get_TrxName()); MOrgInfo orgInfo = MOrgInfo.get(getCtx(), warehouse.getAD_Org_ID(), get_TrxName()); - if (!orgInfo.getDeliveryPolicy().equals(MClientInfo.DELIVERY_POLICY_STRICT_ORDER)) { + if (!orgInfo.getDeliveryPolicy().equals(MClientInfo.DELIVERYPOLICY_StrictOrder)) { return "The current delivery policy of the warehouse doesn't use allocation."; } diff --git a/base/src/org/adempiere/validator/MaterialReceiptModelValidator.java b/base/src/org/adempiere/validator/MaterialReceiptModelValidator.java index c453f5f48c..a7846123c2 100644 --- a/base/src/org/adempiere/validator/MaterialReceiptModelValidator.java +++ b/base/src/org/adempiere/validator/MaterialReceiptModelValidator.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.sql.Connection; import java.sql.SQLException; import java.util.Iterator; +import java.util.List; import java.util.Vector; import org.adempiere.process.AllocateSalesOrders; @@ -88,7 +89,7 @@ public class MaterialReceiptModelValidator implements ModelValidator { // Make sure we have a positive amount if (qty.signum()>0) { - Vector lines = AllocateSalesOrders.getOrderLinesToAllocate(conn, iol.getProduct().get_ID(), trxName); + List lines = AllocateSalesOrders.getOrderLinesToAllocate(conn, iol.getProduct().get_ID(), trxName); MOrderLine line; BigDecimal receivedQty = iol.getMovementQty(); diff --git a/base/src/org/compiere/model/MClientInfo.java b/base/src/org/compiere/model/MClientInfo.java index 6a403877d5..a6e3eeb1c5 100644 --- a/base/src/org/compiere/model/MClientInfo.java +++ b/base/src/org/compiere/model/MClientInfo.java @@ -39,9 +39,6 @@ public class MClientInfo extends X_AD_ClientInfo * */ private static final long serialVersionUID = 4861006368856890116L; - - public static final String DELIVERY_POLICY_STRICT_ORDER = "O"; - public static final String DELIVERY_POLICY_NO_HOLD = "N"; /** * Get Client Info diff --git a/base/src/org/compiere/model/MInOut.java b/base/src/org/compiere/model/MInOut.java index 2dc9975175..aba57689d2 100644 --- a/base/src/org/compiere/model/MInOut.java +++ b/base/src/org/compiere/model/MInOut.java @@ -1319,7 +1319,7 @@ public class MInOut extends X_M_InOut implements DocAction // Check delivery policy MOrgInfo orgInfo = MOrgInfo.get(getCtx(), sLine.getAD_Org_ID(), get_TrxName()); - boolean isStrictOrder = MClientInfo.DELIVERY_POLICY_STRICT_ORDER.equalsIgnoreCase(orgInfo.getDeliveryPolicy()); + boolean isStrictOrder = MClientInfo.DELIVERYPOLICY_StrictOrder.equalsIgnoreCase(orgInfo.getDeliveryPolicy()); // Stock Movement - Counterpart MOrder.reserveStock if (product != null diff --git a/base/src/org/compiere/process/InOutGenerate.java b/base/src/org/compiere/process/InOutGenerate.java index abcbbadc8b..6f94f4344b 100644 --- a/base/src/org/compiere/process/InOutGenerate.java +++ b/base/src/org/compiere/process/InOutGenerate.java @@ -159,7 +159,7 @@ public class InOutGenerate extends SvrProcess // Get client info for warehouse m_warehouse = new MWarehouse(this.getCtx(), p_M_Warehouse_ID, this.get_TrxName()); MOrgInfo orgInfo = MOrgInfo.get(getCtx(), m_warehouse.getAD_Org_ID(), get_TrxName()); - m_strictOrder = MClientInfo.DELIVERY_POLICY_STRICT_ORDER.equalsIgnoreCase(orgInfo.getDeliveryPolicy()); + m_strictOrder = MClientInfo.DELIVERYPOLICY_StrictOrder.equalsIgnoreCase(orgInfo.getDeliveryPolicy()); if (p_Selection) // VInOutGen {