Browse Source

FGdeliveryreport

master
CANCERYS\kw093 1 week ago
parent
commit
4f64cf1624
2 changed files with 12 additions and 41 deletions
  1. +8
    -37
      src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt
  2. +4
    -4
      src/main/resources/jasper/FGDeliveryReport.jrxml

+ 8
- 37
src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt View File

@@ -81,40 +81,10 @@ open class ReportService(
lastOutDateEnd: String?
): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
// 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()



+ 4
- 4
src/main/resources/jasper/FGDeliveryReport.jrxml View File

@@ -64,8 +64,8 @@
<field name="driver" class="java.lang.String"/>
<field name="deliveryOrderNo" class="java.lang.String"/>
<field name="stockSubCategory" class="java.lang.String"/>
<variable name="totalDeliveredQtyPerDeliveryOrder" class="java.math.BigDecimal" resetType="Group" resetGroup="Group1" incrementType="Group" incrementGroup="Group1" calculation="First">
<variableExpression><![CDATA[$F{qtyNumeric}]]></variableExpression>
<variable name="totalDeliveredQtyPerDeliveryOrder" class="java.math.BigDecimal" resetType="Group" resetGroup="Group1" incrementType="Group" incrementGroup="Group1" calculation="Sum">
<variableExpression><![CDATA[$F{qtyNumeric} != null ? $F{qtyNumeric} : java.math.BigDecimal.ZERO]]></variableExpression>
</variable>
<group name="Group1" keepTogether="true">
<groupExpression><![CDATA[$F{itemNo}]]></groupExpression>
@@ -90,12 +90,12 @@
</textElement>
<text><![CDATA[每單交貨總數:]]></text>
</staticText>
<textField>
<textField pattern="#,##0">
<reportElement x="502" y="0" width="80" height="19" uuid="939e4c5b-176c-4154-aabd-bf06c2a0e594"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{qtyNumeric} != null ? $F{qtyNumeric}.toString() : "0.00"]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{totalDeliveredQtyPerDeliveryOrder}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="19" width="799" height="1" uuid="69c9e68d-5a48-4284-b977-d12984bde9bc">


Loading…
Cancel
Save