From f146f5138762ad3e53af9b63f99cc0eaa976aee4 Mon Sep 17 00:00:00 2001 From: "CANCERYS\\kw093" Date: Fri, 30 Oct 2026 14:22:43 +0800 Subject: [PATCH] update --- .../stock/service/StockTakeLocationGuard.kt | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/ffii/fpsms/modules/stock/service/StockTakeLocationGuard.kt b/src/main/java/com/ffii/fpsms/modules/stock/service/StockTakeLocationGuard.kt index 059a2407..83516059 100644 --- a/src/main/java/com/ffii/fpsms/modules/stock/service/StockTakeLocationGuard.kt +++ b/src/main/java/com/ffii/fpsms/modules/stock/service/StockTakeLocationGuard.kt @@ -12,10 +12,8 @@ import org.springframework.stereotype.Service import org.springframework.web.server.ResponseStatusException /** - * Open **section** rounds block only items that appear on that round's stock-take records - * (a section round that skipped lots already on an item round does not freeze those items). - * Open **item** rounds block only items on their records. - * If a section-mode round has no records yet, freeze the whole section (conservative). + * Open **section** rounds freeze the whole section (all items / warehouses in that section). + * Open **item** rounds block only items that appear on their stock-take records (same section). * Stock-take's own variance posting does not call this guard. */ @Service @@ -42,20 +40,9 @@ class StockTakeLocationGuard( StockTakeRoundMode.ITEM.equals(row.getStockTakeRoundMode()?.trim(), ignoreCase = true) } + // Section round: always freeze the entire section (not only items on records). if (sectionModeOpens.isNotEmpty()) { - val sectionRecords = loadRecords(sectionModeOpens).filter { rec -> - section.equals(rec.stockTakeSection?.trim(), ignoreCase = true) - } - if (sectionRecords.isEmpty()) { - // Header created but placeholders not yet → freeze whole section - return "盤點進行中,區域 $section 暫停出入庫" - } - if (itemId == null || itemId <= 0L) { - return "盤點進行中,區域 $section 暫停出入庫" - } - if (sectionRecords.any { it.itemId == itemId }) { - return "盤點進行中,區域 $section 暫停出入庫" - } + return "盤點進行中,區域 $section 暫停出入庫" } if (itemModeOpens.isEmpty()) return null