use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method checkConsumedStockMoveLineList.
/**
* Called from operation order form, on consumed stock move line change. Call {@link
* OperationOrderService#checkConsumedStockMoveLineList(OperationOrder, OperationOrder)}
*
* @param request
* @param response
*/
public void checkConsumedStockMoveLineList(ActionRequest request, ActionResponse response) {
try {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
OperationOrder oldOperationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
Beans.get(OperationOrderService.class).checkConsumedStockMoveLineList(operationOrder, oldOperationOrder);
} catch (Exception e) {
TraceBackService.trace(response, e);
response.setReload(true);
}
}
use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method setPlannedDates.
public void setPlannedDates(ActionRequest request, ActionResponse response) {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
LocalDateTime plannedStartDateT = operationOrder.getPlannedStartDateT();
LocalDateTime plannedEndDateT = operationOrder.getPlannedEndDateT();
operationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
Beans.get(OperationOrderWorkflowService.class).setPlannedDates(operationOrder, plannedStartDateT, plannedEndDateT);
}
use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class OperationOrderController method start.
public void start(ActionRequest request, ActionResponse response) {
try {
OperationOrder operationOrder = request.getContext().asType(OperationOrder.class);
operationOrder = Beans.get(OperationOrderRepository.class).find(operationOrder.getId());
Beans.get(OperationOrderWorkflowService.class).start(operationOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.OperationOrder in project axelor-open-suite by axelor.
the class StockMoveLineController method setProductInfo.
/**
* Called from stock move line form. Fill product info using the company either from the stock
* move line, from the parent stock move or the parent manuf order.
*
* @param request
* @param response
*/
public void setProductInfo(ActionRequest request, ActionResponse response) {
StockMoveLine stockMoveLine;
try {
stockMoveLine = request.getContext().asType(StockMoveLine.class);
Company company;
StockMove stockMove = stockMoveLine.getStockMove();
if (stockMove == null) {
Context parentContext = request.getContext().getParent();
if (parentContext.getContextClass().equals(StockMove.class)) {
stockMove = parentContext.asType(StockMove.class);
company = stockMove.getCompany();
} else if (parentContext.getContextClass().equals(ManufOrder.class)) {
ManufOrder manufOrder = parentContext.asType(ManufOrder.class);
company = manufOrder.getCompany();
} else if (parentContext.getContextClass().equals(OperationOrder.class)) {
OperationOrder operationOrder = parentContext.asType(OperationOrder.class);
if (operationOrder.getManufOrder() == null) {
return;
}
company = operationOrder.getManufOrder().getCompany();
} else {
throw new AxelorException(TraceBackRepository.CATEGORY_INCONSISTENCY, IExceptionMessage.STOCK_MOVE_LINE_UNKNOWN_PARENT_CONTEXT);
}
} else {
company = stockMove.getCompany();
}
if (stockMoveLine.getProduct() == null) {
stockMoveLine = new StockMoveLine();
response.setValues(Mapper.toMap(stockMoveLine));
return;
}
Beans.get(StockMoveLineService.class).setProductInfo(stockMove, stockMoveLine, company);
response.setValues(stockMoveLine);
} catch (Exception e) {
stockMoveLine = new StockMoveLine();
response.setValues(Mapper.toMap(stockMoveLine));
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.OperationOrder 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);
}
Aggregations