浏览代码

ui update

stockTakeUpdate
CANCERYS\kw093 1周前
父节点
当前提交
ba20fd43fa
共有 2 个文件被更改,包括 15 次插入 和 7 次删除
  1. +11
    -5
      src/main/java/com/ffii/fpsms/modules/stock/service/StockTakeRecordService.kt
  2. +4
    -2
      src/main/java/com/ffii/fpsms/modules/stock/web/StockTakeRecordController.kt

+ 11
- 5
src/main/java/com/ffii/fpsms/modules/stock/service/StockTakeRecordService.kt 查看文件

@@ -1250,7 +1250,7 @@ open class StockTakeRecordService(
return toRemove.size
}

open fun listStockTakeRoundCards(yearMonth: String?): StockTakeRoundCardsRes {
open fun listStockTakeRoundCards(yearMonth: String?, view: String? = null): StockTakeRoundCardsRes {
val all = stockTakeRepository.findAll().filter { !it.deleted }
if (all.isEmpty()) {
val thisMonth = java.time.YearMonth.now().toString()
@@ -1285,13 +1285,19 @@ open class StockTakeRecordService(
val completedYearMonths = (
cards.filter { !it.open }.map { it.yearMonth } + thisMonth
).distinct().filter { it <= thisMonth }.sortedDescending()
val rounds = if (hasOpenRounds) {
val openRoundsSorted = run {
val openCards = cards.filter { it.open }
val thisMonthOpen = openCards.filter { it.yearMonth == thisMonth }
thisMonthOpen + openCards.filter { it.yearMonth != thisMonth }
} else {
val ym = yearMonth?.trim()?.takeIf { it.matches(Regex("\\d{4}-\\d{2}")) } ?: thisMonth
cards.filter { !it.open && it.yearMonth == ym }
}
val historyYm = yearMonth?.trim()?.takeIf { it.matches(Regex("\\d{4}-\\d{2}")) } ?: thisMonth
val historyRounds = cards.filter { !it.open && it.yearMonth == historyYm }
val viewNorm = view?.trim()?.lowercase().orEmpty()
val rounds = when (viewNorm) {
"open" -> openRoundsSorted
"history" -> historyRounds
// 舊行為:有進行中只回 open,否則回該月歷史(PickerCardList 等相容)
else -> if (hasOpenRounds) openRoundsSorted else historyRounds
}
return StockTakeRoundCardsRes(
hasOpenRounds = hasOpenRounds,


+ 4
- 2
src/main/java/com/ffii/fpsms/modules/stock/web/StockTakeRecordController.kt 查看文件

@@ -190,9 +190,11 @@ class StockTakeRecordController(

@GetMapping("/stockTakeRoundCards")
fun stockTakeRoundCards(
@RequestParam(required = false) yearMonth: String?
@RequestParam(required = false) yearMonth: String?,
/** open=進行中;history=歷史(依 yearMonth);未傳則維持舊互斥行為 */
@RequestParam(required = false) view: String?,
): StockTakeRoundCardsRes {
return stockOutRecordService.listStockTakeRoundCards(yearMonth)
return stockOutRecordService.listStockTakeRoundCards(yearMonth, view)
}

@GetMapping("/busyStockTakeSections")


正在加载...
取消
保存