Search in sources :

Example 46 with UniqueUnitEao

use of eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao in project dwoss by gg-net.

the class UniqueUnitEaoIT method testCount.

@Test
// TODO: The query behind the eao fails in hsqld but works in mysql. Can't test it for now.
@Ignore
public void testCount() throws Exception {
    utx.begin();
    em.joinTransaction();
    UniqueUnitEao unitEao = new UniqueUnitEao(em);
    NavigableMap<Date, BrandContractorCount> counted = unitEao.countByInputDateContractor(BEFORE, AFTER, WEEK);
    for (Entry<Date, BrandContractorCount> e : counted.entrySet()) {
        LoggerFactory.getLogger(UniqueUnitEaoIT.class).info("TestCount: k={}, v={}", e.getKey(), e.getValue());
    }
    utx.commit();
}
Also used : BrandContractorCount(eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount) UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao) LocalDate(java.time.LocalDate)

Example 47 with UniqueUnitEao

use of eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao in project dwoss by gg-net.

the class UniqueUnitEaoIT method testFindByProductPartNo.

@Test
public void testFindByProductPartNo() throws Exception {
    utx.begin();
    em.joinTransaction();
    UniqueUnitEao unitEao = new UniqueUnitEao(em);
    List<UniqueUnit> uus = unitEao.findByProductPartNo(PARTNO_1);
    assertFalse(uus.isEmpty());
    assertEquals(2, uus.size());
    utx.commit();
}
Also used : UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)

Example 48 with UniqueUnitEao

use of eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao in project dwoss by gg-net.

the class UniqueUnitEaoIT method testFindIdentifiers.

@Test
public void testFindIdentifiers() throws Exception {
    utx.begin();
    em.joinTransaction();
    UniqueUnitEao unitEao = new UniqueUnitEao(em);
    assertEquals(2, unitEao.findByIdentifiers(REFURBISHED_ID, new TreeSet<>(Arrays.asList("99999", "99998"))).size());
    assertTrue(unitEao.findByIdentifiers(REFURBISHED_ID, Arrays.asList(REFURBISHID_62325)).contains(unit_62325));
    utx.commit();
}
Also used : UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)

Example 49 with UniqueUnitEao

use of eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao in project dwoss by gg-net.

the class RedTapeUpdateRepaymentWorkflow method rollInMissingStockUnits.

/**
 * If referenced Units are not in Stock, roll them in and append them to the instance variable (stockUnits).
 *
 * @return the list of rolled in StockUnits
 */
List<StockUnit> rollInMissingStockUnits(String dossierIdentifier, Collection<Position> positions, int destinationId) {
    List<UniqueUnit> uniqueUnits = new ArrayList<>();
    StockUnitEao stockUnitEao = new StockUnitEao(stockEm);
    UniqueUnitEao uniqueUnitEao = new UniqueUnitEao(uniqueUnitEm);
    for (Position position : positions) {
        if (stockUnitEao.findByUniqueUnitId(position.getUniqueUnitId()) == null) {
            uniqueUnits.add(uniqueUnitEao.findById(position.getUniqueUnitId()));
        }
    }
    if (uniqueUnits.isEmpty())
        return Collections.EMPTY_LIST;
    StockTransactionEmo transactionEmo = new StockTransactionEmo(stockEm);
    StockTransaction rollInTransaction = transactionEmo.requestRollInPrepared(destinationId, arranger, "RollIn durch Gutschrift " + dossierIdentifier);
    for (UniqueUnit uu : uniqueUnits) {
        StockUnit stockUnit = new StockUnit(uu.getIdentifier(UniqueUnit.Identifier.REFURBISHED_ID), uu.getProduct().getName(), uu.getId());
        rollInTransaction.addUnit(stockUnit);
        stockEm.persist(stockUnit);
    }
    List<StockUnit> rolledInUnits = transactionEmo.completeRollIn(arranger, Arrays.asList(rollInTransaction));
    L.info("Missing Units rolled In: {}", toIds(rolledInUnits));
    return rolledInUnits;
}
Also used : UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) StockUnitEao(eu.ggnet.dwoss.stock.ee.eao.StockUnitEao) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit) UniqueUnitEao(eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao) StockTransactionEmo(eu.ggnet.dwoss.stock.ee.emo.StockTransactionEmo) StockTransaction(eu.ggnet.dwoss.stock.ee.entity.StockTransaction)

Aggregations

UniqueUnitEao (eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)49 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)38 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)21 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)19 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)17 FileJacket (eu.ggnet.dwoss.util.FileJacket)10 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)9 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)6 File (java.io.File)6 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)5 LogicTransaction (eu.ggnet.dwoss.stock.ee.entity.LogicTransaction)5 CCalcDocument (eu.ggnet.lucidcalc.CCalcDocument)5 CFormat (eu.ggnet.lucidcalc.CFormat)5 CSheet (eu.ggnet.lucidcalc.CSheet)5 STable (eu.ggnet.lucidcalc.STable)5 STableColumn (eu.ggnet.lucidcalc.STableColumn)5 STableModelList (eu.ggnet.lucidcalc.STableModelList)5 TempCalcDocument (eu.ggnet.lucidcalc.TempCalcDocument)5 PriceEngineResult (eu.ggnet.dwoss.price.engine.PriceEngineResult)4 DocumentEao (eu.ggnet.dwoss.redtape.ee.eao.DocumentEao)4