Hi,
Hi Etienne,
Thank you for contacting Aspose support team.
We have analyzed the code and observed few issues. The modified code is attached here for your reference. Only one requirement is not fulfilled where Actual Finish date is not calculated while assignment % complete work is 100% for the second assignment of third task. This causes errors in Actual duration and Task % complete. This issue is logged under Id: TASKSJAVA-217 for further investigation by the product team. You will be automatically notified once any update is received in this regard.
private static SimpleDateFormat formatter2 = new SimpleDateFormat(“MM/dd/yy hh:mm:ss”);
static private void Tasks_744770_Original() throws ParseException
{
Project asProject = new Project("project_blank.mpp");
// Task with No assignment
Task task_no_assignment = asProject.getRootTask().getChildren().add("Task with no assignment");
task_no_assignment.set(Tsk.START,"formatter2".parse("06 / 29 / 16 08:00:00" ));
task_no_assignment.set(Tsk.DURATION, asProject.getDuration(9, TimeUnitType.Day));
task_no_assignment.set(Tsk.WORK, asProject.getDuration(72, TimeUnitType.Hour));
task_no_assignment.set(Tsk.PERCENT_COMPLETE, 50);
task_no_assignment.set(Tsk.ACTUAL_START,"formatter2".parse("06 / 29 / 16 08:00:00" ));
task_no_assignment.set(Tsk.ACTUAL_WORK, asProject.getDuration(36, TimeUnitType.Hour));
task_no_assignment.set(Tsk.ACTUAL_DURATION, asProject.getDuration(4.5, TimeUnitType.Day));
// Completed Task with No assignment
Task task_completed_no_assignment = asProject.getRootTask().getChildren().add("Task Completed with no assignment" );
task_completed_no_assignment.set(Tsk.START,"formatter2".parse("06 / 29 / 16 08:00:00" ));
task_completed_no_assignment.set(Tsk.DURATION, asProject.getDuration(9, TimeUnitType.Day));
task_completed_no_assignment.set(Tsk.WORK, asProject.getDuration(72, TimeUnitType.Hour));
task_completed_no_assignment.set(Tsk.PERCENT_COMPLETE, 100);
task_completed_no_assignment.set(Tsk.ACTUAL_START,"formatter2".parse("06 / 29 / 16 08:00:00" ));
//task_completed_no_assignment.set(Tsk.ACTUAL_FINISH, formatter.parse("07/11/16"));
task_completed_no_assignment.set(Tsk.ACTUAL_WORK, asProject.getDuration(72, TimeUnitType.Hour));
task_completed_no_assignment.set(Tsk.ACTUAL_DURATION, asProject.getDuration(9, TimeUnitType.Day));
// Task with assignments
Task task_with_assignments = asProject.getRootTask().getChildren().add("Task with assignments" );
task_with_assignments.set(Tsk.START,"formatter2".parse("06 / 29 / 16 08:00:00" ));
task_with_assignments.set(Tsk.DURATION, asProject.getDuration(9, TimeUnitType.Day));
// Assignment #1 (Resource in progress)
Resource resource_in_progress = asProject.getResources().add("resource_in_progress" );
ResourceAssignment ra_resource_in_progress =
asProject.getResourceAssignments().add(task_with_assignments, resource_in_progress);
// There’s no duration nor % complete on assignments
ra_resource_in_progress.set(Asn.START,"formatter2".parse("06 / 29 / 16 08:00:00" ));
ra_resource_in_progress.set(Asn.WORK, asProject.getDuration(72, TimeUnitType.Hour));
ra_resource_in_progress.set(Asn.ACTUAL_START,"formatter2".parse("06 / 29 / 16 08:00:00" ));
ra_resource_in_progress.set(Asn.ACTUAL_WORK, asProject.getDuration(18, TimeUnitType.Hour));
// Assignment #2 (Resource completed)
Resource resource_completed = asProject.getResources().add("resource_completed" );
ResourceAssignment ra_completed =
asProject.getResourceAssignments().add(task_with_assignments, resource_completed);
// There’s no duration nor % complete on assignments
ra_completed.set(Asn.START,"formatter2".parse("07 / 06 / 16 08:00:00" ));
ra_completed.set(Asn.WORK, asProject.getDuration(32, TimeUnitType.Hour));
ra_completed.set(Asn.ACTUAL_START,"formatter2".parse("07 / 06 / 16 08:00:00" ));
ra_completed.set(Asn.ACTUAL_WORK, asProject.getDuration(32, TimeUnitType.Hour));
// Recalculating doesn’t make a difference
asProject.recalculate();
// Save the Project
asProject.save("task - resource - assignments.mpp" , SaveFileFormat.MPP );
System.out .println("ok" );
}
Awesome, Thanks a lot for the quick reply as always!
Hi,
The issue has been logged too recently and it will be investigated upon its turn. We’ll update you here once there is some information or a fix version available in this regard.
The issues you have found earlier (filed as TASKSJAVA-217) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Hi,
Hi,
Hi Zhencheng,