Search in sources :

Example 26 with ProductSpec

use of eu.ggnet.dwoss.spec.ee.entity.ProductSpec in project dwoss by gg-net.

the class ProductSpecMatches method execute.

@Override
public ChainLink.Result<String> execute(String value) {
    ProductSpec spec = specAgent.findProductSpecByPartNoEager(value);
    if (spec == null)
        return new ChainLink.Result<>(value, ValidationStatus.ERROR, "ProductSpec existiert noch nicht, bitte anlegen");
    TradeName isBrand = spec.getModel().getFamily().getSeries().getBrand();
    if (isBrand != mustBrand)
        return new ChainLink.Result<>(value, ValidationStatus.ERROR, "ProductSpec ist von der Marke " + isBrand.getName() + ", muss aber von der Marke " + mustBrand.getName() + " sein");
    ProductGroup isGroup = spec.getModel().getFamily().getSeries().getGroup();
    if (isGroup != mustGroup)
        return new ChainLink.Result<>(value, ValidationStatus.ERROR, "ProductSpec ist aus der Warengruppe " + isGroup.getName() + ", muss aber aus der Warengruppe " + mustGroup.getName() + " sein");
    return new ChainLink.Result<>(value);
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ChainLink(eu.ggnet.dwoss.receipt.unit.chain.ChainLink) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec)

Aggregations

ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)26 Test (org.junit.Test)10 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)8 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)8 ProductFamily (eu.ggnet.dwoss.spec.ee.entity.ProductFamily)7 ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)7 Cpu (eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)6 Gpu (eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)6 UniqueUnit (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit)6 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)4 ProductSpecEao (eu.ggnet.dwoss.spec.ee.eao.ProductSpecEao)4 Notebook (eu.ggnet.dwoss.spec.ee.entity.Notebook)4 Display (eu.ggnet.dwoss.spec.ee.entity.piece.Display)4 SpecAgent (eu.ggnet.dwoss.spec.ee.SpecAgent)3 SpecGenerator (eu.ggnet.dwoss.spec.ee.assist.gen.SpecGenerator)3 Desktop (eu.ggnet.dwoss.spec.ee.entity.Desktop)3 DesktopBundle (eu.ggnet.dwoss.spec.ee.entity.DesktopBundle)3 Shipment (eu.ggnet.dwoss.stock.ee.entity.Shipment)3 Stock (eu.ggnet.dwoss.stock.ee.entity.Stock)3 StockTransaction (eu.ggnet.dwoss.stock.ee.entity.StockTransaction)3