Search in sources :

Example 1 with OperationOrderWorkflowService

use of com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService in project axelor-open-suite by axelor.

the class OperationOrderTimesheetServiceImpl method updateAllRealDuration.

@Override
public void updateAllRealDuration(List<TimesheetLine> timesheetLineList) {
    if (timesheetLineList == null) {
        return;
    }
    List<OperationOrder> operationOrderList = timesheetLineList.stream().map(TimesheetLine::getOperationOrder).filter(Objects::nonNull).distinct().collect(Collectors.toList());
    OperationOrderWorkflowService operationOrderWorkflowService = Beans.get(OperationOrderWorkflowService.class);
    operationOrderList.forEach(operationOrderWorkflowService::updateRealDuration);
}
Also used : Objects(java.util.Objects) OperationOrderWorkflowService(com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService) OperationOrder(com.axelor.apps.production.db.OperationOrder)

Example 2 with OperationOrderWorkflowService

use of com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService in project axelor-open-suite by axelor.

the class OperationOrderController method machineChange.

public void machineChange(ActionRequest request, ActionResponse response) {
    try {
        OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
        OperationOrderRepository operationOrderRepo = Beans.get(OperationOrderRepository.class);
        OperationOrderWorkflowService operationOrderWorkflowService = Beans.get(OperationOrderWorkflowService.class);
        operationOrder = operationOrderRepo.find(operationOrder.getId());
        if (operationOrder != null && operationOrder.getStatusSelect() == OperationOrderRepository.STATUS_PLANNED) {
            operationOrder = operationOrderWorkflowService.replan(operationOrder);
            List<OperationOrder> operationOrderList = operationOrderRepo.all().filter("self.manufOrder = ?1 AND self.priority >= ?2 AND self.statusSelect = 3 AND self.id != ?3", operationOrder.getManufOrder(), operationOrder.getPriority(), operationOrder.getId()).order("priority").order("plannedEndDateT").fetch();
            for (OperationOrder operationOrderIt : operationOrderList) {
                operationOrderWorkflowService.replan(operationOrderIt);
            }
            response.setReload(true);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : OperationOrderWorkflowService(com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService) OperationOrderRepository(com.axelor.apps.production.db.repo.OperationOrderRepository) OperationOrder(com.axelor.apps.production.db.OperationOrder) BirtException(org.eclipse.birt.core.exception.BirtException) IOException(java.io.IOException)

Aggregations

OperationOrder (com.axelor.apps.production.db.OperationOrder)2 OperationOrderWorkflowService (com.axelor.apps.production.service.operationorder.OperationOrderWorkflowService)2 OperationOrderRepository (com.axelor.apps.production.db.repo.OperationOrderRepository)1 IOException (java.io.IOException)1 Objects (java.util.Objects)1 BirtException (org.eclipse.birt.core.exception.BirtException)1