• The #temp table isn't strictly necessary but may improve performance:

    ;WITH MassagedData AS (

    SELECT Company,

    MIN_Number = MIN(Number),

    MAX_Number = MAX(Number),

    rn = ROW_NUMBER() OVER(PARTITION BY Company ORDER BY MIN(Number))

    FROM (

    SELECT Company, Number,

    gp = Number - ROW_NUMBER() OVER(PARTITION BY Company ORDER BY Number)

    FROM #TransDetail

    ) d

    GROUP BY Company, gp

    )

    SELECT a.Company, PriorNumber = a.MAX_Number, NextNumber = b.MIN_Number

    INTO #RangeBoundaries

    FROM MassagedData a

    INNER JOIN MassagedData b

    ON b.Company = a.Company AND b.rn = a.rn + 1

    SELECT r.Company, p.[Site],

    r.PriorNumber, PriorDate = p.TransDate, PriorTime = p.TransTime,

    r.NextNumber, NextDate = n.TransDate, NextTime = n.TransTime

    FROM #RangeBoundaries r

    LEFT JOIN #TransDetail p ON p.Company = r.Company AND p.Number = r.PriorNumber

    LEFT JOIN #TransDetail n ON n.Company = r.Company AND n.Number = r.NextNumber

    ORDER BY r.Company, r.PriorNumber

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden