Search in sources :

Example 1 with MachineTool

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);
}
Also used : MachineTool(com.axelor.apps.production.db.MachineTool)

Example 2 with 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);
}
Also used : MachineTool(com.axelor.apps.production.db.MachineTool)

Aggregations

MachineTool (com.axelor.apps.production.db.MachineTool)2