Genealogy tracking report missing serial numbers after batch split operation

We’re experiencing a critical traceability issue in our genealogy tracking module. After splitting batches during production, the genealogy report is missing several serial numbers that were definitely registered in the system.

The problem occurs specifically when we split a parent batch into multiple child batches. The batch split event completes successfully, and we can see all serial numbers in the shop floor control interface immediately after the split. However, when we generate the genealogy tracking report 2-3 hours later, approximately 30-40% of the serial numbers from the child batches are missing.

I checked the event processor logs and see the batch split events are recorded, but the serial registration order seems inconsistent:

SELECT batch_id, serial_number, registration_time
FROM genealogy_serials
WHERE batch_id IN ('BATCH-001-A', 'BATCH-001-B')
ORDER BY registration_time;
-- Returns only 12 of 20 expected serials

This is blocking our compliance reporting and causing major issues with customer shipment traceability. Anyone encountered similar genealogy report generation problems after batch operations?

I’ve seen this before. Check your event processor configuration - specifically the batch event commit timing. If the genealogy report generation job runs before all serial registration events are fully committed to the database, you’ll get incomplete results. Look at the event_processor.properties file and verify the batch commit interval isn’t too aggressive.

I think I found your issue. We had this exact problem last year and it took us weeks to track down. The root cause was the serial registration order relative to the batch split event timing in the genealogy tracking system.

Here’s what’s happening: When you split a batch, the system creates the child batch records first, then attempts to reassign serials to the new batches. However, the genealogy report generation uses a stored procedure that queries based on batch creation timestamp and serial assignment timestamp. If serials are assigned BEFORE the batch hierarchy relationship is fully committed, they get orphaned in the report query.

The fix involves three steps addressing all the focus areas:

1. Batch Split Event Timing: Modify your batch split workflow to ensure the parent-child relationship is committed before serial reassignment:

-- Add explicit commit after hierarchy creation
INSERT INTO genealogy_parent_child (parent_batch, child_batch, split_time)
VALUES ('BATCH-001', 'BATCH-001-A', CURRENT_TIMESTAMP);
COMMIT;
-- Then proceed with serial reassignment

2. Serial Registration Order: Update the event processor configuration to enforce serial registration sequencing:

In event_processor.properties:


genealogy.batch.split.wait_for_hierarchy=true
genealogy.serial.assignment.verify_parent=true
genealogy.event.sequence.enforce=true

This ensures serial assignments wait for the batch hierarchy to be fully established.

3. Genealogy Report Generation: Modify your report query to use a LEFT JOIN instead of INNER JOIN when pulling serial data:

SELECT b.batch_id, b.parent_batch, s.serial_number, s.registration_time
FROM genealogy_batches b
LEFT JOIN genealogy_serials s ON b.batch_id = s.batch_id
LEFT JOIN genealogy_parent_child pc ON b.batch_id = pc.child_batch
WHERE b.batch_id IN (SELECT batch_id FROM batch_operations WHERE operation_date >= ?)
ORDER BY pc.split_time, s.registration_time;

The LEFT JOIN ensures child batches appear even if there’s a timing issue with serial assignment. You should also add a data validation step in your report generation job:

// Validate serial count before finalizing report
int expectedSerials = getExpectedSerialCount(batchId);
int reportedSerials = reportData.getSerialCount(batchId);
if (reportedSerials < expectedSerials) {
    logger.warn("Incomplete serial data for batch: " + batchId);
    // Trigger retry or alert
}

Additional Recommendations:

  • Enable detailed logging in the genealogy tracking module to capture the exact sequence of batch split and serial assignment events
  • Add a database trigger to validate that serial assignments only occur after batch hierarchy records exist
  • Implement a post-split validation routine that runs 60 seconds after batch splits to verify all serials are properly linked
  • Consider adding a genealogy_audit table to track the complete sequence of operations for troubleshooting

After implementing these changes, run a test batch split and monitor the event processor logs closely. You should see the hierarchy creation complete before any serial reassignments occur. The report should then capture all serials consistently.

Let me know if you need help with the specific SQL modifications or event processor configuration changes.

Mike, are you using real-time or scheduled report generation? We had a similar issue where the report was being triggered by an event listener immediately after the batch split, but the child batch serial assignments hadn’t fully propagated through the genealogy tracking tables yet. The timing window between the batch split event and serial registration completion was causing the gap. We ended up adding a 5-minute delay to our report generation trigger to allow all transactions to complete. Also worth checking if there are any database locks or transaction isolation issues during high-volume batch operations.

Sara, we’re using scheduled generation that runs every 4 hours. The batch splits happen throughout the shift, so there should be plenty of time for commits. Raj, I checked the event_processor.properties and the commit interval is set to 30 seconds, which seems reasonable. What’s puzzling is that the serials ARE visible in the shop floor interface immediately, but missing from reports later.

This smells like a genealogy report query issue rather than a data persistence problem. If the shop floor control shows all serials correctly, the data is definitely in the database. The genealogy tracking report probably uses a different query path or joins that might be filtering out certain records. Check if your report definition has any WHERE clauses that could be excluding child batch serials based on status flags or parent-child relationship conditions. Also verify the report’s data source configuration - sometimes reports point to cached views instead of live tables.

Carlos is on the right track. I’d also look at the genealogy_parent_child table to verify the batch hierarchy is properly established. When batches split, there should be explicit parent-child records created. If those relationship records are missing or have incorrect timestamps, the genealogy report’s recursive query won’t pick up all the serials from child batches.