public Timestamp recalculateEstimatedCompletionDate(Long priority,Timestamp startDate){
  if (exist()) {
    getProductionRunRoutingTasks();
    if (quantity == null)     getQuantity();
    Timestamp endDate=null;
    for (Iterator<GenericValue> iter=productionRunRoutingTasks.iterator(); iter.hasNext(); ) {
      GenericValue routingTask=iter.next();
      if (priority.compareTo(routingTask.getLong("priority")) <= 0) {
        long totalTime=ProductionRun.getEstimatedTaskTime(routingTask,quantity,dispatcher);
        endDate=TechDataServices.addForward(TechDataServices.getTechDataCalendar(routingTask),startDate,totalTime);
        routingTask.set("estimatedStartDate",startDate);
        routingTask.set("estimatedCompletionDate",endDate);
        startDate=endDate;
      }
    }
    return endDate;
  }
 else {
    return null;
  }
}

public Timestamp recalculateEstimatedCompletionDate ( Long priority , Timestamp startDate ) { if ( exist ( ) ) { getProductionRunRoutingTasks ( ) ; if ( quantity == null ) getQuantity ( ) ; Timestamp endDate = null ; for ( Iterator < GenericValue > iter = productionRunRoutingTasks . iterator ( ) ; iter . hasNext ( ) ; ) { GenericValue routingTask = iter . next ( ) ; if ( priority . compareTo ( routingTask . getLong ( "priority" ) ) <= 0 ) { long totalTime = ProductionRun . getEstimatedTaskTime ( routingTask , quantity , dispatcher ) ; endDate = TechDataServices . addForward ( TechDataServices . getTechDataCalendar ( routingTask ) , startDate , totalTime ) ; routingTask . set ( "estimatedStartDate" , startDate ) ; routingTask . set ( "estimatedCompletionDate" , endDate ) ; startDate = endDate ; } } return endDate ; } else { return null ; } }
recalculated the estimatedcompletiondate property . use the quantity and the estimatedstartdate properties as entries parameters . < br / > read the listroutingtask and for each recalculated and update the estimatedstart and enddate in the object . < br / > no store in the database is done .
