use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.
the class MrpLineServiceProductionImpl method generateManufacturingProposal.
@Transactional(rollbackOn = { Exception.class })
protected void generateManufacturingProposal(MrpLine mrpLine) throws AxelorException {
Product product = mrpLine.getProduct();
ManufOrder manufOrder = manufOrderService.generateManufOrder(product, mrpLine.getQty(), ManufOrderService.DEFAULT_PRIORITY, ManufOrderService.IS_TO_INVOICE, null, mrpLine.getMaturityDate().atStartOfDay(), null, ManufOrderServiceImpl.ORIGIN_TYPE_MRP);
// correct day
linkToOrder(mrpLine, manufOrder);
}
use of com.axelor.apps.production.db.ManufOrder 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.db.ManufOrder 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>());
}
use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.
the class ManufOrderController method finish.
public void finish(ActionRequest request, ActionResponse response) {
try {
Long manufOrderId = (Long) request.getContext().get("id");
ManufOrder manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrderId);
// we have to inject TraceBackService to use non static methods
TraceBackService traceBackService = Beans.get(TraceBackService.class);
long tracebackCount = traceBackService.countMessageTraceBack(manufOrder);
if (!Beans.get(ManufOrderWorkflowService.class).finish(manufOrder)) {
response.setNotify(I18n.get(IExceptionMessage.MANUF_ORDER_EMAIL_NOT_SENT));
} else if (traceBackService.countMessageTraceBack(manufOrder) > tracebackCount) {
traceBackService.findLastMessageTraceBack(manufOrder).ifPresent(traceback -> response.setNotify(String.format(I18n.get(com.axelor.apps.message.exception.IExceptionMessage.SEND_EMAIL_EXCEPTION), traceback.getMessage())));
}
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.
the class ManufOrderController method consumeStockMove.
/**
* Called from manuf order form on clicking realize button. Call {@link
* ManufOrderStockMoveService#consumeInStockMoves(ManufOrder)} to consume material used in manuf
* order.
*
* @param request
* @param response
*/
public void consumeStockMove(ActionRequest request, ActionResponse response) {
try {
ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
Beans.get(ManufOrderStockMoveService.class).consumeInStockMoves(manufOrder);
response.setReload(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations