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
This commit is contained in:
usrdno 2010-06-24 09:15:08 +00:00
parent 25ff0c3709
commit b090c30bc6
5 changed files with 12 additions and 13 deletions

View File

@ -6,6 +6,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
@ -78,8 +79,8 @@ public class AllocateSalesOrders extends SvrProcess {
* @return Order lines to allocate products to. * @return Order lines to allocate products to.
* @throws SQLException * @throws SQLException
*/ */
public static Vector<MOrderLine> getOrderLinesToAllocate(Connection conn, int productId, String trxName) throws SQLException { public static List<MOrderLine> getOrderLinesToAllocate(Connection conn, int productId, String trxName) throws SQLException {
Vector<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(query); PreparedStatement ps = conn.prepareStatement(query);
@ -103,9 +104,9 @@ public class AllocateSalesOrders extends SvrProcess {
* @return * @return
* @throws SQLException * @throws SQLException
*/ */
public static Vector<StockInfo> getProductsToAllocate(Connection conn, int WarehouseID) throws SQLException { public static List<StockInfo> getProductsToAllocate(Connection conn, int WarehouseID) throws SQLException {
Vector<StockInfo> result = new Vector<StockInfo>(); List<StockInfo> result = new Vector<StockInfo>();
StockInfo si; StockInfo si;
String query1 = "select M_Product_ID, sum(qtyonhand), sum(qtyreserved), sum(m_Product_Stock_v.qtyallocated) " + String query1 = "select M_Product_ID, sum(qtyonhand), sum(qtyreserved), sum(m_Product_Stock_v.qtyallocated) " +
"from M_Product_Stock_v " + "from M_Product_Stock_v " +
@ -143,9 +144,9 @@ public class AllocateSalesOrders extends SvrProcess {
protected String doIt() throws Exception { protected String doIt() throws Exception {
Connection conn = DB.getConnectionRO(); Connection conn = DB.getConnectionRO();
Vector<StockInfo> products = AllocateSalesOrders.getProductsToAllocate(conn, m_warehouseId); List<StockInfo> products = AllocateSalesOrders.getProductsToAllocate(conn, m_warehouseId);
conn.close(); conn.close();
Vector<MOrderLine> lines; List<MOrderLine> lines;
MOrderLine line; MOrderLine line;
BigDecimal lineAllocate; BigDecimal lineAllocate;
BigDecimal toAllocate; BigDecimal toAllocate;
@ -158,7 +159,7 @@ public class AllocateSalesOrders extends SvrProcess {
// Make sure we have settings that needs allocation // Make sure we have settings that needs allocation
MWarehouse warehouse = new MWarehouse(getCtx(), m_warehouseId, get_TrxName()); MWarehouse warehouse = new MWarehouse(getCtx(), m_warehouseId, get_TrxName());
MOrgInfo orgInfo = MOrgInfo.get(getCtx(), warehouse.getAD_Org_ID(), 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."; return "The current delivery policy of the warehouse doesn't use allocation.";
} }

View File

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.adempiere.process.AllocateSalesOrders; import org.adempiere.process.AllocateSalesOrders;
@ -88,7 +89,7 @@ public class MaterialReceiptModelValidator implements ModelValidator {
// Make sure we have a positive amount // Make sure we have a positive amount
if (qty.signum()>0) { if (qty.signum()>0) {
Vector<MOrderLine> lines = AllocateSalesOrders.getOrderLinesToAllocate(conn, iol.getProduct().get_ID(), trxName); List<MOrderLine> lines = AllocateSalesOrders.getOrderLinesToAllocate(conn, iol.getProduct().get_ID(), trxName);
MOrderLine line; MOrderLine line;
BigDecimal receivedQty = iol.getMovementQty(); BigDecimal receivedQty = iol.getMovementQty();

View File

@ -40,9 +40,6 @@ public class MClientInfo extends X_AD_ClientInfo
*/ */
private static final long serialVersionUID = 4861006368856890116L; 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 * Get Client Info
* @param ctx context * @param ctx context

View File

@ -1319,7 +1319,7 @@ public class MInOut extends X_M_InOut implements DocAction
// Check delivery policy // Check delivery policy
MOrgInfo orgInfo = MOrgInfo.get(getCtx(), sLine.getAD_Org_ID(), get_TrxName()); 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 // Stock Movement - Counterpart MOrder.reserveStock
if (product != null if (product != null

View File

@ -159,7 +159,7 @@ public class InOutGenerate extends SvrProcess
// Get client info for warehouse // Get client info for warehouse
m_warehouse = new MWarehouse(this.getCtx(), p_M_Warehouse_ID, this.get_TrxName()); 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()); 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 if (p_Selection) // VInOutGen
{ {