Преглед изворни кода

DNcartonLabel update, report excels fix

master
Tommy\2Fi-Staff пре 8 часа
родитељ
комит
037f5aa288
4 измењених фајлова са 228 додато и 196 уклоњено
  1. +1
    -18
      src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt
  2. +47
    -1
      src/main/java/com/ffii/fpsms/modules/report/web/ReportController.kt
  3. +4
    -1
      src/main/java/com/ffii/fpsms/modules/report/web/StockLedgerReportController.kt
  4. +176
    -176
      src/main/resources/DeliveryNote/DeliveryNoteCartonLabelsPDF.jrxml

+ 1
- 18
src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt Прегледај датотеку

@@ -236,6 +236,7 @@ FORMAT(ROUND(IFNULL(IFNULL(sol.qty, dol.qty), 0), 0), 0) AS qty,
WHERE
dpolr.deleted = 0
AND (dpor.id IS NULL OR dpor.ticket_status = 'completed')
AND COALESCE(sol.qty, dol.qty, 0) <> 0
$stockCategorySql
$stockSubCategorySql
$itemCodeSql
@@ -250,24 +251,6 @@ FORMAT(ROUND(IFNULL(IFNULL(sol.qty, dol.qty), 0), 0), 0) AS qty,
""".trimIndent()

val result = jdbcDao.queryForList(sql, args)
// 打印查询结果(前 10 行)
println("=== Query Result (Total: ${result.size} rows) ===")
result.take(50).forEachIndexed { index, row ->
println("Row $index:")
println(" deliveryDate: ${row["deliveryDate"]}")
println(" itemNo: ${row["itemNo"]}")
println(" itemName: ${row["itemName"]}")
println(" qty: ${row["qty"]}")
println(" qtyNumeric: ${row["qtyNumeric"]}")
println(" deliveryOrderNo: ${row["deliveryOrderNo"]}")
println(" dnNo: ${row["dnNo"]}")
println(" stockSubCategory: ${row["stockSubCategory"]}")
println(" ---")
}
if (result.size > 50) {
println("... (showing first 10 rows, total ${result.size} rows)")
}

return result


+ 47
- 1
src/main/java/com/ffii/fpsms/modules/report/web/ReportController.kt Прегледај датотеку

@@ -773,7 +773,46 @@ class ReportController(
r.createCell(c).apply { setCellValue("-"); cellStyle = styles.text }
}
} else {
dbData.forEach { m ->
fun addDeliveryOrderTotalRow(totalQty: Double) {
val r = sheet.createRow(rowIndex++)
for (c in 0 until totalColumns) {
r.createCell(c).apply {
setCellValue("")
cellStyle = styles.sumEmpty
}
}
r.getCell(6).apply {
setCellValue("每單交貨總數:")
cellStyle = styles.sumLabel
}
r.getCell(7).apply {
setCellValue(totalQty)
cellStyle = styles.sumQty
}
}

// Jasper `totalDeliveredQtyPerDeliveryOrder` is reset by Group1 = itemNo.
// Keep Excel consistent: sort by itemNo then calculate per-item total.
val sorted = dbData.sortedWith(
compareBy<Map<String, Any>>(
{ it["itemNo"]?.toString().orEmpty() },
{ it["deliveryDate"]?.toString().orEmpty() },
{ it["dnNo"]?.toString().orEmpty() },
{ it["deliveryOrderNo"]?.toString().orEmpty() },
),
)

var currentItemNo: String? = null
var itemTotalQty = 0.0

sorted.forEach { m ->
val itemNo = m["itemNo"]?.toString().orEmpty()
if (currentItemNo != null && itemNo != currentItemNo) {
addDeliveryOrderTotalRow(itemTotalQty)
sheet.createRow(rowIndex++)
itemTotalQty = 0.0
}

val r = sheet.createRow(rowIndex++)
setTextCell(r, 0, m["itemNo"], styles.text)
setTextCell(r, 1, m["itemName"], styles.text)
@@ -784,6 +823,13 @@ class ReportController(
setTextCell(r, 6, m["customerName"], styles.text)
setNumberCellFromFormatted(r, 7, m["qty"], styles.int, styles.dash, preferInt = true)
setTextCell(r, 8, m["truckNo"], styles.center)

itemTotalQty += parseSignedNumber(m["qty"]) ?: 0.0
currentItemNo = itemNo
}

if (!currentItemNo.isNullOrBlank()) {
addDeliveryOrderTotalRow(itemTotalQty)
}
}



+ 4
- 1
src/main/java/com/ffii/fpsms/modules/report/web/StockLedgerReportController.kt Прегледај датотеку

@@ -373,7 +373,10 @@ fun generateStockLedgerReport(
setTextCell(r, 1, itemName, styles.text)
setTextCell(r, 2, uom, styles.center)
setTextCell(r, 3, m["trnDate"], styles.center)
setTextCell(r, 4, m["trnRefNo"], styles.center)
val typeText = m["trnRefNo"]?.toString()?.trim().orEmpty().let { t ->
if (t.equals("Expiry", ignoreCase = true)) "過期" else t
}
setTextCell(r, 4, typeText, styles.center)
setTextCell(r, 5, m["lotNo"], styles.text)
setTextCell(r, 6, m["expiryDate"], styles.center)
setIntCellFromFormatted(r, 7, m["cumOpeningBal"], styles.int, styles.dash)


+ 176
- 176
src/main/resources/DeliveryNote/DeliveryNoteCartonLabelsPDF.jrxml Прегледај датотеку

@@ -1,180 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="425" pageHeight="283" columnWidth="385" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="baa9f270-b398-4f1c-b01e-ba216b7997e9">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<parameter name="shopPurchaseOrderNo" class="java.lang.String"/>
<parameter name="shopName" class="java.lang.String"/>
<parameter name="shopAddress" class="java.lang.String"/>
<parameter name="deliveryNoteCode" class="java.lang.String"/>
<parameter name="truckNo" class="java.lang.String"/>
<parameter name="shopCode" class="java.lang.String"/>
<parameter name="shopCodeAbbr" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="243" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField>
<reportElement x="142" y="210" width="240" height="30" uuid="8fac39f8-4936-43a5-8e1f-1afbc8ccca9c">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopPurchaseOrderNo}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="2" y="210" width="140" height="30" uuid="e03fcb92-259c-4427-a68e-60fe5924d763">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[店鋪採購單編號:
<!-- Created with Jaspersoft Studio version 6.17.0.final using JasperReports Library version 6.17.0-6d93193241dd8cc42629e188b94f9e0bc5722efd -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="425" pageHeight="283" columnWidth="425" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="baa9f270-b398-4f1c-b01e-ba216b7997e9">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<parameter name="shopPurchaseOrderNo" class="java.lang.String"/>
<parameter name="shopName" class="java.lang.String"/>
<parameter name="shopAddress" class="java.lang.String"/>
<parameter name="deliveryNoteCode" class="java.lang.String"/>
<parameter name="truckNo" class="java.lang.String"/>
<parameter name="shopCode" class="java.lang.String"/>
<parameter name="shopCodeAbbr" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="243" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField>
<reportElement x="162" y="210" width="240" height="30" uuid="8fac39f8-4936-43a5-8e1f-1afbc8ccca9c">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopPurchaseOrderNo}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="22" y="210" width="140" height="30" uuid="e03fcb92-259c-4427-a68e-60fe5924d763">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[店鋪採購單編號:
]]></text>
</staticText>
<staticText>
<reportElement x="2" y="180" width="140" height="30" uuid="f3ffd4ee-0513-41a5-94d7-f1fdb9966a76">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[送貨單編號:]]></text>
</staticText>
<textField>
<reportElement x="142" y="180" width="240" height="30" uuid="4319059b-9096-4c49-8275-287be93d3e6a">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<textFieldExpression><![CDATA[$P{deliveryNoteCode}]]></textFieldExpression>
</textField>
<textField textAdjust="ScaleFont">
<reportElement x="0" y="0" width="220" height="50" uuid="9a440925-1bd4-4001-9b4b-7163ac27551e">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Top">
<font fontName="微軟正黑體" size="38" isBold="true" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopCode}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="2" y="150" width="140" height="30" uuid="c8b9fafb-9e8b-479f-9a9f-dadda7854f95">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[貨車班次:
</staticText>
<staticText>
<reportElement x="22" y="180" width="140" height="30" uuid="f3ffd4ee-0513-41a5-94d7-f1fdb9966a76">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[送貨單編號:]]></text>
</staticText>
<textField>
<reportElement x="162" y="180" width="240" height="30" uuid="4319059b-9096-4c49-8275-287be93d3e6a">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<textFieldExpression><![CDATA[$P{deliveryNoteCode}]]></textFieldExpression>
</textField>
<textField textAdjust="ScaleFont">
<reportElement x="20" y="0" width="220" height="50" uuid="9a440925-1bd4-4001-9b4b-7163ac27551e">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Top">
<font fontName="微軟正黑體" size="38" isBold="true" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopCode}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="22" y="150" width="140" height="30" uuid="c8b9fafb-9e8b-479f-9a9f-dadda7854f95">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[貨車班次:
]]></text>
</staticText>
<textField>
<reportElement x="142" y="150" width="240" height="30" uuid="57f8e4fa-cea0-42c5-b9e5-a33f0a2710b8">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{truckNo}]]></textFieldExpression>
</textField>
<line>
<reportElement x="2" y="140" width="380" height="1" uuid="3e37c027-d6e9-4a88-b64d-58ba1dd3b22e">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<textField textAdjust="ScaleFont">
<reportElement x="230" y="0" width="152" height="99" uuid="ed6f8ce7-e351-4eeb-9f95-49d64e7ed2dd">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
<pen lineWidth="4.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="100" isBold="true" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopCodeAbbr}]]></textFieldExpression>
</textField>
<textField textAdjust="ScaleFont">
<reportElement x="0" y="50" width="220" height="49" uuid="75a47bc6-5830-4636-9c62-1285163bf0b6">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Top">
<font fontName="微軟正黑體" size="22" isBold="true" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="2" y="106" width="140" height="30" uuid="0ccaeebc-681b-449e-b547-97fc86c35662">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[箱數:]]></text>
</staticText>
<staticText>
<reportElement x="262" y="106" width="120" height="30" uuid="05bc180b-a58d-4ad8-95f6-bc3090ee2c2d">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[ 箱(蛋類除外)]]></text>
</staticText>
<textField>
<reportElement x="142" y="106" width="40" height="30" uuid="dab335a5-e253-498c-a9bf-b9707d8e1099">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="16"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="217" y="106" width="40" height="30" uuid="66d50bad-7b39-49c1-b127-4d763133ee0c">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="16"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="182" y="106" width="35" height="30" uuid="73c18ae5-a07b-4215-a753-fa72d6db87eb">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[/]]></text>
</staticText>
</band>
</detail>
</staticText>
<textField>
<reportElement x="162" y="150" width="240" height="30" uuid="57f8e4fa-cea0-42c5-b9e5-a33f0a2710b8">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{truckNo}]]></textFieldExpression>
</textField>
<line>
<reportElement x="22" y="140" width="380" height="1" uuid="3e37c027-d6e9-4a88-b64d-58ba1dd3b22e">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</line>
<textField textAdjust="ScaleFont">
<reportElement x="250" y="0" width="152" height="99" uuid="ed6f8ce7-e351-4eeb-9f95-49d64e7ed2dd">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
<pen lineWidth="4.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="100" isBold="true" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopCodeAbbr}]]></textFieldExpression>
</textField>
<textField textAdjust="ScaleFont">
<reportElement x="20" y="50" width="220" height="49" uuid="75a47bc6-5830-4636-9c62-1285163bf0b6">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Top">
<font fontName="微軟正黑體" size="22" isBold="true" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{shopName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="22" y="106" width="140" height="30" uuid="0ccaeebc-681b-449e-b547-97fc86c35662">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[箱數:]]></text>
</staticText>
<staticText>
<reportElement x="282" y="106" width="120" height="30" uuid="05bc180b-a58d-4ad8-95f6-bc3090ee2c2d">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[ 箱(蛋類除外)]]></text>
</staticText>
<textField>
<reportElement x="162" y="106" width="40" height="30" uuid="dab335a5-e253-498c-a9bf-b9707d8e1099">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="16"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="237" y="106" width="40" height="30" uuid="66d50bad-7b39-49c1-b127-4d763133ee0c">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="16"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="202" y="106" width="35" height="30" uuid="73c18ae5-a07b-4215-a753-fa72d6db87eb">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="16"/>
</textElement>
<text><![CDATA[/]]></text>
</staticText>
</band>
</detail>
</jasperReport>

Loading…
Откажи
Сачувај