소스 검색

Truck Routing Summary Update

master
B.E.N.S.O.N 11 시간 전
부모
커밋
41867ee662
3개의 변경된 파일91개의 추가작업 그리고 48개의 파일을 삭제
  1. +29
    -1
      src/main/java/com/ffii/fpsms/modules/deliveryOrder/service/TruckRoutingSummaryService.kt
  2. +18
    -0
      src/main/java/com/ffii/fpsms/modules/deliveryOrder/web/TruckRoutingSummaryController.kt
  3. +44
    -47
      src/main/resources/DeliveryNote/TruckRoutingSummaryPDF.jrxml

+ 29
- 1
src/main/java/com/ffii/fpsms/modules/deliveryOrder/service/TruckRoutingSummaryService.kt 파일 보기

@@ -1,6 +1,7 @@
package com.ffii.fpsms.modules.deliveryOrder.service

import com.ffii.core.support.JdbcDao
import com.ffii.fpsms.modules.deliveryOrder.enums.DoPickOrderStatus
import org.springframework.stereotype.Service

@Service
@@ -104,7 +105,10 @@ class TruckRoutingSummaryService(
END
) AS shopName,
COALESCE(s.addr3, '') AS address,
CAST(COALESCE(carton_sum.qty, 0) AS CHAR) AS noOfCartons
CASE
WHEN COALESCE(carton_sum.qty, 0) = 0 THEN '-'
ELSE CAST(carton_sum.qty AS CHAR)
END AS noOfCartons
FROM truck t
LEFT JOIN shop s
ON t.shopId = s.id
@@ -145,6 +149,30 @@ class TruckRoutingSummaryService(
)
}

fun getUnpickedOrderCount(storeId: String?, truckLanceCode: String?, reportDate: String?): Int {
if (storeId.isNullOrBlank() || truckLanceCode.isNullOrBlank() || reportDate.isNullOrBlank()) {
return 0
}
val args = mutableMapOf<String, Any>(
"storeId" to storeId.replace("/", ""),
"truckLanceCode" to truckLanceCode.trim(),
"reportDate" to reportDate.trim(),
"pendingStatus" to DoPickOrderStatus.pending.name,
"releasedStatus" to DoPickOrderStatus.released.name,
)
val sql = """
SELECT COUNT(1) AS unpickedCount
FROM do_pick_order dpo
WHERE dpo.deleted = 0
AND REPLACE(dpo.store_id, '/', '') = :storeId
AND dpo.TruckLanceCode = :truckLanceCode
AND dpo.RequiredDeliveryDate = :reportDate
AND dpo.ticket_status IN (:pendingStatus, :releasedStatus)
""".trimIndent()
val row = jdbcDao.queryForList(sql, args).firstOrNull()
return (row?.get("unpickedCount") as? Number)?.toInt() ?: 0
}

/**
* Earliest departure time among trucks matching store + lane (for PDF header).
*/


+ 18
- 0
src/main/java/com/ffii/fpsms/modules/deliveryOrder/web/TruckRoutingSummaryController.kt 파일 보기

@@ -33,6 +33,24 @@ class TruckRoutingSummaryController(
): List<Map<String, String>> =
truckRoutingSummaryService.getLaneOptions(storeId)

@GetMapping("/precheck")
fun precheck(
@RequestParam(required = false) storeId: String?,
@RequestParam(required = false) truckLanceCode: String?,
@RequestParam(required = false) date: String?
): Map<String, Any> {
val reportDate = if (date.isNullOrBlank()) {
LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))
} else {
date
}
val unpickedCount = truckRoutingSummaryService.getUnpickedOrderCount(storeId, truckLanceCode, reportDate)
return mapOf(
"unpickedOrderCount" to unpickedCount,
"hasUnpickedOrders" to (unpickedCount > 0),
)
}

