svn commit: r603280 - in /ofbiz/trunk/applications/manufacturing: config/ data/ entitydef/ servicedef/ src/org/ofbiz/manufacturing/mrp/ webapp/manufacturing/WEB-INF/actions/mrp/ webapp/manufacturing/mrp/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r603280 - in /ofbiz/trunk/applications/manufacturing: config/ data/ entitydef/ servicedef/ src/org/ofbiz/manufacturing/mrp/ webapp/manufacturing/WEB-INF/actions/mrp/ webapp/manufacturing/mrp/

jacopoc
Author: jacopoc
Date: Tue Dec 11 07:44:25 2007
New Revision: 603280

URL: http://svn.apache.org/viewvc?rev=603280&view=rev
Log:
Refactored the entities (and supported code) that are used by the MRP. This is a step part of a more general review and enhancement of the manufacturing component.
There is still a lot to do.

Modified:
    ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties
    ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml
    ofbiz/trunk/applications/manufacturing/entitydef/entitygroup.xml
    ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml
    ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml
    ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java
    ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.bsh
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpTabBar.ftl
    ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl

Modified: ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties (original)
+++ ofbiz/trunk/applications/manufacturing/config/ManufacturingUiLabels.properties Tue Dec 11 07:44:25 2007
@@ -100,10 +100,6 @@
 ManufacturingFormula=Formula
 ManufacturingImplosion=Implosion
 ManufacturingInstruction=Instruction
-ManufacturingInventoryEventPlanned=Inventory Event Planned
-ManufacturingInventoryEventPlannedCreateError=Can not create a record in InventoryEventPlanned
-ManufacturingInventoryEventPlannedNotExist=InventoryEventPlanned does not exist
-ManufacturingInventoryEventPlannedNotUpdate=InventoryEventPlanned can't be updated
 ManufacturingInventoryEventTypeNotExist=Inventory Event Type does not exist
 ManufacturingInventoryItemNotExis=InventoryItem table does not exist
 ManufacturingJobShop=JobShop
@@ -135,6 +131,7 @@
 ManufacturingMrpJobIsRunning=An Mrp Job is Running
 ManufacturingMrpJobScheduledOrRunning=Scheduled or Running Jobs
 ManufacturingMrpInitialisation=IEP init.
+ManufacturingMrpLog=MRP Log
 ManufacturingNewCalendar=New calendar
 ManufacturingNewCalendarWeek=New Week
 ManufacturingNewMachineGroup=New Fixed Asset group

Modified: ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml (original)
+++ ofbiz/trunk/applications/manufacturing/data/ManufacturingData.xml Tue Dec 11 07:44:25 2007
@@ -19,16 +19,17 @@
 -->
 
 <entity-engine-xml>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="INITIAL_QOH" description="Initial QOH" inOut="+"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="MRP_REQUIREMENT" description="Mrp requirement" inOut="-"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="MANUF_ORDER_RECP" description="Manufacturing Order receipt" inOut="+"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="MANUF_ORDER_REQ" description="Manufacturing Order requirement" inOut="-"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="PROP_MANUF_O_RECP" description="Proposed Manufacturing Order receipt" inOut="+"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="PUR_ORDER_RECP" description="Purchase Order receipt" inOut="+"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="PROD_REQ_RECP" description="Product Requirement Receipt" inOut="+"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="PROP_PUR_O_RECP" description="Proposed Purchase Order receipt" inOut="+"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="SALES_ORDER_SHIP" description="Sales order shipment" inOut="-"/>
-    <InventoryEventPlannedType inventoryEventPlanTypeId="ERROR" description="Error"/>
+    <MrpEventType mrpEventTypeId="INITIAL_QOH" description="Initial QOH"/>
+    <MrpEventType mrpEventTypeId="MRP_REQUIREMENT" description="Mrp requirement"/>
+    <MrpEventType mrpEventTypeId="MANUF_ORDER_RECP" description="Manufacturing Order receipt"/>
+    <MrpEventType mrpEventTypeId="MANUF_ORDER_REQ" description="Manufacturing Order requirement"/>
+    <MrpEventType mrpEventTypeId="PROP_MANUF_O_RECP" description="Proposed Manufacturing Order receipt"/>
+    <MrpEventType mrpEventTypeId="PUR_ORDER_RECP" description="Purchase Order receipt"/>
+    <MrpEventType mrpEventTypeId="PROD_REQ_RECP" description="Product Requirement Receipt"/>
+    <MrpEventType mrpEventTypeId="PROP_PUR_O_RECP" description="Proposed Purchase Order receipt"/>
+    <MrpEventType mrpEventTypeId="SALES_ORDER_SHIP" description="Sales order shipment"/>
+    <MrpEventType mrpEventTypeId="ERROR" description="Error"/>
+
     <TechDataCalendarWeek calendarWeekId="SUPPLIER" description="8hours/days, currently the Re-Order Process convert day to mms with 8h/days" mondayStartTime="08:30:00" mondayCapacity="2.88E7" tuesdayStartTime="08:30:00" tuesdayCapacity="2.88E7" wednesdayStartTime="08:30:00" wednesdayCapacity="2.88E7" thursdayStartTime="08:30:00" thursdayCapacity="2.88E7" fridayStartTime="08:30:00" fridayCapacity="2.88E7"/>
     <TechDataCalendar calendarId="SUPPLIER" description="Calendar used for Re-Order date calculation for bought product" calendarWeekId="SUPPLIER"/>
     <TechDataCalendarWeek calendarWeekId="DEFAULT" description="8hours/days" mondayStartTime="08:30:00" mondayCapacity="2.88E7" tuesdayStartTime="08:30:00" tuesdayCapacity="2.88E7" wednesdayStartTime="08:30:00" wednesdayCapacity="2.88E7" thursdayStartTime="08:30:00" thursdayCapacity="2.88E7" fridayStartTime="08:30:00" fridayCapacity="2.88E7"/>

