You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/03/11 09:56:46 UTC

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

Author: jacopoc
Date: Sun Mar 11 00:56:45 2007
New Revision: 516875

URL: http://svn.apache.org/viewvc?view=rev&rev=516875
Log:
Improved the mrp event log with information about facilityId:
- new facilityId field in the InventoryEventPlanned entity
- removed the facility drop down box from the find event screen, now the correct facility is pulled by the event

Modified:
    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/findInventoryEventPlan.ftl

Modified: ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml?view=diff&rev=516875&r1=516874&r2=516875
==============================================================================
--- ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml Sun Mar 11 00:56:45 2007
@@ -166,6 +166,7 @@
       <field name="eventDate" type="date-time"></field>
       <field name="inventoryEventPlanTypeId" type="id-ne"></field>
       <field name="eventQuantity" type="floating-point"></field>
+      <field name="facilityId" type="id"></field>
       <field name="eventName" type="name"></field>
       <prim-key field="productId"/>
       <prim-key field="eventDate"/>
@@ -175,6 +176,9 @@
       </relation>
       <relation type="one" fk-name="INV_EVNT_PLN_TYP" rel-entity-name="InventoryEventPlannedType">
         <key-map field-name="inventoryEventPlanTypeId"/>
+      </relation>
+      <relation type="one" fk-name="INV_EVNT_PLN_FAC" rel-entity-name="Facility">
+        <key-map field-name="facilityId"/>
       </relation>
     </entity>
     <entity entity-name="InventoryEventPlannedType"

Modified: ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml?view=diff&rev=516875&r1=516874&r2=516875
==============================================================================
--- ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml (original)
+++ ofbiz/trunk/applications/manufacturing/servicedef/services_mrp.xml Sun Mar 11 00:56:45 2007
@@ -57,5 +57,7 @@
         <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="facilityId" type="String" mode="IN" optional="true"/>
+        <attribute name="eventName" type="String" mode="IN" optional="true"/>
     </service>
 </services>

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?view=diff&rev=516875&r1=516874&r2=516875
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java Sun Mar 11 00:56:45 2007
@@ -54,7 +54,7 @@
         Double quantity = (Double)context.get("eventQuantity");
         GenericValue inventoryEventPlanned = null;
         try {
-            createOrUpdateInventoryEventPlanned(parameters, quantity, (String)context.get("eventName"), delegator);
+            createOrUpdateInventoryEventPlanned(parameters, quantity, (String)context.get("facilityId"), (String)context.get("eventName"), delegator);
         } catch (GenericEntityException e) {
             Debug.logError(e,"Error : delegator.findByPrimaryKey(\"InventoryEventPlanned\", parameters =)"+parameters, module);
             return ServiceUtil.returnError("Problem, on database access, for more detail look at the log");
@@ -62,13 +62,14 @@
         return ServiceUtil.returnSuccess();
     }
 
-    public static void createOrUpdateInventoryEventPlanned(Map inventoryEventPlannedKeyMap, Double newQuantity, String eventName, GenericDelegator delegator) throws GenericEntityException {
+    public static void createOrUpdateInventoryEventPlanned(Map inventoryEventPlannedKeyMap, Double newQuantity, String facilityId, String eventName, 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.create();
         } else {
             double qties = newQuantity.doubleValue() + ((Double)inventoryEventPlanned.get("eventQuantity")).doubleValue();
@@ -80,5 +81,4 @@
             inventoryEventPlanned.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?view=diff&rev=516875&r1=516874&r2=516875
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java Sun Mar 11 00:56:45 2007
@@ -161,7 +161,7 @@
             }
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "SALE_ORDER_SHIP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (SALE_ORDER_SHIP)");
             }
@@ -192,7 +192,7 @@
             
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "PROD_REQ_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, genericResult.getString("requirementId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("requirementId"), delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (PROD_REQ_RECP)");
             }
@@ -246,7 +246,7 @@
             
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "PUR_ORDER_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (PUR_ORDER_RECP)");
             }
@@ -278,7 +278,7 @@
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "MANUF_ORDER_REQ");
             try {
                 String eventName = (UtilValidate.isEmpty(genericResult.getString("workEffortParentId"))? genericResult.getString("workEffortId"): genericResult.getString("workEffortParentId") + "-" + genericResult.getString("workEffortId"));
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, eventName, delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, eventName, delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (MRP_REQUIREMENT)");
             }
@@ -324,7 +324,7 @@
             
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "MANUF_ORDER_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, genericResult.getString("workEffortId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("workEffortId"), delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (MANUF_ORDER_RECP)");
             }
@@ -438,7 +438,7 @@
                     parameters.put("inventoryEventPlanTypeId", "MRP_REQUIREMENT");
                     double componentEventQuantity = node.getQuantity();
                     try {
-                        InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, new Double(-1.0 * componentEventQuantity), null, delegator);
+                        InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, new Double(-1.0 * componentEventQuantity), null, null, delegator);
                     } catch (GenericEntityException e) {
                         Debug.logError("Error : delegator.findByPrimaryKey(\"InventoryEventPlanned\", parameters) ="+parameters+"--"+e.getMessage(), module);
                     }
