Search in sources :

Example 21 with ProductSpec

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

the class SpecGenerator method main.

public static void main(String[] args) {
    SpecGenerator g = new SpecGenerator();
    for (int i = 0; i < 10; i++) {
        ProductSpec spec = g.makeSpec();
        System.out.println(spec);
    }
    ProductSpec spec = g.makeSpec();
    System.out.println();
    System.out.println("toName");
    System.out.println("------------");
    System.out.println(SpecFormater.toName(spec));
    System.out.println();
    System.out.println("toDetailedName");
    System.out.println("------------");
    System.out.println(SpecFormater.toDetailedName(spec));
    System.out.println();
    System.out.println("toSingleLine");
    System.out.println("------------");
    System.out.println(SpecFormater.toSingleLine(spec));
    System.out.println();
    System.out.println("toSingleHtmlLine");
    System.out.println("------------");
    System.out.println(SpecFormater.toSingleHtmlLine(spec));
    System.out.println();
    System.out.println("toHtml");
    System.out.println("------------");
    System.out.println(SpecFormater.toHtml(spec));
    System.out.println();
    System.out.println("toSource");
    System.out.println("------------");
    System.out.println(SpecFormater.toSource(spec));
}
Also used : ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec)

Example 22 with ProductSpec

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

the class ContainerIT method testAgent.

@Test
public void testAgent() {
    ProductSpec spec = generatorBean.makeOne();
    assertNotNull(spec);
    assertNotNull(specAgent);
    List<ProductSpec> specs = specAgent.findAll(ProductSpec.class);
    assertFalse(specs.isEmpty());
    assertEquals(1, specs.size());
    assertEquals(spec, specs.get(0));
}
Also used : ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) Test(org.junit.Test)

Example 23 with ProductSpec

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

the class DesktopBundleView method validatePartNoAndLoad.

private ProductSpec validatePartNoAndLoad(UnitModel.MetaValue<String> partNo) {
    L.debug("Validating partNo : {}", partNo.getValue());
    partNo.getSurvey().validating("Wert wird geprüft");
    updateValidationStatus();
    ChainLink.Result<String> result = Chains.execute(partNo.getChain(), partNo.getValue());
    L.debug("After Chain : {}", result);
    partNo.getSurvey().setStatus(result.getValid(), result.getMessage());
    updateValidationStatus();
    partNo.setValue(result.getValue());
    L.debug("After Chain2 : {}", result);
    ProductSpec spec = null;
    if (partNo.getSurvey().isOkOrWarn()) {
        L.debug("Loading Details for PartNo: {}", partNo.getValue());
        spec = specAgent.findProductSpecByPartNoEager(partNo.getValue());
    }
    L.debug("Completing, after update : {}", partNo.getValue());
    return spec;
}
Also used : ChainLink(eu.ggnet.dwoss.receipt.unit.chain.ChainLink) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec)

Example 24 with ProductSpec

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