Modified: ofbiz/trunk/applications/manufacturing/entitydef/entitygroup.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/entitydef/entitygroup.xml?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/entitydef/entitygroup.xml (original)
+++ ofbiz/trunk/applications/manufacturing/entitydef/entitygroup.xml Tue Dec 11 07:44:25 2007
@@ -40,9 +40,9 @@
   <!-- org.ofbiz.manufacturing.mrp -->
   <!-- ========================================================= -->
 
-    <entity-group group="org.ofbiz" entity="InventoryEventPlanned" />
-    <entity-group group="org.ofbiz" entity="InventoryEventPlannedType" />
-    <entity-group group="org.ofbiz" entity="MrpInventoryEventPlanned" />
+    <entity-group group="org.ofbiz" entity="MrpEvent" />
+    <entity-group group="org.ofbiz" entity="MrpEventType" />
+    <entity-group group="org.ofbiz" entity="MrpEventView" />
 
 </entitygroup>
 

Modified: ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml Tue Dec 11 07:44:25 2007
@@ -155,61 +155,56 @@
   <!-- org.ofbiz.manufacturing.mrp -->
   <!-- ========================================================= -->
 
-    <entity entity-name="InventoryEventPlanned"
+    <entity entity-name="MrpEventType"
             package-name="org.ofbiz.manufacturing.mrp"
-            title="Inventory event planned">
-      <description>
-        Contains all the planned InventoryEvent by ProductId to be able to check the product availability
-        and if necessary generate some requirements
-      </description>
+            default-resource-name="ManufacturingEntityLabels"
+            title="MRP Event Type">
+      <description></description>
+      <field name="mrpEventTypeId" type="id-ne"></field>
+      <field name="description" type="description"></field>
+      <prim-key field="mrpEventTypeId"/>
+    </entity>
+
+    <entity entity-name="MrpEvent"
+            package-name="org.ofbiz.manufacturing.mrp"
+            title="MRP Event">
+      <description></description>
+      <field name="mrpId" type="id-ne"></field>
       <field name="productId" type="id-ne"></field>
       <field name="eventDate" type="date-time"></field>
-      <field name="inventoryEventPlanTypeId" type="id-ne"></field>
-      <field name="eventQuantity" type="floating-point"></field>
+      <field name="mrpEventTypeId" type="id-ne"></field>
       <field name="facilityId" type="id"></field>
+      <field name="quantity" type="floating-point"></field>
       <field name="eventName" type="very-long"></field>
       <field name="isLate" type="indicator"></field>
+      <prim-key field="mrpId"/>
       <prim-key field="productId"/>
       <prim-key field="eventDate"/>
-      <prim-key field="inventoryEventPlanTypeId"/>
-      <relation type="one" fk-name="INV_EVNT_PLN_PRDT" rel-entity-name="Product">
+      <prim-key field="mrpEventTypeId"/>
+      <relation type="one" fk-name="MRPEV_PROD" rel-entity-name="Product">
         <key-map field-name="productId"/>
       </relation>
-      <relation type="one" fk-name="INV_EVNT_PLN_TYP" rel-entity-name="InventoryEventPlannedType">
-        <key-map field-name="inventoryEventPlanTypeId"/>
+      <relation type="one" fk-name="MRPEV_TYP" rel-entity-name="MrpEventType">
+        <key-map field-name="mrpEventTypeId"/>
       </relation>
-      <relation type="one" fk-name="INV_EVNT_PLN_FAC" rel-entity-name="Facility">
+      <relation type="one" fk-name="MRPEV_FAC" rel-entity-name="Facility">
         <key-map field-name="facilityId"/>
       </relation>
     </entity>
-    <entity entity-name="InventoryEventPlannedType"
-            package-name="org.ofbiz.manufacturing.mrp"
-            default-resource-name="ManufacturingEntityLabels"
-            title="Inventory  event Planned type">
-      <description>Used to describe the InventoryEventPlanned and give the information if it's an in or out event</description>
-      <field name="inventoryEventPlanTypeId" type="id-ne"></field>
-      <field name="description" type="description"></field>
-      <field name="inOut" type="indicator"></field>
-      <prim-key field="inventoryEventPlanTypeId"/>
-    </entity>
-    <view-entity entity-name="MrpInventoryEventPlanned" package-name="org.ofbiz.manufacturing.mrp"
-        title="Inventory Event Planned view for MRP process">
-      <description>Uses for the MRP process to be able to read the InventoryEventPlanned By billOfMaterialLevel and by eventDate</description>
-      <member-entity entity-alias="IEP" entity-name="InventoryEventPlanned"></member-entity>
-      <member-entity entity-alias="IEPT" entity-name="InventoryEventPlannedType"></member-entity>
+
+    <view-entity entity-name="MrpEventView"
+                 package-name="org.ofbiz.manufacturing.mrp"
+                 title="MRP Event View">
+      <member-entity entity-alias="MEV" entity-name="MrpEvent"></member-entity>
       <member-entity entity-alias="PR" entity-name="Product"></member-entity>
-      <alias-all entity-alias="IEP"></alias-all>
+      <alias-all entity-alias="MEV"></alias-all>
       <alias entity-alias="PR" name="billOfMaterialLevel"></alias>
-      <alias entity-alias="IEPT" name="inOut"></alias>
-      <view-link entity-alias="IEP" rel-entity-alias="PR">
+      <view-link entity-alias="MEV" rel-entity-alias="PR">
         <key-map field-name="productId"></key-map>
       </view-link>
-      <view-link entity-alias="IEP" rel-entity-alias="IEPT">
-        <key-map field-name="inventoryEventPlanTypeId"></key-map>
-      </view-link>
       <relation rel-entity-name="Product" type="one-nofk">
         <key-map field-name="productId"/>
       </relation>
     </view-entity>
-</entitymodel>
 
+</entitymodel>

Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml (original)
+++ ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml Tue Dec 11 07:44:25 2007
@@ -35,31 +35,27 @@
         <attribute name="defaultYearsOffset" type="Integer" mode="IN" optional="true"/>
         <attribute name="msgResult" type="List" mode="OUT" optional="false"/>
     </service>
