svn commit: r521847 - /ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java

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

svn commit: r521847 - /ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java

jacopoc
Author: jacopoc
Date: Fri Mar 23 11:22:54 2007
New Revision: 521847

URL: http://svn.apache.org/viewvc?view=rev&rev=521847
Log:
Further improvements to the MRP error logs and messages.

Modified:
    ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java

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=521847&r1=521846&r2=521847
==============================================================================
--- 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 11:22:54 2007
@@ -412,7 +412,8 @@
             if (UtilValidate.isNotEmpty(productId) && UtilValidate.isNotEmpty(errorMessage)) {
                 GenericValue inventoryEventError = delegator.makeValue("InventoryEventPlanned", UtilMisc.toMap("productId", productId,
                                                                                                                "eventDate", UtilDateTime.nowTimestamp(),
-                                                                                                               "inventoryEventPlanTypeId", "ERROR"));
+                                                                                                               "inventoryEventPlanTypeId", "ERROR",
+                                                                                                               "eventName", errorMessage));
                 inventoryEventError.create();
             }
         } catch (GenericEntityException e) {
@@ -519,7 +520,7 @@
         }
 
         if (UtilValidate.isEmpty(facilityId) || UtilValidate.isEmpty(manufacturingFacilityId)) {
-            return ServiceUtil.returnError("facilityId and manufacturingFacilityId cannot be both null");
+            return ServiceUtil.returnError("facilityId and manufacturingFacilityId cannot be null");
         }
         
         int bomLevelWithNoEvent = 0;
@@ -670,14 +671,19 @@
                             processBomComponent(product, proposedOrder.getQuantity(), proposedOrder.getRequirementStartDate(), routingTaskStartDate, components);
                         }
                         // create the  ProposedOrder (only if the product is warehouse managed), and the InventoryEventPlanned associated
+                        String requirementId = null;
                         if (productFacility != null) {
-                            String proposedOrderId = proposedOrder.create(ctx, userLogin);
+                            requirementId = proposedOrder.create(ctx, userLogin);
                         }
+                        if (UtilValidate.isEmpty(productFacility) && !isBuilt) {
+                            logMrpError(productId, "No ProductFacility record for [" + facilityId + "]; no requirement created.", delegator);
+                        }
+                        
                         Map eventMap = UtilMisc.toMap("productId", product.getString("productId"),
                                                       "eventDate", eventDate,
                                                       "inventoryEventPlanTypeId", (isBuilt? "PROP_MANUF_O_RECP" : "PROP_PUR_O_RECP"));
                         try {
-                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new Double(proposedOrder.getQuantity()), null, null, (proposedOrder.getRequirementStartDate().compareTo(now) > 0), delegator);
+                            InventoryEventPlannedServices.createOrUpdateInventoryEventPlanned(eventMap, new Double(proposedOrder.getQuantity()), null, (requirementId != null? "*" + requirementId + "*": null), (proposedOrder.getRequirementStartDate().compareTo(now) > 0), delegator);
                         } catch (GenericEntityException e) {
                             return ServiceUtil.returnError("Problem running createOrUpdateInventoryEventPlanned");
                         }