Search in sources :

Example 1 with ManufOrderRepository

use of com.axelor.apps.production.db.repo.ManufOrderRepository 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)

Aggregations

PriceList (com.axelor.apps.base.db.PriceList)1 ManufOrder (com.axelor.apps.production.db.ManufOrder)1 ManufOrderRepository (com.axelor.apps.production.db.repo.ManufOrderRepository)1 AppProductionService (com.axelor.apps.production.service.app.AppProductionService)1 PurchaseOrder (com.axelor.apps.purchase.db.PurchaseOrder)1 List (java.util.List)1