the class UnitViewTryout method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    final SpecGenerator GEN = new SpecGenerator();
    final List<ProductSpec> productSpecs = new ArrayList<>();
    final Map<String, ProductModel> productModels = new HashMap<>();
    final Map<String, ProductSeries> productSeries = new HashMap<>();
    final Map<String, ProductFamily> productFamily = new HashMap<>();
    final List<Product> products = new ArrayList<>();
    for (int i = 0; i < 100; i++) {
        ProductSpec spec = GEN.makeSpec();
        productSpecs.add(spec);
        products.add(new Product(spec.getModel().getFamily().getSeries().getGroup(), spec.getModel().getFamily().getSeries().getBrand(), spec.getPartNo(), spec.getModel().getName()));
        productModels.putIfAbsent(spec.getModel().getName(), spec.getModel());
        productFamily.putIfAbsent(spec.getModel().getFamily().getName(), spec.getModel().getFamily());
        productSeries.putIfAbsent(spec.getModel().getFamily().getSeries().getName(), spec.getModel().getFamily().getSeries());
    }
    // final Product product = new Product(spec.getModel().getFamily().getSeries().getGroup(),
    // spec.getModel().getFamily().getSeries().getBrand(), spec.getPartNo(), spec.getModel().getName());
    Dl.remote().add(Mandators.class, new Mandators() {

        @Override
        public Mandator loadMandator() {
            return Mandator.builder().defaultMailSignature(null).smtpConfiguration(null).mailTemplateLocation(null).company(CompanyGen.makeCompany()).dossierPrefix("DW").documentIntermix(null).documentIdentifierGeneratorConfigurations(new EnumMap<>(DocumentType.class)).build();
        }

        @Override
        public DefaultCustomerSalesdata loadSalesdata() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ReceiptCustomers loadReceiptCustomers() {
            return ReceiptCustomers.builder().build();
        }

        @Override
        public SpecialSystemCustomers loadSystemCustomers() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Contractors loadContractors() {
            return new Contractors(EnumSet.allOf(TradeName.class), TradeName.getManufacturers());
        }

        @Override
        public PostLedger loadPostLedger() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ShippingTerms loadShippingTerms() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Dl.remote().add(SpecAgent.class, new SpecAgent() {

        @Override
        public ProductSpec findProductSpecByPartNoEager(String partNo) {
            return productSpecs.stream().filter(p -> Objects.equals(partNo, p.getPartNo())).findFirst().orElse(null);
        }

        // <editor-fold defaultstate="collapsed" desc="Unneeded Methods">
        @Override
        public <T> long count(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass) {
            if (entityClass.equals(ProductSpec.class))
                return (List<T>) productSpecs;
            else if (entityClass.equals(ProductSeries.class))
                return (List<T>) new ArrayList<>(productSeries.values());
            else if (entityClass.equals(ProductFamily.class))
                return (List<T>) new ArrayList<>(productFamily.values());
            else if (entityClass.equals(ProductModel.class))
                return (List<T>) new ArrayList<>(productModels.values());
            return Collections.emptyList();
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass) {
            return findAll(entityClass);
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
            return findAll(entityClass, start, amount);
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Dl.remote().add(UnitSupporter.class, new UnitSupporter() {

        @Override
        public boolean isRefurbishIdAvailable(String refurbishId) {
            return Pattern.matches("([2-8][0-9]{4}|A1[0-9]{3})", refurbishId);
        }

        @Override
        public boolean isSerialAvailable(String serial) {
            if (serial == null)
                return true;
            return !serial.startsWith("AAAA");
        }

        @Override
        public String findRefurbishIdBySerial(String serial) {
            if (serial == null)
                return null;
            if (serial.startsWith("B"))
                return "12345";
            return null;
        }
    });
    Dl.remote().add(UniqueUnitAgent.class, new UniqueUnitAgent() {

        @Override
        public Product findProductByPartNo(String partNo) {
            return products.stream().filter(p -> Objects.equals(partNo, p.getPartNo())).findFirst().orElse(null);
        }

        // <editor-fold defaultstate="collapsed" desc="Unneeded Methods">
        @Override
        public UniqueUnit findUnitByIdentifierEager(UniqueUnit.Identifier type, String identifier) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> long count(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Product findProductByPartNoEager(String partNo) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public CategoryProduct createOrUpdate(CategoryProductDto dto, String username) throws NullPointerException {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        // </editor-fold>
        @Override
        public Reply<Void> deleteCategoryProduct(long id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<Void> addToUnitCollection(PicoUnit unit, long unitCollectionId) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<Void> unsetUnitCollection(PicoUnit unit) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<UnitCollection> createOnProduct(long productId, UnitCollectionDto dto, String username) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<UnitCollection> update(UnitCollectionDto dto, String username) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Reply<Void> delete(UnitCollection dto) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Dl.remote().add(ProductProcessor.class, new ProductProcessorStub());
    UnitController controller = new UnitController();
    UnitModel model = new UnitModel();
    model.setContractor(ONESELF);
    model.setMode(ACER);
    controller.setModel(model);
    final UnitView view = new UnitView(null);
    view.setModel(model);
    controller.setView(view);
    view.setController(controller);
    controller.init();
    // To Model
    view.setVisible(true);
    System.out.println("View canceled ? " + view.isCancel());
    System.out.println(view.getUnit());
    System.out.println(model.getProduct());
    System.out.println(model.getOperation());
    System.out.println(model.getOperationComment());
}
Also used : ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) UIManager(javax.swing.UIManager) java.util(java.util) TradeName(eu.ggnet.dwoss.rules.TradeName) ONESELF(eu.ggnet.dwoss.rules.TradeName.ONESELF) CategoryProductDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.CategoryProductDto) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) CategoryProduct(eu.ggnet.dwoss.uniqueunit.ee.entity.CategoryProduct) Dl(eu.ggnet.saft.Dl) UnitCollectionDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.UnitCollectionDto) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) DocumentType(eu.ggnet.dwoss.rules.DocumentType) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) UnitSupporter(eu.ggnet.dwoss.receipt.ee.UnitSupporter) Mandators(eu.ggnet.dwoss.mandator.Mandators) UniqueUnitAgent(eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent) ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) SpecAgent(eu.ggnet.dwoss.spec.ee.SpecAgent) eu.ggnet.dwoss.mandator.api.value(eu.ggnet.dwoss.mandator.api.value) SpecGenerator(eu.ggnet.dwoss.spec.ee.assist.gen.SpecGenerator) ProductProcessor(eu.ggnet.dwoss.receipt.ee.ProductProcessor) ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub) Reply(eu.ggnet.saft.api.Reply) ACER(eu.ggnet.dwoss.rules.TradeName.ACER) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) Pattern(java.util.regex.Pattern) LockModeType(javax.persistence.LockModeType) ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) CategoryProduct(eu.ggnet.dwoss.uniqueunit.ee.entity.CategoryProduct) CategoryProduct(eu.ggnet.dwoss.uniqueunit.ee.entity.CategoryProduct) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) UnitCollection(eu.ggnet.dwoss.uniqueunit.ee.entity.UnitCollection) UniqueUnitAgent(eu.ggnet.dwoss.uniqueunit.ee.UniqueUnitAgent) UnitCollectionDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.UnitCollectionDto) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) UniqueUnit(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnit) Mandators(eu.ggnet.dwoss.mandator.Mandators) LockModeType(javax.persistence.LockModeType) ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub) UnitSupporter(eu.ggnet.dwoss.receipt.ee.UnitSupporter) SpecAgent(eu.ggnet.dwoss.spec.ee.SpecAgent) SpecGenerator(eu.ggnet.dwoss.spec.ee.assist.gen.SpecGenerator) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) DocumentType(eu.ggnet.dwoss.rules.DocumentType) PicoUnit(eu.ggnet.dwoss.uniqueunit.api.PicoUnit) CategoryProductDto(eu.ggnet.dwoss.uniqueunit.ee.entity.dto.CategoryProductDto) Reply(eu.ggnet.saft.api.Reply)

Example 25 with ProductSpec

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

the class SimpleView method editButtonActionPerformed.

// GEN-LAST:event_modelBoxActionPerformed
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_editButtonActionPerformed
    String result = JOptionPane.showInputDialog(this, "Artikelnummer ändern:", spec.getPartNo());
    // Cancel and Nothing
    if (result == null || result.trim().equals("") || result.equals(spec.getPartNo()))
        return;
    if (result.startsWith(" ") || result.endsWith(" ")) {
        error("ArtikelNummer hat am Anfang oder Ende Freizeichen, nicht erlaubt");
        return;
    }
    ProductSpec localSpec = specAgent.findProductSpecByPartNoEager(result);
    if (localSpec != null) {
        error("Artikel exitiert schon : " + localSpec.getModel().getName() + " (" + localSpec.getPartNo() + ")");
        return;
    }
    // Will be persisted later on.
    spec.setPartNo(result);
    partNoField.setText(result);
}
Also used : 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