Search in sources :

Example 36 with Shift

use of com.qcadoo.mes.basic.shift.Shift in project mes by qcadoo.

the class ShiftIntervalsProvider method getWorkIntervals.

private Set<Interval> getWorkIntervals(final TimeGapsContext context) {
    Interval searchInterval = context.getInterval();
    Date fromDate = searchInterval.getStart().toDate();
    Date toDate = searchInterval.getEnd().toDate();
    List<Shift> shifts = shiftsService.findAll();
    List<DateTimeRange> dateTimeRanges = shiftsService.getDateTimeRanges(shifts, fromDate, toDate);
    Set<Interval> shiftWorkTimeIntervals = Sets.newHashSet();
    for (DateTimeRange dateTimeRange : dateTimeRanges) {
        Interval shiftWorkTimeInterval = new Interval(dateTimeRange.getFrom(), dateTimeRange.getTo());
        shiftWorkTimeIntervals.add(shiftWorkTimeInterval);
    }
    return shiftWorkTimeIntervals;
}
Also used : Shift(com.qcadoo.mes.basic.shift.Shift) DateTimeRange(com.qcadoo.mes.basic.util.DateTimeRange) Date(java.util.Date) Interval(org.joda.time.Interval)

Example 37 with Shift

use of com.qcadoo.mes.basic.shift.Shift in project mes by qcadoo.

the class ShiftsGanttChartItemResolverImpl method resolve.

@Override
@Transactional
public Map<String, List<GanttChartItem>> resolve(final GanttChartScale scale, final JSONObject context, final Locale locale) {
    List<Shift> shifts = shiftsService.findAll();
    Map<String, List<GanttChartItem>> items = new LinkedHashMap<>();
    for (Shift shift : shifts) {
        items.put(shift.getEntity().getStringField(ShiftFields.NAME), getItemsForShift(shift, scale));
    }
    return items;
}
Also used : Shift(com.qcadoo.mes.basic.shift.Shift) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Shift (com.qcadoo.mes.basic.shift.Shift)37 DateTime (org.joda.time.DateTime)30 Entity (com.qcadoo.model.api.Entity)12 Test (org.junit.Test)11 TimeRange (com.qcadoo.commons.dateTime.TimeRange)9 DateTimeRange (com.qcadoo.mes.basic.util.DateTimeRange)8 Date (java.util.Date)7 LocalTime (org.joda.time.LocalTime)7 LocalDate (org.joda.time.LocalDate)6 BigDecimal (java.math.BigDecimal)3 DailyProgressContainer (com.qcadoo.mes.productionPerShift.domain.DailyProgressContainer)2 ErrorMessage (com.qcadoo.model.api.validators.ErrorMessage)2 Calendar (java.util.Calendar)2 HSSFCell (org.apache.poi.hssf.usermodel.HSSFCell)2 Function (com.google.common.base.Function)1 Optional (com.google.common.base.Optional)1 Predicate (com.google.common.base.Predicate)1 FluentIterable (com.google.common.collect.FluentIterable)1 Lists (com.google.common.collect.Lists)1 DateRange (com.qcadoo.commons.dateTime.DateRange)1