long today = getTimeUtils().pushToEndOfDay(inventoryPlugin.getcurrentTimeMillis());
long today = getTimeUtils().pushToEndOfDay(inventoryPlugin.getCurrentTimeMillis());
  public void calculateRefills(ArrayList touchedInventories, int advanceOrderTime,                                    int orderFrequency, int maxLeadTime) {    //should we push now to the end of today?    long today = getTimeUtils().pushToEndOfDay(inventoryPlugin.getcurrentTimeMillis());    long maxLeadDay = getTimeUtils().addNDays(today, maxLeadTime);    Iterator tiIter = touchedInventories.iterator();    while (tiIter.hasNext()) {      Inventory anInventory = (Inventory) tiIter.next();      //LogisticsInventoryBG theBG = (LogisticsInventoryBG)anInventory.getLogisticsInventoryPG().      //  getLogisticsInventoryBG();      //clear the refills      //theBG.clearRefillTasks(new Date(now));      //ask the bg (or another module) what the reorder level is      //int reorderLevel = theBG.getReorderLevel();      //pick a starting day - today + advanceOrderTime + 1      long refillDay = getTimeUtils().addNDays(today, advanceOrderTime + 1);            //ask the bg for the inventory level for that day.      //int invLevel = theBG.getInventoryLevel(refillDay);      //if the inv level is below the reorder level create a refill.      //if (invLevel < reorderLevel) {      //  create the refills      while (refillDay < maxLeadDay) {        double aRefill = generateRefill(refillDay, orderFrequency);        //  add refill to local inventory count        // make a task for this refill and publish it to glue plugin        createRefillTask(aRefill, refillDay, anInventory, today);        refillDay = getTimeUtils().addNDays(refillDay, orderFrequency);      }            //}        } // done going through inventories  }