use of com.axelor.apps.production.db.MachineTool in project axelor-open-suite by axelor.
the class OperationOrderWorkflowService method calculateHoursOfUse.
private void calculateHoursOfUse(OperationOrder operationOrder) {
if (operationOrder.getMachineTool() == null) {
return;
}
long hoursOfUse = operationOrderRepo.all().filter("self.machineTool.id = :id AND self.statusSelect = 6").bind("id", operationOrder.getMachineTool().getId()).fetchStream().mapToLong(OperationOrder::getRealDuration).sum();
MachineTool machineTool = machineToolRepo.find(operationOrder.getMachineTool().getId());
machineTool.setHoursOfUse(hoursOfUse);
machineToolRepo.save(machineTool);
}
use of com.axelor.apps.production.db.MachineTool in project axelor-open-suite by axelor.
the class MachineToolManagementRepository method save.
@Override
public Machine save(Machine entity) {
if (appProductionService.getAppProduction().getEnableToolManagement() && entity.getMachineToolLineList() != null) {
for (MachineTool machineTool : entity.getMachineToolLineList()) {
machineTool.setMachine(entity);
machineToolRepository.save(machineTool);
}
}
return super.save(entity);
}
Aggregations