Timephased -Datenerzeugung

Aspose.Tasks können Zeitdaten für verschiedene Arbeitskonturen einer zugewiesenen Ressource generieren. Die generierten Daten werden unter Verwendung von Timescaledata erhalten, wodurch die Projektstart- und Abschlussdaten als Eingabeparameter verwendet werden.

Timephased Data Generation Der folgende Code-Stück weist einer zugewiesenen Ressource verschiedene Arten von Arbeitskonturen zu und zeigt ihre zeitphasenen Daten an.

 1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
 2// The path to the documents directory.
 3String dataDir = Utils.getDataDir(TimephasedDataGeneration.class);
 4
 5// Read the source MPP file
 6Project project = new Project(dataDir + "SampleFile.Mpp");
 7
 8// Get the first task of the Project
 9Task task = project.getRootTask().getChildren().getById(1);
10
11// Get the First Resource Assignment of the Project
12ResourceAssignment firstRA = project.getResourceAssignments().toList().get(0);
13
14// Flat contour is default contour
15System.out.println("Flat contour");
16for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
17    System.out.println(td.getStart().toString() + " " + td.getValue());
18}
19
20// Change contour
21firstRA.set(Asn.WORK_CONTOUR, WorkContourType.Turtle);
22System.out.println("Turtle contour");
23for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
24    System.out.println(td.getStart().toString() + " " + td.getValue());
25}
26
27// Change contour
28firstRA.set(Asn.WORK_CONTOUR, WorkContourType.BackLoaded);
29System.out.println("BackLoaded contour");
30for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
31    System.out.println(td.getStart().toString() + " " + td.getValue());
32}
33
34// Change contour
35firstRA.set(Asn.WORK_CONTOUR, WorkContourType.FrontLoaded);
36System.out.println("FrontLoaded contour");
37for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
38    System.out.println(td.getStart().toString() + " " + td.getValue());
39}
40
41// Change contour
42firstRA.set(Asn.WORK_CONTOUR, WorkContourType.Bell);
43System.out.println("Bell contour");
44for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
45    System.out.println(td.getStart().toString() + " " + td.getValue());
46}
47
48// Change contour
49firstRA.set(Asn.WORK_CONTOUR, WorkContourType.EarlyPeak);
50System.out.println("EarlyPeak contour");
51for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
52    System.out.println(td.getStart().toString() + " " + td.getValue());
53}
54
55// Change contour
56firstRA.set(Asn.WORK_CONTOUR, WorkContourType.LatePeak);
57System.out.println("LatePeak contour");
58for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
59    System.out.println(td.getStart().toString() + " " + td.getValue());
60}
61// Change contour
62firstRA.set(Asn.WORK_CONTOUR, WorkContourType.DoublePeak);
63System.out.println("DoublePeak contour");
64for (TimephasedData td : task.getTimephasedData(project.get(Prj.START_DATE), project.get(Prj.FINISH_DATE))) {
65    System.out.println(td.getStart().toString() + " " + td.getValue());
66}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.