|
|
@@ -2385,11 +2385,11 @@ open class ProductProcessService( |
|
|
val allLines = productProcessLineRepository.findByProductProcess_Id(productProcessId) |
|
|
val allLines = productProcessLineRepository.findByProductProcess_Id(productProcessId) |
|
|
.sortedBy { it.seqNo ?: 0L } |
|
|
.sortedBy { it.seqNo ?: 0L } |
|
|
|
|
|
|
|
|
println("=== findNewCreatedLineIds DEBUG START ===") |
|
|
|
|
|
println("BOM bomProcessMap: $bomProcessMap") |
|
|
|
|
|
println("All lines (sorted by seqNo):") |
|
|
|
|
|
|
|
|
//println("=== findNewCreatedLineIds DEBUG START ===") |
|
|
|
|
|
//println("BOM bomProcessMap: $bomProcessMap") |
|
|
|
|
|
//println("All lines (sorted by seqNo):") |
|
|
allLines.forEach { line -> |
|
|
allLines.forEach { line -> |
|
|
println(" id=${line.id}, seqNo=${line.seqNo}, bomProcessId=${line.bomProcess?.id}") |
|
|
|
|
|
|
|
|
//println(" id=${line.id}, seqNo=${line.seqNo}, bomProcessId=${line.bomProcess?.id}") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 创建一个集合来跟踪哪些 line 是新创建的 |
|
|
// 创建一个集合来跟踪哪些 line 是新创建的 |
|
|
@@ -2402,18 +2402,18 @@ open class ProductProcessService( |
|
|
iteration++ |
|
|
iteration++ |
|
|
hasChanges = false |
|
|
hasChanges = false |
|
|
|
|
|
|
|
|
println("\n--- Iteration $iteration ---") |
|
|
|
|
|
|
|
|
//println("\n--- Iteration $iteration ---") |
|
|
|
|
|
|
|
|
// 获取剩余的 line(排除已标记为新创建的),按 seqNo 排序 |
|
|
// 获取剩余的 line(排除已标记为新创建的),按 seqNo 排序 |
|
|
val remainingLines = allLines.filter { it.id !in newCreatedLineIds } |
|
|
val remainingLines = allLines.filter { it.id !in newCreatedLineIds } |
|
|
.sortedBy { it.seqNo ?: 0L } |
|
|
.sortedBy { it.seqNo ?: 0L } |
|
|
|
|
|
|
|
|
println("Remaining lines (excluding new created):") |
|
|
|
|
|
|
|
|
//println("Remaining lines (excluding new created):") |
|
|
remainingLines.forEach { line -> |
|
|
remainingLines.forEach { line -> |
|
|
println(" id=${line.id}, seqNo=${line.seqNo}, bomProcessId=${line.bomProcess?.id}") |
|
|
|
|
|
|
|
|
//println(" id=${line.id}, seqNo=${line.seqNo}, bomProcessId=${line.bomProcess?.id}") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
println("New created line IDs so far: $newCreatedLineIds") |
|
|
|
|
|
|
|
|
//println("New created line IDs so far: $newCreatedLineIds") |
|
|
|
|
|
|
|
|
// 计算每个剩余 line 的期望 seqNo(应该是连续的 1, 2, 3...) |
|
|
// 计算每个剩余 line 的期望 seqNo(应该是连续的 1, 2, 3...) |
|
|
val expectedSeqNoMap = remainingLines.mapIndexed { index, line -> |
|
|
val expectedSeqNoMap = remainingLines.mapIndexed { index, line -> |
|
|
@@ -2430,7 +2430,7 @@ open class ProductProcessService( |
|
|
val bomProcessId = line.bomProcess?.id |
|
|
val bomProcessId = line.bomProcess?.id |
|
|
val expectedSeqNo = expectedSeqNoMap[line.id] ?: continue |
|
|
val expectedSeqNo = expectedSeqNoMap[line.id] ?: continue |
|
|
|
|
|
|
|
|
println("\nChecking line id=${line.id}, seqNo=${line.seqNo}, bomProcessId=$bomProcessId, expectedSeqNo=$expectedSeqNo") |
|
|
|
|
|
|
|
|
//println("\nChecking line id=${line.id}, seqNo=${line.seqNo}, bomProcessId=$bomProcessId, expectedSeqNo=$expectedSeqNo") |
|
|
|
|
|
|
|
|
if (bomProcessId == null) { |
|
|
if (bomProcessId == null) { |
|
|
println(" -> No bomProcessId, marking as new created") |
|
|
println(" -> No bomProcessId, marking as new created") |
|
|
@@ -2442,7 +2442,7 @@ open class ProductProcessService( |
|
|
// 查找这个 bomProcessId 在 BOM 中的实际 seqNo |
|
|
// 查找这个 bomProcessId 在 BOM 中的实际 seqNo |
|
|
val bomProcessSeqNo = bomProcessMap[bomProcessId] |
|
|
val bomProcessSeqNo = bomProcessMap[bomProcessId] |
|
|
|
|
|
|
|
|
println(" -> BOM bomProcessId=$bomProcessId has seqNo=$bomProcessSeqNo in BOM") |
|
|
|
|
|
|
|
|
//println(" -> BOM bomProcessId=$bomProcessId has seqNo=$bomProcessSeqNo in BOM") |
|
|
|
|
|
|
|
|
if (bomProcessSeqNo == null) { |
|
|
if (bomProcessSeqNo == null) { |
|
|
println(" -> bomProcessId not found in BOM, marking as new created") |
|
|
println(" -> bomProcessId not found in BOM, marking as new created") |
|
|
@@ -2461,8 +2461,8 @@ open class ProductProcessService( |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
println("\n=== Final Result ===") |
|
|
|
|
|
println("New created line IDs: $newCreatedLineIds") |
|
|
|
|
|
|
|
|
//println("\n=== Final Result ===") |
|
|
|
|
|
//println("New created line IDs: $newCreatedLineIds") |
|
|
println("=== findNewCreatedLineIds DEBUG END ===\n") |
|
|
println("=== findNewCreatedLineIds DEBUG END ===\n") |
|
|
|
|
|
|
|
|
return newCreatedLineIds |
|
|
return newCreatedLineIds |
|
|
|