@@ -576,7 +576,7 @@
                         stockTmp = findProductMrpQoh(product, facilityId, dispatcher);
                         try {
                             InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(UtilMisc.toMap("productId", product.getString("productId"), "inventoryEventPlanTypeId", "INITIAL_QOH", "eventDate", now),
-                                                                                              new Double(stockTmp), null,
+                                                                                              new Double(stockTmp), facilityId, null,
                                                                                               delegator);
                         } catch (GenericEntityException e) {
                             return ServiceUtil.returnError("Problem running createOrUpdateInventoryEventPlanned");
@@ -663,7 +663,7 @@
                                                       "eventDate", eventDate,
                                                       "inventoryEventPlanTypeId", (isBuilt? "PROP_MANUF_O_RECP" : "PROP_PUR_O_RECP"));
                         try {
-                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new Double(proposedOrder.getQuantity()), null, delegator);
+                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new Double(proposedOrder.getQuantity()), null, null, delegator);
                         } catch (GenericEntityException e) {
                             return ServiceUtil.returnError("Problem running createOrUpdateInventoryEventPlanned");
                         }

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?view=diff&rev=516875&r1=516874&r2=516875
==============================================================================
--- 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 Sun Mar 11 00:56:45 2007
@@ -49,9 +49,6 @@
 // get the lookup flag
 lookupFlag = request.getParameter("lookupFlag");
 
-facilityId = request.getParameter("facilityId");
-context.put("facilityId", facilityId);
-
 // blank param list
 paramList = "";
 inventoryList = null;
@@ -117,6 +114,3 @@
 context.put("highIndex", highIndex);
 context.put("lowIndex", lowIndex);
 context.put("viewSize", viewSize);
-
-facilities = delegator.findAll("Facility", UtilMisc.toList("facilityId"));
-context.put("facilities", facilities);

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?view=diff&rev=516875&r1=516874&r2=516875
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl Sun Mar 11 00:56:45 2007
@@ -67,17 +67,6 @@
                  </td>
               </tr>
               <tr>
-                <td width='20%' align='right'><div class='tableheadtext'>${uiLabelMap.ProductFacility}:</div></td>
-                <td width='5%'>&nbsp;</td>
-                <td>
-                  <select name="facilityId">
-                    <#list facilities as facility>
-                      <option value="${facility.facilityId}">${facility.facilityName} [${facility.facilityId}]</option>
-                    </#list>
-                  </select>
-                </td>
-              </tr>        
-              <tr>
                 <td width='20%' align='right'><div class='tableheadtext'>${uiLabelMap.CommonFromDate}:</div></td>
                 <td width='5%'>&nbsp;</td>
                 <td>
@@ -161,10 +150,16 @@
         <#list inventoryList[lowIndex..highIndex-1] as inven>
             <#assign product = inven.getRelatedOne("Product")>
             <#if facilityId?exists && facilityId?has_content>
-                <#assign productFacility = delegator.findByPrimaryKey("ProductFacility", Static["org.ofbiz.base.util.UtilMisc"].toMap("facilityId", facilityId, "productId", inven.productId))?if_exists>
             </#if>
             <#if ! product.equals( productTmp )>
                 <#assign quantityAvailableAtDate = 0>
+                <#assign initialQohEvent = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("InventoryEventPlanned", Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId", "INITIAL_QOH", "productId", inven.productId)))>
+                <#if initialQohEvent?exists && initialQohEvent.eventQuantity?has_content>
+                    <#assign quantityAvailableAtDate = initialQohEvent.eventQuantity>
+                </#if>
+                <#if initialQohEvent?exists && initialQohEvent.facilityId?has_content>
+                    <#assign productFacility = delegator.findByPrimaryKey("ProductFacility", Static["org.ofbiz.base.util.UtilMisc"].toMap("facilityId", initialQohEvent.facilityId, "productId", inven.productId))?if_exists>
+                </#if>
                 <tr bgcolor="lightblue">  
                   <td align="left">
                     <div class='tabletext'>
@@ -174,6 +169,9 @@
                   <td align="left">
                     <#if productFacility?exists && productFacility?has_content>
                       <div class='tabletext'>
+                      <b>${uiLabelMap.ProductFacility}:</b>&nbsp;${productFacility.facilityId?if_exists}
+                      </div>
+                      <div class='tabletext'>
                       <b>${uiLabelMap.ProductMinimumStock}:</b>&nbsp;${productFacility.minimumStock?if_exists}
                       </div>
                       <div class='tabletext'>
@@ -185,10 +183,6 @@
                       </#if>
                   </td>
                   <td colspan="5" align="right">
-                    <#assign initialQohEvent = Static["org.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("InventoryEventPlanned", Static["org.ofbiz.base.util.UtilMisc"].toMap("inventoryEventPlanTypeId", "INITIAL_QOH", "productId", inven.productId)))>
-                    <#if initialQohEvent?exists && initialQohEvent.eventQuantity?has_content>
-                        <#assign quantityAvailableAtDate = initialQohEvent.eventQuantity>
-                    </#if>
                     <big><b><div class='tabletext'>${quantityAvailableAtDate}</div></b></big>
                   </td>
                 </tr>