svn commit: r521806 - in /ofbiz/trunk/applications/manufacturing: entitydef/ src/org/ofbiz/manufacturing/mrp/ src/org/ofbiz/manufacturing/techdata/ 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: r521806 - in /ofbiz/trunk/applications/manufacturing: entitydef/ src/org/ofbiz/manufacturing/mrp/ src/org/ofbiz/manufacturing/techdata/ webapp/manufacturing/mrp/

jacopoc
Author: jacopoc
Date: Fri Mar 23 10:06:53 2007
New Revision: 521806

URL: http://svn.apache.org/viewvc?view=rev&rev=521806
Log:
Improved the MRP log with the isLate flag set in the events.

Modified:
    ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.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/src/org/ofbiz/manufacturing/techdata/TechDataServices.java
    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=521806&r1=521805&r2=521806
==============================================================================
--- ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/manufacturing/entitydef/entitymodel.xml Fri Mar 23 10:06:53 2007
@@ -168,6 +168,7 @@
       <field name="eventQuantity" type="floating-point"></field>
       <field name="facilityId" type="id"></field>
       <field name="eventName" type="name"></field>
+      <field name="isLate" type="indicator"></field>
       <prim-key field="productId"/>
       <prim-key field="eventDate"/>
       <prim-key field="inventoryEventPlanTypeId"/>

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=521806&r1=521805&r2=521806
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java Fri Mar 23 10:06:53 2007
@@ -54,7 +54,7 @@
         Double quantity = (Double)context.get("eventQuantity");
         GenericValue inventoryEventPlanned = null;
         try {
-            createOrUpdateInventoryEventPlanned(parameters, quantity, (String)context.get("facilityId"), (String)context.get("eventName"), delegator);
+            createOrUpdateInventoryEventPlanned(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);
             return ServiceUtil.returnError("Problem, on database access, for more detail look at the log");
@@ -62,7 +62,7 @@
         return ServiceUtil.returnSuccess();
     }
 
-    public static void createOrUpdateInventoryEventPlanned(Map inventoryEventPlannedKeyMap, Double newQuantity, String facilityId, String eventName, GenericDelegator delegator) throws GenericEntityException {
+    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) {
@@ -70,6 +70,7 @@
             inventoryEventPlanned.put("eventQuantity", newQuantity);
             inventoryEventPlanned.put("eventName", eventName);
             inventoryEventPlanned.put("facilityId", facilityId);
+            inventoryEventPlanned.put("isLate", (isLate? "Y": "N"));
             inventoryEventPlanned.create();
         } else {
             double qties = newQuantity.doubleValue() + ((Double)inventoryEventPlanned.get("eventQuantity")).doubleValue();
@@ -77,6 +78,9 @@
             if (!UtilValidate.isEmpty(eventName)) {
                 String existingEventName = inventoryEventPlanned.getString("eventName");
                 inventoryEventPlanned.put("eventName", (UtilValidate.isEmpty(existingEventName)? eventName: existingEventName + ", " + eventName));
+            }
+            if (isLate) {
+                inventoryEventPlanned.put("isLate", "Y");
             }
             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=521806&r1=521805&r2=521806
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java Fri Mar 23 10:06:53 2007
@@ -160,7 +160,7 @@
             }
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "SALE_ORDER_SHIP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), false, delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (SALE_ORDER_SHIP)");
             }
@@ -191,7 +191,7 @@
             
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "PROD_REQ_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("requirementId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("requirementId"), false, delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (PROD_REQ_RECP)");
             }
@@ -245,7 +245,7 @@
             
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "PUR_ORDER_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(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)");
             }
@@ -277,7 +277,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, null, eventName, delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, eventName, false, delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (MRP_REQUIREMENT)");
             }
@@ -323,7 +323,7 @@
             
             parameters = UtilMisc.toMap("productId", productId, "eventDate", estimatedShipDate, "inventoryEventPlanTypeId", "MANUF_ORDER_RECP");
             try {
-                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("workEffortId"), delegator);
+                InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, eventQuantityTmp, null, genericResult.getString("workEffortId"), false, delegator);
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError("Problem initializing the InventoryEventPlanned entity (MANUF_ORDER_RECP)");
             }
@@ -451,7 +451,7 @@
                     parameters.put("inventoryEventPlanTypeId", "MRP_REQUIREMENT");
                     double componentEventQuantity = node.getQuantity();
                     try {
-                        InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, new Double(-1.0 * componentEventQuantity), null, null, delegator);
+                        InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(parameters, new Double(-1.0 * componentEventQuantity), null, null, false, delegator);
                     } catch (GenericEntityException e) {
                         Debug.logError("Error : delegator.findByPrimaryKey(\"InventoryEventPlanned\", parameters) ="+parameters+"--"+e.getMessage(), module);
                         logMrpError(node.getProduct().getString("productId"), "Unable to create event (processBomComponent)", delegator);
@@ -590,7 +590,7 @@
                         stockTmp = findProductMrpQoh(product, facilityId, dispatcher, delegator);
                         try {
                             InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(UtilMisc.toMap("productId", product.getString("productId"), "inventoryEventPlanTypeId", "INITIAL_QOH", "eventDate", now),
-                                                                                              new Double(stockTmp), facilityId, null,
+                                                                                              new Double(stockTmp), facilityId, null, false,
                                                                                               delegator);
                         } catch (GenericEntityException e) {
                             return ServiceUtil.returnError("Problem running createOrUpdateInventoryEventPlanned");
@@ -677,7 +677,7 @@
                                                       "eventDate", eventDate,
                                                       "inventoryEventPlanTypeId", (isBuilt? "PROP_MANUF_O_RECP" : "PROP_PUR_O_RECP"));
                         try {
-                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new Double(proposedOrder.getQuantity()), null, null, delegator);
+                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new Double(proposedOrder.getQuantity()), null, null, (proposedOrder.getRequirementStartDate().compareTo(now) > 0), delegator);
                         } catch (GenericEntityException e) {
                             return ServiceUtil.returnError("Problem running createOrUpdateInventoryEventPlanned");
                         }

Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java?view=diff&rev=521806&r1=521805&r2=521806
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java Fri Mar 23 10:06:53 2007
@@ -475,7 +475,7 @@
         result.put("previousCapacity",position.get("capacity"));
         return result;
     }
-    /** Used to move backward in a TechDataCalenda, start from the dateFrom and move backward only on available period.
+    /** Used to move backward in a TechDataCalendar, start from the dateFrom and move backward only on available period.
      * If the dateFrom (param in) is not  a available TechDataCalendar period, the startDate is the end of the previous day available
      *
      * @param techDataCalendar        The TechDataCalendar cover

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=521806&r1=521805&r2=521806
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/mrp/findInventoryEventPlan.ftl Fri Mar 23 10:06:53 2007
@@ -200,7 +200,7 @@
               <td><div class='tabletext'>${inventoryEventPlannedType.get("description",locale)}</div></td>
               <td>&nbsp</td>
               <td>${inven.eventName?if_exists}</td>
-              <td><div class='tabletext'>${inven.getString("eventDate")}</div></td>
+              <td><div class='tabletext'><font <#if inven.isLate?default("N") == "Y">color='red'</#if>>${inven.getString("eventDate")}</font></div></td>
               <td>&nbsp</td>
               <td><div class='tabletext'align="right"> ${inven.getString("eventQuantity")}</div></td>
               <td align="right">