Search in sources :

Example 1 with MrpFamily

use of com.axelor.apps.supplychain.db.MrpFamily in project axelor-open-suite by axelor.

the class MrpServiceImpl method getPreviousProposalMrpLine.

public MrpLine getPreviousProposalMrpLine(Product product, MrpLineType mrpLineType, StockLocation stockLocation, LocalDate maturityDate) {
    LocalDate startPeriodDate = maturityDate;
    MrpFamily mrpFamily = product.getMrpFamily();
    if (mrpFamily != null) {
        if (mrpFamily.getDayNb() == 0) {
            return null;
        }
        startPeriodDate = maturityDate.minusDays(mrpFamily.getDayNb());
    }
    return mrpLineRepository.all().filter("self.mrp.id = ?1 AND self.product = ?2 AND self.mrpLineType = ?3 AND self.stockLocation = ?4 AND self.maturityDate > ?5 AND self.maturityDate <= ?6", mrp.getId(), product, mrpLineType, stockLocation, startPeriodDate, maturityDate).fetchOne();
}
Also used : LocalDate(java.time.LocalDate) MrpFamily(com.axelor.apps.supplychain.db.MrpFamily)

Aggregations

MrpFamily (com.axelor.apps.supplychain.db.MrpFamily)1 LocalDate (java.time.LocalDate)1