plantime calculation per week done

main
Said Gedik 2023-06-15 13:52:31 +02:00
parent ca9af38d11
commit b72aa7196b
1 changed files with 18 additions and 12 deletions

View File

@ -9,6 +9,7 @@ import java.time.temporal.TemporalAdjuster;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Date;
import java.util.Objects;
import com.bmc.arsys.api.ARException;
import com.bmc.thirdparty.org.springframework.cglib.core.Local;
@ -67,21 +68,21 @@ public class PlanTimes {
LocalDate dateEnd = LocalDate.parse(week.getEndDate(), formatter);
if (d2.isAfter(dateStart) && (d2.isEqual(dateEnd) || d2.isBefore(dateEnd))) {
System.out.println(change.get(queryChanges.getFieldId("ChangeNr")).toString() + " _ "
+ new SimpleDateFormat("dd.MM.yyyy").format(d2));
var minutes = change.get(queryChanges.getFieldId("PlanTimeMinutes")).toString();
var hours = change.get(queryChanges.getFieldId("PlanTimeHours")).toString();
var ptMinutes = minutes.isEmpty() ? "00" : minutes;
var ptHours = hours.isEmpty() ? "00" : hours;
double planTime = convertPlanTime(ptHours, ptMinutes);
var plantime = convertPlanTime(hours, minutes);
System.out.println(change.get(queryChanges.getFieldId("ChangeNr")).toString() + " - "
+ d2 + " | " + minutes + ":" + hours + " (" + plantime + ")");
planTimePerWeek += plantime;
planTimePerWeek += planTime;
}
}
System.out.println(planTimePerWeek);
week.setPlanTime((int) Math.ceil(planTimePerWeek));
System.out.println("Total Plantime : " + (int) Math.ceil(planTimePerWeek));
}
for (var v : calenderWeeks)
@ -91,10 +92,15 @@ public class PlanTimes {
}
public double convertPlanTime(String hours, String minutes) throws ARException {
double totalHours = Integer.valueOf(hours) + (Integer.valueOf(minutes) / 60.0);
double mins = 0.0;
double hrs = 0.0;
if (minutes != null) mins = (Double.valueOf(minutes) / 60.0);
if (hours != null) Double.valueOf(hours);
double totalHours = hrs + mins;
return totalHours;
}
public LocalDate timestampToDate(String timestamp) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy");
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");