LATDX ; IHS/DIR/FJE - ABBOTT TDX,PACKARD TDX 7/20/90 10:16 ;
;;5.2;LA;;NOV 01, 1997
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
;CROSS LINK BY CUP
LA1 S:$D(ZTQUEUED) ZTREQ="@" S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)) Q:TSK<1
Q:'$D(^LA(TSK))
D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP")
LA2 S TOUT=0 D IN G QUIT:TOUT,LA2:$E(IN,1,5)'="ASSAY" S TEST=$E(IN,8,23)
F I=0:0 S I=$O(TC(I)) Q:I<1 S X1=TC(I,4) Q:X1=TEST
G LA2:'$D(X1)!(X1'=TEST) S TESTX=I
LA2A D IN I $E(IN,1,8)="CAROUSEL" S V=$E(IN,11,12) D NUM S TRAY=+V
G LA2A:$E(IN,1,3)'="LOC"
S TOUT=0 S:'$D(TRAY) TRAY=1 F A=1:1:20 D IN S V=$E(IN,1,2) D NUM Q:+V>20!(+V<1) S CUP=+V,V=$E(IN,5,13) D NUM S:+V'=0 @TC(TESTX,1)=V D LA3
K TV G LA2:IN'["CALCULATION" F A=1:1:2 S TOUT=0 D IN G QUIT:TOUT
S V=$E(IN,24,36) D NUM S TEST=V F I=0:0 S I=$O(TC(I)) Q:I<1 S X1=TC(I,4) Q:X1=TEST
G LA2:'$D(X1)!(X1'=TEST) S TESTX=I
S TOUT=0 F A=1:1:20 D IN S V=$E(IN,1,2) D NUM Q:+V>20!(+V<1) S CUP=+V,V=$E(IN,24,35) D NUM S:+V @TC(TESTX,1)=V D LA3
K TV G LA2
LA3 X LAGEN
F I=0:0 S I=$O(TV(I)) Q:I<1 S:TV(I,1)]"" ^LAH(LWL,1,ISQN,I)=TV(I,1)
Q
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
S Y(A)=IN Q
NUM S X="" F JJ=1:1:$L(V) S:$A(V,JJ)>32 X=X_$E(V,JJ)
S V=X Q
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>300 H 5 G IN
S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0
S:IN["~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
Q
QUIT LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK)
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
LATDX ; IHS/DIR/FJE - ABBOTT TDX,PACKARD TDX 7/20/90 10:16 ;
+1 ;;5.2;LA;;NOV 01, 1997
+2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
+3 ;CROSS LINK BY CUP
LA1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
SET LANM=$TEXT(+0)
SET TSK=$ORDER(^LAB(62.4,"C",LANM,0))
IF TSK<1
QUIT
+1 IF '$DATA(^LA(TSK))
QUIT
+2 DO ^LASET
IF 'TSK
QUIT
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
LA2 SET TOUT=0
DO IN
IF TOUT
GOTO QUIT
IF $EXTRACT(IN,1,5)'="ASSAY"
GOTO LA2
SET TEST=$EXTRACT(IN,8,23)
+1 FOR I=0:0
SET I=$ORDER(TC(I))
IF I<1
QUIT
SET X1=TC(I,4)
IF X1=TEST
QUIT
+2 IF '$DATA(X1)!(X1'=TEST)
GOTO LA2
SET TESTX=I
LA2A DO IN
IF $EXTRACT(IN,1,8)="CAROUSEL"
SET V=$EXTRACT(IN,11,12)
DO NUM
SET TRAY=+V
+1 IF $EXTRACT(IN,1,3)'="LOC"
GOTO LA2A
+2 SET TOUT=0
IF '$DATA(TRAY)
SET TRAY=1
FOR A=1:1:20
DO IN
SET V=$EXTRACT(IN,1,2)
DO NUM
IF +V>20!(+V<1)
QUIT
SET CUP=+V
SET V=$EXTRACT(IN,5,13)
DO NUM
IF +V'=0
SET @TC(TESTX,1)=V
DO LA3
+3 KILL TV
IF IN'["CALCULATION"
GOTO LA2
FOR A=1:1:2
SET TOUT=0
DO IN
IF TOUT
GOTO QUIT
+4 SET V=$EXTRACT(IN,24,36)
DO NUM
SET TEST=V
FOR I=0:0
SET I=$ORDER(TC(I))
IF I<1
QUIT
SET X1=TC(I,4)
IF X1=TEST
QUIT
+5 IF '$DATA(X1)!(X1'=TEST)
GOTO LA2
SET TESTX=I
+6 SET TOUT=0
FOR A=1:1:20
DO IN
SET V=$EXTRACT(IN,1,2)
DO NUM
IF +V>20!(+V<1)
QUIT
SET CUP=+V
SET V=$EXTRACT(IN,24,35)
DO NUM
IF +V
SET @TC(TESTX,1)=V
DO LA3
+7 KILL TV
GOTO LA2
LA3 XECUTE LAGEN
+1 FOR I=0:0
SET I=$ORDER(TV(I))
IF I<1
QUIT
IF TV(I,1)]""
SET ^LAH(LWL,1,ISQN,I)=TV(I,1)
+2 QUIT
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
+1 SET Y(A)=IN
QUIT
NUM SET X=""
FOR JJ=1:1:$LENGTH(V)
IF $ASCII(V,JJ)>32
SET X=X_$EXTRACT(V,JJ)
+1 SET V=X
QUIT
IN SET CNT=^LA(TSK,"I",0)+1
IF '$DATA(^(CNT))
SET TOUT=TOUT+1
IF TOUT>300
QUIT
HANG 5
GOTO IN
+1 SET ^LA(TSK,"I",0)=CNT
SET IN=^(CNT)
SET TOUT=0
+2 IF IN["~"
SET CTRL=$PIECE(IN,"~",2)
SET IN=$PIECE(IN,"~",1)
+3 QUIT
QUIT LOCK ^LA(TSK)
HANG 1
KILL ^LA(TSK),^LA("LOCK",TSK)
+1 QUIT
TRAP ;ERROR TRAP
DO ^LABERR
SET T=TSK
DO SET^LAB
GOTO @("LA2^"_LANM)