joniles / mpxj

Primary repository for MPXJ library
http://www.mpxj.org/
GNU Lesser General Public License v2.1
249 stars 104 forks source link

MPP: Incorrect Timephased work in Manual task mode #733

Closed Fabian-Schmidt closed 3 months ago

Fabian-Schmidt commented 3 months ago

Hi, Thank you for this library. I am using the MPXJ library to read time phased work from MPP files. I encountered an issue when reading the work via MPXJ. It does not match what is reported in Project in the Task usage view.

Simplified scenario is as follow:

  1. New blank Project.
  2. Create a Task and Resource and create a 3 day assignment. The task is by default in manual schedule mode.
  3. Modify the start time from 8:00(default) to 7:00. Manual task mode allows this change. Auto scheduled will not allow this change as it is outside of the work calendar.
Day 1 Day 2 Day 3
Project 9h 8h 7h
MPXJ 8.3478..h 8.3478..h 7.3043..h
MPXJ with setUseRawTimephasedData 8.3478..h 8.3478..h 8.3478..h

The sum is correct but the distribution is wrong.

I am using the latest .NET version of the MPXJ library.

MPP example file: ManualTaskTimephasedv2.zip

joniles commented 3 months ago

Hello! Thanks for opening this issue. The timephased work handling code in MPXJ does have some shortcomings and I am planning to begin overhauling this code in the next few months to address this and other related problems. Apologies that this won't be a short term fix.

In the meantime you can try setting the "Use Raw Timephased Data" flag to true:

MPPReader reader = new MPPReader();
reader.setUseRawTimephasedData(true)

this should give you the data exactly as it is represented in MS Project, but you will probably need to write your own code merge/segment it into the timescale you need.

I will update this issue once I have made progress with the longer term work on improving timephased data handling.

Fabian-Schmidt commented 3 months ago

Thanks for the quick response. When using "Use Raw Timephased Data" the result is worse. As it reads 8.3478..h for every day. So the sum does no longer match. I updated the first message with this new data.