-    <service name="initInventoryEventPlanned" engine="java"
-            location="org.ofbiz.manufacturing.mrp.MrpServices" invoke="initInventoryEventPlanned" auth="true" use-transaction="false">
-        <description>Initialize the table "InventoryEventPlanned"</description>
+    <service name="initMrpEvents" engine="java"
+            location="org.ofbiz.manufacturing.mrp.MrpServices" invoke="initMrpEvents" auth="true" use-transaction="false">
+        <description>Initialize data for the MRP</description>
+        <attribute name="mrpId" type="String" mode="IN" optional="false"/>
         <attribute name="reInitialize" type="Boolean" mode="IN" optional="false"/>
         <attribute name="defaultYearsOffset" type="Integer" mode="IN" optional="true"/>
     </service>
-    <service name="listProductForMrp" engine="java"
-            location="org.ofbiz.manufacturing.mrp.MrpServices" invoke="listProductForMrp" auth="true">
-        <description>List the products for the MRP"</description>
-        <attribute name="billOfMaterialLevel" type="Long" mode="IN" optional="false"/>
-        <attribute name="listInventoryEventForMrp" type="List" mode="OUT" optional="false"/>
-    </service>
     <service name="findProductMrpQoh" engine="java"
             location="org.ofbiz.manufacturing.mrp.MrpServices" invoke="findProductMrpQoh" auth="true">
         <description>Find the quantity on hand of products for the MRP</description>
         <attribute name="productId" type="String" mode="IN" optional="false"/>
         <attribute name="quantityOnHandTotal" type="Double" mode="OUT" optional="false"/>
     </service>
-    <service name="createInventoryEventPlanned" engine="java"
-            location="org.ofbiz.manufacturing.mrp.InventoryEventPlannedServices" invoke="createInventoryEventPlanned" auth="false">
-        <description>create an createInventoryEventPlanned record in the database</description>
+    <service name="createMrpEvent" engine="java"
+            location="org.ofbiz.manufacturing.mrp.InventoryEventPlannedServices" invoke="createMrpEvent" auth="false">
+        <description>create an MrpEvent</description>
+        <attribute name="mrpId" type="String" mode="IN" optional="false"/>
         <attribute name="productId" type="String" mode="IN" optional="false"/>
         <attribute name="eventDate" type="Timestamp" mode="IN" optional="false"/>
-        <attribute name="inventoryEventPlanTypeId" type="String" mode="IN" optional="false"/>
-        <attribute name="eventQuantity" type="Double" mode="IN" optional="false"/>
+        <attribute name="mrpEventTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="quantity" type="Double" mode="IN" optional="false"/>
         <attribute name="facilityId" type="String" mode="IN" optional="true"/>
         <attribute name="eventName" type="String" mode="IN" optional="true"/>
     </service>

Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java Tue Dec 11 07:44:25 2007
@@ -29,60 +29,58 @@
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ServiceUtil;
 
