Hey Patrick,
You can assign the tracking number yourself before saving it as an order. We ended up doing this because CS2007 allocates 5,000 order numbers for each application instance. If the application pool is reset you jump up to the next block of 5,000. We noticed this first when unit testing.
Here's the stored procedure that we use to do this:
CREATE PROCEDURE [dbo].[RetrieveNextTrackingNumber]
AS
BEGIN
BEGIN TRANSACTION
UPDATE IdentityCounter
SET CurrentId = CurrentId + 1
WHERE CounterName = 'PuchaseOrder.TrackingNumber'
SELECT CurrentId
FROM IdentityCounter
WHERE CounterName = 'PuchaseOrder.TrackingNumber'
COMMIT TRANSACTION
END
Cheers,
Colin