|
|
@@ -17,6 +17,8 @@ open class DoFloorSupplierSettingsService( |
|
|
const val SETTING_JO_PICK_EXCLUDE_WAREHOUSES = "JO.pick.excludeWarehouses" |
|
|
const val SETTING_JO_PICK_EXCLUDE_WAREHOUSES = "JO.pick.excludeWarehouses" |
|
|
const val SETTING_DO_PICK_EXCLUDE_PRINT_MODE = "DO.pick.excludePrintMode" |
|
|
const val SETTING_DO_PICK_EXCLUDE_PRINT_MODE = "DO.pick.excludePrintMode" |
|
|
const val SETTING_JO_PICK_EXCLUDE_PRINT_MODE = "JO.pick.excludePrintMode" |
|
|
const val SETTING_JO_PICK_EXCLUDE_PRINT_MODE = "JO.pick.excludePrintMode" |
|
|
|
|
|
const val SETTING_DO_PICK_EXCLUDE_HIDE_QR = "DO.pick.excludeHideQrWarehouses" |
|
|
|
|
|
const val SETTING_JO_PICK_EXCLUDE_HIDE_QR = "JO.pick.excludeHideQrWarehouses" |
|
|
const val PRINT_MODE_HIDE_LIST = "hideList" |
|
|
const val PRINT_MODE_HIDE_LIST = "hideList" |
|
|
const val PRINT_MODE_HIDE_QR = "hideQr" |
|
|
const val PRINT_MODE_HIDE_QR = "hideQr" |
|
|
|
|
|
|
|
|
@@ -36,7 +38,8 @@ open class DoFloorSupplierSettingsService( |
|
|
?.trim() |
|
|
?.trim() |
|
|
.orEmpty() |
|
|
.orEmpty() |
|
|
if (raw.isEmpty()) return defaultList |
|
|
if (raw.isEmpty()) return defaultList |
|
|
val parsed = raw.split(",").map { it.trim() }.filter { it.isNotEmpty() }.distinct() |
|
|
|
|
|
|
|
|
if (raw == EMPTY_CODE_LIST_MARKER) return emptyList() |
|
|
|
|
|
val parsed = raw.split(",").map { it.trim() }.filter { it.isNotEmpty() && it != EMPTY_CODE_LIST_MARKER }.distinct() |
|
|
return parsed.ifEmpty { defaultList } |
|
|
return parsed.ifEmpty { defaultList } |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -69,9 +72,47 @@ open class DoFloorSupplierSettingsService( |
|
|
|
|
|
|
|
|
open fun loadJoPickExcludePrintMode(): String = printModeFromSetting(SETTING_JO_PICK_EXCLUDE_PRINT_MODE) |
|
|
open fun loadJoPickExcludePrintMode(): String = printModeFromSetting(SETTING_JO_PICK_EXCLUDE_PRINT_MODE) |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Warehouses omitted from the print list. Scanning their physical QR does not pass. |
|
|
|
|
|
* Hide-QR warehouses stay on the list and can still be scanned. |
|
|
|
|
|
* A missing hide-QR row keeps the old single print mode. |
|
|
|
|
|
*/ |
|
|
|
|
|
open fun loadDoHideListWarehouseCodes(): Set<String> = |
|
|
|
|
|
hideListCodes( |
|
|
|
|
|
loadDoPickExcludeWarehouseCodes(), |
|
|
|
|
|
SETTING_DO_PICK_EXCLUDE_HIDE_QR, |
|
|
|
|
|
loadDoPickExcludePrintMode(), |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
open fun loadJoHideListWarehouseCodes(): Set<String> = |
|
|
|
|
|
hideListCodes( |
|
|
|
|
|
loadJoPickExcludeWarehouseCodes(), |
|
|
|
|
|
SETTING_JO_PICK_EXCLUDE_HIDE_QR, |
|
|
|
|
|
loadJoPickExcludePrintMode(), |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
open fun rejectsScanOfExcludedWarehouse(printMode: String): Boolean = |
|
|
open fun rejectsScanOfExcludedWarehouse(printMode: String): Boolean = |
|
|
printMode != PRINT_MODE_HIDE_QR |
|
|
printMode != PRINT_MODE_HIDE_QR |
|
|
|
|
|
|
|
|
|
|
|
private fun hideListCodes(all: Set<String>, hideQrSetting: String, legacyMode: String): Set<String> { |
|
|
|
|
|
val row = settingsRepository.findByName(hideQrSetting) |
|
|
|
|
|
val raw = if (row.isEmpty) "" else row.get().value?.trim().orEmpty() |
|
|
|
|
|
if (raw.isEmpty() || raw == EMPTY_CODE_LIST_MARKER) { |
|
|
|
|
|
return if (legacyMode == PRINT_MODE_HIDE_QR) emptySet() else all |
|
|
|
|
|
} |
|
|
|
|
|
val hideQr = parseWarehouseCodes(raw) |
|
|
|
|
|
return all.filter { it !in hideQr }.toSet() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun parseWarehouseCodes(raw: String?): Set<String> { |
|
|
|
|
|
val value = raw?.trim().orEmpty() |
|
|
|
|
|
if (value.isEmpty() || value == EMPTY_CODE_LIST_MARKER) return emptySet() |
|
|
|
|
|
return value.split(",") |
|
|
|
|
|
.map { it.trim().uppercase(Locale.ROOT) } |
|
|
|
|
|
.filter { it.isNotEmpty() && it != EMPTY_CODE_LIST_MARKER } |
|
|
|
|
|
.toSet() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private fun printModeFromSetting(settingName: String): String { |
|
|
private fun printModeFromSetting(settingName: String): String { |
|
|
val raw = settingsRepository.findByName(settingName).map { it.value }.orElse(null)?.trim().orEmpty() |
|
|
val raw = settingsRepository.findByName(settingName).map { it.value }.orElse(null)?.trim().orEmpty() |
|
|
return if (raw == PRINT_MODE_HIDE_QR) PRINT_MODE_HIDE_QR else PRINT_MODE_HIDE_LIST |
|
|
return if (raw == PRINT_MODE_HIDE_QR) PRINT_MODE_HIDE_QR else PRINT_MODE_HIDE_LIST |
|
|
|