Search in sources :

Example 16 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class TreeTableController method getTradeNames.

private ObservableList<TreeItem<DataWrapper>> getTradeNames() {
    ObservableList<TreeItem<DataWrapper>> result = FXCollections.observableArrayList();
    for (TradeName tradeName : TradeName.values()) {
        TreeItem<DataWrapper> item = new TreeItem<>(new TradeNameWrapper(tradeName));
        item.getChildren().addAll(getProductGroups(tradeName));
        result.add(item);
    }
    return result;
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) TreeItem(javafx.scene.control.TreeItem)

Example 17 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class SelectExistingReportViewTryout method main.

public static void main(String[] args) {
    ReportAgent rastub = new ReportAgent() {

        private int counter = 0;

        // <editor-fold defaultstate="collapsed" desc="Unused Methods">
        @Override
        public List<SimpleReportLine> findSimple(SearchParameter search, int firstResult, int maxResults) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<ReportLine> find(SearchParameter search, int firstResult, int maxResults) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

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

        @Override
        public ViewReportResult prepareReport(ReportParameter p, boolean loadUnreported) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public List<ReportLine> findReportLinesByDocumentType(DocumentType type, Date from, Date till) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Report store(Report report, Collection<Storeable> storeables) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

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

        @Override
        public List<ReportLine> findAllReportLinesReverse(int firstResult, int maxResults) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Set<ReportLine> attachDanglingComplaints(TradeName type, Date till) {
            // 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 boolean updateReportLineComment(int optLock, long reportId, String comment) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        // </editor-fold>
        @Override
        public Reply<String> updateReportName(Report.OptimisticKey key, String name) {
            System.out.println("Report Name updated with " + name + " calles");
            counter++;
            if ((counter % 2) != 0) {
                System.out.println("Counter=" + counter + " simulating Error");
                return Reply.failure("Counter=" + counter + " simulating Error");
            } else {
                System.out.println("Counter=" + counter + " simulating Success");
                return Reply.success(name);
            }
        }
    };
    Dl.remote().add(ReportAgent.class, rastub);
    UiCore.startSwing(() -> new JLabel("Main Applikation"));
    final Date today = new Date();
    final Date enddate = new Date();
    final Date startdate = new Date();
    final Set<TradeName> trades = new HashSet<>();
    trades.add(TradeName.HP);
    trades.add(TradeName.ACER);
    // build some sample Reports
    List<Report> allReports = new ArrayList();
    for (int i = 0; i < 8; i++) {
        for (TradeName traden : trades) {
            startdate.setYear(62 + i);
            long sum = today.getTime() + startdate.getTime();
            Date sumDate = new Date(sum);
            String name = "Report: " + i + "-" + traden + "-" + sumDate.toString();
            Report e = new Report(name, traden, sumDate, enddate);
            allReports.add(e);
        }
    }
    Ui.exec(() -> {
        Ui.build().fx().show(() -> allReports, () -> new SelectExistingReportView());
    });
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) SimpleReportLine(eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine) ReportParameter(eu.ggnet.dwoss.report.ee.ReportAgent.ReportParameter) ReportAgent(eu.ggnet.dwoss.report.ee.ReportAgent) SearchParameter(eu.ggnet.dwoss.report.ee.ReportAgent.SearchParameter) SimpleReportLine(eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine) SelectExistingReportView(eu.ggnet.dwoss.report.ui.cap.support.SelectExistingReportView) TradeName(eu.ggnet.dwoss.rules.TradeName) Report(eu.ggnet.dwoss.report.ee.entity.Report) DocumentType(eu.ggnet.dwoss.rules.DocumentType) JLabel(javax.swing.JLabel) LockModeType(javax.persistence.LockModeType)

Example 18 with TradeName

use of eu.ggnet.dwoss.rules.TradeName 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

TradeName (eu.ggnet.dwoss.rules.TradeName)18 ProductGroup (eu.ggnet.dwoss.rules.ProductGroup)5 Test (org.junit.Test)4 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)3 ProductModelEmo (eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo)3 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)3 BrandContractorCount (eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount)3 FileJacket (eu.ggnet.dwoss.util.FileJacket)3 JExcelLucidCalcWriter (eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)3 MonitorFactory (eu.ggnet.dwoss.progress.MonitorFactory)2 ReportLine (eu.ggnet.dwoss.report.ee.entity.ReportLine)2 SimpleReportLine (eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine)2 ProductFamilyEmo (eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo)2 ProductSeriesEmo (eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo)2 ProductEao (eu.ggnet.dwoss.uniqueunit.ee.eao.ProductEao)2 CONTRACTOR_REFERENCE (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.CONTRACTOR_REFERENCE)2 MANUFACTURER_COST (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.MANUFACTURER_COST)2 ProductFormater (eu.ggnet.dwoss.uniqueunit.ee.format.ProductFormater)2 ISO (eu.ggnet.dwoss.util.DateFormats.ISO)2 eu.ggnet.lucidcalc (eu.ggnet.lucidcalc)2