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

SDESCHECKLOCK.m

Go to the documentation of this file.
SDESCHECKLOCK ;ALB/LAB - SDES CHECK ORDER LOCK ;APR 21,2023
 ;;5.3;Scheduling;**844**;Aug 13, 1993;Build 12
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 ; Reference to $$LOCK1^ORX2 is supported by IA #867
 ; Reference to UNKL1^ORX2 is supported by IA #867
 Q
 ;
LOCKCHECK(JSONRETURN,REQUESTIEN) ;
 N REQTYP,RETURN,ORDERID,ERROR,USER,LOCKFLG
 S LOCKFLG=0
 D VALIDATEREQIEN(.ERRORS,REQUESTIEN)
 I $D(ERRORS) M RETURN=ERRORS D BUILDJSON(.JSONRETURN,.RETURN) Q
 D GETORDER(.ORDERID,REQUESTIEN)
 D CHECKORDERLOCK(.ORDERID,.LOCKFLG)
 S RETURN("RecordLock")=LOCKFLG
 D BUILDJSON(.JSONRETURN,.RETURN)
 Q
 ;
CHECKORDERLOCK(ORDERID,LOCKFLG) ;
 N LOCKED
 S LOCKED=0
 Q:'ORDERID
 I $D(^XTMP("ORLK-"_ORDERID)) D
 . S LOCKFLG=1
 I LOCKFLG'=1 D
 . S LOCKED=$$LOCK1^ORX2(ORDERID)
 . S:+LOCKED=0 LOCKFLG=1
 . I +LOCKED D
 . . D UNLK1^ORX2(ORDERID)
 Q
VALIDATEREQIEN(ERRORS,REQUESTIEN) ;
 I $G(REQUESTIEN)="" D ERRLOG^SDESJSON(.ERRORS,3) Q
 I ('$D(^SDEC(409.85,REQUESTIEN)))!(REQUESTIEN=0) D ERRLOG^SDESJSON(.ERRORS,4)
 Q
 ;
GETORDER(ORDERID,REQUESTIEN) ;
 S ORDERID=$$GET1^DIQ(409.85,REQUESTIEN,46,"I")
 Q
 ;
BUILDJSON(JSONRETURN,RETURN) ;
 N JSONERROR
 D ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERROR")
 ;
 Q
 ;