@GetMapping("/print")
fun print(
@RequestParam(required = false) storeId: String?,


+ 44
- 47
src/main/resources/DeliveryNote/TruckRoutingSummaryPDF.jrxml 파일 보기

@@ -14,7 +14,7 @@
<group name="DropOffSequenceGroup">
<groupExpression><![CDATA[$F{dropOffSequence}]]></groupExpression>
<groupFooter>
<band height="10"/>
<band height="3"/>
</groupFooter>
</group>
<title>
@@ -33,28 +33,28 @@
<staticText>
<reportElement x="0" y="0" width="130" height="22" uuid="9d3f5b73-ceaa-4653-909f-e8534d19c61e"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
<font fontName="微軟正黑體" size="14" isBold="true"/>
</textElement>
<text><![CDATA[計劃車次出發時間:]]></text>
</staticText>
<textField>
<reportElement x="130" y="0" width="90" height="22" uuid="92335393-c410-4935-bd28-29a6175a9769"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12"/>
<font fontName="微軟正黑體" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{DEPARTURE_TIME}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="430" y="0" width="45" height="22" uuid="8770a6e7-8a03-47ab-aa3c-00f02815d3b4"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
<font fontName="微軟正黑體" size="14" isBold="true"/>
</textElement>
<text><![CDATA[日期:]]></text>
</staticText>
<textField>
<reportElement x="475" y="0" width="80" height="22" uuid="1a628742-c50c-47a8-9f3d-df91dbc4b184"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12"/>
<font fontName="微軟正黑體" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{REPORT_DATE}]]></textFieldExpression>
</textField>
@@ -66,37 +66,30 @@
<columnHeader>
<band height="28">
<staticText>
<reportElement x="0" y="4" width="50" height="20" uuid="7dbf4192-d9d9-4f3e-95bc-d2700d4e5798"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
<reportElement x="0" y="4" width="60" height="20" uuid="7dbf4192-d9d9-4f3e-95bc-d2700d4e5798"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="14" isBold="true"/>
</textElement>
<text><![CDATA[卸貨順序]]></text>
</staticText>
<staticText>
<reportElement x="60" y="4" width="60" height="20" uuid="9c31b1d9-d866-4555-9ee9-57b924ff2540"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
<reportElement x="70" y="4" width="60" height="20" uuid="9c31b1d9-d866-4555-9ee9-57b924ff2540"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="14" isBold="true"/>
</textElement>
<text><![CDATA[店鋪代碼]]></text>
</staticText>
<staticText>
<reportElement x="120" y="4" width="140" height="20" uuid="e7d49961-b1c8-40b0-a109-29da1142fc8d"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
</textElement>
<text><![CDATA[店鋪名稱]]></text>
</staticText>
<staticText>
<reportElement x="260" y="4" width="260" height="20" uuid="d2538a2b-ebbb-4cbb-a6c1-51249b831afe"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
<reportElement x="140" y="4" width="380" height="20" uuid="e7d49961-b1c8-40b0-a109-29da1142fc8d"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="14" isBold="true"/>
</textElement>
<text><![CDATA[地址]]></text>
<text><![CDATA[店鋪名稱 / 地址]]></text>
</staticText>
<staticText>
<reportElement x="520" y="4" width="34" height="20" uuid="8473f6ea-a5bd-4739-bc05-618c0afb06d2"/>
<reportElement x="520" y="4" width="35" height="20" uuid="8473f6ea-a5bd-4739-bc05-618c0afb06d2"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
<font fontName="微軟正黑體" size="14" isBold="true"/>
</textElement>
<text><![CDATA[箱數]]></text>
</staticText>
@@ -106,39 +99,43 @@
</band>
</columnHeader>
<detail>
<band height="24">
<band height="40" splitType="Stretch">
<rectangle>
<reportElement mode="Opaque" x="0" y="0" width="555" height="40" backcolor="#EFEFEF" uuid="a4c8bcb4-6fa2-4c97-b52d-507f629d54a0">
<printWhenExpression><![CDATA[$V{REPORT_COUNT}.intValue() % 2 == 0]]></printWhenExpression>
</reportElement>
<graphicElement>
<pen lineWidth="0.0"/>
</graphicElement>
</rectangle>
<textField isBlankWhenNull="true">
<reportElement x="0" y="3" width="50" height="18" uuid="31c8d1cf-9298-4866-9dca-d5bbaa08b277"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="11"/>
<reportElement stretchType="RelativeToTallestObject" x="0" y="2" width="60" height="32" uuid="31c8d1cf-9298-4866-9dca-d5bbaa08b277"/>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="微軟正黑體" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{dropOffSequence}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="60" y="3" width="60" height="18" uuid="f4ed6642-ce1c-4130-bf80-1024c5453db4"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="11"/>
<reportElement stretchType="RelativeToTallestObject" x="70" y="2" width="60" height="32" uuid="f4ed6642-ce1c-4130-bf80-1024c5453db4"/>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="微軟正黑體" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{shopCode}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="120" y="3" width="140" height="18" uuid="a44a3df4-a77f-4dda-8b82-d77b47e56eaf"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{shopName}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="260" y="3" width="260" height="18" uuid="553b201d-910f-40d9-aea3-711852ebff59"/>
<textElement verticalAlignment="Middle">
<font fontName="微軟正黑體" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement stretchType="RelativeToTallestObject" x="140" y="2" width="380" height="22" uuid="a44a3df4-a77f-4dda-8b82-d77b47e56eaf"/>
<textElement verticalAlignment="Top">
<font fontName="微軟正黑體" size="14"/>
</textElement>
<textFieldExpression><![CDATA[(($F{shopName} == null || $F{shopName}.trim().isEmpty()) ? "" : ("店鋪:" + $F{shopName}.trim()))
+ (($F{address} == null || $F{address}.trim().isEmpty()) ? "" : (
(($F{shopName} == null || $F{shopName}.trim().isEmpty()) ? "" : "\n") + "地址:" + $F{address}.trim()
))]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="520" y="3" width="34" height="18" uuid="ff0c3947-9dd6-48eb-8ba9-83e47b7cd8e1"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="11"/>
<reportElement stretchType="RelativeToTallestObject" x="520" y="2" width="35" height="32" uuid="ff0c3947-9dd6-48eb-8ba9-83e47b7cd8e1"/>
<textElement textAlignment="Right" verticalAlignment="Top">
<font fontName="微軟正黑體" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{noOfCartons}]]></textFieldExpression>
</textField>


불러오는 중...
취소
저장