From e01ca930d2ddc3a6f00ee7a51fd9cb6975b7e314 Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Thu, 7 Aug 2008 17:48:00 +0000 Subject: [PATCH] Fix refactory --- base/src/org/eevolution/model/MPPProductPlanning.java | 8 +++++--- base/src/org/eevolution/process/MRP.java | 11 +++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/base/src/org/eevolution/model/MPPProductPlanning.java b/base/src/org/eevolution/model/MPPProductPlanning.java index 0cccb90c5f..4faae6cd21 100644 --- a/base/src/org/eevolution/model/MPPProductPlanning.java +++ b/base/src/org/eevolution/model/MPPProductPlanning.java @@ -15,8 +15,10 @@ *****************************************************************************/ package org.eevolution.model; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Properties; +import java.util.logging.Level; import org.compiere.model.MOrgInfo; import org.compiere.model.MResource; @@ -126,8 +128,8 @@ public class MPPProductPlanning extends X_PP_Product_Planning * @param M_Product_ID Product ID * @param trxName Transaction Name * @return MPPProductPlanning Planning Data - * - public static MPPProductPlanning getFirst(Properties ctx ,int AD_Client_ID, int AD_Org_ID ,int M_Warehouse_ID, int S_Resource_ID, int M_Product_ID, String trxName) + **/ + public static MPPProductPlanning find(Properties ctx ,int AD_Client_ID, int AD_Org_ID ,int M_Warehouse_ID, int S_Resource_ID, int M_Product_ID, String trxName) { MPPProductPlanning pp = null; PreparedStatement pstmt = null; @@ -197,7 +199,7 @@ public class MPPProductPlanning extends X_PP_Product_Planning } return null; } - */ + /************************************************************************** * find planning data demand & supply to this warehouse diff --git a/base/src/org/eevolution/process/MRP.java b/base/src/org/eevolution/process/MRP.java index 1b5a146d1c..e15f11758e 100644 --- a/base/src/org/eevolution/process/MRP.java +++ b/base/src/org/eevolution/process/MRP.java @@ -385,6 +385,10 @@ public class MRP extends SvrProcess //Define m_product_planning setProduct(AD_Client_ID,AD_Org_ID ,S_Resource_ID , M_Warehouse_ID, product); + + if (m_product_planning==null) + continue; + //first DatePromised.compareTo for ORDER_POLICY_PeriodOrderQuantity if (m_product_planning.getOrder_Policy().equals(MPPProductPlanning.ORDER_POLICY_PeriodOrderQuantity)) @@ -482,7 +486,7 @@ public class MRP extends SvrProcess { //find data product planning demand - MPPProductPlanning pp = MPPProductPlanning.get(getCtx(), AD_Client_ID ,AD_Org_ID , M_Warehouse_ID, S_Resource_ID , product.getM_Product_ID(), get_TrxName()); + MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Client_ID ,AD_Org_ID , M_Warehouse_ID, S_Resource_ID , product.getM_Product_ID(), get_TrxName()); DatePromisedTo = null; DatePromisedFrom = null; if (pp != null) @@ -526,9 +530,8 @@ public class MRP extends SvrProcess MMessage MRP=MMessage.get(getCtx(), "MRP-120"); MNote note = new MNote (getCtx(), MRP.getAD_Message_ID() , 0 , MPPMRP.Table_ID , 0 , product.getValue() + " " + product.getName() , Msg.getMsg(getCtx(), MRP.getValue()),get_TrxName()); note.save(); - log.severe(Msg.getMsg(getCtx(), MRP.getValue())); - m_product_planning.setIsCreatePlan(false); - + //log.severe(Msg.getMsg(getCtx(), MRP.getValue())); + return; }