Search in sources :

Example 41 with ManufOrder

use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.

the class ManufOrderController method generateWasteStockMove.

public void generateWasteStockMove(ActionRequest request, ActionResponse response) {
    try {
        ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
        manufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
        Beans.get(ManufOrderService.class).generateWasteStockMove(manufOrder);
        response.setReload(true);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : ManufOrderService(com.axelor.apps.production.service.manuforder.ManufOrderService) BirtException(org.eclipse.birt.core.exception.BirtException) AxelorException(com.axelor.exception.AxelorException) IOException(java.io.IOException) ManufOrder(com.axelor.apps.production.db.ManufOrder)

Example 42 with ManufOrder

use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.

the class ManufOrderController method checkConsumedStockMoveLineList.

/**
 * Called from manuf order form, on consumed stock move line change. Call {@link
 * ManufOrderService#checkConsumedStockMoveLineList(ManufOrder, ManufOrder)}.
 *
 * @param request
 * @param response
 */
public void checkConsumedStockMoveLineList(ActionRequest request, ActionResponse response) {
    try {
        ManufOrder manufOrder = request.getContext().asType(ManufOrder.class);
        ManufOrder oldManufOrder = Beans.get(ManufOrderRepository.class).find(manufOrder.getId());
        Beans.get(ManufOrderService.class).checkConsumedStockMoveLineList(manufOrder, oldManufOrder);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
        response.setReload(true);
    }
}
Also used : ManufOrderService(com.axelor.apps.production.service.manuforder.ManufOrderService) ManufOrderRepository(com.axelor.apps.production.db.repo.ManufOrderRepository) BirtException(org.eclipse.birt.core.exception.BirtException) AxelorException(com.axelor.exception.AxelorException) IOException(java.io.IOException) ManufOrder(com.axelor.apps.production.db.ManufOrder)

Example 43 with ManufOrder

use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.

the class PurchaseOrderServiceProductionImpl method setMergedPurchaseOrderForManufOrder.

@SuppressWarnings("unchecked")
private void setMergedPurchaseOrderForManufOrder(PurchaseOrder mergedPurchaseOrder, List<PurchaseOrder> purchaseOrderList) {
    AppProductionService appProductionService = Beans.get(AppProductionService.class);
    if (appProductionService.isApp("production") && appProductionService.getAppProduction().getManageOutsourcing()) {
        ManufOrderRepository manufOrderRepository = Beans.get(ManufOrderRepository.class);
        for (PurchaseOrder purchaseOrder : purchaseOrderList) {
            List<ManufOrder> manufOrderList = (List<ManufOrder>) manufOrderRepository.all().filter("self.purchaseOrder.id = ?1", purchaseOrder.getId());
            for (ManufOrder manufOrder : manufOrderList) {
                manufOrder.setPurchaseOrder(mergedPurchaseOrder);
                manufOrderRepository.save(manufOrder);
            }
        }
    }
}
Also used : ManufOrderRepository(com.axelor.apps.production.db.repo.ManufOrderRepository) PurchaseOrder(com.axelor.apps.purchase.db.PurchaseOrder) List(java.util.List) PriceList(com.axelor.apps.base.db.PriceList) AppProductionService(com.axelor.apps.production.service.app.AppProductionService) ManufOrder(com.axelor.apps.production.db.ManufOrder)

Example 44 with ManufOrder

use of com.axelor.apps.production.db.ManufOrder in project axelor-open-suite by axelor.

the class MrpServiceProductionImpl method createManufOrderMrpLines.

// Manufacturing order AND manufacturing order need
protected void createManufOrderMrpLines() throws AxelorException {
    MrpLineType manufOrderMrpLineType = this.getMrpLineType(MrpLineTypeRepository.ELEMENT_MANUFACTURING_ORDER);
    if (manufOrderMrpLineType == null) {
        return;
    }
    MrpLineType manufOrderNeedMrpLineType = this.getMrpLineType(MrpLineTypeRepository.ELEMENT_MANUFACTURING_ORDER_NEED);
    String statusSelect = manufOrderMrpLineType.getStatusSelect();
    List<Integer> statusList = StringTool.getIntegerList(statusSelect);
    if (statusList.isEmpty()) {
        statusList.add(ManufOrderRepository.STATUS_FINISHED);
    }
    List<ManufOrder> manufOrderList = manufOrderRepository.all().filter("self.product.id in (?1) AND self.prodProcess.stockLocation in (?2) " + "AND self.statusSelect IN (?3)", this.productMap.keySet(), this.stockLocationList, statusList).fetch();
    for (ManufOrder manufOrder : manufOrderList) {
        this.createManufOrderMrpLines(mrpRepository.find(mrp.getId()), manufOrderRepository.find(manufOrder.getId()), mrpLineTypeRepository.find(manufOrderMrpLineType.getId()), mrpLineTypeRepository.find(manufOrderNeedMrpLineType.getId()));
        JPA.clear();
    }
}
Also used : MrpLineType(com.axelor.apps.supplychain.db.MrpLineType) ManufOrder(com.axelor.apps.production.db.ManufOrder)

Aggregations

ManufOrder (com.axelor.apps.production.db.ManufOrder)44 AxelorException (com.axelor.exception.AxelorException)30 IOException (java.io.IOException)22 BirtException (org.eclipse.birt.core.exception.BirtException)22 ManufOrderRepository (com.axelor.apps.production.db.repo.ManufOrderRepository)17 ManufOrderService (com.axelor.apps.production.service.manuforder.ManufOrderService)12 BigDecimal (java.math.BigDecimal)12 ArrayList (java.util.ArrayList)12 AppProductionService (com.axelor.apps.production.service.app.AppProductionService)11 List (java.util.List)11 ProdProduct (com.axelor.apps.production.db.ProdProduct)10 ManufOrderWorkflowService (com.axelor.apps.production.service.manuforder.ManufOrderWorkflowService)10 Transactional (com.google.inject.persist.Transactional)10 Beans (com.axelor.inject.Beans)9 Company (com.axelor.apps.base.db.Company)8 Product (com.axelor.apps.base.db.Product)8 ProductRepository (com.axelor.apps.base.db.repo.ProductRepository)8 AppBaseService (com.axelor.apps.base.service.app.AppBaseService)8 IExceptionMessage (com.axelor.apps.production.exceptions.IExceptionMessage)8 I18n (com.axelor.i18n.I18n)8