|
|
|
@@ -2773,11 +2773,11 @@ if (existingRecords.isNotEmpty()) { |
|
|
|
return emptyList() |
|
|
|
} |
|
|
|
|
|
|
|
if (pickOrder.status?.value !in listOf("assigned", "released", "picking", "completed")) { |
|
|
|
if (pickOrder.status?.value !in listOf("assigned", "released", "picking")) { |
|
|
|
println("❌ Pick order status is not in allowed states: ${pickOrder.status?.value}") |
|
|
|
return emptyList() |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val deliveryOrder = pickOrder.deliveryOrder |
|
|
|
val shop = deliveryOrder?.shop |
|
|
|
val supplier = deliveryOrder?.supplier |
|
|
|
@@ -3168,7 +3168,9 @@ open fun getAllPickOrderLotsWithDetailsHierarchical(userId: Long): Map<String, A |
|
|
|
// Get all pick orders assigned to user with PENDING or RELEASED status that have doId |
|
|
|
val allAssignedPickOrders = pickOrderRepository.findAllByAssignToAndStatusIn( |
|
|
|
user, |
|
|
|
listOf(PickOrderStatus.PENDING, PickOrderStatus.RELEASED, PickOrderStatus.COMPLETED) |
|
|
|
listOf(PickOrderStatus.PENDING, PickOrderStatus.RELEASED |
|
|
|
// , PickOrderStatus.COMPLETED |
|
|
|
) |
|
|
|
).filter { it.deliveryOrder != null } // Only pick orders with doId |
|
|
|
|
|
|
|
println("🔍 DEBUG: Found ${allAssignedPickOrders.size} pick orders assigned to user $userId") |
|
|
|
@@ -3341,11 +3343,11 @@ open fun getAllPickOrderLotsWithDetailsHierarchical(userId: Long): Map<String, A |
|
|
|
println("✅ Total result count: ${results.size}") |
|
|
|
|
|
|
|
// Filter out lots with null availableQty (rejected lots) |
|
|
|
val filteredResults = results.filter { row -> |
|
|
|
val availableQty = row["availableQty"] |
|
|
|
availableQty != null |
|
|
|
} |
|
|
|
|
|
|
|
// val filteredResults = results.filter { row -> |
|
|
|
//val availableQty = row["availableQty"] |
|
|
|
// availableQty != null |
|
|
|
// } |
|
|
|
val filteredResults = results |
|
|
|
println("✅ Filtered result count: ${filteredResults.size}") |
|
|
|
|
|
|
|
// ✅ Transform flat results into hierarchical structure |
|
|
|
@@ -3432,6 +3434,7 @@ open fun getAllPickOrderLotsWithDetailsHierarchical(userId: Long): Map<String, A |
|
|
|
"pickOrderLines" to pickOrderLinesMap as Any? |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
// Fix the type issues in the getPickOrdersByDateAndStore method |
|
|
|
open fun getPickOrdersByDateAndStore(storeId: String): Map<String, Any?> { |
|
|
|
println("=== Debug: getPickOrdersByDateAndStore ===") |
|
|
|
|