Demo entry 6354279

js_code

   

Submitted by anonymous on Apr 06, 2017 at 04:54
Language: JavaScript. Code size: 1.1 kB.

var ReportData = Java.type("logwire.core.meta.report.ReportData")
var Maps = Java.type("com.google.common.collect.Maps")
var Lists = Java.type("com.google.common.collect.Lists")
var ListMapDataSource = Java.type("logwire.web.service.report.ListMapDataSource")

reports.shipment_report1 = function (actionContext, actionData) {
  // 传入报表的参数 paras
  paras = Maps.newHashMap()
  // 途经站点子报表 JasperReport 对象
  paras.put("stopsReport", actionContext.getReportService().getJasperReport("dispatch_stops"))

  // 为每一张运单准备其途经站点明细数据源
  stopsDataSource = Maps.newHashMap();
  var queryService = actionContext.getQueryService();
  var query = queryService.getQuery("shipment_stops_subreport");
  var rows = actionData.selectedRows;
  rows.forEach(function(row) {
    var select = queryService.select(query);
    select.eq("shipment", row.id);
    var ds = new ListMapDataSource(select.findAll());
    stopsDataSource.put(row.id, ds)

  })
  paras.put("stopsDataSource", stopsDataSource)

  // ReportData 结构:
  // 参数1:报表名称
  // 参数2:主数据源
  // 参数3:报表参数 Map
  return new ReportData("dispatch_temp_ownQuery", null, paras)
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).