source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENEQPMS2.m@ 1800

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

initial load of WorldVistAEHR

File size: 5.4 KB
Line 
1ENEQPMS2 ;(WASH ISC)/DH-Select Equipment for PMI ;6.5.97
2 ;;7.0;ENGINEERING;**26,35,42**;Aug 17, 1993
3NTRY ; Identify entries for specified PM worklist (single shop)
4 ; List is sorted in ^TMP($J,
5 K ^TMP($J) N I,SE,NODE
6 F DA=0:0 S DA=$O(^ENG(6914,"AB",ENSHKEY,DA)) Q:DA'>0 S SE=0 F S SE=$O(^ENG(6914,"AB",ENSHKEY,DA,SE)) Q:SE'>0 D LST2
7 D PR^ENEQPMS5 G OUT
8 ;
9MNTRY ; Identify entries for specified PM worklist (all shops)
10 ; List is sorted in ^TMP($J,
11 K ^TMP($J) N I,SE,NODE
12 F ENSHKEY=0:0 S ENSHKEY=$O(^ENG(6914,"AB",ENSHKEY)) Q:ENSHKEY'>0 F DA=0:0 S DA=$O(^ENG(6914,"AB",ENSHKEY,DA)) Q:DA'>0 S SE=0 F S SE=$O(^ENG(6914,"AB",ENSHKEY,DA,SE)) Q:SE'>0 D LST2
13 D PR^ENEQPMS5 G OUT
14 ;
15LST2 N EN,A,B,C,X,X1,X2,TAG,SUB,MULT
16 S X1=$P($G(^ENG(6914,DA,3)),U) I "^4^5^"[(U_X1_U) Q
17 I 'ENSRT("OOS"),X1=2 Q
18 Q:'$D(^ENG(6914,DA,4,SE,0)) I '$D(ENCRIT("ALL")) D Q:ENCRIT<0
19 . S ENCRIT=$P(^ENG(6914,DA,4,SE,0),U,4) I ENCRIT'?1.2N S:'$G(ENCRIT("NULL")) ENCRIT=-1 Q
20 . I ENCRIT<ENCRIT("FR")!(ENCRIT>ENCRIT("TO")) S ENCRIT=-1
21 S EN("NEXT")="A" F X="A","B","C" S @X=""
22 S X1=0,X2=$P(^ENG(6914,DA,4,SE,0),U,2) I 'ENTECH("ALL"),X2'=ENTECH Q
23 I ENTECH'=0 S:X2="" X2=0 S:$D(^ENG("EMP",X2,0)) X1=""""_$P(^(0),U)_"""" D
24 . I X2>0,X1=0 S X1=""""_"DELETED"_""""
25 . S @EN("NEXT")=X1
26 . S EN("NEXT")=$C($A(EN("NEXT"))+1)
27 S TAG="LST"_ENSRT D @TAG Q:$G(X)=-1
28 S SUB="" F X1="A","B","C" Q:$G(@X1)="" S SUB=SUB_@X1_","
29 D LSTSKP
30 Q
31 ;
32LSTE ; By ENTRY NUMBER
33 I ENSRT("ALL") Q
34 I ENSRT("FR")]DA!(DA]ENSRT("TO")) S X=-1
35 Q
36LSTP ; By PM NUMBER
37 S X1=$P($G(^ENG(6914,DA,3)),U,6) S:X1="" X1=0
38 S:X1'=0 X1=""""_X1_""""
39 S @EN("NEXT")=X1
40 Q
41LSTI ; By LOCAL ID
42 S (X1,X1("T"))=$P($G(^ENG(6914,DA,3)),U,7) S:X1="" (X1,X1("T"))=0
43 S:X1'?.N X1("T")=""""_X1_""""
44 I ENSRT("ALL") S @EN("NEXT")=X1("T"),EN("NEXT")=$C($A(EN("NEXT"))+1)
45 E S X="" D
46 . I ENSRT("FR")]X1!(X1]ENSRT("TO")) S X=-1 Q
47 . S @EN("NEXT")=X1("T"),EN("NEXT")=$C($A(EN("NEXT"))+1)
48 I ENSRT("LOC"),$G(X)'=-1 D
49 . S X1=$$LOC^ENEQPMS8(DA) I X1=-1 S X=-1 Q
50 . I $P(X1,U)=-2,ENSRT("LOC","ALL") D
51 .. S X1=""""_$P(X1,U,2)_""""
52 .. F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
53 . I $P(X1,U)=-2 S X=-1 Q
54 . I X1=-3,ENSRT("LOC","ALL") D
55 .. S X1=0 F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
56 . I X1=-3 S X=-1 Q
57 . S @EN("NEXT")=X1
58 Q
59LSTL ; By LOCATION
60 S X1=$$LOC^ENEQPMS8(DA) I X1=-1 S X=-1 Q
61 I $P(X1,U)=-2,ENSRT("LOC","ALL") D
62 . S X1=""""_$P(X1,U,2)_""""
63 . F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
64 I $P(X1,U)=-2 S X=-1 Q
65 I X1=-3,ENSRT("LOC","ALL") D
66 . S X1=0 F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
67 I X1=-3 S X=-1 Q
68 S @EN("NEXT")=X1
69 Q
70LSTC ; By EQUIPMENT CATEGORY
71 S X2=$P($G(^ENG(6914,DA,1)),U) S:X2="" X1=0
72 I X2>0 S X1=$P($G(^ENG(6911,X2,0)),U) S:X1="" X1=0
73 S:X1'?.N X1=""""_X1_""""
74 I 'ENSRT("ALL"),X2'=ENSRT("FR") S X=-1 Q
75 S @EN("NEXT")=X1,EN("NEXT")=$C($A(EN("NEXT"))+1)
76 I ENSRT("LOC") D
77 . S X1=$$LOC^ENEQPMS8(DA) I X1=-1 S X=-1 Q
78 . I $P(X1,U)=-2,ENSRT("LOC","ALL") D
79 .. S X1=""""_$P(X1,U,2)_""""
80 .. F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
81 . I $P(X1,U)=-2 S X=-1 Q
82 . I X1=-3,ENSRT("LOC","ALL") D
83 .. S X1=0 F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
84 . I X1=-3 S X=-1 Q
85 . S @EN("NEXT")=X1
86 Q
87LSTS ; By OWNING SERVICE
88 S X2=$P($G(^ENG(6914,DA,3)),U,2) S:X2="" X1=0
89 I X2>0 S X1=$P($G(^DIC(49,X2,0)),U) S:X1="" X1=0
90 S:X1'?.N X1=""""_X1_""""
91 I 'ENSRT("ALL"),X2'=ENSRT("FR") S X=-1 Q
92 S @EN("NEXT")=X1,EN("NEXT")=$C($A(EN("NEXT"))+1)
93 I ENSRT("LOC") D
94 . S X1=$$LOC^ENEQPMS8(DA) I X1=-1 S X=-1 Q
95 . I $P(X1,U)=-2,ENSRT("LOC","ALL") D
96 .. S X1=""""_$P(X1,U,2)_""""
97 .. F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
98 . I $P(X1,U)=-2 S X=-1 Q
99 . I X1=-3,ENSRT("LOC","ALL") D
100 .. S X1=0 F J=1:1:($L(ENSRT("BY"))-1) S X1="0,"_X1
101 . I X1=-3 S X=-1 Q
102 . S @EN("NEXT")=X1
103 Q
104 ;
105LSTSKP ; Check for SKIP MONTHS
106 S ENSKP=$P(^ENG(6914,DA,4,SE,0),U,3) G:ENSKP']"" LST21 S ENMNTH=$P(ENSKP,"-",1) D RVMNTH^ENLIB1 S ENSKP("FR")=ENMN,ENMNTH=$P(ENSKP,"-",2) D RVMNTH^ENLIB1 S ENSKP("TO")=ENMN
107 I ENSKP("FR")'>ENSKP("TO") G:ENPMMN<ENSKP("FR")!(ENPMMN>ENSKP("TO")) LST21 K ENSKP Q
108 I ENPMMN'>ENSKP("TO")!(ENPMMN'<ENSKP("FR")) K ENSKP Q
109LST21 ; SKIP MONTH not a problem
110 K ENSKP S ENHZS="^",ENSTMN=1 I $D(^ENG(6914,DA,4,SE,1)),^(1)>1 S ENSTMN=^(1)
111 S MULT=0 F S MULT=$O(^ENG(6914,DA,4,SE,2,MULT)) Q:MULT'>0 I $P(^ENG(6914,DA,4,SE,2,MULT,0),U)]"" S ENHZS=ENHZS_$P(^(0),U)_"^",ENHZ($P(^(0),U))=SE_U_MULT
112 I ENPM["W" D LSTW Q
113 I ENHZS["^TA^" D Q:$G(ENHZ)="TA"
114 . S MULT=$P(ENHZ("TA"),U,2),ENSTYR=$P(^ENG(6914,DA,4,SE,2,MULT,0),U,6) Q:ENSTYR'?4N
115 . I ENSTYR>ENPMYR Q
116 . I '(ENPMYR-ENSTYR#3),(ENPMMN=ENSTMN) S ENHZ="TA",ENHZ(1)="TRI-ANNUAL" D BLD
117 I ENHZS["^BA^" D Q:$G(ENHZ)="BA"
118 . S MULT=$P(ENHZ("BA"),U,2),ENSTYR=$P(^ENG(6914,DA,4,SE,2,MULT,0),U,6) Q:ENSTYR'?4N
119 . I ENSTYR>ENPMYR Q
120 . I '(ENPMYR-ENSTYR#2),(ENPMMN=ENSTMN) S ENHZ="BA",ENHZ(1)="BI-ANNUAL" D BLD
121 I ENHZS["^A^",ENSTMN=ENPMMN S ENHZ="A",ENHZ(1)="ANNUAL" D BLD Q
122 I ENHZS["^S^",'(ENPMMN-ENSTMN#6) S ENHZ="S",ENHZ(1)="SEMI-ANNUAL" D BLD Q
123 I ENHZS["^Q^",'(ENPMMN-ENSTMN#3) S ENHZ="Q",ENHZ(1)="QUARTERLY" D BLD Q
124 I ENHZS["^BM^",'(ENPMMN-ENSTMN#2) S ENHZ="BM",ENHZ(1)="BI-MONTHLY" D BLD Q
125 I ENHZS["^M^" S ENHZ="M",ENHZ(1)="MONTHLY" D BLD
126 Q
127 ;
128LSTW I ENHZS["BW",(ENPM["1"!(ENPM["3")) S ENHZ="BW",ENHZ(1)="BI-WEEKLY" D BLD Q
129 I ENHZS["^W^" S ENHZ="W",ENHZ(1)="WEEKLY" D BLD
130 Q
131 ;
132BLD ; Build ^TMP GLOBAL
133 S NODE="^TMP($J,""ENWL"","_ENSHKEY_","_SUB_DA_")"
134 S @NODE=ENHZ_U_ENHZ(1)_U_ENHZ(ENHZ)
135 Q
136 ;
137OUT K K,S,ENDATE,ENPM,ENPMDT,ENA,ENHZS,ENPMWK,ENSHOP,ENSHKEY,ENPMMN,ENSTMN,ENSTYR,ENCRIT,ENSRT,ENTECH,ENY,ENERR,ENMN,ENMNTH,ENI,ENLID
138 S:$D(ZTQUEUED) ZTREQ="@"
139 Q
140 ;ENEQPMS2
Note: See TracBrowser for help on using the repository browser.