Changeset 1466 for Scheduling/trunk/m/BSDX25.m
- Timestamp:
- Jul 3, 2012, 7:45:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/m/BSDX25.m
r1464 r1466 1 BSDX25 ; VEN/SMH - WINDOWS SCHEDULING RPCS ; 6/29/12 12:04pm1 BSDX25 ; VEN/SMH - WINDOWS SCHEDULING RPCS ; 7/3/12 12:27pm 2 2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18 3 3 ; Licensed under LGPL … … 34 34 ; - Another number or text if not 35 35 ; 36 ; Error reference: 37 ; -1 -> Invalid Appointment ID 38 ; -2 -> Invalid Check-in Date 39 ; -3 -> Cannot check-in due to Fileman Filer failure 40 ; -10 -> BSDXAPI error 41 ; -100 -> Mumps Error 42 ; 36 43 ; Turn off SDAM Appointment Events BSDX Protocol Processing 37 44 N BSDXNOEV … … 44 51 N $ET S $ET="G ERROR^BSDX25" 45 52 ; 53 ; Test for error trap for Unit Tests 54 I $G(BSDXDIE) N X S X=1/0 55 ; 46 56 N BSDXI S BSDXI=0 47 57 ; … … 51 61 S ^BSDXTMP($J,0)="T00020ERRORID"_$C(30) 52 62 ; 53 I '+BSDXAPPTID D ERR("Invalid Appointment ID") QUIT 54 I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("Invalid Appointment ID") QUIT 55 ; 56 ; Lock the node for synchronizing access to appointment 57 LOCK +^BSDXAPPT(BSDXAPPTID):1 58 ELSE DO ERR("-7~Lock not acquired") QUIT 63 I '+BSDXAPPTID D ERR("-1~Invalid Appointment ID") QUIT 64 I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("-1~Invalid Appointment ID") QUIT 59 65 ; 60 66 ; Remove Date formatting v.1.5. Client will send date as FM Date. … … 62 68 ;S %DT="T",X=BSDXCDT D ^%DT S BSDXCDT=Y 63 69 S BSDXCDT=+BSDXCDT ; Strip off zeros if C# sends them 64 I BSDXCDT =-1 D ERR(70) Q70 I BSDXCDT'>2000000 D ERR("-2~Invalid Check-in Date") QUIT 65 71 I BSDXCDT>$$NOW^XLFDT S BSDXCDT=$$NOW^XLFDT 66 72 ; 67 ;Checkin BSDX APPOINTMENT entry 68 N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,BSDXCDT) 69 I BSDXERR D ERR("BSDX08: Fileman Filer failed to check-in appt") QUIT 70 ; 71 N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0) 72 N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) 73 N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) 73 ; Some data 74 N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0) ; Appointment Node 75 N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; DFN 76 N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) ; Appointment Start Time 74 77 ; 75 78 ; Get Hospital Location IEN from BSDXAPPT to BSDXRES (RESOUCE:HOSPITAL LOCATION) … … 77 80 I BSDXSC1,'$D(^SC(BSDXSC1,0)) S BSDXSC1="" ; Null it off if it doesn't exist 78 81 ; 82 ; Check if we can check-in using BSDXAPI 83 N BSDXERR S BSDXERR=0 84 I BSDXSC1 S BSDXERR=$$CHECKIC1^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART) 85 I BSDXERR D ERR(-10_"~"_$P(BSDXERR,U,2)) QUIT 86 ; 87 ; Checkin BSDX APPOINTMENT entry 88 ; Failure Analysis: If we fail here, no changes were made. 89 N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,BSDXCDT) 90 I BSDXERR D ERR("-3~Fileman Filer failed to check-in appt") QUIT 91 ; 79 92 ; File check-in using BSDXAPI 93 ; Failure Analysis: If we fail here, we need to roll back first check-in. 80 94 N BSDXERR S BSDXERR=0 81 95 I BSDXSC1 S BSDXERR=$$CHECKIN1^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART) 82 I BSDXERR D ERR($P(BSDXZ,U,2)) QUIT 83 ; 84 ; Unlock 85 LOCK -^BSDXAPPT(BSDXAPPTID) 96 I BSDXERR D QUIT 97 . N % S %=$$BSDXCHK(BSDXAPPTID,"@") ; No Error checking to prevent loop. 98 . D ERR(-10_"~"_$P(BSDXERR,U,2)) ; Send error message to client 86 99 ; 87 100 S BSDXI=BSDXI+1 … … 98 111 ; Output: 1^Error for error 99 112 ; 0 for success 113 ; 114 Q:$G(BSDXSIMERR1) 1_U_"Simulated Error 1" 100 115 ; 101 116 N BSDXIENS,BSDXMSG,BSDXFDA ; Filer variables … … 145 160 I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("-2~Invalid Appointment ID") QUIT 146 161 ; 147 ; Lock the node for synchronizing access to appointment148 LOCK +^BSDXAPPT(BSDXAPPTID):1149 ELSE DO ERR("-7~Lock not acquired") QUIT150 ;151 162 ; Remove checkin from BSDX APPOINTMENT entry 152 163 N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,"@") … … 167 178 ; 168 179 N BSDXZ ; Scratch variable to hold error message 169 I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI (BSDXPATID,BSDXSC1,BSDXSTART)180 I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI1(BSDXPATID,BSDXSC1,BSDXSTART) 170 181 I +$G(BSDXZ) D ERR("-5~"_$P(BSDXZ,U,2)) QUIT 171 182 ; 172 ; Unlock173 LOCK -^BSDXAPPT(BSDXAPPTID)174 ;175 183 ; Return ADO recordset 176 184 S BSDXI=BSDXI+1 … … 225 233 S $ETRAP="D ^%ZTER HALT" ; Emergency Error Trap for the wise 226 234 D ^%ZTER 227 S $EC="" ; Clear Error 235 ; VEN/SMH: NB: I make a conscious decision not to roll back anything 236 ; here in the error trap. Once the error is fixed, users can 237 ; undo or redo the check-in. 238 ; Individual portions of this routine may choose to do rolling back 239 ; of their own (e.g. a failed call to BSDXAPI causes rollback to occur 240 ; in CHECKIN) 241 ; 228 242 ; Log error message and send to client 229 243 D ERR("-100~Mumps Error") 230 Q 244 Q:$Q "-100^Mumps Error" Q 231 245 ; 232 246 ERR(BSDXERR) ;Error processing 233 I $G(BSDXAPPTID) LOCK -^BSDXAPPT(BSDXAPPTID) 247 ; If last line is $C(31), we are done. No more errors to send to client. 248 I ^BSDXTMP($J,$O(^BSDXTMP($J," "),-1))=$C(31) QUIT 234 249 S BSDXERR=$G(BSDXERR) 235 250 S BSDXERR=$P(BSDXERR,"~")_"~"_$TEXT(+0)_":"_$P(BSDXERR,"~",2) ; Append Routine Name
Note:
See TracChangeset
for help on using the changeset viewer.