LRDOWN ;SLC/DG - TOP LEVEL OF DOWNLOAD OPTIONS ;4/4/89 21:37 ;
;;V~5.0~;LAB;;02/27/90 17:09
BUILD ;Build a download file for an Instrument
D INIT G QUIT:Y'>0 S %=($P(LRAUTO(9),"^",5)["N")+1
BU2 ;W !,"Send TRAY/CUP locations" D YN^DICN G QUIT:%<0 I %=0 W !,"If optional for this instrument, should I send the tray,cup locations." G BU2
S LRFORCE=1,%=$P(LRAUTO(9),"^",6)["N"+1 W !,"QUEUE WORK" D YN^DICN G QUIT:%<0 W ! I %<1 W "Answer YES or NO" G BU2
I %=1 S ZTRTN="DQB^LRDOWN",ZTIO="",ZTSAVE("LR*")="" D ^%ZTLOAD G QUIT
DQB D BUILD^LRDOWN1 ;Now ready to build file.
S LRTRAY=LRTRAY1 D @$P(LRAUTO(9),U,3,4) ;Routine from auto instrument file.
G SE2:'$D(LREND),LAST ;Go send the records
QUIT ;CLEAN UP
K ^UTILITY($J),LRLL,LRINST,LRAUTO,LRFILE,LRI,LRTRAY,LRCUP,LRAA,LRAD,LRAN,LRTEST,LRECORD,LRFLUID,LRFORCE,LRL,LRPNM,F,I,J,X,X5,LRRTN
Q
INIT K DIC,ZTSK,LREND S DIC="^LAB(62.4,",DIC(0)="AMEQZ",DIC("S")="I Y<99" D ^DIC K DIC I Y'>0 W !,"TRY LATER" Q
S LRINST=+Y,LRAUTO=Y(0),LRAUTO(9)=$S($D(^LAB(62.4,LRINST,9)):^(9),1:"") I LRAUTO(9)="" S Y=0 W !,"Sorry I don't know how to build for this Instrument"
S LRLL=$P(LRAUTO,"^",4) W !,"Working on the download file for instrument ",$P(LRAUTO,"^",1)," from Load list ",$P(^LRO(68.2,LRLL,0),"^",1)
IN2 S X=1 ;W !,"Starting Tray number: 1//" R X:DTIME Q:X["^" I X["?" W !," Enter a tray to start the build and sending at." G IN2
S LRTRAY1=$S(X="":1,1:+X)
Q
PURGE ;Remove the download records from the Load List file, Should be removed when sent.
D INIT G QUIT:Y'>0 S %=2 W !,"Is this OK" D YN^DICN G QUIT:%'=1
F T=0:0 S T=$O(^LRO(68.2,LRLL,1,T)) Q:T'>0 F C=0:0 S C=$O(^LRO(68.2,LRLL,1,T,1,C)) Q:C'>0 K ^LRO(68.2,LRLL,1,T,1,C,2)
K T,C W !,"DONE" G QUIT
;
SEND D INIT G QUIT:Y'>0
SE2 K LRFILE W:'$D(ZTSK) !,"Now setting up to send."
S TSK=LRINST,LRRTN=$P(LRAUTO(9),"^",1,2),LRFILE=$P(^LRO(68.2,LRLL,0),"^",1),T=TSK D SET^LAB
D @("START^"_$P(LRRTN,"^",2)) ;Set-up call
F LRTRAY=LRTRAY1:0 D:$D(^LRO(68.2,LRLL,1,LRTRAY)) TRAY S LRTRAY=$O(^LRO(68.2,LRLL,1,LRTRAY)) Q:LRTRAY'>0
SE3 D @("END^"_$P(LRRTN,"^",2)) ;Clean-up call
LAST W:'$D(ZTSK) !,"DONE. Data should start moving now" G QUIT
NEW ;Start a new file for each tray.
D @("NEXT^"_$P(LRRTN,"^",2)) Q
TRAY S LRNEW=1 Q:LRTRAY'>0 F LRCUP=0:0 S LRCUP=$O(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP)) Q:LRCUP'>0 D NEW:LRNEW S LRNEW=0 I $D(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP,2)) S X=^(2) D @LRRTN
LRDOWN ;SLC/DG - TOP LEVEL OF DOWNLOAD OPTIONS ;4/4/89 21:37 ;
+1 ;;V~5.0~;LAB;;02/27/90 17:09
BUILD ;Build a download file for an Instrument
+1 DO INIT
IF Y'>0
GOTO QUIT
SET %=($PIECE(LRAUTO(9),"^",5)["N")+1
BU2 ;W !,"Send TRAY/CUP locations" D YN^DICN G QUIT:%<0 I %=0 W !,"If optional for this instrument, should I send the tray,cup locations." G BU2
+1 SET LRFORCE=1
SET %=$PIECE(LRAUTO(9),"^",6)["N"+1
WRITE !,"QUEUE WORK"
DO YN^DICN
IF %<0
GOTO QUIT
WRITE !
IF %<1
WRITE "Answer YES or NO"
GOTO BU2
+2 IF %=1
SET ZTRTN="DQB^LRDOWN"
SET ZTIO=""
SET ZTSAVE("LR*")=""
DO ^%ZTLOAD
GOTO QUIT
DQB ;Now ready to build file.
DO BUILD^LRDOWN1
+1 ;Routine from auto instrument file.
SET LRTRAY=LRTRAY1
DO @$PIECE(LRAUTO(9),U,3,4)
+2 ;Go send the records
IF '$DATA(LREND)
GOTO SE2
GOTO LAST
QUIT ;CLEAN UP
+1 KILL ^UTILITY($JOB),LRLL,LRINST,LRAUTO,LRFILE,LRI,LRTRAY,LRCUP,LRAA,LRAD,LRAN,LRTEST,LRECORD,LRFLUID,LRFORCE,LRL,LRPNM,F,I,J,X,X5,LRRTN
+2 QUIT
INIT KILL DIC,ZTSK,LREND
SET DIC="^LAB(62.4,"
SET DIC(0)="AMEQZ"
SET DIC("S")="I Y<99"
DO ^DIC
KILL DIC
IF Y'>0
WRITE !,"TRY LATER"
QUIT
+1 SET LRINST=+Y
SET LRAUTO=Y(0)
SET LRAUTO(9)=$SELECT($DATA(^LAB(62.4,LRINST,9)):^(9),1:"")
IF LRAUTO(9)=""
SET Y=0
WRITE !,"Sorry I don't know how to build for this Instrument"
+2 SET LRLL=$PIECE(LRAUTO,"^",4)
WRITE !,"Working on the download file for instrument ",$PIECE(LRAUTO,"^",1)," from Load list ",$PIECE(^LRO(68.2,LRLL,0),"^",1)
IN2 ;W !,"Starting Tray number: 1//" R X:DTIME Q:X["^" I X["?" W !," Enter a tray to start the build and sending at." G IN2
SET X=1
+1 SET LRTRAY1=$SELECT(X="":1,1:+X)
+2 QUIT
PURGE ;Remove the download records from the Load List file, Should be removed when sent.
+1 DO INIT
IF Y'>0
GOTO QUIT
SET %=2
WRITE !,"Is this OK"
DO YN^DICN
IF %'=1
GOTO QUIT
+2 FOR T=0:0
SET T=$ORDER(^LRO(68.2,LRLL,1,T))
IF T'>0
QUIT
FOR C=0:0
SET C=$ORDER(^LRO(68.2,LRLL,1,T,1,C))
IF C'>0
QUIT
KILL ^LRO(68.2,LRLL,1,T,1,C,2)
+3 KILL T,C
WRITE !,"DONE"
GOTO QUIT
+4 ;
SEND DO INIT
IF Y'>0
GOTO QUIT
SE2 KILL LRFILE
IF '$DATA(ZTSK)
WRITE !,"Now setting up to send."
+1 SET TSK=LRINST
SET LRRTN=$PIECE(LRAUTO(9),"^",1,2)
SET LRFILE=$PIECE(^LRO(68.2,LRLL,0),"^",1)
SET T=TSK
DO SET^LAB
+2 ;Set-up call
DO @("START^"_$PIECE(LRRTN,"^",2))
+3 FOR LRTRAY=LRTRAY1:0
IF $DATA(^LRO(68.2,LRLL,1,LRTRAY))
DO TRAY
SET LRTRAY=$ORDER(^LRO(68.2,LRLL,1,LRTRAY))
IF LRTRAY'>0
QUIT
SE3 ;Clean-up call
DO @("END^"_$PIECE(LRRTN,"^",2))
LAST IF '$DATA(ZTSK)
WRITE !,"DONE. Data should start moving now"
GOTO QUIT
NEW ;Start a new file for each tray.
+1 DO @("NEXT^"_$PIECE(LRRTN,"^",2))
QUIT
TRAY SET LRNEW=1
IF LRTRAY'>0
QUIT
FOR LRCUP=0:0
SET LRCUP=$ORDER(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP))
IF LRCUP'>0
QUIT
IF LRNEW
DO NEW
SET LRNEW=0
IF $DATA(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP,2))
SET X=^(2)
DO @LRRTN