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());
}
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);
});
}
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;
}
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;
}
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;
}
Aggregations