Search in sources :

Example 26 with StockTransaction

use of eu.ggnet.dwoss.stock.ee.entity.StockTransaction in project dwoss by gg-net.

the class StockTransactionEmoIT method testCompleteRollInRollOut.

@Test
public void testCompleteRollInRollOut() throws Exception {
    List<Stock> stocks = gen.makeStocksAndLocations(2);
    StockTransactionEmo stockTransactionEmo = new StockTransactionEmo(em);
    utx.begin();
    em.joinTransaction();
    StockTransaction st1 = stockTransactionEmo.requestRollInPrepared(stocks.get(0).getId(), "Hugo", "Ein toller Komentar");
    st1.addUnit(new StockUnit("1", 1));
    st1.addUnit(new StockUnit("2", 2));
    st1.addUnit(new StockUnit("3", 3));
    st1.addUnit(new StockUnit("4", 4));
    st1.addUnit(new StockUnit("5", 5));
    st1.addUnit(new StockUnit("6", 6));
    st1.addUnit(new StockUnit("7", 7));
    st1.addUnit(new StockUnit("8", 8));
    st1.addUnit(new StockUnit("9", 9));
    List<StockUnit> units = stockTransactionEmo.completeRollIn("Hans", Arrays.asList(st1));
    assertEquals(COMPLETED, st1.getStatus().getType());
    assertNotNull(units);
    assertEquals(st1.getPositions().size(), units.size());
    for (StockUnit stockUnit : units) {
        assertTrue(stockUnit.isInStock());
        assertFalse(stockUnit.isInTransaction());
        assertEquals(stocks.get(0), stockUnit.getStock());
    }
    utx.commit();
    StockUnitEao stockUnitEao = new StockUnitEao(em);
    utx.begin();
    em.joinTransaction();
    st1 = stockTransactionEmo.requestRollOutPrepared(stocks.get(0).getId(), "Hugo", "Ein toller Komentar");
    for (StockUnit stockUnit : stockUnitEao.findAll()) {
        st1.addUnit(stockUnit);
    }
    assertEquals(units.size(), st1.getPositions().size());
    utx.commit();
    utx.begin();
    em.joinTransaction();
    st1 = em.merge(st1);
    List<Integer> uids = stockTransactionEmo.completeRollOut("Horst", Arrays.asList(st1));
    assertNotNull(uids);
    assertEquals(units.size(), uids.size());
    utx.commit();
    utx.begin();
    em.joinTransaction();
    List<StockUnit> stockUnits = stockUnitEao.findAll();
    assertTrue(stockUnits.isEmpty());
    utx.commit();
}
Also used : StockUnitEao(eu.ggnet.dwoss.stock.ee.eao.StockUnitEao) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit) Stock(eu.ggnet.dwoss.stock.ee.entity.Stock) StockTransactionEmo(eu.ggnet.dwoss.stock.ee.emo.StockTransactionEmo) StockTransaction(eu.ggnet.dwoss.stock.ee.entity.StockTransaction) Test(org.junit.Test)

Example 27 with StockTransaction

use of eu.ggnet.dwoss.stock.ee.entity.StockTransaction in project dwoss by gg-net.

the class StockUnitEaoIT method testFindByNoTransaction.

@Test
public void testFindByNoTransaction() throws Exception {
    utx.begin();
    em.joinTransaction();
    Stock s = new Stock(0, "TEEEEEEEEEEEEEEST");
    em.persist(s);
    StockLocation sl = new StockLocation("Lagerplatz");
    s.addStockLocation(sl);
    StockUnit s1 = new StockUnit("G1", 1);
    StockUnit s2 = new StockUnit("G2", 2);
    StockUnit s3 = new StockUnit("G3", 3);
    StockUnit s4 = new StockUnit("G4", 4);
    s.addUnit(s1, sl);
    s.addUnit(s2, sl);
    s.addUnit(s3, sl);
    s.addUnit(s4, sl);
    em.persist(s);
    em.persist(new Stock(1, "TEEEEEEEEEST2"));
    LogicTransaction lt = new LogicTransaction();
    lt.setDossierId(1);
    lt.add(s4);
    em.persist(lt);
    StockTransaction st = new StockTransaction(StockTransactionType.TRANSFER);
    st.setSource(s);
    st.addStatus(new StockTransactionStatus(StockTransactionStatusType.PREPARED, new Date()));
    em.persist(st);
    st.addPosition(new StockTransactionPosition(s1));
    utx.commit();
    List<StockUnit> sts = sus.findByNoTransaction();
    assertEquals(2, sts.size());
}
Also used : StockLocation(eu.ggnet.dwoss.stock.ee.entity.StockLocation) StockTransactionStatus(eu.ggnet.dwoss.stock.ee.entity.StockTransactionStatus) LogicTransaction(eu.ggnet.dwoss.stock.ee.entity.LogicTransaction) StockTransactionPosition(eu.ggnet.dwoss.stock.ee.entity.StockTransactionPosition) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit) Stock(eu.ggnet.dwoss.stock.ee.entity.Stock) Date(java.util.Date) StockTransaction(eu.ggnet.dwoss.stock.ee.entity.StockTransaction) Test(org.junit.Test)

Example 28 with StockTransaction

use of eu.ggnet.dwoss.stock.ee.entity.StockTransaction in project dwoss by gg-net.

the class StockTransactionTest method testTransferInvalid.

@Test
public void testTransferInvalid() throws InterruptedException {
    StockTransaction tr1 = new StockTransaction(StockTransactionType.TRANSFER);
    addStatus(tr1, StockTransactionStatusType.PREPARED);
    valid(tr1);
    addStatus(tr1, StockTransactionStatusType.IN_TRANSFER);
    invalid(tr1);
}
Also used : StockTransaction(eu.ggnet.dwoss.stock.ee.entity.StockTransaction) Test(org.junit.Test)

Example 29 with StockTransaction

use of eu.ggnet.dwoss.stock.ee.entity.StockTransaction in project dwoss by gg-net.

the class StockTransactionTest method testTransferInvalid2.

@Test
public void testTransferInvalid2() throws InterruptedException {
    StockTransaction tr1 = new StockTransaction(StockTransactionType.TRANSFER);
    addStatus(tr1, StockTransactionStatusType.PREPARED);
    valid(tr1);
    addStatus(tr1, StockTransactionStatusType.PREPARED);
    invalid(tr1);
}
Also used : StockTransaction(eu.ggnet.dwoss.stock.ee.entity.StockTransaction) Test(org.junit.Test)

Example 30 with StockTransaction

use of eu.ggnet.dwoss.stock.ee.entity.StockTransaction in project dwoss by gg-net.

the class StockTransactionTest method testTransferValid.

@Test
public void testTransferValid() throws InterruptedException {
    StockTransaction tr1 = new StockTransaction(StockTransactionType.TRANSFER);
    addStatus(tr1, StockTransactionStatusType.PREPARED);
    valid(tr1);
    addStatus(tr1, StockTransactionStatusType.COMMISSIONED);
    valid(tr1);
    addStatus(tr1, StockTransactionStatusType.IN_TRANSFER);
    valid(tr1);
    addStatus(tr1, StockTransactionStatusType.RECEIVED);
    valid(tr1);
    addStatus(tr1, StockTransactionStatusType.COMPLETED);
    valid(tr1);
}
Also used : StockTransaction(eu.ggnet.dwoss.stock.ee.entity.StockTransaction) Test(org.junit.Test)

Aggregations

StockTransaction (eu.ggnet.dwoss.stock.ee.entity.StockTransaction)36 Stock (eu.ggnet.dwoss.stock.ee.entity.Stock)21 Test (org.junit.Test)21 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)20 StockTransactionEmo (eu.ggnet.dwoss.stock.ee.emo.StockTransactionEmo)10 StockTransactionStatus (eu.ggnet.dwoss.stock.ee.entity.StockTransactionStatus)10 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)10 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)8 Date (java.util.Date)8 LogicTransaction (eu.ggnet.dwoss.stock.ee.entity.LogicTransaction)7 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)7 StockTransactionPosition (eu.ggnet.dwoss.stock.ee.entity.StockTransactionPosition)5 UniqueUnitEao (eu.ggnet.dwoss.uniqueunit.ee.eao.UniqueUnitEao)5 StockAgent (eu.ggnet.dwoss.stock.ee.StockAgent)4 Shipment (eu.ggnet.dwoss.stock.ee.entity.Shipment)4 StockTransactionParticipation (eu.ggnet.dwoss.stock.ee.entity.StockTransactionParticipation)4 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)3 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)3 ReportLine (eu.ggnet.dwoss.report.ee.entity.ReportLine)3 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)3