| @@ -3941,19 +3941,27 @@ ORDER BY | |||||
| // 按 router index 排序 | // 按 router index 排序 | ||||
| allPickOrderLines.sortWith(compareBy( | allPickOrderLines.sortWith(compareBy( | ||||
| { line -> | |||||
| val lots = line["lots"] as? List<Map<String, Any?>> | |||||
| val firstLot = lots?.firstOrNull() | |||||
| val router = firstLot?.get("router") as? Map<String, Any?> | |||||
| val indexValue = router?.get("index") | |||||
| // 修复:支持字符串和数字两种格式 | |||||
| when (indexValue) { | |||||
| is Number -> indexValue.toInt() | |||||
| is String -> indexValue.toIntOrNull() ?: 999999 | |||||
| else -> 999999 | |||||
| { line -> | |||||
| val lots = line["lots"] as? List<Map<String, Any?>> | |||||
| val firstLot = lots?.firstOrNull() | |||||
| val router = firstLot?.get("router") as? Map<String, Any?> | |||||
| val indexValue = router?.get("index") | |||||
| // 修复:支持字符串和数字两种格式,新格式为 "store_id-number" (如 "2F-004") | |||||
| when (indexValue) { | |||||
| is Number -> indexValue.toInt() | |||||
| is String -> { | |||||
| // 提取数字部分:格式为 "store_id-number",取 "-" 后的数字 | |||||
| val parts = indexValue.split("-") | |||||
| if (parts.size > 1) { | |||||
| parts.last().toIntOrNull() ?: 999999 | |||||
| } else { | |||||
| indexValue.toIntOrNull() ?: 999999 | |||||
| } | |||||
| } | } | ||||
| else -> 999999 | |||||
| } | } | ||||
| )) | |||||
| } | |||||
| )) | |||||
| // 构建 FG 信息 | // 构建 FG 信息 | ||||
| val fgInfo = mapOf( | val fgInfo = mapOf( | ||||
| @@ -4298,13 +4306,26 @@ println("DEBUG sol polIds in linesResults: " + linesResults.mapNotNull { it["sto | |||||
| } | } | ||||
| // 合并到总列表 | // 合并到总列表 | ||||
| allPickOrderLines.sortWith(compareBy( | allPickOrderLines.sortWith(compareBy( | ||||
| { line -> | |||||
| val lots = line["lots"] as? List<Map<String, Any?>> | |||||
| val firstLot = lots?.firstOrNull() | |||||
| val router = firstLot?.get("router") as? Map<String, Any?> | |||||
| (router?.get("index") as? Number)?.toInt() ?: 999999 | |||||
| { line -> | |||||
| val lots = line["lots"] as? List<Map<String, Any?>> | |||||
| val firstLot = lots?.firstOrNull() | |||||
| val router = firstLot?.get("router") as? Map<String, Any?> | |||||
| val indexValue = router?.get("index") | |||||
| when (indexValue) { | |||||
| is Number -> indexValue.toInt() | |||||
| is String -> { | |||||
| // 提取数字部分:格式为 "store_id-number",取 "-" 后的数字 | |||||
| val parts = indexValue.split("-") | |||||
| if (parts.size > 1) { | |||||
| parts.last().toIntOrNull() ?: 999999 | |||||
| } else { | |||||
| indexValue.toIntOrNull() ?: 999999 | |||||
| } | |||||
| } | } | ||||
| )) | |||||
| else -> 999999 | |||||
| } | |||||
| } | |||||
| )) | |||||
| // 构建 FG 信息 | // 构建 FG 信息 | ||||