-/**
- * InventoryEventPlannedServices - InventoryEventPlanned related Services
- *
- */
+
 public class InventoryEventPlannedServices {
     
     public static final String module = InventoryEventPlannedServices.class.getName();
   
     /**
      *
-     *  Create an InventoryEventPlanned.
-     *  Make an update if a record exist with same key,  (adding the eventQuantity to the exiting record)
+     *  Create an MrpEvent.
+     *  Make an update if a record exist with same key,  (adding the event quantity to the exiting record)
      *
      * @param ctx
-     * @param context: a map containing the parameters used to create an InventoryEventPlanned (see the servcie definition)
+     * @param context: a map containing the parameters used to create an MrpEvent
      * @return result: a map with service status
      */
-    public static Map createInventoryEventPlanned(DispatchContext ctx, Map context) {
+    public static Map createMrpEvent(DispatchContext ctx, Map context) {
         GenericDelegator delegator = ctx.getDelegator();
-        Map parameters = UtilMisc.toMap("productId", context.get("productId"),
+        Map parameters = UtilMisc.toMap("mrpId", context.get("mrpId"),
+                                        "productId", context.get("productId"),
                                         "eventDate", context.get("eventDate"),
-                                        "inventoryEventPlanTypeId", context.get("inventoryEventPlanTypeId"));
-        Double quantity = (Double)context.get("eventQuantity");
-        GenericValue inventoryEventPlanned = null;
+                                        "mrpEventTypeId", context.get("mrpEventTypeId"));
+        Double quantity = (Double)context.get("quantity");
+        GenericValue mrpEvent = null;
         try {
-            createOrUpdateInventoryEventPlanned(parameters, quantity, (String)context.get("facilityId"), (String)context.get("eventName"), false, delegator);
+            createOrUpdateMrpEvent(parameters, quantity, (String)context.get("facilityId"), (String)context.get("eventName"), false, delegator);
         } catch (GenericEntityException e) {
-            Debug.logError(e,"Error : delegator.findByPrimaryKey(\"InventoryEventPlanned\", parameters =)"+parameters, module);
+            Debug.logError(e,"Error : delegator.findByPrimaryKey(\"MrpEvent\", parameters =)"+parameters, module);
             return ServiceUtil.returnError("Problem, on database access, for more detail look at the log");
         }
         return ServiceUtil.returnSuccess();
     }
 
-    public static void createOrUpdateInventoryEventPlanned(Map inventoryEventPlannedKeyMap, Double newQuantity, String facilityId, String eventName, boolean isLate, GenericDelegator delegator) throws GenericEntityException {
-        GenericValue inventoryEventPlanned = null;
-        inventoryEventPlanned = delegator.findByPrimaryKey("InventoryEventPlanned", inventoryEventPlannedKeyMap);
-        if (inventoryEventPlanned == null) {
-            inventoryEventPlanned = delegator.makeValue("InventoryEventPlanned", inventoryEventPlannedKeyMap);
-            inventoryEventPlanned.put("eventQuantity", newQuantity);
-            inventoryEventPlanned.put("eventName", eventName);
-            inventoryEventPlanned.put("facilityId", facilityId);
-            inventoryEventPlanned.put("isLate", (isLate? "Y": "N"));
-            inventoryEventPlanned.create();
+    public static void createOrUpdateMrpEvent(Map mrpEventKeyMap, Double newQuantity, String facilityId, String eventName, boolean isLate, GenericDelegator delegator) throws GenericEntityException {
+        GenericValue mrpEvent = null;
+        mrpEvent = delegator.findByPrimaryKey("MrpEvent", mrpEventKeyMap);
+        if (mrpEvent == null) {
+            mrpEvent = delegator.makeValue("MrpEvent", mrpEventKeyMap);
+            mrpEvent.put("quantity", newQuantity);
+            mrpEvent.put("eventName", eventName);
+            mrpEvent.put("facilityId", facilityId);
+            mrpEvent.put("isLate", (isLate? "Y": "N"));
+            mrpEvent.create();
         } else {
-            double qties = newQuantity.doubleValue() + ((Double)inventoryEventPlanned.get("eventQuantity")).doubleValue();
-            inventoryEventPlanned.put("eventQuantity", new Double(qties));
+            double qties = newQuantity.doubleValue() + ((Double)mrpEvent.get("quantity")).doubleValue();
+            mrpEvent.put("quantity", new Double(qties));
             if (!UtilValidate.isEmpty(eventName)) {
-                String existingEventName = inventoryEventPlanned.getString("eventName");
-                inventoryEventPlanned.put("eventName", (UtilValidate.isEmpty(existingEventName)? eventName: existingEventName + ", " + eventName));
+                String existingEventName = mrpEvent.getString("eventName");
+                mrpEvent.put("eventName", (UtilValidate.isEmpty(existingEventName)? eventName: existingEventName + ", " + eventName));
             }
             if (isLate) {
-                inventoryEventPlanned.put("isLate", "Y");
+                mrpEvent.put("isLate", "Y");
             }
-            inventoryEventPlanned.store();
+            mrpEvent.store();
         }
     }
 }

Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java Tue Dec 11 07:44:25 2007
@@ -59,9 +59,7 @@
     
     
     /**
-     * Initialize the InventoryEventPlanned table.
-     * <li>PreConditions : none</li>
-     * <li>Result : The table InventoryEventPlannedForMRP is initialized</li>
+     * Initialize the MrpEvent table.
      * <li>INPUT : Parameter to get from the context :</li><ul>
      * <li>Boolean reInitialize<br/>
      * if true : we must reinitialize the table, else we synchronize the table (not for the moment)</li></ul>
@@ -74,30 +72,30 @@
      * @return Map with the result of the service, the output parameters.
      */
     
-    public static Map initInventoryEventPlanned(DispatchContext ctx, Map context) {
+    public static Map initMrpEvents(DispatchContext ctx, Map context) {
         GenericDelegator delegator = ctx.getDelegator();
         Timestamp now = UtilDateTime.nowTimestamp();
         
         Integer defaultYearsOffset = (Integer)context.get("defaultYearsOffset");
-        
+        String mrpId = (String)context.get("mrpId");
+
         //Erases the old table for the moment and initializes it with the new orders,
         //Does not modify the old one now.
-        Debug.logInfo("initInventoryEventPlanned called", module);
         
         List listResult = null;
-        try{
-            listResult = delegator.findAll("InventoryEventPlanned");
-            //int numOfRecordsRemoved = delegator.removeByCondition("InventoryEventPlanned", null);
+        try {
+            listResult = delegator.findAll("MrpEvent");
+            //int numOfRecordsRemoved = delegator.removeByCondition("MrpEvent", null);
         } catch(GenericEntityException e) {
-            Debug.logError(e,"Error : delegator.findAll(\"InventoryEventPlanned\")", module);
-            return ServiceUtil.returnError("Problem, we can not find all the items of InventoryEventPlanned, for more detail look at the log");
+            Debug.logError(e,"Error : delegator.findAll(\"MrpEvent\")", module);
+            return ServiceUtil.returnError("Problem, we can not find all the items of MrpEvent, for more detail look at the log");
         }
-        if(listResult != null){
+        if (listResult != null){
             try{
                 delegator.removeAll(listResult);
             } catch(GenericEntityException e) {
                 Debug.logError(e,"Error : delegator.removeAll(listResult), listResult ="+listResult, module);
-                return ServiceUtil.returnError("Problem, we can not remove the InventoryEventPlanned items, for more detail look at the log");
+                return ServiceUtil.returnError("Problem, we can not remove the MrpEvent items, for more detail look at the log");
             }
         }
 
@@ -107,7 +105,7 @@
         try{
             listResult = delegator.findByAnd("Requirement", UtilMisc.toMap("requirementTypeId", "PRODUCT_REQUIREMENT", "statusId", "REQ_PROPOSED"));
         } catch(GenericEntityException e) {
-            return ServiceUtil.returnError("Problem, we can not find all the items of InventoryEventPlanned, for more detail look at the log");
+            return ServiceUtil.returnError("Problem, we can not find all the items of MrpEvent, for more detail look at the log");
         }
         if (listResult != null){
             try{
@@ -120,20 +118,20 @@
                 delegator.removeAll(listResultRoles);
                 delegator.removeAll(listResult);
             } catch(GenericEntityException e) {
-                return ServiceUtil.returnError("Problem, we can not remove the InventoryEventPlanned items, for more detail look at the log");
+                return ServiceUtil.returnError("Problem, we can not remove the MrpEvent items, for more detail look at the log");
             }
         }
         listResult = null;
-        try{
+        try {
             listResult = delegator.findByAnd("Requirement", UtilMisc.toMap("requirementTypeId", "INTERNAL_REQUIREMENT", "statusId", "REQ_PROPOSED"));
         } catch(GenericEntityException e) {
-            return ServiceUtil.returnError("Problem, we can not find all the items of InventoryEventPlanned, for more detail look at the log");
+            return ServiceUtil.returnError("Problem, we can not find all the items of MrpEvent, for more detail look at the log");
         }
-        if(listResult != null){
+        if (listResult != null){
             try{
                 delegator.removeAll(listResult);
             } catch(GenericEntityException e) {
-                return ServiceUtil.returnError("Problem, we can not remove the InventoryEventPlanned items, for more detail look at the log");
+                return ServiceUtil.returnError("Problem, we can not remove the MrpEvent items, for more detail look at the log");
             }
         }
 
@@ -199,11 +197,11 @@
                     }
                 }
             }
-            parameters = UtilMisc.toMap("productId", productId, "eventDate", requiredByDate, "inventoryEventPlanTypeId", "SALES_ORDER_SHIP");
+            parameters = UtilMisc.toMap("mrpId", mrpId, "productId", productId, "eventDate", requiredByDate, "mrpEventTypeId", "SALES_ORDER_SHIP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), false, delegator);
+                InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), false, delegator);
             } catch (GenericEntityException e) {
-                return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (SALES_ORDER_SHIP)");
+                return ServiceUtil.returnError("Problem initializing the MrpEvent entity (SALES_ORDER_SHIP)");
             }
         }
         // ----------------------------------------
@@ -215,7 +213,7 @@
         try{
             resultList = delegator.findByAnd("Requirement", parameters);
         } catch(GenericEntityException e) {
-            return ServiceUtil.returnError("Problem, we can not find all the items of InventoryEventPlanned, for more detail look at the log");
+            return ServiceUtil.returnError("Problem, we can not find all the items of MrpEvent, for more detail look at the log");
         }
         iteratorResult = resultList.iterator();
         while(iteratorResult.hasNext()){
@@ -230,11 +228,11 @@
                 estimatedShipDate = now;
             }
             
-            parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "PROD_REQ_RECP");
+            parameters = UtilMisc.toMap("mrpId", mrpId, "productId", productId, "eventDate", estimatedShipDate, "mrpEventTypeId", "PROD_REQ_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("requirementId"), false, delegator);
+                InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, genericResult.getString("requirementId"), false, delegator);
             } catch (GenericEntityException e) {
-                return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (PROD_REQ_RECP)");
+                return ServiceUtil.returnError("Problem initializing the MrpEvent entity (PROD_REQ_RECP)");
             }
         }
         
