source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENEQPMS8.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: 4.3 KB
Line 
1ENEQPMS8 ;(WIRMFO)/DH-Sort PM Worklist by LOCATION ;4.21.97
2 ;;7.0;ENGINEERING;**26,35**;Aug 17, 1993
3 ;
4 ; Programs calling this routine without having defined loc var
5 ; ENSRT("LOC","ALL") should expect it to exist upon return and
6 ; kill it before terminating job.
7 ;
8 ; In processing ranges, values will be treated as numbers if all
9 ; values are numbers, otherwise all values will be treated as strings
10 ;
11LOC(DA) ; DA => IEN for Equipment File (6914)
12 ; Expects ENSRT array as prepared via routine ENEQPMS1
13 ; Called by ENEQPMS2
14 ;
15 N SPC
16 S SPC=$P($G(^ENG(6914,DA,3)),U,5) I SPC="" S X=-3 Q X
17 I $E(SPC)="*" S X=-2_U_$P(SPC,",") Q X ;Not a pointer
18 I '$D(^ENG("SP",SPC,0)) S X=-2_U_$P(SPC,",") Q X ;Not a pointer either
19 D MAIN
20 Q X
21 ;
22SPACE(SPC) ; SPC => IEN for Space File (6928)
23 ; Expects ENSRT array as prepared via routine ENWOST
24 ; Called by ENWOP3
25 ;
26 I SPC="" S X=-3 Q X ;Shouldn't happen
27 I $E(SPC)="*" S X=-2_U_SPC Q X ;Not a pointer
28 I '$D(^ENG("SP",SPC,0)) S X=-2_U_$P(SPC,",") Q X ;Still not a pointer
29 D MAIN
30 Q X
31 ;
32 ; X returned
33 ; returned as less than 0 if entry is to be excluded, otherwise
34 ; piece 1 => DIVISION
35 ; piece 2 => BUILDING or WING, as specified
36 ; piece 3 => WING or BUILDING, as specified
37 ; piece 4 => ROOM
38 ;
39MAIN N A,I,J,D,B,W,R
40 S (D,B,W,R)=0,X=""
41 S:$G(ENSRT("LOC","ALL"))="" ENSRT("LOC","ALL")=1 I ENSRT("LOC","ALL")=1 D
42 . S:'$D(ENSRT("BY")) ENSRT("BY")="DBWR"
43 . F I="DIV","BLDG","WING","ROOM" S:ENSRT("BY")[$E(I) ENSRT(I,"ALL")=""
44 F A="D","B","W","R" D @A Q:@A=-1 I @A'="N/A" S:@A="" @A=0 S:@A'?.N @A=""""_@A_"""" S X=X_@A_","
45 I @A<0 S X=-1 Q
46 S X=$E(X,1,$L(X)-1) ;Strip trailing coma
47 Q ;Design EXIT
48 ;
49D ; Check DIVISION
50 I ENSRT("BY")'["D" S D="N/A" Q
51 S D=$P(^ENG("SP",SPC,0),U,10)
52 I $D(ENSRT("DIV","ALL")) S:D?.N D=D_" " Q
53 I D="",$D(ENSRT("DIV","AIND","NULL")) Q
54 I D]"",$D(ENSRT("DIV","AIND",D)) S:D?.N D=D_" " Q
55 S J=0 F S J=$O(ENSRT("DIV","FR",J)) Q:'J!($D(D(0))) D
56 . I ENSRT("DIV","FR",J)?.N,ENSRT("DIV","TO",J)?.N,D?.N D Q
57 .. I ENSRT("DIV","FR",J)>D!(D>ENSRT("DIV","TO",J)) Q
58 .. S D(0)="",D=D_" "
59 . S:ENSRT("DIV","FR",J)?.N ENSRT("DIV","FR",J)=ENSRT("DIV","FR",J)_" "
60 . S:ENSRT("DIV","TO",J)?.N ENSRT("DIV","TO",J)=ENSRT("DIV","TO",J)_" "
61 . S:D?.N D=D_" "
62 . I ENSRT("DIV","FR",J)]D!(D]ENSRT("DIV","TO",J)) Q
63 . S D(0)=""
64 I '$D(D(0)) S D=-1
65 Q
66 ;
67B ; Check BUILDING
68 I ENSRT("BY")'["B" S B="N/A" Q
69 S B=$P(^ENG("SP",SPC,0),U,2)
70 I $D(ENSRT("BLDG","ALL")) S:B?.N B=B_" " Q
71 I B="",$D(ENSRT("BLDG","AIND","NULL")) Q
72 I B]"",$D(ENSRT("BLDG","AIND",B)) S:B?.N B=B_" " Q
73 S J=0 F S J=$O(ENSRT("BLDG","FR",J)) Q:'J!($D(B(0))) D
74 . I ENSRT("BLDG","FR",J)?.N,ENSRT("BLDG","TO",J)?.N,B?.N D Q
75 .. I ENSRT("BLDG","FR",J)>B!(B>ENSRT("BLDG","TO",J)) Q
76 .. S B(0)="",B=B_" "
77 . S:ENSRT("BLDG","FR",J)?.N ENSRT("BLDG","FR",J)=ENSRT("BLDG","FR",J)_" "
78 . S:ENSRT("BLDG","TO",J)?.N ENSRT("BLDG","TO",J)=ENSRT("BLDG","TO",J)_" "
79 . S:B?.N B=B_" "
80 . I ENSRT("BLDG","FR",J)]B!(B]ENSRT("BLDG","TO",J)) Q
81 . S B(0)=""
82 I '$D(B(0)) S B=-1
83 Q
84 ;
85W ; Check WING
86 I ENSRT("BY")'["W" S W="N/A" Q
87 S W=$P(^ENG("SP",SPC,0),U,3)
88 I $D(ENSRT("WING","ALL")) S:W?.N W=W_" " Q
89 I W="",$D(ENSRT("WING","AIND","NULL")) Q
90 I W]"",$D(ENSRT("WING","AIND",W)) S:W?.N W=W_" " Q
91 S J=0 F S J=$O(ENSRT("WING","FR",J)) Q:'J!($D(W(0))) D
92 . I ENSRT("WING","FR",J)?.N,ENSRT("WING","TO",J)?.N,W?.N D Q
93 .. I ENSRT("WING","FR",J)>W!(W>ENSRT("WING","TO",J)) Q
94 .. S W(0)="",W=W_" "
95 . S:ENSRT("WING","FR",J)?.N ENSRT("WING","FR",J)=ENSRT("WING","FR",J)_" "
96 . S:ENSRT("WING","TO",J)?.N ENSRT("WING","TO",J)=ENSRT("WING","TO",J)_" "
97 . S:W?.N W=W_" "
98 . I ENSRT("WING","FR",J)]W!(W]ENSRT("WING","TO",J)) Q
99 . S W(0)=""
100 I '$D(W(0)) S W=-1
101 Q
102 ;
103R ; Check ROOM
104 I ENSRT("BY")'["R" S R="N/A" Q
105 S R=$P($P(^ENG("SP",SPC,0),U),"-")
106 I $D(ENSRT("ROOM","ALL")) S:R?.N R=R_" " Q
107 I $D(ENSRT("ROOM","AIND",R)) S:R?.N R=R_" " Q
108 S J=0 F S J=$O(ENSRT("ROOM","FR",J)) Q:'J!($D(R(0))) D
109 . I ENSRT("ROOM","FR",J)?.N,ENSRT("ROOM","TO",J)?.N,R?.N D Q
110 .. I ENSRT("ROOM","FR",J)>R!(R>ENSRT("ROOM","TO",J)) Q
111 .. S R(0)="",R=R_" "
112 . S:ENSRT("ROOM","FR",J)?.N ENSRT("ROOM","FR",J)=ENSRT("ROOM","FR",J)_" "
113 . S:ENSRT("ROOM","TO",J)?.N ENSRT("ROOM","TO",J)=ENSRT("ROOM","TO",J)_" "
114 . S:R?.N R=R_" "
115 . I ENSRT("ROOM","FR",J)]R!(R]ENSRT("ROOM","TO",J)) Q
116 . S R(0)=""
117 I '$D(R(0)) S R=-1
118 Q
119 ;ENEQPMS8
Note: See TracBrowser for help on using the repository browser.