ENWOME ;(WASH ISC)/SAB-WORK ORDER MULTIPLE ENTRY ;1-27-97
;;7.0;ENGINEERING;**35**;Aug 17, 1993
N NUMBER,SHOPKEY,WARD
K ^TMP($J)
S DIR("A")="Enter a new equipment work order and copy it (Y/N)"
S DIR(0)="Y",DIR("B")="YES" D ^DIR K DIR G:'Y!$D(DIRUT) EXIT
; get first w.o.
D SSHOP^ENWO G:ENSHKEY'>0 EXIT
S SHOPKEY=ENSHKEY
S NUMBER="" D WONUM^ENWONEW I NUMBER="" D G EXIT
. W !!,*7,"Can't seem to add to Work Order File."
. W !,"Please try again later or contact IRM Service."
S ENWODA=DA L +^ENG(6920,ENWODA)
W !,"WORK ORDER #: ",NUMBER
S WARD=0 D WOFILL^ENWONEW
EDITWO ; edit work order
S DR=$S($D(^DIE("B","ENZWONEW")):"[ENZWONEW]",1:"[ENWONEW]")
D ^DIE I $D(DTOUT) D DELWO G EXIT
S ENEQDA=$P($G(^ENG(6920,ENWODA,3)),U,8)
I ENEQDA']"" D G:Y EDITWO D DELWO G EXIT
. W !,"An Equipment ID # is required by this option."
. S DIR(0)="Y"
. S DIR("A")="Do you want to edit the work order (Y/N)",DIR("B")="YES"
. D ^DIR K DIR
S DIR(0)="Y",DIR("B")="NO"
S DIR("A")="Do you want to CLOSE this work order now (Y/N)"
D ^DIR K DIR D:Y I $D(DIRUT) D DELWO G EXIT
. S DR=$S($D(^DIE("B","ENZWONEWCLOSE")):"[ENZWONEWCLOSE]",1:"[ENWONEWCLOSE]")
. D ^DIE
S DIR(0)="Y"
S DIR("A")="Do you want to print this work order (Y/N)",DIR("B")="YES"
D ^DIR K DIR I $D(DIRUT) D DELWO G EXIT
I Y S DA=ENWODA D P^ENWOD
SEL ; select equipment
K ^TMP($J)
S DIR(0)="S^1:SEARCH EQUIPMENT FILE BY CATEGORY, MANUFACTURER, OR MODEL;2:INDIVIDUALLY SELECT EQUIPMENT"
S DIR("A")="USE METHOD: ",DIR("B")="1"
S DIR("A",1)="Choose desired method to select additional equipment."
S DIR("?")="Enter 1 or 2 (enter '^' to abort and W.O. will be deleted)"
S DIR("?",1)="Additional equipment can be selected by one of the following methods."
S DIR("?",2)=" "
S DIR("?",3)="1 SEARCH EQUIPMENT FILE BY CATEGORY, MANUFACTURER, OR MODEL -"
S DIR("?",4)=" Enter desired value(s) in one or more of the three available search"
S DIR("?",5)=" criteria. Equipment Category, Manufacturer, and/or Model can be specified."
S DIR("?",6)=" Equipment which exactly matches all specified criteria will be selected."
S DIR("?",7)=" If a value is not entered then the corresponding search criteria will not"
S DIR("?",8)=" be used. Equipment with a disposition date will not be included."
S DIR("?",9)=" "
S DIR("?",10)="2 INDIVIDUALLY SELECT EQUIPMENT - Individually choose each equipment item."
S DIR("?",11)=" "
D ^DIR K DIR S ENMETH=Y I $D(DIRUT) D DELWO G EXIT
S ENC("EQ")=0
I ENMETH=1 D I $D(DTOUT)!$D(DUOUT) D DELWO G EXIT
. S (ENEQCAT,ENMANF,ENMODEL)="" K DA
. S DIR(0)="6914,6",DIR("A")="Select items with EQUIPMENT CATEGORY"
. D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT) S:Y>0 ENEQCAT=+Y
. S DIR(0)="6914,1",DIR("A")="Select items with MANUFACTURER"
. D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT) S:Y>0 ENMANF=+Y
. S DIR(0)="6914,4",DIR("A")="Select items with MODEL"
. D ^DIR K DIR Q:$D(DTOUT)!$D(DUOUT) S ENMODEL=Y
. I ENEQCAT']"",ENMANF']"",ENMODEL']"" W !,"No criteria entered" Q
. S ENXREF=$S(ENMODEL]"":"E",ENMANF]"":"K",1:"G")
. S ENXREFV=$S(ENXREF="E":ENMODEL,ENXREF="K":ENMANF,1:ENEQCAT)
. S ENI=0 F S ENI=$O(^ENG(6914,ENXREF,ENXREFV,ENI)) Q:'ENI D
. . S ENY1=$G(^ENG(6914,ENI,1))
. . I ENEQCAT]"",$P(ENY1,U,1)'=ENEQCAT Q
. . I ENMANF]"",$P(ENY1,U,4)'=ENMANF Q
. . I ENMODEL]"",$P(ENY1,U,2)'=ENMODEL Q
. . I $P($G(^ENG(6914,ENI,3)),U,11)]"" Q ; disposition date exists
. . I ENI'=ENEQDA S ^TMP($J,ENI)="",ENC("EQ")=ENC("EQ")+1
I ENMETH=2 D K DIC
. S DIC="^ENG(6914,",DIC(0)="AQEM"
. F D ^DIC Q:Y'>0 I Y'=ENEQDA,'$D(^TMP($J,+Y)) S ^(+Y)="",ENC("EQ")=ENC("EQ")+1
I 'ENC("EQ") W !,"No equipment items were selected" G SEL
CONF ; confirm
W !!,"Work Orders will be copied for ",ENC("EQ")," items of equipment"
S DIR("A")="OK to Proceed"
S DIR("?")="Enter Y, N, or L (enter '^' to exit and delete work order)"
S DIR("?",1)="Select appropriate action"
S DIR("?",2)="YES to create work orders for selected equipment"
S DIR("?",3)="NO to select different equipment"
S DIR("?",4)="LIST to list currently selected equipment"
S DIR("?",5)="^ to exit and delete original work order"
S DIR(0)="SMB^Y:YES;N:NO;L:LIST" D ^DIR K DIR I $D(DIRUT) D DELWO G EXIT
I Y="N" G SEL
I Y="L" D LST^ENWOME1 G CONF
ASKPRT ; print new work orders?
S DIR(0)="Y"
S DIR("?")="Enter Yes or No"
S DIR("?",1)="Enter Yes to print all new work orders to a selected"
S DIR("?",2)="device. The appropriate format (LONG or SHORT) will be"
S DIR("?",3)="obtained from the AUTO PRINT NEW W.O. software option."
S DIR("?",4)=" "
S DIR("A")="Should all new work orders be printed? (Y/N)",DIR("B")="NO"
D ^DIR K DIR S ENPRT=Y I $D(DIRUT) D DELWO G EXIT
D:ENPRT I $D(DTOUT)!$D(DUOUT) D DELWO G EXIT
. ; get output device (with default for shop)
. S DIC=6922,DR="2",DA=ENSHKEY,DIQ="ENDIQ",DIQ(0)="E"
. D EN^DIQ1 K DIQ
. S DIC=3.5,DIC(0)="AQEMZ",DIC("B")=ENDIQ(6922,ENSHKEY,2,"E")
. K ENDIQ
. D ^DIC K DIC S:Y>0 ENPRT("DEV")=$P(Y(0),U)
COPYWO ;
W !,"Copying work order for selected equipment"
S ENFATAL=0
S ENI=0 F S ENI=$O(^TMP($J,ENI)) Q:'ENI D Q:ENFATAL
. ; get new w.o. number
. S NUMBER="" D WONUM^ENWONEW
. I NUMBER="" D I NUMBER="" S ENFATAL=1 Q
. . W !,"Couldn't obtain a new Work Order #. Retrying..."
. . D WONUM^ENWONEW
. . I NUMBER="" W !,"Still couldn't get a new Work Order #"
. S ENWODAY=DA
. ; copy data
. L +^ENG(6920,ENWODAY)
. S %X="^ENG(6920,ENWODA,",%Y="^ENG(6920,ENWODAY," D %XY^%RCR
. ; set specific data for .01, .05, LOCATION, EQUIPMENT ID #
. S ENY0=$G(^ENG(6920,ENWODAY,0))
. S $P(ENY0,U,1)=NUMBER
. S $P(ENY0,U,6)=NUMBER
. S $P(ENY0,U,4)=$P($G(^ENG(6914,ENI,3)),U,5) ; location from equip
. S ^ENG(6920,ENWODAY,0)=ENY0
. S $P(^ENG(6920,ENWODAY,3),U,8)=ENI ; will trigger remaining fields
. ; index new entry
. S DA=ENWODAY,DIK="^ENG(6920," D IX^DIK K DIK
. ; save w.o. number in ^tmp
. S ^TMP($J,ENI)=ENWODAY_U_NUMBER
. L -^ENG(6920,ENWODAY)
. W "."
I ENFATAL D DELWO G EXIT
I ENPRT D QUETSK^ENWOME2
W !,"All work orders created"
W !,"Select output device for list or enter '^' to suppress report"
S ENCOPY=1 D LST^ENWOME1
EXIT ;
I $D(ENWODA) L -^ENG(6920,ENWODA)
K ^TMP($J)
K %X,%Y,DA,DIK,DIROUT,DIRUT,DR,DTOUT,DUOUT,X,Y
K ENBARCD,ENC,ENCOPY,ENDA,ENEQCAT,ENEQDA,ENFATAL,ENI
K ENMANF,ENMODEL,ENMETH,ENPRT,ENSHKEY,ENWOCLOD
K ENWODA,ENWODAY,ENXREF,ENXREFV,ENY0,ENY1
Q
DELWO ; delete work orders (master and any copied)
W !,"Process Terminated - Deleting any created work orders"
K DA S DA=ENWODA
S ENWOCLOD=$P($G(^ENG(6920,ENWODA,5)),U,2)
I ENWOCLOD]"" D KILLHS^ENEQHS
S DA=ENWODA,DIK="^ENG(6920," D ^DIK K DIK W "."
S ENI=0 F S ENI=$O(^TMP($J,ENI)) Q:'ENI S ENDA=$P($G(^(ENI)),U) D:ENDA
. I ENWOCLOD]"" S DA=ENDA D KILLHS^ENEQHS
. S DA=ENDA,DIK="^ENG(6920," D ^DIK K DIK
. W "."
Q
;ENWOME
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENWOME 6928 printed Dec 13, 2024@01:56:18 Page 2
ENWOME ;(WASH ISC)/SAB-WORK ORDER MULTIPLE ENTRY ;1-27-97
+1 ;;7.0;ENGINEERING;**35**;Aug 17, 1993
+2 NEW NUMBER,SHOPKEY,WARD
+3 KILL ^TMP($JOB)
+4 SET DIR("A")="Enter a new equipment work order and copy it (Y/N)"
+5 SET DIR(0)="Y"
SET DIR("B")="YES"
DO ^DIR
KILL DIR
if 'Y!$DATA(DIRUT)
GOTO EXIT
+6 ; get first w.o.
+7 DO SSHOP^ENWO
if ENSHKEY'>0
GOTO EXIT
+8 SET SHOPKEY=ENSHKEY
+9 SET NUMBER=""
DO WONUM^ENWONEW
IF NUMBER=""
Begin DoDot:1
+10 WRITE !!,*7,"Can't seem to add to Work Order File."
+11 WRITE !,"Please try again later or contact IRM Service."
End DoDot:1
GOTO EXIT
+12 SET ENWODA=DA
LOCK +^ENG(6920,ENWODA)
+13 WRITE !,"WORK ORDER #: ",NUMBER
+14 SET WARD=0
DO WOFILL^ENWONEW
EDITWO ; edit work order
+1 SET DR=$SELECT($DATA(^DIE("B","ENZWONEW")):"[ENZWONEW]",1:"[ENWONEW]")
+2 DO ^DIE
IF $DATA(DTOUT)
DO DELWO
GOTO EXIT
+3 SET ENEQDA=$PIECE($GET(^ENG(6920,ENWODA,3)),U,8)
+4 IF ENEQDA']""
Begin DoDot:1
+5 WRITE !,"An Equipment ID # is required by this option."
+6 SET DIR(0)="Y"
+7 SET DIR("A")="Do you want to edit the work order (Y/N)"
SET DIR("B")="YES"
+8 DO ^DIR
KILL DIR
End DoDot:1
if Y
GOTO EDITWO
DO DELWO
GOTO EXIT
+9 SET DIR(0)="Y"
SET DIR("B")="NO"
+10 SET DIR("A")="Do you want to CLOSE this work order now (Y/N)"
+11 DO ^DIR
KILL DIR
if Y
Begin DoDot:1
+12 SET DR=$SELECT($DATA(^DIE("B","ENZWONEWCLOSE")):"[ENZWONEWCLOSE]",1:"[ENWONEWCLOSE]")
+13 DO ^DIE
End DoDot:1
IF $DATA(DIRUT)
DO DELWO
GOTO EXIT
+14 SET DIR(0)="Y"
+15 SET DIR("A")="Do you want to print this work order (Y/N)"
SET DIR("B")="YES"
+16 DO ^DIR
KILL DIR
IF $DATA(DIRUT)
DO DELWO
GOTO EXIT
+17 IF Y
SET DA=ENWODA
DO P^ENWOD
SEL ; select equipment
+1 KILL ^TMP($JOB)
+2 SET DIR(0)="S^1:SEARCH EQUIPMENT FILE BY CATEGORY, MANUFACTURER, OR MODEL;2:INDIVIDUALLY SELECT EQUIPMENT"
+3 SET DIR("A")="USE METHOD: "
SET DIR("B")="1"
+4 SET DIR("A",1)="Choose desired method to select additional equipment."
+5 SET DIR("?")="Enter 1 or 2 (enter '^' to abort and W.O. will be deleted)"
+6 SET DIR("?",1)="Additional equipment can be selected by one of the following methods."
+7 SET DIR("?",2)=" "
+8 SET DIR("?",3)="1 SEARCH EQUIPMENT FILE BY CATEGORY, MANUFACTURER, OR MODEL -"
+9 SET DIR("?",4)=" Enter desired value(s) in one or more of the three available search"
+10 SET DIR("?",5)=" criteria. Equipment Category, Manufacturer, and/or Model can be specified."
+11 SET DIR("?",6)=" Equipment which exactly matches all specified criteria will be selected."
+12 SET DIR("?",7)=" If a value is not entered then the corresponding search criteria will not"
+13 SET DIR("?",8)=" be used. Equipment with a disposition date will not be included."
+14 SET DIR("?",9)=" "
+15 SET DIR("?",10)="2 INDIVIDUALLY SELECT EQUIPMENT - Individually choose each equipment item."
+16 SET DIR("?",11)=" "
+17 DO ^DIR
KILL DIR
SET ENMETH=Y
IF $DATA(DIRUT)
DO DELWO
GOTO EXIT
+18 SET ENC("EQ")=0
+19 IF ENMETH=1
Begin DoDot:1
+20 SET (ENEQCAT,ENMANF,ENMODEL)=""
KILL DA
+21 SET DIR(0)="6914,6"
SET DIR("A")="Select items with EQUIPMENT CATEGORY"
+22 DO ^DIR
KILL DIR
if $DATA(DTOUT)!$DATA(DUOUT)
QUIT
if Y>0
SET ENEQCAT=+Y
+23 SET DIR(0)="6914,1"
SET DIR("A")="Select items with MANUFACTURER"
+24 DO ^DIR
KILL DIR
if $DATA(DTOUT)!$DATA(DUOUT)
QUIT
if Y>0
SET ENMANF=+Y
+25 SET DIR(0)="6914,4"
SET DIR("A")="Select items with MODEL"
+26 DO ^DIR
KILL DIR
if $DATA(DTOUT)!$DATA(DUOUT)
QUIT
SET ENMODEL=Y
+27 IF ENEQCAT']""
IF ENMANF']""
IF ENMODEL']""
WRITE !,"No criteria entered"
QUIT
+28 SET ENXREF=$SELECT(ENMODEL]"":"E",ENMANF]"":"K",1:"G")
+29 SET ENXREFV=$SELECT(ENXREF="E":ENMODEL,ENXREF="K":ENMANF,1:ENEQCAT)
+30 SET ENI=0
FOR
SET ENI=$ORDER(^ENG(6914,ENXREF,ENXREFV,ENI))
if 'ENI
QUIT
Begin DoDot:2
+31 SET ENY1=$GET(^ENG(6914,ENI,1))
+32 IF ENEQCAT]""
IF $PIECE(ENY1,U,1)'=ENEQCAT
QUIT
+33 IF ENMANF]""
IF $PIECE(ENY1,U,4)'=ENMANF
QUIT
+34 IF ENMODEL]""
IF $PIECE(ENY1,U,2)'=ENMODEL
QUIT
+35 ; disposition date exists
IF $PIECE($GET(^ENG(6914,ENI,3)),U,11)]""
QUIT
+36 IF ENI'=ENEQDA
SET ^TMP($JOB,ENI)=""
SET ENC("EQ")=ENC("EQ")+1
End DoDot:2
End DoDot:1
IF $DATA(DTOUT)!$DATA(DUOUT)
DO DELWO
GOTO EXIT
+37 IF ENMETH=2
Begin DoDot:1
+38 SET DIC="^ENG(6914,"
SET DIC(0)="AQEM"
+39 FOR
DO ^DIC
if Y'>0
QUIT
IF Y'=ENEQDA
IF '$DATA(^TMP($JOB,+Y))
SET ^(+Y)=""
SET ENC("EQ")=ENC("EQ")+1
End DoDot:1
KILL DIC
+40 IF 'ENC("EQ")
WRITE !,"No equipment items were selected"
GOTO SEL
CONF ; confirm
+1 WRITE !!,"Work Orders will be copied for ",ENC("EQ")," items of equipment"
+2 SET DIR("A")="OK to Proceed"
+3 SET DIR("?")="Enter Y, N, or L (enter '^' to exit and delete work order)"
+4 SET DIR("?",1)="Select appropriate action"
+5 SET DIR("?",2)="YES to create work orders for selected equipment"
+6 SET DIR("?",3)="NO to select different equipment"
+7 SET DIR("?",4)="LIST to list currently selected equipment"
+8 SET DIR("?",5)="^ to exit and delete original work order"
+9 SET DIR(0)="SMB^Y:YES;N:NO;L:LIST"
DO ^DIR
KILL DIR
IF $DATA(DIRUT)
DO DELWO
GOTO EXIT
+10 IF Y="N"
GOTO SEL
+11 IF Y="L"
DO LST^ENWOME1
GOTO CONF
ASKPRT ; print new work orders?
+1 SET DIR(0)="Y"
+2 SET DIR("?")="Enter Yes or No"
+3 SET DIR("?",1)="Enter Yes to print all new work orders to a selected"
+4 SET DIR("?",2)="device. The appropriate format (LONG or SHORT) will be"
+5 SET DIR("?",3)="obtained from the AUTO PRINT NEW W.O. software option."
+6 SET DIR("?",4)=" "
+7 SET DIR("A")="Should all new work orders be printed? (Y/N)"
SET DIR("B")="NO"
+8 DO ^DIR
KILL DIR
SET ENPRT=Y
IF $DATA(DIRUT)
DO DELWO
GOTO EXIT
+9 if ENPRT
Begin DoDot:1
+10 ; get output device (with default for shop)
+11 SET DIC=6922
SET DR="2"
SET DA=ENSHKEY
SET DIQ="ENDIQ"
SET DIQ(0)="E"
+12 DO EN^DIQ1
KILL DIQ
+13 SET DIC=3.5
SET DIC(0)="AQEMZ"
SET DIC("B")=ENDIQ(6922,ENSHKEY,2,"E")
+14 KILL ENDIQ
+15 DO ^DIC
KILL DIC
if Y>0
SET ENPRT("DEV")=$PIECE(Y(0),U)
End DoDot:1
IF $DATA(DTOUT)!$DATA(DUOUT)
DO DELWO
GOTO EXIT
COPYWO ;
+1 WRITE !,"Copying work order for selected equipment"
+2 SET ENFATAL=0
+3 SET ENI=0
FOR
SET ENI=$ORDER(^TMP($JOB,ENI))
if 'ENI
QUIT
Begin DoDot:1
+4 ; get new w.o. number
+5 SET NUMBER=""
DO WONUM^ENWONEW
+6 IF NUMBER=""
Begin DoDot:2
+7 WRITE !,"Couldn't obtain a new Work Order #. Retrying..."
+8 DO WONUM^ENWONEW
+9 IF NUMBER=""
WRITE !,"Still couldn't get a new Work Order #"
End DoDot:2
IF NUMBER=""
SET ENFATAL=1
QUIT
+10 SET ENWODAY=DA
+11 ; copy data
+12 LOCK +^ENG(6920,ENWODAY)
+13 SET %X="^ENG(6920,ENWODA,"
SET %Y="^ENG(6920,ENWODAY,"
DO %XY^%RCR
+14 ; set specific data for .01, .05, LOCATION, EQUIPMENT ID #
+15 SET ENY0=$GET(^ENG(6920,ENWODAY,0))
+16 SET $PIECE(ENY0,U,1)=NUMBER
+17 SET $PIECE(ENY0,U,6)=NUMBER
+18 ; location from equip
SET $PIECE(ENY0,U,4)=$PIECE($GET(^ENG(6914,ENI,3)),U,5)
+19 SET ^ENG(6920,ENWODAY,0)=ENY0
+20 ; will trigger remaining fields
SET $PIECE(^ENG(6920,ENWODAY,3),U,8)=ENI
+21 ; index new entry
+22 SET DA=ENWODAY
SET DIK="^ENG(6920,"
DO IX^DIK
KILL DIK
+23 ; save w.o. number in ^tmp
+24 SET ^TMP($JOB,ENI)=ENWODAY_U_NUMBER
+25 LOCK -^ENG(6920,ENWODAY)
+26 WRITE "."
End DoDot:1
if ENFATAL
QUIT
+27 IF ENFATAL
DO DELWO
GOTO EXIT
+28 IF ENPRT
DO QUETSK^ENWOME2
+29 WRITE !,"All work orders created"
+30 WRITE !,"Select output device for list or enter '^' to suppress report"
+31 SET ENCOPY=1
DO LST^ENWOME1
EXIT ;
+1 IF $DATA(ENWODA)
LOCK -^ENG(6920,ENWODA)
+2 KILL ^TMP($JOB)
+3 KILL %X,%Y,DA,DIK,DIROUT,DIRUT,DR,DTOUT,DUOUT,X,Y
+4 KILL ENBARCD,ENC,ENCOPY,ENDA,ENEQCAT,ENEQDA,ENFATAL,ENI
+5 KILL ENMANF,ENMODEL,ENMETH,ENPRT,ENSHKEY,ENWOCLOD
+6 KILL ENWODA,ENWODAY,ENXREF,ENXREFV,ENY0,ENY1
+7 QUIT
DELWO ; delete work orders (master and any copied)
+1 WRITE !,"Process Terminated - Deleting any created work orders"
+2 KILL DA
SET DA=ENWODA
+3 SET ENWOCLOD=$PIECE($GET(^ENG(6920,ENWODA,5)),U,2)
+4 IF ENWOCLOD]""
DO KILLHS^ENEQHS
+5 SET DA=ENWODA
SET DIK="^ENG(6920,"
DO ^DIK
KILL DIK
WRITE "."
+6 SET ENI=0
FOR
SET ENI=$ORDER(^TMP($JOB,ENI))
if 'ENI
QUIT
SET ENDA=$PIECE($GET(^(ENI)),U)
if ENDA
Begin DoDot:1
+7 IF ENWOCLOD]""
SET DA=ENDA
DO KILLHS^ENEQHS
+8 SET DA=ENDA
SET DIK="^ENG(6920,"
DO ^DIK
KILL DIK
+9 WRITE "."
End DoDot:1
+10 QUIT
+11 ;ENWOME