@@ -284,11 +282,11 @@
                 estimatedShipDate = now;
             }
             
-            parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "PUR_ORDER_RECP");
+            parameters = UtilMisc.toMap("mrpId", mrpId, "productId", productId, "eventDate", estimatedShipDate, "mrpEventTypeId", "PUR_ORDER_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), false, delegator);
+                InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), false, delegator);
             } catch (GenericEntityException e) {
-                return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (PUR_ORDER_RECP)");
+                return ServiceUtil.returnError("Problem initializing the MrpEvent entity (PUR_ORDER_RECP)");
             }
         }
 
@@ -315,12 +313,12 @@
                 estimatedShipDate = now;
             }
             
-            parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "MANUF_ORDER_REQ");
+            parameters = UtilMisc.toMap("mrpId", mrpId, "productId", productId, "eventDate", estimatedShipDate, "mrpEventTypeId", "MANUF_ORDER_REQ");
             try {
                 String eventName = (UtilValidate.isEmpty(genericResult.getString("workEffortParentId"))? genericResult.getString("workEffortId"): genericResult.getString("workEffortParentId") + "-" + genericResult.getString("workEffortId"));
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, eventName, false, delegator);
+                InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, eventName, false, delegator);
             } catch (GenericEntityException e) {
-                return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (MRP_REQUIREMENT)");
+                return ServiceUtil.returnError("Problem initializing the MrpEvent entity (MRP_REQUIREMENT)");
             }
         }
         
@@ -362,64 +360,18 @@
                 estimatedShipDate = now;
             }
             
-            parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "MANUF_ORDER_RECP");
+            parameters = UtilMisc.toMap("mrpId", mrpId, "productId", productId, "eventDate", estimatedShipDate, "mrpEventTypeId", "MANUF_ORDER_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("workEffortId"), false, delegator);
+                InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, genericResult.getString("workEffortId"), false, delegator);
             } catch (GenericEntityException e) {
-                return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (MANUF_ORDER_RECP)");
+                return ServiceUtil.returnError("Problem initializing the MrpEvent entity (MANUF_ORDER_RECP)");
             }
         }
 
         
         Map result = new HashMap();
         result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
-        Debug.logInfo("return from initInventoryEventPlanned", module);
-        return result;
-    }
-    /**
-     * Create a List  with all the event of InventotyEventPlanned for one billOfMaterialLevel, sorted by productId and eventDate.
-     *
-     * <li>INPUT : Parameter to get from the context : </li><ul>
-     * <li>Integer billOfMaterialLevel : 0 for root for more detail see BomHelper.getMaxDepth</li></ul>
-     *
-     * <li>OUTPUT : Result to put in the map :</li><ul>
-     * <li>List listInventoryEventForMRP : all the event of InventotyEventPlanned for one billOfMaterialLevel, sorted by productId and eventDate<br/>
-     * @param ctx The DispatchContext that this service is operating in.
-     * @param context Map containing the input parameters.
-     * @return Map with the result of the service, the output parameters.
-     */
-    public static Map listProductForMrp(DispatchContext ctx, Map context) {
-        Debug.logInfo("listProductForMrp called", module);
-        // read parameters from context
-        GenericDelegator delegator = ctx.getDelegator();
-        Long billOfMaterialLevel = (Long) context.get("billOfMaterialLevel");
-        
-        // Find all products in MrpInventoryEventPlanned, ordered by bom and eventDate
-        List listResult = null;
-        // If billOfMaterialLevel == 0 the search must be done with (billOfMaterialLevel == 0 || billOfMaterialLevel == null)
-        EntityCondition parameters = null;
-        if (billOfMaterialLevel.intValue() == 0) {
-            parameters = new EntityExpr(new EntityExpr("billOfMaterialLevel", EntityOperator.EQUALS, null),
-                                        EntityOperator.OR,
-                                        new EntityExpr("billOfMaterialLevel", EntityOperator.EQUALS, billOfMaterialLevel));
-        } else {
-            parameters = new EntityExpr("billOfMaterialLevel", EntityOperator.EQUALS, billOfMaterialLevel);
-        }
-
-        List orderBy = UtilMisc.toList("productId", "eventDate");
-        try{
-            //listResult = delegator.findByAnd("MrpInventoryEventPlanned", parameters, orderBy);
-            listResult = delegator.findByCondition("MrpInventoryEventPlanned", parameters, null, orderBy);
-        } catch(GenericEntityException e) {
-            Debug.logError(e, "Error : delegator.findByCondition(\"MrpInventoryEventPlanned\", parameters, null, orderBy)", module);
-            Debug.logError(e, "Error : parameters = "+parameters,module);
-            Debug.logError(e, "Error : orderBy = "+orderBy,module);
-            return ServiceUtil.returnError("Problem, we can not find the products, for more detail look at the log");
-        }
-        Map result = new HashMap();
-        result.put("listInventoryEventForMrp",listResult);
-        result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
-        Debug.logInfo("return from listProductForMrp "+billOfMaterialLevel, module);
+        Debug.logInfo("return from initMrpEvent", module);
         return result;
     }
     
