Search in sources :

Example 1 with BPPurchaseScheduleService

use of de.metas.purchasecandidate.BPPurchaseScheduleService in project metasfresh-webui-api by metasfresh.

the class PurchaseRowsLoaderTest method init.

@BeforeEach
public void init() {
    AdempiereTestHelper.get().init();
    availabilityCheckService = Mockito.mock(AvailabilityCheckService.class);
    org = newInstance(I_AD_Org.class);
    saveRecord(org);
    final I_C_UOM uom = newInstance(I_C_UOM.class);
    uom.setUOMSymbol("testUOMSympol");
    saveRecord(uom);
    this.TEN = Quantity.of(BigDecimal.TEN, uom);
    warehouse = newInstance(I_M_Warehouse.class);
    saveRecord(warehouse);
    final I_M_Product_Category productCategory = newInstance(I_M_Product_Category.class);
    saveRecord(productCategory);
    product = newInstance(I_M_Product.class);
    product.setM_Product_Category_ID(productCategory.getM_Product_Category_ID());
    product.setC_UOM_ID(uom.getC_UOM_ID());
    saveRecord(product);
    final I_C_BPartner bPartnerCustomer = newInstance(I_C_BPartner.class);
    bPartnerCustomer.setName("bPartnerCustomer.Name");
    saveRecord(bPartnerCustomer);
    salesOrderRecord = newInstance(I_C_Order.class);
    salesOrderRecord.setC_BPartner_ID(bPartnerCustomer.getC_BPartner_ID());
    salesOrderRecord.setPreparationDate(SystemTime.asTimestamp());
    salesOrderRecord.setC_PaymentTerm_ID(30);
    saveRecord(salesOrderRecord);
    bPartnerVendor = newInstance(I_C_BPartner.class);
    bPartnerVendor.setName("bPartnerVendor.Name");
    saveRecord(bPartnerVendor);
    currencyId = PlainCurrencyDAO.createCurrencyId(CurrencyCode.EUR);
    // wire together a SalesOrder2PurchaseViewFactory
    final PurchaseCandidateRepository purchaseCandidateRepository = new PurchaseCandidateRepository(new PurchaseItemRepository(), new ReferenceGenerator(), new BPPurchaseScheduleService(new BPPurchaseScheduleRepository()));
    final DoNothingPurchaseProfitInfoServiceImpl purchaseProfitInfoService = new DoNothingPurchaseProfitInfoServiceImpl();
    final PurchaseDemandWithCandidatesService purchaseDemandWithCandidatesService = new PurchaseDemandWithCandidatesService(purchaseCandidateRepository, new BPPurchaseScheduleService(new BPPurchaseScheduleRepository()), new VendorProductInfoService(new BPartnerBL(new UserRepository())), purchaseProfitInfoService);
    final PurchaseRowFactory purchaseRowFactory = new PurchaseRowFactory(new AvailableToPromiseRepository(), purchaseProfitInfoService);
    salesOrder2PurchaseViewFactory = new SalesOrder2PurchaseViewFactory(purchaseDemandWithCandidatesService, // mocked
    availabilityCheckService, purchaseCandidateRepository, purchaseRowFactory, new SalesOrderLineRepository(new OrderLineRepository()));
}
Also used : BPPurchaseScheduleService(de.metas.purchasecandidate.BPPurchaseScheduleService) AvailabilityCheckService(de.metas.purchasecandidate.availability.AvailabilityCheckService) I_C_Order(org.compiere.model.I_C_Order) AvailableToPromiseRepository(de.metas.material.dispo.commons.repository.atp.AvailableToPromiseRepository) I_M_Product(org.compiere.model.I_M_Product) I_AD_Org(org.compiere.model.I_AD_Org) SalesOrderLineRepository(de.metas.purchasecandidate.SalesOrderLineRepository) OrderLineRepository(de.metas.order.OrderLineRepository) SalesOrderLineRepository(de.metas.purchasecandidate.SalesOrderLineRepository) BPartnerBL(de.metas.bpartner.service.impl.BPartnerBL) I_M_Warehouse(org.compiere.model.I_M_Warehouse) PurchaseDemandWithCandidatesService(de.metas.purchasecandidate.PurchaseDemandWithCandidatesService) I_M_Product_Category(org.compiere.model.I_M_Product_Category) PurchaseItemRepository(de.metas.purchasecandidate.purchaseordercreation.remotepurchaseitem.PurchaseItemRepository) UserRepository(de.metas.user.UserRepository) BPPurchaseScheduleRepository(de.metas.purchasecandidate.BPPurchaseScheduleRepository) ReferenceGenerator(de.metas.purchasecandidate.ReferenceGenerator) PurchaseCandidateRepository(de.metas.purchasecandidate.PurchaseCandidateRepository) VendorProductInfoService(de.metas.purchasecandidate.VendorProductInfoService) I_C_UOM(org.compiere.model.I_C_UOM) I_C_BPartner(org.compiere.model.I_C_BPartner) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BPartnerBL (de.metas.bpartner.service.impl.BPartnerBL)1 AvailableToPromiseRepository (de.metas.material.dispo.commons.repository.atp.AvailableToPromiseRepository)1 OrderLineRepository (de.metas.order.OrderLineRepository)1 BPPurchaseScheduleRepository (de.metas.purchasecandidate.BPPurchaseScheduleRepository)1 BPPurchaseScheduleService (de.metas.purchasecandidate.BPPurchaseScheduleService)1 PurchaseCandidateRepository (de.metas.purchasecandidate.PurchaseCandidateRepository)1 PurchaseDemandWithCandidatesService (de.metas.purchasecandidate.PurchaseDemandWithCandidatesService)1 ReferenceGenerator (de.metas.purchasecandidate.ReferenceGenerator)1 SalesOrderLineRepository (de.metas.purchasecandidate.SalesOrderLineRepository)1 VendorProductInfoService (de.metas.purchasecandidate.VendorProductInfoService)1 AvailabilityCheckService (de.metas.purchasecandidate.availability.AvailabilityCheckService)1 PurchaseItemRepository (de.metas.purchasecandidate.purchaseordercreation.remotepurchaseitem.PurchaseItemRepository)1 UserRepository (de.metas.user.UserRepository)1 I_AD_Org (org.compiere.model.I_AD_Org)1 I_C_BPartner (org.compiere.model.I_C_BPartner)1 I_C_Order (org.compiere.model.I_C_Order)1 I_C_UOM (org.compiere.model.I_C_UOM)1 I_M_Product (org.compiere.model.I_M_Product)1 I_M_Product_Category (org.compiere.model.I_M_Product_Category)1 I_M_Warehouse (org.compiere.model.I_M_Warehouse)1