Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ENWOME

ENWOME.m

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