From b5c52e42d56e5bd06b9c863eb279d4fd2e2a7ed7 Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Fri, 16 Jan 2009 19:54:07 +0000 Subject: [PATCH] Make To Kit functionality http://sourceforge.net/tracker2/?func=detail&aid=2501713&group_id=176962&atid=879335 Fix cycle closeIt, and DocStatus. --- base/src/org/eevolution/model/MPPMRP.java | 14 ++++++++++++++ base/src/org/eevolution/model/MPPOrder.java | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/base/src/org/eevolution/model/MPPMRP.java b/base/src/org/eevolution/model/MPPMRP.java index c690f52b82..d1968d006e 100644 --- a/base/src/org/eevolution/model/MPPMRP.java +++ b/base/src/org/eevolution/model/MPPMRP.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; +import org.adempiere.exceptions.AdempiereException; import org.compiere.model.MDocType; import org.compiere.model.MForecastLine; import org.compiere.model.MLocator; @@ -400,6 +401,11 @@ public class MPPMRP extends X_PP_MRP { final MProduct product = MProduct.get(ol.getCtx(), ol.getM_Product_ID()); final int plant_id = MPPProductPlanning.getPlantForWarehouse(ol.getM_Warehouse_ID()); + if(plant_id <= 0 ) + { + //TODO: vpj-cd create the msg for error + throw new AdempiereException("Do not exist Resource Plant for this Warehouse"); + } MWorkflow workflow = MWorkflow.get(ol.getCtx(), MWorkflow.getWorkflowSearchKey(ol.getCtx(), product)); //Validate the workflow based in planning data if(workflow == null && pp != null) @@ -412,6 +418,7 @@ public class MPPMRP extends X_PP_MRP int duration = MPPMRP.getDays(ol.getCtx(), plant_id, workflow.get_ID(), ol.getQtyOrdered(), ol.get_TrxName()).intValue(); // order = new MPPOrder(ol.getCtx(), 0 , ol.get_TrxName()); + //comment for Manufacturing Order order.setDescription( Msg.translate(ol.getCtx(),MRefList.getListName(ol.getCtx(), MPPOrderBOM.BOMTYPE_AD_Reference_ID, bom.getBOMType())) + " " + Msg.translate(ol.getCtx(), MOrder.COLUMNNAME_C_Order_ID) @@ -437,6 +444,13 @@ public class MPPMRP extends X_PP_MRP order.setDocStatus(order.prepareIt()); order.setDocAction(MPPOrder.ACTION_Complete); order.saveEx(); + //comment for Order Line + ol.setDescription( Msg.translate(ol.getCtx(),MRefList.getListName(ol.getCtx(), MPPOrderBOM.BOMTYPE_AD_Reference_ID, bom.getBOMType())) + + " " + + Msg.translate(ol.getCtx(), MPPOrder.COLUMNNAME_PP_Order_ID) + + " : " + + order.getDocumentNo()); + ol.saveEx(); } } } diff --git a/base/src/org/eevolution/model/MPPOrder.java b/base/src/org/eevolution/model/MPPOrder.java index 19e6398634..690acd1b3f 100644 --- a/base/src/org/eevolution/model/MPPOrder.java +++ b/base/src/org/eevolution/model/MPPOrder.java @@ -664,8 +664,8 @@ public class MPPOrder extends X_PP_Order implements DocAction this.getQtyScrap(), this.getQtyReject(), this.getM_Locator_ID(), - this.getM_AttributeSetInstance_ID(), true, get_TrxName()); - return DocAction.ACTION_None; + this.getM_AttributeSetInstance_ID(), false, get_TrxName()); + return DOCSTATUS_Closed; } setProcessed(true); @@ -720,7 +720,7 @@ public class MPPOrder extends X_PP_Order implements DocAction { String DocStatus = completeIt(); setDocStatus(DocStatus); - setDocAction(MPPOrder.ACTION_Close); + setDocAction(MPPOrder.ACTION_None); } // Before Close m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_BEFORE_CLOSE);