Quellcode durchsuchen

reports update

reset-do-picking-order
Tommy\2Fi-Staff vor 6 Tagen
Ursprung
Commit
4ba583fddd
5 geänderte Dateien mit 21 neuen und 17 gelöschten Zeilen
  1. +6
    -2
      src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt
  2. +5
    -5
      src/main/java/com/ffii/fpsms/modules/report/service/StockTakeVarianceReportService.kt
  3. +8
    -8
      src/main/java/com/ffii/fpsms/modules/report/web/StockTakeVarianceReportController.kt
  4. +1
    -1
      src/main/resources/jasper/StockItemConsumptionTrendReport.jrxml
  5. +1
    -1
      src/main/resources/jasper/StockTakeVarianceReport.jrxml

+ 6
- 2
src/main/java/com/ffii/fpsms/modules/report/service/ReportService.kt Datei anzeigen

@@ -876,12 +876,16 @@ fun searchMaterialStockOutTraceabilityReport(
CASE WHEN COALESCE(item_agg.totalMisInputAndLost, 0) < 0 THEN CONCAT('(', FORMAT(-item_agg.totalMisInputAndLost, 0), ')') ELSE FORMAT(COALESCE(item_agg.totalMisInputAndLost, 0), 0) END as totalMisInputAndLost,
CASE WHEN COALESCE(item_agg.totalVariance, 0) < 0 THEN CONCAT('(', FORMAT(-item_agg.totalVariance, 0), ')') ELSE FORMAT(COALESCE(item_agg.totalVariance, 0), 0) END as totalVariance,
CASE WHEN COALESCE(item_agg.totalDefectiveGoods, 0) < 0 THEN CONCAT('(', FORMAT(-item_agg.totalDefectiveGoods, 0), ')') ELSE FORMAT(COALESCE(item_agg.totalDefectiveGoods, 0), 0) END as totalDefectiveGoods,
FORMAT(ROUND(COALESCE(item_agg.total_in_value, 0) - COALESCE(item_agg.total_out_value, 0), 2), 2) as totalStockBalance,
CASE
WHEN COALESCE(item_agg.totalCurrentBalance, 0) > 0
THEN FORMAT(ROUND((COALESCE(item_agg.total_in_value, 0) - COALESCE(item_agg.total_out_value, 0)) / item_agg.totalCurrentBalance, 2), 2)
ELSE '0.00'
END as avgUnitPrice
END as avgUnitPrice,
CASE
WHEN COALESCE(item_agg.totalCurrentBalance, 0) > 0
THEN FORMAT(ROUND(item_agg.totalCurrentBalance * (COALESCE(item_agg.total_in_value, 0) - COALESCE(item_agg.total_out_value, 0)) / item_agg.totalCurrentBalance, 2), 2)
ELSE '0.00'
END as totalStockBalance
FROM (
SELECT
agg.itemCode AS itemNo,


+ 5
- 5
src/main/java/com/ffii/fpsms/modules/report/service/StockTakeVarianceReportService.kt Datei anzeigen

@@ -38,8 +38,8 @@ open class StockTakeVarianceReportService(
stockCategory: String?,
itemCode: String?,
storeLocation: String?,
lastInDateStart: String?, // 前端 startDateStart
lastInDateEnd: String?, // 前端 startDateEnd
stockTakeDateStart: String?,
stockTakeDateEnd: String?,
): List<Map<String, Any>> {
val args = mutableMapOf<String, Any>()
@@ -64,12 +64,12 @@ open class StockTakeVarianceReportService(
}
// 1) toDate:有填用傳入,沒填用今天
val toDate = (lastInDateEnd?.replace("/", "-")
val toDate = (stockTakeDateEnd?.replace("/", "-")
?: LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
// 2) fromDate:有填用傳入,沒填查 stock_ledger 最早日期
val fromDate = if (!lastInDateStart.isNullOrBlank()) {
lastInDateStart.replace("/", "-")
val fromDate = if (!stockTakeDateStart.isNullOrBlank()) {
stockTakeDateStart.replace("/", "-")
} else {
val minDateSql = """
SELECT DATE_FORMAT(MIN(sl.date), '%Y-%m-%d') AS firstDate


+ 8
- 8
src/main/java/com/ffii/fpsms/modules/report/web/StockTakeVarianceReportController.kt Datei anzeigen

@@ -28,15 +28,15 @@ class StockTakeVarianceReportController(
* - stockCategory
* - itemCode
* - storeLocation
* - lastInDateStart / lastInDateEnd
* - stockTakeDateStart / stockTakeDateEnd
*/
@GetMapping("/print-stock-take-variance")
fun generateStockTakeVarianceReport(
@RequestParam(required = false) stockCategory: String?,
@RequestParam(required = false) itemCode: String?,
@RequestParam(required = false) storeLocation: String?,
@RequestParam(required = false) lastInDateStart: String?,
@RequestParam(required = false) lastInDateEnd: String?,
@RequestParam(required = false) stockTakeDateStart: String?,
@RequestParam(required = false) stockTakeDateEnd: String?,
): ResponseEntity<ByteArray> {
val parameters = mutableMapOf<String, Any>()

@@ -51,9 +51,9 @@ class StockTakeVarianceReportController(
parameters["balanceFilterStart"] = ""
parameters["balanceFilterEnd"] = ""

parameters["lastInDateStart"] = lastInDateStart ?: ""
parameters["lastInDateEnd"] = lastInDateEnd ?: ""
parameters["lastOutDateStart"] = ""
parameters["stockTakeDateStart"] = stockTakeDateStart ?: ""
parameters["stockTakeDateEnd"] = stockTakeDateEnd ?: ""
parameters["lastInDateEnd"] = ""
parameters["lastOutDateEnd"] = ""


@@ -62,8 +62,8 @@ class StockTakeVarianceReportController(
stockCategory = stockCategory,
itemCode = itemCode,
storeLocation = storeLocation,
lastInDateStart = lastInDateStart,
lastInDateEnd = lastInDateEnd,
stockTakeDateStart = stockTakeDateStart,
stockTakeDateEnd = stockTakeDateEnd,
)
val stockTakeDateDisplay = dbData
.mapNotNull { it["stockTakeDate"] as? String }


+ 1
- 1
src/main/resources/jasper/StockItemConsumptionTrendReport.jrxml Datei anzeigen

@@ -461,7 +461,7 @@
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{lastOutDateStart} + " " + $P{lastOutDateEnd}]]></textFieldExpression>
<textFieldExpression><![CDATA[$P{lastOutDateStart} + " " + $P{lastOutDateEnd}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="10" y="53" width="90" height="23" uuid="fb09a559-f5fa-4e56-a891-87c600a2745a">


+ 1
- 1
src/main/resources/jasper/StockTakeVarianceReport.jrxml Datei anzeigen

@@ -164,7 +164,7 @@
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="微軟正黑體" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{stockTakeDateStart}+"至"+$P{stockTakeDateEnd}]]></textFieldExpression>
<textFieldExpression><![CDATA[$P{stockTakeDateStart}+" "+$P{stockTakeDateEnd}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="747" y="0" width="21" height="23" uuid="5a1b4b58-b7b1-48c9-b229-7e96392c6425">


Laden…
Abbrechen
Speichern