| @@ -5402,6 +5402,48 @@ open fun getLotDetailsByDoPickOrderRecordId(doPickOrderRecordId: Long): Map<Stri | |||||
| ) | ) | ||||
| } | } | ||||
| // ✅ 添加排序逻辑:按楼层(1F > 2F/4F)和 router index 排序 | |||||
| val sortedLineDtos = lineDtos.sortedWith(compareBy( | |||||
| { line -> | |||||
| // 提取楼层排序值:1F = 1, 2F/4F = 2, 其他 = 3 | |||||
| val firstLot = line.lots.firstOrNull() | |||||
| val routerIndex = firstLot?.router?.index | |||||
| val floorSortValue = when (routerIndex) { | |||||
| is String -> { | |||||
| val parts = routerIndex.split("-") | |||||
| if (parts.isNotEmpty()) { | |||||
| val floorPart = parts[0].uppercase() // "1F", "2F", "4F" | |||||
| when (floorPart) { | |||||
| "1F" -> 1 | |||||
| "2F", "4F" -> 2 | |||||
| else -> 3 | |||||
| } | |||||
| } else { | |||||
| 3 | |||||
| } | |||||
| } | |||||
| else -> 3 | |||||
| } | |||||
| floorSortValue | |||||
| }, | |||||
| { line -> | |||||
| // 提取数字部分:格式为 "store_id-number" (如 "2F-004") | |||||
| val firstLot = line.lots.firstOrNull() | |||||
| val routerIndex = firstLot?.router?.index | |||||
| when (routerIndex) { | |||||
| is String -> { | |||||
| val parts = routerIndex.split("-") | |||||
| if (parts.size > 1) { | |||||
| parts.last().toIntOrNull() ?: 999999 | |||||
| } else { | |||||
| routerIndex.toIntOrNull() ?: 999999 | |||||
| } | |||||
| } | |||||
| else -> 999999 | |||||
| } | |||||
| } | |||||
| )) | |||||
| PickOrderDetailResponse( | PickOrderDetailResponse( | ||||
| pickOrderId = po.id, | pickOrderId = po.id, | ||||
| pickOrderCode = po.code, | pickOrderCode = po.code, | ||||
| @@ -5410,7 +5452,7 @@ open fun getLotDetailsByDoPickOrderRecordId(doPickOrderRecordId: Long): Map<Stri | |||||
| consoCode = po.consoCode, | consoCode = po.consoCode, | ||||
| status = po.status?.value, | status = po.status?.value, | ||||
| targetDate = po.targetDate?.toLocalDate(), | targetDate = po.targetDate?.toLocalDate(), | ||||
| pickOrderLines = lineDtos | |||||
| pickOrderLines = sortedLineDtos | |||||
| ) | ) | ||||
| } | } | ||||