@@ -454,9 +406,9 @@
     public static void logMrpError(String productId, Timestamp eventDate, String errorMessage, GenericDelegator delegator) {
         try {
             if (UtilValidate.isNotEmpty(productId) && UtilValidate.isNotEmpty(errorMessage)) {
-                GenericValue inventoryEventError = delegator.makeValue("InventoryEventPlanned", UtilMisc.toMap("productId", productId,
+                GenericValue inventoryEventError = delegator.makeValue("MrpEvent", UtilMisc.toMap("productId", productId,
                                                                                                                "eventDate", eventDate,
-                                                                                                               "inventoryEventPlanTypeId", "ERROR",
+                                                                                                               "mrpEventTypeId", "ERROR",
                                                                                                                "eventName", errorMessage));
                 delegator.createOrStore(inventoryEventError);
             }
@@ -466,7 +418,7 @@
     }
 
     /**
-     * Process the bill of material (bom) of the product  to insert components in the InventoryEventPlanned table.
+     * Process the bill of material (bom) of the product  to insert components in the MrpEvent table.
      *   Before inserting in the entity, test if there is the record already existing to add quantity rather to create a new one.
      *
      * @param product
@@ -476,7 +428,7 @@
      * @return None
      */
     
-    public static void processBomComponent(GenericValue product, double eventQuantity, Timestamp startDate, Map routingTaskStartDate, List listComponent) {
+    public static void processBomComponent(String mrpId, GenericValue product, double eventQuantity, Timestamp startDate, Map routingTaskStartDate, List listComponent) {
         // TODO : change the return type to boolean to be able to test if all is ok or if it have had a exception
         GenericDelegator delegator = product.getDelegator();
 
@@ -488,17 +440,18 @@
                 // read the startDate for the component
                 String routingTask = node.getProductAssoc().getString("routingWorkEffortId");
                 Timestamp eventDate = (routingTask == null || !routingTaskStartDate.containsKey(routingTask)) ? startDate : (Timestamp) routingTaskStartDate.get(routingTask);
-                // if the components is valid at the event Date create the Mrp requirement in the InventoryEventPlanned entity
+                // if the components is valid at the event Date create the Mrp requirement in the M entity
                 if (EntityUtil.isValueActive(productComponent, eventDate)) {
                     //Map parameters = UtilMisc.toMap("productId", productComponent.getString("productIdTo"));
                     Map parameters = UtilMisc.toMap("productId", node.getProduct().getString("productId"));
+                    parameters.put("mrpId", mrpId);
                     parameters.put("eventDate", eventDate);
-                    parameters.put("inventoryEventPlanTypeId", "MRP_REQUIREMENT");
+                    parameters.put("mrpEventTypeId", "MRP_REQUIREMENT");
                     double componentEventQuantity = node.getQuantity();
                     try {
-                        InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, new Double(-1.0 * componentEventQuantity), null, product.get("productId") + ": " + eventDate, false, delegator);
+                        InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, new Double(-1.0 * componentEventQuantity), null, product.get("productId") + ": " + eventDate, false, delegator);
                     } catch (GenericEntityException e) {
-                        Debug.logError("Error : delegator.findByPrimaryKey(\"InventoryEventPlanned\", parameters) ="+parameters+"--"+e.getMessage(), module);
+                        Debug.logError("Error : delegator.findByPrimaryKey(\"MrpEvent\", parameters) ="+parameters+"--"+e.getMessage(), module);
                         logMrpError(node.getProduct().getString("productId"), "Unable to create event (processBomComponent)", delegator);
                     }
                 }
@@ -585,34 +538,39 @@
         boolean isBuilt = false;
         GenericValue routing = null;
         
+        String mrpId = delegator.getNextSeqId("Mrp");
+
         Map result = null;
         Map parameters = null;
         List listInventoryEventForMRP = null;
         ListIterator iteratorListInventoryEventForMRP = null;
         GenericValue inventoryEventForMRP = null;
         
-        // Initialisation of the InventoryEventPlanned table, This table will contain the products we want to buy or build.
-        parameters = UtilMisc.toMap("reInitialize", Boolean.TRUE, "defaultYearsOffset", defaultYearsOffset, "userLogin", userLogin);
+        // Initialisation of the MrpEvent table, This table will contain the products we want to buy or build.
+        parameters = UtilMisc.toMap("mrpId", mrpId, "reInitialize", Boolean.TRUE, "defaultYearsOffset", defaultYearsOffset, "userLogin", userLogin);
         try {
-            result = dispatcher.runSync("initInventoryEventPlanned", parameters);
+            result = dispatcher.runSync("initMrpEvents", parameters);
         } catch (GenericServiceException e) {
-            Debug.logError("Error : initInventoryEventPlanned", module);
-            Debug.logError("Error : parameters = "+parameters,module);
-            return ServiceUtil.returnError("Problem, can not initialise the table InventoryEventPlanned, for more detail look at the log");
+            return ServiceUtil.returnError("Error running the initMrpEvents service: " + e.getMessage());
         }
         long bomLevel = 0;
         do {
-            //get the products from the InventoryEventPlanned table for the current billOfMaterialLevel (ie. BOM)
-            parameters = UtilMisc.toMap("billOfMaterialLevel", new Long(bomLevel), "userLogin", userLogin);
-            try {
-                result = dispatcher.runSync("listProductForMrp", parameters);
-            } catch (GenericServiceException e) {
-                Debug.logError("Error : listProductForMrp, parameters ="+parameters, module);
-                return ServiceUtil.returnError("Problem, can not list the products for the MRP, for more detail look at the log");
+            // Find all products in MrpEventView, ordered by bom and eventDate
+            EntityCondition filterByConditions = null;
+            if (bomLevel == 0) {
+                filterByConditions = new EntityExpr(new EntityExpr("billOfMaterialLevel", EntityOperator.EQUALS, null),
+                                            EntityOperator.OR,
+                                            new EntityExpr("billOfMaterialLevel", EntityOperator.EQUALS, new Long(bomLevel)));
+            } else {
+                filterByConditions = new EntityExpr("billOfMaterialLevel", EntityOperator.EQUALS, new Long(bomLevel));
+            }
+            try{
+                listInventoryEventForMRP = delegator.findByCondition("MrpEventView", filterByConditions, null, UtilMisc.toList("productId", "eventDate"));
+            } catch(GenericEntityException e) {
+                return ServiceUtil.returnError("MRP Error retieving MRP event for the bom level: " + bomLevel + ". Error: " + e.getMessage());
             }
-            listInventoryEventForMRP = (List) result.get("listInventoryEventForMrp");
             
-            if (listInventoryEventForMRP != null && listInventoryEventForMRP.size()>0) {
+            if (UtilValidate.isNotEmpty(listInventoryEventForMRP)) {
                 bomLevelWithNoEvent = 0;
                 iteratorListInventoryEventForMRP = listInventoryEventForMRP.listIterator();
                 
@@ -620,7 +578,7 @@
                 while (iteratorListInventoryEventForMRP.hasNext()) {
                     inventoryEventForMRP = (GenericValue) iteratorListInventoryEventForMRP.next();
                     productId = inventoryEventForMRP.getString("productId");
-                    eventQuantity = inventoryEventForMRP.getDouble("eventQuantity").doubleValue();
+                    eventQuantity = inventoryEventForMRP.getDouble("quantity").doubleValue();
 
                     if (!productId.equals(oldProductId)) {
                         double positiveEventQuantity = (eventQuantity > 0? eventQuantity: -1 * eventQuantity);
@@ -633,11 +591,11 @@
                         }
                         stockTmp = findProductMrpQoh(product, facilityId, dispatcher, delegator);
                         try {
-                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(UtilMisc.toMap("productId", product.getString("productId"), "inventoryEventPlanTypeId", "INITIAL_QOH", "eventDate", now),
+                            InventoryEventPlannedServices.createOrUpdateMrpEvent(UtilMisc.toMap("mrpId", mrpId, "productId", product.getString("productId"), "mrpEventTypeId", "INITIAL_QOH", "eventDate", now),
                                                                                               new Double(stockTmp), facilityId, null, false,
                                                                                               delegator);
                         } catch (GenericEntityException e) {
-                            return ServiceUtil.returnError("Problem running createOrUpdateInventoryEventPlanned");
+                            return ServiceUtil.returnError("Problem running createOrUpdateMrpEvent");
                         }
  // days to ship is only relevant for sales order to plan for preparatory days to ship.  Otherwise MRP will push event dates for manufacturing parts
                         // as well and cause problems
@@ -645,7 +603,7 @@
                         if (productFacility != null) {
                             reorderQuantity = (productFacility.getDouble("reorderQuantity") != null? productFacility.getDouble("reorderQuantity").doubleValue(): -1);
                             minimumStock = (productFacility.getDouble("minimumStock") != null? productFacility.getDouble("minimumStock").doubleValue(): 0);
-                            if ("SALES_ORDER_SHIP".equals(inventoryEventForMRP.getString("inventoryEventPlanTypeId"))) {
+                            if ("SALES_ORDER_SHIP".equals(inventoryEventForMRP.getString("mrpEventTypeId"))) {
                                 daysToShip = (productFacility.getLong("daysToShip") != null? productFacility.getLong("daysToShip").intValue(): 0);
                             }
                         } else {
@@ -715,9 +673,9 @@
                         Map routingTaskStartDate = proposedOrder.calculateStartDate(daysToShip, routing, delegator, dispatcher, userLogin);
                         if (isBuilt) {
                             // process the product components
-                            processBomComponent(product, proposedOrder.getQuantity(), proposedOrder.getRequirementStartDate(), routingTaskStartDate, components);
+                            processBomComponent(mrpId, product, proposedOrder.getQuantity(), proposedOrder.getRequirementStartDate(), routingTaskStartDate, components);
                         }
-                        // create the  ProposedOrder (only if the product is warehouse managed), and the InventoryEventPlanned associated
+                        // create the  ProposedOrder (only if the product is warehouse managed), and the MrpEvent associated
                         String requirementId = null;
                         if (productFacility != null) {
                             requirementId = proposedOrder.create(ctx, userLogin);
@@ -730,12 +688,13 @@
                             eventName = "*" + requirementId + " (" + proposedOrder.getRequirementStartDate() + ")*";
                         }
                         Map eventMap = UtilMisc.toMap("productId", product.getString("productId"),
+                                                      "mrpId", mrpId,
                                                       "eventDate", eventDate,
-                                                      "inventoryEventPlanTypeId", (isBuilt? "PROP_MANUF_O_RECP" : "PROP_PUR_O_RECP"));
+                                                      "mrpEventTypeId", (isBuilt? "PROP_MANUF_O_RECP" : "PROP_PUR_O_RECP"));
                         try {
-                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new Double(proposedOrder.getQuantity()), null, eventName, (proposedOrder.getRequirementStartDate().compareTo(now) < 0), delegator);
+                            InventoryEventPlannedServices.createOrUpdateMrpEvent(eventMap, new Double(proposedOrder.getQuantity()), null, eventName, (proposedOrder.getRequirementStartDate().compareTo(now) < 0), delegator);
                         } catch (GenericEntityException e) {
-                            return ServiceUtil.returnError("Problem running createOrUpdateInventoryEventPlanned");
+                            return ServiceUtil.returnError("Problem running createOrUpdateMrpEvent");
                         }
                         //
                         stockTmp = stockTmp + proposedOrder.getQuantity();

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.bsh?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.bsh (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/findInventoryEventPlan.bsh Tue Dec 11 07:44:25 2007
@@ -32,7 +32,6 @@
 GenericDelegator delegator = request.getAttribute("delegator");
 LocalDispatcher dispatcher = request.getAttribute("dispatcher");
 
-//get the inventory (inventoryEventPlanned)
 productId = request.getParameter("productId");
 
 // get the lookup flag
@@ -65,14 +64,14 @@
         if ( productId.length() > 0)
         andExprs.add(new EntityExpr("productId", EntityOperator.EQUALS, productId));
     }
-    andExprs.add(new EntityExpr("inventoryEventPlanTypeId", EntityOperator.NOT_EQUAL, "INITIAL_QOH"));
-    andExprs.add(new EntityExpr("inventoryEventPlanTypeId", EntityOperator.NOT_EQUAL, "ERROR"));
+    andExprs.add(new EntityExpr("mrpEventTypeId", EntityOperator.NOT_EQUAL, "INITIAL_QOH"));
+    andExprs.add(new EntityExpr("mrpEventTypeId", EntityOperator.NOT_EQUAL, "ERROR"));
 
     mainCond = new EntityConditionList(andExprs, EntityOperator.AND);
     
     if ( mainCond != null) {
     // do the lookup
-        inventoryList = delegator.findByCondition("InventoryEventPlanned", mainCond, null, UtilMisc.toList("productId", "eventDate"));
+        inventoryList = delegator.findByCondition("MrpEvent", mainCond, null, UtilMisc.toList("productId", "eventDate"));
     }
     
     context.put("inventoryList", inventoryList);

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpTabBar.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpTabBar.ftl?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpTabBar.ftl (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/MrpTabBar.ftl Tue Dec 11 07:44:25 2007
@@ -22,5 +22,5 @@
 
 <div class='tabContainer'>
     <a href="<@ofbizUrl>RunMrp</@ofbizUrl>" class="${selectedClassMap.RunMrp?default(unselectedClassName)}">${uiLabelMap.ManufacturingRunMrp}</a>
-    <a href="<@ofbizUrl>FindInventoryEventPlan</@ofbizUrl>" class="${selectedClassMap.findInventoryEventPlan?default(unselectedClassName)}">${uiLabelMap.ManufacturingInventoryEventPlanned}</a>
+    <a href="<@ofbizUrl>FindInventoryEventPlan</@ofbizUrl>" class="${selectedClassMap.findInventoryEventPlan?default(unselectedClassName)}">${uiLabelMap.ManufacturingMrpLog}</a>
 </div>

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl?rev=603280&r1=603279&r2=603280&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl Tue Dec 11 07:44:25 2007
@@ -153,8 +153,8 @@
             </#if>
             <#if ! product.equals( productTmp )>
                 <#assign quantityAvailableAtDate = 0>
-                <#assign errorEvents = delegator.findByAnd("InventoryEventPlanned", Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId", "ERROR", "productId", inven.productId))>
-                <#assign qohEvents = delegator.findByAnd("InventoryEventPlanned", Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId", "INITIAL_QOH", "productId", inven.productId))>
+                <#assign errorEvents = delegator.findByAnd("MrpEvent", Static["org.ofbiz.base.util.UtilMisc"].toMap("mrpEventTypeId", "ERROR", "productId", inven.productId))>
+                <#assign qohEvents = delegator.findByAnd("MrpEvent", Static["org.ofbiz.base.util.UtilMisc"].toMap("mrpEventTypeId", "INITIAL_QOH", "productId", inven.productId))>
                 <#assign additionalErrorMessage = "">
                 <#assign initialQohEvent = null>
                 <#assign productFacility = null>
@@ -162,8 +162,8 @@
                     <#assign initialQohEvent = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(qohEvents)>
                 </#if>
                 <#if initialQohEvent != null>
-                    <#if initialQohEvent.eventQuantity?has_content>
-                        <#assign quantityAvailableAtDate = initialQohEvent.eventQuantity>
+                    <#if initialQohEvent.quantity?has_content>
+                        <#assign quantityAvailableAtDate = initialQohEvent.quantity>
                     </#if>
                     <#if initialQohEvent.facilityId?has_content>
                         <#assign productFacility = delegator.findByPrimaryKey("ProductFacility", Static["org.ofbiz.base.util.UtilMisc"].toMap("facilityId", initialQohEvent.facilityId, "productId", inven.productId))?if_exists>
@@ -206,16 +206,16 @@
                 </tr>
                 </#list>
             </#if>
-            <#assign quantityAvailableAtDate = quantityAvailableAtDate?default(0) + inven.getDouble("eventQuantity")>
+            <#assign quantityAvailableAtDate = quantityAvailableAtDate?default(0) + inven.getDouble("quantity")>
             <#assign productTmp = product>
-            <#assign inventoryEventPlannedType = inven.getRelatedOne("InventoryEventPlannedType")>
+            <#assign MrpEventType = inven.getRelatedOne("MrpEventType")>
             <tr class="${rowClass}">
-              <td>${inventoryEventPlannedType.get("description",locale)}</td>
+              <td>${MrpEventType.get("description",locale)}</td>
               <td>&nbsp</td>
               <td>${inven.eventName?if_exists}</td>
               <td><font <#if inven.isLate?default("N") == "Y">color='red'</#if>>${inven.getString("eventDate")}</font></td>
               <td>&nbsp</td>
-              <td align="right">${inven.getString("eventQuantity")}</td>
+              <td align="right">${inven.getString("quantity")}</td>
               <td align="right">${quantityAvailableAtDate?if_exists}</td>
             </tr>
             <#assign count=count+1>