svn commit: r521722 - /ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java

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

svn commit: r521722 - /ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java

jacopoc
Author: jacopoc
Date: Fri Mar 23 06:36:59 2007
New Revision: 521722

URL: http://svn.apache.org/viewvc?view=rev&rev=521722
Log:
The days set in ProductFacility.daysToShip are taken into account by the MRP even for manufactured items: the time is added to the standard time of the routing.

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

Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java?view=diff&rev=521722&r1=521721&r2=521722
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/ProposedOrder.java Fri Mar 23 06:36:59 2007
@@ -97,8 +97,9 @@
      **/
     public Map calculateStartDate(int daysToShip, GenericValue routing, GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin){
         Map result = null;
-        Timestamp endDate = (Timestamp) requiredByDate.clone();
+        Timestamp endDate = (Timestamp)requiredByDate.clone();
         Timestamp startDate = endDate;
+        long timeToShip = daysToShip * 8 * 60 * 60 * 1000;
         if (isBuilt) {
             List listRoutingTaskAssoc = null;
             if (routing == null) {
@@ -144,6 +145,7 @@
                         }
                         // Calculate the estimatedStartDate
                         long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, quantity, dispatcher);
+                        totalTime += timeToShip;
                         startDate = TechDataServices.addBackward(TechDataServices.getTechDataCalendar(routingTask),endDate, totalTime);
                         // record the routingTask with the startDate associated
                         result.put(routingTask.getString("workEffortId"),startDate);
@@ -164,18 +166,16 @@
 
             } else {
                 // routing is null
-                // TODO : write an error message for the endUser to say "Build product without routing"
-                Debug.logError("Build product without routing for product = "+product.getString("productId"), module);
+                Debug.logError("No routing found for product = "+ product.getString("productId"), module);
             }
         } else {
             // the product is purchased
             // TODO: REVIEW this code
-            long duringTime = daysToShip * 8 * 60 * 60 * 1000;
             try {
-                GenericValue techDataCalendar = product.getDelegator().findByPrimaryKeyCache("TechDataCalendar",UtilMisc.toMap("calendarId", "SUPPLIER"));
-                startDate = TechDataServices.addBackward(techDataCalendar, endDate, duringTime);
+                GenericValue techDataCalendar = product.getDelegator().findByPrimaryKeyCache("TechDataCalendar", UtilMisc.toMap("calendarId", "SUPPLIER"));
+                startDate = TechDataServices.addBackward(techDataCalendar, endDate, timeToShip);
             } catch(GenericEntityException e) {
-                Debug.logError(e, "Error : reading SUPPLIER TechDataCalendar"+"--"+e.getMessage(), module);
+                Debug.logError(e, "Error : reading SUPPLIER TechDataCalendar: " + e.getMessage(), module);
             }
         }
         requirementStartDate = startDate;