public static Map<String,Object> quickRunAllProductionRunTasks(DispatchContext ctx,Map<String,? extends Object> context){
  Map<String,Object> result=ServiceUtil.returnSuccess();
  Delegator delegator=ctx.getDelegator();
  LocalDispatcher dispatcher=ctx.getDispatcher();
  Locale locale=(Locale)context.get("locale");
  GenericValue userLogin=(GenericValue)context.get("userLogin");
  String productionRunId=(String)context.get("productionRunId");
  ProductionRun productionRun=new ProductionRun(productionRunId,delegator,dispatcher);
  if (!productionRun.exist()) {
    return ServiceUtil.returnError(UtilProperties.getMessage(resource,"ManufacturingProductionRunNotExists",locale));
  }
  List<GenericValue> tasks=productionRun.getProductionRunRoutingTasks();
  GenericValue oneTask=null;
  String taskId=null;
  for (int i=0; i < tasks.size(); i++) {
    oneTask=tasks.get(i);
    taskId=oneTask.getString("workEffortId");
    try {
      Map<String,Object> serviceContext=FastMap.newInstance();
      serviceContext.put("productionRunId",productionRunId);
      serviceContext.put("taskId",taskId);
      serviceContext.put("userLogin",userLogin);
      dispatcher.runSync("quickRunProductionRunTask",serviceContext);
    }
 catch (    GenericServiceException e) {
      Debug.logError(e,"Problem calling the quickRunProductionRunTask service",module);
      return ServiceUtil.returnError(UtilProperties.getMessage(resource,"ManufacturingProductionRunStatusNotChanged",locale));
    }
  }
  return result;
}

public static Map < String , Object > quickRunAllProductionRunTasks ( DispatchContext ctx , Map < String , ? extends Object > context ) { Map < String , Object > result = ServiceUtil . returnSuccess ( ) ; Delegator delegator = ctx . getDelegator ( ) ; LocalDispatcher dispatcher = ctx . getDispatcher ( ) ; Locale locale = ( Locale ) context . get ( "locale" ) ; GenericValue userLogin = ( GenericValue ) context . get ( "userLogin" ) ; String productionRunId = ( String ) context . get ( "productionRunId" ) ; ProductionRun productionRun = new ProductionRun ( productionRunId , delegator , dispatcher ) ; if ( ! productionRun . exist ( ) ) { return ServiceUtil . returnError ( UtilProperties . getMessage ( resource , "ManufacturingProductionRunNotExists" , locale ) ) ; } List < GenericValue > tasks = productionRun . getProductionRunRoutingTasks ( ) ; GenericValue oneTask = null ; String taskId = null ; for ( int i = 0 ; i < tasks . size ( ) ; i ++ ) { oneTask = tasks . get ( i ) ; taskId = oneTask . getString ( "workEffortId" ) ; try { Map < String , Object > serviceContext = FastMap . newInstance ( ) ; serviceContext . put ( "productionRunId" , productionRunId ) ; serviceContext . put ( "taskId" , taskId ) ; serviceContext . put ( "userLogin" , userLogin ) ; dispatcher . runSync ( "quickRunProductionRunTask" , serviceContext ) ; } catch ( GenericServiceException e ) { Debug . logError ( e , "Problem calling the quickRunProductionRunTask service" , module ) ; return ServiceUtil . returnError ( UtilProperties . getMessage ( resource , "ManufacturingProductionRunStatusNotChanged" , locale ) ) ; } } return result ; }
quick runs all the tasks of a productionrun to the completed status , also issuing components if necessary .
