use of com.axelor.apps.production.service.app.AppProductionService in project axelor-open-suite by axelor.
the class TimesheetBusinessProductionServiceImpl method draft.
@Override
@Transactional
public void draft(Timesheet timesheet) {
super.draft(timesheet);
AppProductionService appProductionService = Beans.get(AppProductionService.class);
if (appProductionService.isApp("production") && appProductionService.getAppProduction().getManageBusinessProduction()) {
Beans.get(OperationOrderTimesheetServiceImpl.class).updateAllRealDuration(timesheet.getTimesheetLineList());
}
}
use of com.axelor.apps.production.service.app.AppProductionService in project axelor-open-suite by axelor.
the class CostSheetServiceBusinessImpl method _computeHumanResourceCost.
@Override
protected void _computeHumanResourceCost(ProdHumanResource prodHumanResource, int priority, int bomLevel, CostSheetLine parentCostSheetLine) throws AxelorException {
Employee employee = prodHumanResource.getEmployee();
AppProductionService appProductionService = Beans.get(AppProductionService.class);
if (appProductionService.isApp("production") && appProductionService.getAppProduction().getManageBusinessProduction() && employee != null && !EmployeeHRRepository.isEmployeeFormerNewOrArchived(employee)) {
BigDecimal durationHours = new BigDecimal(prodHumanResource.getDuration()).divide(BigDecimal.valueOf(3600), appProductionService.getNbDecimalDigitForUnitPrice(), BigDecimal.ROUND_HALF_UP);
costSheet.addCostSheetLineListItem(costSheetLineService.createWorkCenterHRCostSheetLine(prodHumanResource.getWorkCenter(), prodHumanResource, priority, bomLevel, parentCostSheetLine, durationHours, employee.getHourlyRate().multiply(durationHours), hourUnit));
} else {
super._computeHumanResourceCost(prodHumanResource, priority, bomLevel, parentCostSheetLine);
}
}
use of com.axelor.apps.production.service.app.AppProductionService in project axelor-open-suite by axelor.
the class InvoicingProjectServiceBusinessProdImpl method fillLines.
@Override
public void fillLines(InvoicingProject invoicingProject, Project project) {
super.fillLines(invoicingProject, project);
AppProductionService appProductionService = Beans.get(AppProductionService.class);
if (!appProductionService.isApp("production") || !appProductionService.getAppProduction().getManageBusinessProduction()) {
return;
}
if (invoicingProject.getManufOrderSet() == null) {
invoicingProject.setManufOrderSet(new HashSet<ManufOrder>());
}
if (invoicingProject.getDeadlineDate() != null) {
LocalDateTime deadlineDateToDateTime = invoicingProject.getDeadlineDate().atStartOfDay();
invoicingProject.getManufOrderSet().addAll(Beans.get(ManufOrderRepository.class).all().filter("self.productionOrderSet.project = ?1 AND (self.realStartDateT < ?2)", project, deadlineDateToDateTime).fetch());
} else {
invoicingProject.getManufOrderSet().addAll(Beans.get(ManufOrderRepository.class).all().filter("self.productionOrderSet.project = ?1", project).fetch());
}
}
use of com.axelor.apps.production.service.app.AppProductionService in project axelor-open-suite by axelor.
the class InvoicingProjectServiceBusinessProdImpl method countToInvoice.
@Override
public int countToInvoice(Project project) {
AppProductionService appProductionService = Beans.get(AppProductionService.class);
int toInvoiceCount = super.countToInvoice(project);
if (!appProductionService.isApp("production") || !appProductionService.getAppProduction().getManageBusinessProduction()) {
return toInvoiceCount;
}
int productionOrderCount = (int) Beans.get(ManufOrderRepository.class).all().filter("self.productionOrderSet.project = ?1", project).count();
toInvoiceCount += productionOrderCount;
return toInvoiceCount;
}
use of com.axelor.apps.production.service.app.AppProductionService in project axelor-open-suite by axelor.
the class InvoicingProjectServiceBusinessProdImpl method clearLines.
@Override
public void clearLines(InvoicingProject invoicingProject) {
AppProductionService appProductionService = Beans.get(AppProductionService.class);
super.clearLines(invoicingProject);
if (!appProductionService.isApp("production") || !appProductionService.getAppProduction().getManageBusinessProduction()) {
return;
}
invoicingProject.setManufOrderSet(new HashSet<ManufOrder>());
}
Aggregations