Переглянути джерело

關閉工單 planStart 每日自動排程;庫存流水帳 Excel 不再印耗時,日結不再寫 sync log。

Co-authored-by: Cursor <[email protected]>
production
CANCERYS\kw093 3 години тому
джерело
коміт
330c02e3e9
3 змінених файлів з 4 додано та 37 видалено
  1. +1
    -24
      src/main/java/com/ffii/fpsms/modules/common/scheduler/service/SchedulerService.kt
  2. +2
    -12
      src/main/java/com/ffii/fpsms/modules/report/web/StockLotLedgerReportController.kt
  3. +1
    -1
      src/main/resources/application.yml

+ 1
- 24
src/main/java/com/ffii/fpsms/modules/common/scheduler/service/SchedulerService.kt Переглянути файл

@@ -622,11 +622,11 @@ open class SchedulerService(
}

/**
* FP-MTMS Version Checklist | Functions Ref. No. 92 | v1.0.0 | 2026-11-06
* Close through [date] (default yesterday). Catch-up from last closed day, capped by catchUpDays.
* Rejects date >= today.
*/
open fun runStockLotDayClose(date: LocalDate? = null): String {
val currentTime = LocalDateTime.now()
return try {
val result = stockLotDayCloseService.closeThrough(
target = date,
@@ -635,36 +635,13 @@ open class SchedulerService(
if (result.skipped) {
val msg = "stock_lot_day close skipped: ${result.skipReason}"
logger.warn("Scheduler - {}", msg)
saveSyncLog(
type = "STOCK_LOT_DAY",
status = "SKIPPED",
result = SyncResult(0, 0, 0, msg),
start = currentTime,
)
return msg
}
val query = "from=${result.dateFrom} to=${result.dateTo} days=${result.days.size} catchUpDays=$stockLotDayCloseCatchUpDays"
saveSyncLog(
type = "STOCK_LOT_DAY",
status = "SUCCESS",
result = SyncResult(
totalProcessed = result.days.size,
totalSuccess = result.totalRows,
totalFail = 0,
query = query,
),
start = currentTime,
)
logger.info("Scheduler - stock_lot_day close done {}", query)
"stock_lot_day close ok $query rows=${result.totalRows}"
} catch (e: Exception) {
logger.error("Scheduler - stock_lot_day close failed: ${e.message}", e)
saveSyncLog(
type = "STOCK_LOT_DAY",
status = "FAILED",
error = e.message,
start = currentTime,
)
throw e
}
}


+ 2
- 12
src/main/java/com/ffii/fpsms/modules/report/web/StockLotLedgerReportController.kt Переглянути файл

@@ -53,6 +53,7 @@ class StockLotLedgerReportController(
return mapOf("earliest" to earliest.format(DateTimeFormatter.ISO_LOCAL_DATE))
}

/** FP-MTMS Version Checklist | Functions Ref. No. 91 | v1.0.0 | 2026-11-06 */
@GetMapping("/print-stock-lot-ledger-excel")
fun exportStockLotLedgerReportExcel(
@RequestParam(required = false) itemCode: String?,
@@ -71,7 +72,6 @@ class StockLotLedgerReportController(
dbData = result.rows,
reportPeriodStart = period.startStr,
reportPeriodEnd = period.endStr,
timings = result.timings,
)
val excelMs = (System.nanoTime() - tExcel) / 1_000_000
val totalMs = (System.nanoTime() - tAll) / 1_000_000
@@ -209,11 +209,11 @@ class StockLotLedgerReportController(
return v?.toString() == "1"
}

/** FP-MTMS Version Checklist | Functions Ref. No. 91 | v1.0.0 | 2026-11-06 */
private fun createExcel(
dbData: List<Map<String, Any>>,
reportPeriodStart: String,
reportPeriodEnd: String,
timings: List<String>,
): ByteArray {
val workbook = SXSSFWorkbook(100)
workbook.setCompressTempFiles(true)
@@ -252,16 +252,6 @@ class StockLotLedgerReportController(
cellStyle = styles.subtitle
}
sheet.addMergedRegion(CellRangeAddress(1, 1, 5, totalColumns - 1))
if (timings.isNotEmpty()) {
val timingRow = sheet.createRow(rowIndex++)
timingRow.createCell(0).apply {
setCellValue("耗時:${timings.joinToString(" | ")}")
cellStyle = styles.subtitle
}
sheet.addMergedRegion(CellRangeAddress(2, 2, 0, totalColumns - 1))
} else {
sheet.createRow(rowIndex++)
}

val headerRowIndex = rowIndex
val headerRow = sheet.createRow(rowIndex++)


+ 1
- 1
src/main/resources/application.yml Переглянути файл

@@ -40,7 +40,7 @@ scheduler:
# Job order: at 00:00:15 daily, process JOs whose planStart was yesterday (hide or reschedule).
jo:
planStart:
enabled: true
enabled: false
# One-time DO1 catch-up jobs (production only — requires scheduler.m18Sync.enabled=true in application-prod.yml).
do1CatchUp:
enabled: false


Завантаження…
Відмінити
Зберегти