joniles / mpxj

Primary repository for MPXJ library

Home Page:http://www.mpxj.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MaxUnits / Day is not accurate

iMohannad opened this issue · comments

Hello,

I am trying to get Max Units / Day for primavera file (EC620) file.
I try to do it this way:

foreach (Resource res in resourceContainer)
{

      int rsrcID = res.getID().intValue();
      if (res.getMaxUnits() == null)
      {
          maxRsrcCap = 0;
      }
      else
      {
          hoursPerDay = res.getCalendar().getMinutesPerDay().intValue() / 60;
          maxRsrcCap = (int)(res.getMaxUnits().doubleValue() / 100 * hoursPerDay);
      }
}

The thing is maxRsrcCap always return the default unit/time instead of maxunit per time.

How can I get accurate max unit per time?

Hi! Thanks for opening the issue - definitely an interesting one. It led me to digging in to how I should have been using the availability table for the resource in a couple of places and undertaking a big refactor. Having said all that, I've made the necessary changes to address this, and those are now merged. Default Units has its own attribute now, and Max Units is derived from the availability table, so you should get back the value you're expecting.