From 4f64cf1624563f6c1ea7ae9cf42a47d9e319e558 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Sun, 15 Feb 2026 15:25:49 +0800 Subject: [PATCH] FGdeliveryreport --- .../modules/report/service/ReportService.kt | 45 ++++--------------- .../resources/jasper/FGDeliveryReport.jrxml | 8 ++-- 2 files changed, 12 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt b/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt index 5a9ac73..64d272b 100644 --- a/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt +++ b/src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt @@ -81,40 +81,10 @@ open class ReportService( lastOutDateEnd: String? ): List> { val args = mutableMapOf() - - // Stock Category 过滤:通过 qc_category.code 或 qc_category.name - val stockCategorySql = if (!stockCategory.isNullOrBlank()) { - val categories = stockCategory.split(",").map { it.trim() }.filter { it.isNotBlank() } - if (categories.isNotEmpty()) { - val conditions = categories.mapIndexed { index, cat -> - val paramName = "stockCategory_$index" - args[paramName] = "%$cat%" - "(qc.code LIKE :$paramName OR qc.name LIKE :$paramName)" - } - "AND (${conditions.joinToString(" OR ")})" - } else { - "" - } - } else { - "" - } - - // 修正:stockSubCategory 也过滤 qc_category.name(而不是 item_category.sub) - val stockSubCategorySql = if (!stockSubCategory.isNullOrBlank()) { - val values = stockSubCategory.split(",").map { it.trim() }.filter { it.isNotBlank() } - if (values.isNotEmpty()) { - val conditions = values.mapIndexed { index, value -> - val paramName = "stockSubCategory_$index" - args[paramName] = "%$value%" - "qc.name LIKE :$paramName" - } - "AND (${conditions.joinToString(" OR ")})" - } else { - "" - } - } else { - "" - } + val stockCategorySql = "" + val stockSubCategorySql = "" + + val itemCodeSql = buildMultiValueLikeClause(itemCode, "it.code", "itemCode", args) @@ -155,7 +125,7 @@ open class ReportService( ) AS DECIMAL(14,2) ) AS qtyNumeric, -CAST(ROUND(IFNULL(IFNULL(sol.qty, dol.qty), 0), 2) AS CHAR) AS qty, +FORMAT(ROUND(IFNULL(IFNULL(sol.qty, dol.qty), 0), 0), 0) AS qty, COALESCE( dpor.TruckLanceCode, (SELECT t2.TruckLanceCode @@ -252,9 +222,10 @@ CAST(ROUND(IFNULL(IFNULL(sol.qty, dol.qty), 0), 2) AS CHAR) AS qty, $yearSql $lastOutDateStartSql $lastOutDateEndSql - ORDER BY - qc.name, + ORDER BY it.code, + deliveryDate, + qc.name, IFNULL(sil.lotNo, '') """.trimIndent() diff --git a/src/main/resources/jasper/FGDeliveryReport.jrxml b/src/main/resources/jasper/FGDeliveryReport.jrxml index 1a1cc5a..0cfcd75 100644 --- a/src/main/resources/jasper/FGDeliveryReport.jrxml +++ b/src/main/resources/jasper/FGDeliveryReport.jrxml @@ -64,8 +64,8 @@ - - + + @@ -90,12 +90,12 @@ - + - +