|
|
|
@@ -452,9 +452,9 @@ open class JoPickOrderService( |
|
|
|
"routerArea" to row["routerArea"], |
|
|
|
"routerRoute" to row["routerRoute"], |
|
|
|
"uomShortDesc" to row["uomShortDesc"], |
|
|
|
"match_status" to row["match_status"], |
|
|
|
"match_by" to row["match_by"], |
|
|
|
"match_qty" to row["match_qty"] |
|
|
|
"matchStatus" to row["match_status"], |
|
|
|
"matchBy" to row["match_by"], |
|
|
|
"matchQty" to row["match_qty"] |
|
|
|
) |
|
|
|
} |
|
|
|
) |
|
|
|
@@ -727,9 +727,9 @@ open fun getCompletedJobOrderLotsHierarchical(userId: Long): Map<String, Any?> { |
|
|
|
"routerArea" to row["routerArea"], |
|
|
|
"routerRoute" to row["routerRoute"], |
|
|
|
"uomShortDesc" to row["uomShortDesc"], |
|
|
|
"match_status" to row["match_status"], |
|
|
|
"match_by" to row["match_by"], |
|
|
|
"match_qty" to row["match_qty"] |
|
|
|
"matchStatus" to row["match_status"], |
|
|
|
"matchBy" to row["match_by"], |
|
|
|
"matchQty" to row["match_qty"] |
|
|
|
) |
|
|
|
} |
|
|
|
) |
|
|
|
@@ -905,50 +905,65 @@ open fun assignJobOrderPickOrderToUser(pickOrderId: Long, userId: Long): Message |
|
|
|
} |
|
|
|
} |
|
|
|
// ✅ Fix the updateMatchStatus method |
|
|
|
open fun updateMatchStatus(pickOrderId: Long, itemId: Long): MessageResponse { |
|
|
|
try { |
|
|
|
println("=== Debug: updateMatchStatus ===") |
|
|
|
println("pickOrderId: $pickOrderId, itemId: $itemId") |
|
|
|
|
|
|
|
val joPickOrder = joPickOrderRepository.findByPickOrderIdAndItemId(pickOrderId, itemId) |
|
|
|
|
|
|
|
if (joPickOrder.isEmpty) { |
|
|
|
open fun updateMatchStatus(pickOrderId: Long, itemId: Long, userId: Long, qty: Int): MessageResponse { |
|
|
|
try { |
|
|
|
println("=== Debug: updateMatchStatus ===") |
|
|
|
println("pickOrderId: $pickOrderId, itemId: $itemId, userId: $userId, qty: $qty") |
|
|
|
|
|
|
|
val joPickOrder = joPickOrderRepository.findByPickOrderIdAndItemId(pickOrderId, itemId) |
|
|
|
|
|
|
|
if (joPickOrder.isEmpty) { |
|
|
|
return MessageResponse( |
|
|
|
id = null, |
|
|
|
name = null, |
|
|
|
code = "ERROR", |
|
|
|
type = "NOT_FOUND", |
|
|
|
message = "Job Order Pick Order not found for pickOrderId: $pickOrderId, itemId: $itemId", |
|
|
|
errorPosition = null |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
val joPickOrderEntity = joPickOrder.get() |
|
|
|
|
|
|
|
// ✅ 设置扫描状态和相关字段 |
|
|
|
joPickOrderEntity.matchStatus = JoPickOrderStatus.scanned |
|
|
|
joPickOrderEntity.matchBy = userId |
|
|
|
joPickOrderEntity.matchQty = qty // ✅ 使用传递的 qty |
|
|
|
joPickOrderRepository.save(joPickOrderEntity) |
|
|
|
|
|
|
|
// ✅ 同时更新 jo_pick_order_record |
|
|
|
val joPickOrderRecord = joPickOrderRecordRepository.findByPickOrderIdAndItemId(pickOrderId, itemId) |
|
|
|
if (joPickOrderRecord.isPresent) { |
|
|
|
val recordEntity = joPickOrderRecord.get() |
|
|
|
recordEntity.matchStatus = JoPickOrderStatus.scanned |
|
|
|
recordEntity.matchBy = userId |
|
|
|
recordEntity.matchQty = qty // ✅ 使用相同的 qty |
|
|
|
joPickOrderRecordRepository.save(recordEntity) |
|
|
|
} |
|
|
|
|
|
|
|
println("✅ Updated match status: pickOrderId=$pickOrderId, itemId=$itemId, matchQty=$qty") |
|
|
|
|
|
|
|
return MessageResponse( |
|
|
|
id = null, |
|
|
|
name = null, |
|
|
|
code = "SUCCESS", |
|
|
|
type = "UPDATED", |
|
|
|
message = "Second QR scan status updated to scanned with quantity $qty", |
|
|
|
errorPosition = null |
|
|
|
) |
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
|
println("❌ Error updating second QR scan status: ${e.message}") |
|
|
|
return MessageResponse( |
|
|
|
id = null, |
|
|
|
name = null, |
|
|
|
code = "ERROR", |
|
|
|
type = "NOT_FOUND", |
|
|
|
message = "Job Order Pick Order not found for pickOrderId: $pickOrderId, itemId: $itemId", |
|
|
|
type = "EXCEPTION", |
|
|
|
message = "Error updating second QR scan status: ${e.message}", |
|
|
|
errorPosition = null |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
val joPickOrderEntity = joPickOrder.get() |
|
|
|
joPickOrderEntity.matchStatus = JoPickOrderStatus.scanned // ✅ Use enum instead of string |
|
|
|
joPickOrderRepository.save(joPickOrderEntity) |
|
|
|
|
|
|
|
return MessageResponse( |
|
|
|
id = null, |
|
|
|
name = null, |
|
|
|
code = "SUCCESS", |
|
|
|
type = "UPDATED", |
|
|
|
message = "Second QR scan status updated to checked", |
|
|
|
errorPosition = null |
|
|
|
) |
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
|
println("❌ Error updating second QR scan status: ${e.message}") |
|
|
|
return MessageResponse( |
|
|
|
id = null, |
|
|
|
name = null, |
|
|
|
code = "ERROR", |
|
|
|
type = "EXCEPTION", |
|
|
|
message = "Error updating second QR scan status: ${e.message}", |
|
|
|
errorPosition = null |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
open fun submitSecondScanQty(request: SecondScanSubmitRequest): MessageResponse { |
|
|
|
try { |
|
|
|
println("=== Debug: submitSecondScanQty ===") |
|
|
|
|