Ver a proveniência

fixing the pdf label

debrand
Fai Luk há 1 mês
ascendente
cometimento
e5ae1e7a65
2 ficheiros alterados com 14 adições e 2 eliminações
  1. +11
    -2
      src/main/java/com/ffii/core/utils/PdfUtils.java
  2. +3
    -0
      src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt

+ 11
- 2
src/main/java/com/ffii/core/utils/PdfUtils.java Ver ficheiro

@@ -12,6 +12,7 @@ import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.data.JRMapCollectionDataSource;

public class PdfUtils {

@@ -23,8 +24,16 @@ public class PdfUtils {

public static <T> JasperPrint fillReport(JasperReport report, List<T> loopList, Map<String, Object> params)
throws Exception {
JRDataSource dataSources = loopList.size() > 0 ? new JRBeanCollectionDataSource(loopList)
: new JREmptyDataSource();
JRDataSource dataSources;
if (loopList == null || loopList.isEmpty()) {
dataSources = new JREmptyDataSource();
} else if (loopList.get(0) instanceof Map) {
@SuppressWarnings("unchecked")
List<Map<String, ?>> rows = (List<Map<String, ?>>) loopList;
dataSources = new JRMapCollectionDataSource(rows);
} else {
dataSources = new JRBeanCollectionDataSource(loopList);
}
JasperPrint jasperPrint = JasperFillManager.fillReport(report, params, dataSources);
return jasperPrint;
}


+ 3
- 0
src/main/java/com/ffii/fpsms/modules/stock/service/StockInLineService.kt Ver ficheiro

@@ -1221,6 +1221,9 @@ open class StockInLineService(
val inputStream = resource.inputStream
val poLabel = JasperCompileManager.compileReport(inputStream)
val qrCodeInfo = stockInLineRepository.findStockInLineInfoByIdInAndDeletedFalse(request.stockInLineIds).toMutableList()
if (qrCodeInfo.isEmpty()) {
throw IllegalArgumentException("找不到來貨記錄,無法產生二維碼")
}
val fields = mutableListOf<MutableMap<String ,Any>>()

for (info in qrCodeInfo) {


Carregando…
Cancelar
Guardar