if (isPrintConcise()) { printConcise("orderRefill goal=" + goal_level + " reorder level=" + reorder_level + " current level=" + currentInventory);
if (logger.isDebugEnabled()) { logger.debug("orderRefill goal=" + goal_level + " reorder level=" + reorder_level + " current level=" + currentInventory);
  private boolean orderRefill(Inventory inventory, int day) {    InventoryPG invpg = (InventoryPG)inventory.getInventoryPG();    double currentInventory = convertScalarToDouble(invpg.getLevel(day));    double goal_level = invpg.getGoalLevel(day);    double refill_qty = goal_level - currentInventory;    double reorder_level = invpg.getReorderLevel(day);    defaultSupplyTask.setDirectObject(invpg.getResource());    if (invpg.getProjectionWeight().getProjectionWeight(defaultSupplyTask, invpg.getImputedDay(day)) <= 0.0) {      // This test is to avoid generating refill SUPPLY tasks for times when the system      //  will ignore their effect on inventory      return false;       // Can't do a refill    }    if (!invpg.getFillToCapacity()) {      // ** THIS IS A KLUDGE FOR SUBSISTENCE -- WITHOUT IT WE FAIL THE FIRST ORDER.      //    SHOULDN'T HAPPEN LIKE THAT -- FIX ASAP -- RUSTY AND AMY!!      //    	    refill_qty = refill_qty*1.3;      // *** KLUDGE ********    }    boolean isCount = invpg.getCapacity() instanceof Count;    if (refill_qty > 0.0) {      if (isPrintConcise()) {	printConcise("orderRefill goal=" + goal_level		     + " reorder level=" + reorder_level		     + " current level=" + currentInventory);      }      Task task = null;      Task prev_refill = invpg.refillAlreadyFailedOnDay(day);      if (prev_refill != null) {	double min_qty = reorder_level - currentInventory;	if (min_qty <= 0.0) { // Refill unneeded	  min_qty = 1e-10;	  //                      invpg.removeDueIn(prev_refill);	  //                      plugin_.publishRemoveFromExpansion(prev_refill);	  //                      return true;	}	double prev_qty = TaskUtils.getQuantity(prev_refill);	if (isCount) min_qty = Math.ceil(min_qty);	if (min_qty < prev_qty) {	  refill_qty = min_qty; // Retry the refill with the min needed	} else {	  return false; // Can't refill on this day.	}      } else {	prev_refill = invpg.getRefillOnDay(day);      }      if (isCount) {	refill_qty=java.lang.Math.ceil(refill_qty);      }      if(prev_refill != null) {        return orderRefillWithPrevious(inventory, day, invpg, refill_qty);      } else {	return orderNewRefill(inventory, day, invpg, refill_qty);      }    } else {      printLog("OrderRefill qty < 0: "+refill_qty+" = "+goal_level+" - "+currentInventory);    }    return true;  }