Search in sources :

Example 1 with Shipment

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

the class ReceiptGeneratorOperation method makeUniqueUnit.

/**
 * Generates one UniquUnits and receipts it.
 *
 * @return the generated UniquUnits.
 */
public UniqueUnit makeUniqueUnit() {
    Stock stock = findOrMakeStock();
    TradeName contractor = new ArrayList<>(contractors.all()).get(R.nextInt(contractors.all().size()));
    Shipment shipment = new Shipment("TEST-SHIPMENT-" + R.nextInt(10), contractor, TradeName.ACER, Shipment.Status.OPENED);
    stockEm.persist(shipment);
    StockTransaction transaction = stockTransactionEmo.requestRollInPrepared(stock.getId(), "SampleGenerator", "Rollin via makeUniqueUnit");
    ProductSpec productSpec = makeProductSpec();
    Product product = uniqueUnitAgent.findById(Product.class, productSpec.getProductId());
    UniqueUnit unit = unitGenerator.makeUniqueUnit(contractor, product);
    unitProcessor.receipt(unit, product, shipment, transaction, ReceiptOperation.SALEABLE, "SampleGenerator", "Generator");
    stockTransactionProcessor.rollIn(Arrays.asList(transaction), "JUnit");
    return uniqueUnitAgent.findUnitByIdentifierEager(REFURBISHED_ID, unit.getRefurbishId());
}
Also used : UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) Shipment(eu.ggnet.dwoss.stock.ee.entity.Shipment) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) Stock(eu.ggnet.dwoss.stock.ee.entity.Stock) StockTransaction(eu.ggnet.dwoss.stock.ee.entity.StockTransaction)

Example 2 with Shipment

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

the class ShipmentController method createShipment.

public void createShipment() {
    Platform.runLater(() -> {
        ShipmentUpdateStage stage = new ShipmentUpdateStage(new Shipment());
        stage.showAndWait();
        if (!stage.isOk())
            return;
        Shipment shipment = stockAgent.persist(stage.getShipment());
        model.add(shipment);
    });
}
Also used : Shipment(eu.ggnet.dwoss.stock.ee.entity.Shipment)

Example 3 with Shipment

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

the class ShipmentCreatePanel method getShipment.

// End of variables declaration//GEN-END:variables
public Shipment getShipment() {
    Shipment shipment = new Shipment();
    shipment.setDate(new Date());
    shipment.setShipmentId(idField.getText());
    shipment.setContractor((TradeName) ownerBox.getSelectedItem());
    return shipment;
}
Also used : Shipment(eu.ggnet.dwoss.stock.ee.entity.Shipment) Date(java.util.Date)

Example 4 with Shipment

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

the class ShipmentCreatePanel method pre.

@Override
public boolean pre(CloseType type) {
    if (type == CloseType.CANCEL)
        return true;
    Shipment shipment = getShipment();
    if (!ValidationUtil.isValidOrShow(SwingUtilities.getWindowAncestor(this), shipment))
        return false;
    if (!Dl.remote().contains(ShipmentLabelValidator.class))
        return true;
    String warn = Dl.remote().lookup(ShipmentLabelValidator.class).validate(shipment.getShipmentId(), shipment.getContractor());
    if (warn == null)
        return true;
    int result = JOptionPane.showConfirmDialog(this, warn, "Achtung", JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.CANCEL_OPTION)
        return false;
    return true;
}
Also used : Shipment(eu.ggnet.dwoss.stock.ee.entity.Shipment) ShipmentLabelValidator(eu.ggnet.dwoss.mandator.api.service.ShipmentLabelValidator)

Example 5 with Shipment

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

the class ShipmentEditPanel method pre.

@Override
public boolean pre(CloseType type) {
    if (type == CloseType.CANCEL)
        return true;
    Shipment resultShipment = getShipment();
    if (!ValidationUtil.isValidOrShow(SwingUtilities.getWindowAncestor(this), resultShipment))
        return false;
    if (!Dl.remote().contains(ShipmentLabelValidator.class))
        return true;
    String warn = Dl.remote().lookup(ShipmentLabelValidator.class).validate(shipment.getShipmentId(), shipment.getContractor());
    if (warn == null)
        return true;
    int result = JOptionPane.showConfirmDialog(this, warn, "Achtung", JOptionPane.OK_CANCEL_OPTION);
    if (result == JOptionPane.CANCEL_OPTION)
        return false;
    return true;
}
Also used : Shipment(eu.ggnet.dwoss.stock.ee.entity.Shipment) ShipmentLabelValidator(eu.ggnet.dwoss.mandator.api.service.ShipmentLabelValidator)

Aggregations

Shipment (eu.ggnet.dwoss.stock.ee.entity.Shipment)15 StockTransaction (eu.ggnet.dwoss.stock.ee.entity.StockTransaction)4 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)3 Stock (eu.ggnet.dwoss.stock.ee.entity.Stock)3 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)3 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)3 ShipmentLabelValidator (eu.ggnet.dwoss.mandator.api.service.ShipmentLabelValidator)2 Test (org.junit.Test)2 Mandators (eu.ggnet.dwoss.mandator.Mandators)1 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)1 ReceiptOperation (eu.ggnet.dwoss.rules.ReceiptOperation)1 StockUpi (eu.ggnet.dwoss.stock.upi.StockUpi)1 Date (java.util.Date)1 JFXPanel (javafx.embed.swing.JFXPanel)1