Search in sources :

Example 1 with UniqueUnitHistory

use of eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnitHistory in project dwoss by gg-net.

the class UnitOverseerBean method toDetailedHtmlUnit.

private String toDetailedHtmlUnit(UniqueUnit uniqueUnit, boolean showPrices) {
    SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyy");
    StockUnit stockUnit = new StockUnitEao(stockEm).findByUniqueUnitId(uniqueUnit.getId());
    List<ReportLine> reportLines = new ReportLineEao(reportEm).findByUniqueUnitId(uniqueUnit.getId());
    String re = UniqueUnitFormater.toHtmlDetailed(uniqueUnit);
    TreeSet<Dossier> dossiers = new TreeSet<>(Dossier.ORDER_INVERSE_ACTIVE_ACTUAL);
    for (Position pos : new PositionEao(redTapeEm).findByUniqueUnitId(uniqueUnit.getId())) {
        // For now we ignore all Dossiers which just had the unit in the history
        if (!pos.getDocument().isActive())
            continue;
        dossiers.add(pos.getDocument().getDossier());
    }
    re += "<hr />";
    re += "<b>Vorgänge:</b><ul>";
    if (dossiers.isEmpty())
        re += "<li>Keine Vorgänge vorhanden</li>";
    for (Dossier dossier : dossiers) {
        re += "<li>";
        re += customerService.asUiCustomer(dossier.getCustomerId()).toNameCompanyLine();
        re += DossierFormater.toHtmlSimpleWithDocument(dossier) + "<br /></li>";
    }
    re += "</ul>";
    re += "<hr />";
    if (uniqueUnit.getHistory() != null && !uniqueUnit.getHistory().isEmpty()) {
        re += "<b>Unit History:</b><ul>";
        for (UniqueUnitHistory history : new TreeSet<>(uniqueUnit.getHistory())) {
            re += "<li>" + df.format(history.getOccurence()) + " - " + history.getComment() + "</li>";
        }
        re += "</ul>";
    }
    re += "<hr />";
    re += "<p><b>Lagerinformationen</b><br />";
    if (stockUnit == null)
        re += "Kein Lagergerät vorhanden<br />";
    else
        re += StockUnitFormater.toHtml(stockUnit);
    re += "</p>";
    re += "<hr />";
    re += "<b>Reporting-Informationen</b>";
    if (reportLines == null || reportLines.isEmpty())
        re += "Keine Reporting-Informationen vorhanden<br />";
    else {
        re += "<table border=\"1\"><tr>";
        re += wrap("<th>", "</th>", "Id", "ReportDate", "Kid", "SopoNr", "Type", "Dossier", "Report");
        re += "</tr>";
        for (ReportLine l : reportLines) {
            re += "<tr>";
            re += wrap("<td>", "</td>", l.getId(), DateFormats.ISO.format(l.getReportingDate()), l.getCustomerId(), l.getRefurbishId(), l.getPositionType() == PRODUCT_BATCH && l.getReference(WARRANTY) != null ? "Garantieerweiterung" : l.getPositionType().getName(), l.getDossierIdentifier() + ", " + l.getDocumentType().getName() + l.getWorkflowStatus().getSign() + (l.getDocumentIdentifier() == null ? "" : ", " + l.getDocumentIdentifier()), l.getReports().stream().map(Report::getName).collect(Collectors.joining(",")));
        }
        re += "</table><br />";
    }
    if (!showPrices)
        return re;
    re += "<hr />";
    re += "<b>Geräte Preis-Informationen</b>";
    re += UniqueUnitFormater.toHtmlPriceInformation(uniqueUnit.getPrices(), uniqueUnit.getPriceHistory());
    re += "<b>Artikel Preis-Informationen</b>";
    re += UniqueUnitFormater.toHtmlPriceInformation(uniqueUnit.getProduct().getPrices(), uniqueUnit.getProduct().getPriceHistory());
    return Css.toHtml5WithStyle(re);
}
Also used : ReportLine(eu.ggnet.dwoss.report.ee.entity.ReportLine) ReportLineEao(eu.ggnet.dwoss.report.ee.eao.ReportLineEao) StockUnitEao(eu.ggnet.dwoss.stock.ee.eao.StockUnitEao) SimpleDateFormat(java.text.SimpleDateFormat) StockUnit(eu.ggnet.dwoss.stock.ee.entity.StockUnit) UniqueUnitHistory(eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnitHistory)

Aggregations

ReportLineEao (eu.ggnet.dwoss.report.ee.eao.ReportLineEao)1 ReportLine (eu.ggnet.dwoss.report.ee.entity.ReportLine)1 StockUnitEao (eu.ggnet.dwoss.stock.ee.eao.StockUnitEao)1 StockUnit (eu.ggnet.dwoss.stock.ee.entity.StockUnit)1 UniqueUnitHistory (eu.ggnet.dwoss.uniqueunit.ee.entity.UniqueUnitHistory)1 SimpleDateFormat (java.text.SimpleDateFormat)1