BEGIN
EXEC FWLTC.SendStatusMessage 'Checking for Reversals...'
DECLARE @TempId int = 0,
@NextTempId int
SET @TempId = (SELECT top 1 TempID FROM #t0127 WHERE TempID > @TempId AND BlockPrinting = 0 order by TempID)
WHILE @TempId is not null
BEGIN
SET @NextTempId = (SELECT top 1 t2.TempID FROM #t0127 t2
inner join #t0127 t1 on t1.PharmID = t2.PharmID AND t1.FacID = t2.FacID AND t1.RxNo = t2.RxNo AND
t1.DispenseDt = t2.DispenseDt AND t1.RoNo = t2.RoNo AND t1.PatID = t2.PatID AND
case when t1.InvoiceGrp is null then '' else t1.InvoiceGrp end = case when t2.InvoiceGrp is null then '' else t2.InvoiceGrp end
AND case when t1.CustomerNo is null then '' else t1.CustomerNo end = case when t2.CustomerNo is null then '' else t2.CustomerNo end
AND t1.Amount = (-1 * t2.Amount)
AND case when t1.BlockPrinting is null then '' else t1.BlockPrinting end = case when t2.BlockPrinting is null then '' else t2.BlockPrinting end
AND t1.TempID != t2.TempID
WHERE t1.TempID = @TempId)
IF @NextTempId IS NOT NULL
BEGIN
UPDATE #t0127 SET BlockPrinting = 1 WHERE TempID = @TempId
UPDATE #t0127 SET BlockPrinting = 1 WHERE TempID = @NextTempId
END
SET @TempId = (SELECT top 1 TempId FROM #t0127 WHERE TempID > @TempId AND BlockPrinting = 0 order by TempID)
END
EXEC FWLTC.SendStatusMessage 'Removing Billed/Reversals...'
DELETE FROM #t0127 where BlockPrinting = 1
DROP TABLE #t0127
DROP TABLE #t0127Exc
END
发回状态信息后一段时间我得到"等待操作超时"在此查询
知道为什么吗?