Search in sources :

Example 1 with PicoStock

use of eu.ggnet.dwoss.stock.api.PicoStock in project dwoss by gg-net.

the class ShipmentDialogTryout method testShipment.

@Test
public void testShipment() throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    Dl.local().add(Guardian.class, new AbstractGuardian() {

        {
            setRights(new Operator("Testuser", 0, Arrays.asList(AtomicRight.values())));
        }

        @Override
        public void login(String user, char[] pass) throws AuthenticationException {
        }
    });
    StockUpiImpl su = new StockUpiImpl();
    su.setActiveStock(new PicoStock(0, "Demostock"));
    Dl.local().add(StockUpi.class, su);
    Dl.remote().add(StockAgent.class, new StockAgentStub());
    ShipmentController controller = new ShipmentController();
    ShipmentDialog dialog = new ShipmentDialog(new javax.swing.JFrame(), controller);
    dialog.setVisible(true);
}
Also used : Operator(eu.ggnet.dwoss.rights.api.Operator) AuthenticationException(eu.ggnet.saft.core.auth.AuthenticationException) PicoStock(eu.ggnet.dwoss.stock.api.PicoStock) AbstractGuardian(eu.ggnet.dwoss.common.AbstractGuardian) StockUpiImpl(eu.ggnet.dwoss.stock.upi.impl.StockUpiImpl) Test(org.junit.Test)

Example 2 with PicoStock

use of eu.ggnet.dwoss.stock.api.PicoStock in project dwoss by gg-net.

the class UiUnitSupport method optionalChangeStock.

private UniqueUnit optionalChangeStock(UniqueUnit uniqueUnit, StockUnit stockUnit, PicoStock localStock, Window parent, String account) {
    if (!stockUnit.isInStock())
        return uniqueUnit;
    if (localStock.getId() == stockUnit.getStock().getId())
        return uniqueUnit;
    if (stockUnit.isInTransaction()) {
        JOptionPane.showMessageDialog(parent, "Achtung, Gerät ist nicht auf " + localStock.getShortDescription() + ",\n" + "aber Gerät ist auch auf einer Transaktion.\n" + "Automatische Lageränderung nicht möglich !");
        return uniqueUnit;
    }
    int option = JOptionPane.showConfirmDialog(parent, "Gerät steht nicht auf " + localStock.getShortDescription() + ", welches als Standort angegeben ist. Gerätestandort ändern ?", "Standortabweichung", JOptionPane.YES_NO_OPTION);
    if (option == JOptionPane.YES_OPTION) {
        StockDialog dialog = new StockDialog(parent, Dl.remote().lookup(StockAgent.class).findAll(Stock.class).toArray(new Stock[0]), new StockCellRenderer());
        dialog.setSelection(localStock);
        dialog.setVisible(true);
        if (dialog.isOk())
            return unitProcessor.transfer(uniqueUnit, dialog.getSelection().getId(), account);
    }
    return uniqueUnit;
}
Also used : StockAgent(eu.ggnet.dwoss.stock.ee.StockAgent) StockDialog(eu.ggnet.dwoss.receipt.product.StockDialog) PicoStock(eu.ggnet.dwoss.stock.api.PicoStock) Stock(eu.ggnet.dwoss.stock.ee.entity.Stock)

Aggregations

PicoStock (eu.ggnet.dwoss.stock.api.PicoStock)2 AbstractGuardian (eu.ggnet.dwoss.common.AbstractGuardian)1 StockDialog (eu.ggnet.dwoss.receipt.product.StockDialog)1 Operator (eu.ggnet.dwoss.rights.api.Operator)1 StockAgent (eu.ggnet.dwoss.stock.ee.StockAgent)1 Stock (eu.ggnet.dwoss.stock.ee.entity.Stock)1 StockUpiImpl (eu.ggnet.dwoss.stock.upi.impl.StockUpiImpl)1 AuthenticationException (eu.ggnet.saft.core.auth.AuthenticationException)1 Test (org.junit.Test)1