Hello
In one of our BTS RFID implementations we are using the “DuplicateTagIdsElimination” event handler.
The event handler is part of BizTalk Server Code Samples.
The client was seeing a strange behaviour, the event handler will work properly for a while. but after some time, it would start to flag all RFID tags as duplicates.
I run a script to constantly send tags to the event handler to try to recreate the issue.
After letting it run for 24 hours, I noticed that the event handler was doing good until midnight, but right after midnight it started to mark all tags as dups.
I looked at the code: the event handler is using the current system time to determine when was a specific tag last seen. it then compares the current system time to the time embedded in the RFID tag itself.
If the elapsed time is bigger then a configurable value, the tag is marked as new, otherwise it is marked as dup.
the interesting lines in the code are:
currentTS = EventLog.getTimeStamp(System.DateTime.Now);// get the current system time
int tagTS = (int) entry.VendorSpecificData[TIMESTAMPKEY]; //get the time stamp imbedded in the tag
elapsedTime = currentTS - tagTS;// calculate the elapsed time.
The event handler fails (by marking valid tags a dups) after midnight because it uses “System.DateTime.Now” as a starting point.
“System.DateTime.Now” takes into consideration the current day.
so, a tag that was introduced at 05/22/20011 11:59:59PM will fail dup check at 05/23/2011 00:00:01AM because the day has changed and the elapsedTime values will be 86,400 (one day in seconds) instead of just 2 seconds.
To resolve this, I recommend using the dup elimination logic in BizTalk RFID Better Duplicate Tag Eliminator.
The code in this event handler is similar to the one provided from Microsoft, BUT uses different approach to calculate the elapsedTime value.
Good Luck
Uri