source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENEQPMR5.m@ 1361

Last change on this file since 1361 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.3 KB
RevLine 
[613]1ENEQPMR5 ;(WASH ISC)/DH-Single PMI's ;2.26.98
2 ;;7.0;ENGINEERING;**14,35,48**;Aug 17, 1993
3SDPM4 I ENDEL'="N" D Q:DA'>0 G SDPM41 ;pm work order not to be retained
4 . K DD,DO S DIC="^ENG(6920,",DIC(0)="LX",X=ENPMWO
5 . D FILE^DICN S DA=+Y
6 ; retain pm work order
7 F I=1:1 S J=$S($L(I)=1:"00"_I,$L(I)=2:"0"_I,1:I),ENPMWO(0)=ENPMWO_"-"_J I '$D(^ENG(6920,"B",ENPMWO(0))),'$D(^ENG(6920,"H",ENPMWO(0))) Q
8 L +^ENG(6920,"B")
9 F Q:'$D(^ENG(6920,"B",ENPMWO(0))) S J=$P(ENPMWO(0),"-",3)+1,J=$S($L(J)=1:"00"_J,$L(J)=2:"0"_J,1:J),ENPMWO(0)=$P(ENPMWO(0),"-",1,2)_"-"_J
10 K DD,DO S DIC="^ENG(6920,",DIC(0)="LX",X=ENPMWO(0) D FILE^DICN S DA=+Y
11 L -^ENG(6920,"B") Q:DA'>0
12 ;
13SDPM41 S DIE="^ENG(6920,",DR=".05///^S X=$S($D(ENPMWO(0)):ENPMWO(0),1:ENPMWO);1///^S X=DT;9///^S X=ENSHKEY;10///^S X=DT;18///^S X=ENDA;39///^S X=""OFF-SCHEDULE PMI""" D ^DIE
14 S ^ENG(6920,DA,8,0)="^6920.035^1^1",DIE="^ENG(6920,DA(1),8,",(ENOLDDA,DA(1))=DA,DA=1,DR=".01///^S X=""PREVENTIVE MAINTENANCE""" D ^DIE K DA,DR S DIE="^ENG(6920,",DA=ENOLDDA K ENOLDDA
15 ;
16SDPM42 S DR=$S($D(^DIE("B","ENZPMCLOSE")):"[ENZPMCLOSE]",1:"[ENPMCLOSE]") D ^DIE Q:'$D(DA) ;pm work order deleted within ^DIE
17 ;
18SDPM43 I $P($G(^ENG(6920,DA,5)),U,2)="" D G:%=1 SDPM42 G:%'=2 SDPM43
19 . W !,*7,"You need to enter a DATE COMPLETE in order to post this PM work order. My",!,"guess is that you should re-edit to either enter a DATE COMPLETE or to delete"
20 . W !,"the work order ('@' in response to first prompt).",!,"Am I right" S %=1 D YN^DICN
21 ;
22SDPM44 I $P($G(^ENG(6920,DA,5)),U,2)]"",$E(^ENG(6920,DA,0),1,3)="PM-" D
23 . D PMHRS^ENEQPMR4,PMINV^ENEQPMR4 S ENCLOSE=$P(^ENG(6920,DA,5),U,2)
24 . I ENDEL="Y" S DIK="^ENG(6920," D ^DIK K DIK
25 Q:'$G(ENCLOSE)!(ENPM'="M") ;return control to ENEQPMR4
26 ;
27SDPM5 ; should user change the STARTING MONTH (or maybe YEAR)
28 Q:'$D(ENDA) ;nothing to look at
29 S ENRS=$O(^ENG(6914,ENDA,4,"B",ENSHKEY,0))
30 Q:'ENRS ;shop doesn't normally do pm
31 K ENA S I=0 F S I=$O(^ENG(6914,ENDA,4,ENRS,2,I)) Q:'I S ENA($P(^(I,0),U))=$P(^(0),U,6) ;build frequency array
32 Q:$D(ENA("M")) ;no need to change STARTING MONTH if MONTHLY on file
33 F I="TA","BA" I $D(ENA(I)),ENA(I)="" K ENA(I)
34 S ENPMYR("C")=ENPMYR,ENSTMN=$S($D(^ENG(6914,ENDA,4,ENRS,1)):^(1),1:1),I=0 S:ENSTMN="" ENSTMN=1
35SDPM51 K ENHZ S ENNXMN=1+(ENPMMN#12) S:ENPMMN=12 ENPMYR("C")=ENPMYR("C")+1
36 F D Q:$G(ENHZ(0))!((ENNXMN=ENPMMN)&('$D(ENA("TA")))&('$D(ENA("BA")))) Q:ENPMYR("C")>(ENPMYR+4)
37 . I $D(ENA("TA")),'((ENPMYR("C")-ENA("TA"))#3),ENNXMN=ENSTMN S ENHZ(0)=1,ENHZ="TRI-ANNUAL" Q
38 . I $D(ENA("BA")),'((ENPMYR("C")-ENA("BA"))#2),ENNXMN=ENSTMN S ENHZ(0)=1,ENHZ="BI-ANNUAL" Q
39 . I $D(ENA("A")),ENNXMN=ENSTMN S ENHZ(0)=1,ENHZ="ANNUAL" Q
40 . I $D(ENA("S")),'((ENNXMN-ENSTMN)#6) S ENHZ(0)=1,ENNXMN(0)=$S(ENPMMN>ENNXMN:ENNXMN+12,1:ENNXMN) I (ENNXMN(0)-ENPMMN)<6 S ENHZ="SEMI-ANNUAL" Q
41 . I $D(ENA("Q")),'((ENNXMN-ENSTMN)#3) S ENHZ(0)=1,ENNXMN(0)=$S(ENPMMN>ENNXMN:ENNXMN+12,1:ENNXMN) I (ENNXMN(0)-ENPMMN)<3 S ENHZ="QUARTERLY" Q
42 . I $D(ENA("BM")),'((ENNXMN-ENSTMN)#2) S ENHZ(0)=1,ENNXMN(0)=$S(ENPMMN>ENNXMN:ENNXMN+12,1:ENNXMN) I (ENNXMN(0)-ENPMMN)<2 S ENHZ="BI-MONTHLY" Q
43 . S ENNXMN=1+(ENNXMN#12) S:ENNXMN=1 ENPMYR("C")=ENPMYR("C")+1
44 ;
45 Q:$G(ENHZ)="" Q:(ENHZ="ANNUAL"&(ENNXMN=ENPMMN)) ; return to ENEQPMR4, STARTING DATE is probably OK
46 I $D(^ENG(6914,ENDA,6)) D Q:ENHZ="DONE" ;strange result (exception)
47 . ; check for posting of a future PM (will set ENHZ)
48 . S:$L(ENNXMN)=1 ENNXMN="0"_ENNXMN S ENPMWO("P")="PM-"_ENSHABR_$E(ENPMYR("C")-1700,2,3)_ENNXMN_"M"
49 . S I=0 F S I=$O(^ENG(6914,ENDA,6,I)) Q:'I!(ENHZ="DONE") I $P(^(I,0),U,2)[ENPMWO("P") S ENHZ="DONE"
50 ;
51 S ENPMN=$P($G(^ENG(6914,ENDA,3)),U,6)
52 W !!,"Equipment entry # "_ENDA W:ENPMN]"" " (PM# ",ENPMN,") " W " is in the scheduled PMI program of the",!,ENSHOP_" shop."
53 W !,"The next scheduled event is a" W:ENHZ="ANNUAL" "n" W " "_ENHZ_" PMI in ",$P("Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec","^",ENNXMN),", "_ENPMYR("C")_"."
54SDPM71 W !!,"Would you like to change the PM schedule (at least the STARTING MONTH)",!,"for this device at this time"
55 S %=2 D YN^DICN I %=1 S DIE="^ENG(6914,",DA=ENDA,ENXP=1,ENOLSHOP=ENSHOP D XNPMSE^ENEQPMP S ENSHOP=ENOLSHOP K ENOLSHOP Q ; return to ENEQPMR4
56 I %=0 W !,"You may wish to change the STARTING MONTH so that you don't perform",!,"one PMI on the heels of another. It's your call." G SDPM71
57 ;
58 Q ; return to ENEQPMR4
59 ;ENEQPMR5
Note: See TracBrowser for help on using the repository browser.