COMPILE FUNCTION obj_React_LL(Method,Parms) /* Methods for the Reactor Load Lock (REACT_LL) table 08/13/2015 JCH - Initial Coding Properties: Methods: Create() ;* Create new React Mode record Close() ;* Close existing React Mode record */ DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box,NextKey, Popup, Get_Property DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, Btree.Extract, ErrMsg, obj_React_Event, Database_Services $INSERT MSG_EQUATES $INSERT REACT_LL_EQUATES ErrTitle = 'Error in Stored Procedure "obj_React_LL"' ErrorMsg = '' IF NOT(ASSIGNED(Method)) THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine' IF NOT(ASSIGNED(Parms)) THEN Parms = '' IF ErrorMsg NE '' THEN Set_Status(-1,ErrTitle:@SVM:ErrorMsg) RETURN '' END Result = '' BEGIN CASE CASE Method = 'Create' ; GOSUB Create CASE Method = 'Close' ; GOSUB Close Case Method = 'SetQual' ; GOSUB SetQual CASE 1 ErrorMsg = 'Unknown Method ':QUOTE(Method):' passed to routine.' END CASE IF ErrorMsg NE '' THEN Set_Status(-1,ErrTitle:@SVM:ErrorMsg) RETURN '' END RETURN Result * * * * * * * Create: * * * * * * * ReactNo = Parms[1,@RM] StartDTM = Parms[COL2()+1,@RM] UserID = Parms[COL2()+1,@RM] LLDisabled = Parms[COL2()+1,@RM] Note = Parms[COL2()+1,@RM] IF ReactNo = '' THEN ErrorMsg = 'Null parameter ReactNo passed to routine (':Method:').' IF StartDTM = '' THEN ErrorMsg = 'Null parameter StartDTM passed to routine (':Method:').' IF UserID = '' THEN ErrorMsg = 'Null parameter UserID passed to routine (':Method:').' IF LLDisabled = '' THEN ErrorMsg = 'Null parameter Mode passed to routine (':Method:').' IF ErrorMsg NE '' THEN RETURN IF LLDisabled NE 'L' AND LLDisabled NE 'R' THEN ErrorMsg = 'Invalid value ':QUOTE(LLDisabled):' passed for parameter LLDisabled (':Method:').' Return END thisStartDTM = ICONV(StartDTM,'DT') IF thisStartDTM = '' THEN ErrorMsg = 'Invalid value ':QUOTE(StartDTM):' passed for parameter StartDTM (':Method:').' RETURN END ReactLLKey = ReactNo:'*':thisStartDTM ReactLLRec = '' ReactLLRec = UserID ReactLLRec = Note ReactLLRec = LLDisabled TableVar = '' OtParms = 'REACT_LL':@RM:ReactLLKey:@RM:TableVar:@RM:ReactLLRec obj_Tables('WriteRec',OtParms) ;* Writes and unlocks the record ***** Added 10/2/1013 JCH - Log Mode change in the REACT_EVENT table. CurrMode = XLATE('REACTOR',ReactNo,'CURR_MODE','X') oREParms = ReactNo:@RM oREParms := StartDTM:@RM oREParms := 'LLD':@RM ;* React Event - Load Lock Disabled oREParms := UserID:@RM oREParms := Note:@RM oREParms := '' ;* New Mode - not used here oREParms := CurrMode obj_React_Event('Create',oREParms) RETURN * * * * * * * Close: * * * * * * * ReactNo = Parms[1,@RM] StartDTM = Parms[COL2()+1,@RM] StopDTM = Parms[COL2()+1,@RM] UserID = Parms[COL2()+1,@RM] Note = Parms[COL2()+1,@RM] IF ReactNo = '' THEN ErrorMsg = 'Null parameter ReactNo passed to routine (':Method:').' IF StartDTM = '' THEN ErrorMsg = 'Null parameter StartDTM passed to routine (':Method:').' IF StopDTM = '' THEN ErrorMsg = 'Null parameter StopDTM passed to routine (':Method:').' IF UserID = '' THEN ErrorMsg = 'Null parameter UserID passed to routine (':Method:').' IF ErrorMsg NE '' THEN RETURN thisStartDTM = ICONV(StartDTM,'DT') IF thisStartDTM = '' THEN ErrorMsg = 'Invalid value ':QUOTE(StartDTM):' passed for parameter StartDTM (':Method:').' RETURN END thisStopDTM = ICONV(StopDTM,'DT') IF thisStopDTM = '' THEN ErrorMsg = 'Invalid value ':QUOTE(StopDTM):' passed for parameter StopDTM (':Method:').' RETURN END ReactLLKey = ReactNo:'*':thisStartDTM OtParms = 'REACT_LL':@RM:ReactLLKey ReactLLRec = obj_Tables('ReadRec',OtParms) ReactLLRec = thisStopDTM ReactLLRec = UserID ReactLLRec = Note OtParms = FieldStore(OtParms,@RM,4,1,ReactLLRec) obj_Tables('WriteRec',OtParms) ;* Writes and unlocks the record ***** Added 10/2/1013 JCH - Log Mode change in the REACT_EVENT table. CurrMode = XLATE('REACTOR',ReactNo,'CURR_MODE','X') oREParms = ReactNo:@RM oREParms := StopDTM:@RM oREParms := 'LLE':@RM ;* React Event - Load Lock Enabled oREParms := UserID:@RM oREParms := Note:@RM oREParms := '' ;* New Mode - not used here oREParms := CurrMode obj_React_Event('Create',oREParms) RETURN * * * * * * * SetQual: * * * * * * * ReactNo = Parms[1,@RM] ReactLLKey = Parms[COL2()+1,@RM] UserID = Parms[COL2()+1,@RM] DownLL = Parms[COL2()+1,@RM] CurrTime = Parms[COL2()+1,@RM] IF ReactNo = '' THEN ErrorMsg = 'Null parameter ReactNo passed to routine (':Method:').' IF ReactLLKey = '' THEN ErrorMsg = 'Null parameter ReactLLKey passed to routine (':Method:').' IF UserID = '' THEN ErrorMsg = 'Null parameter UserID passed to routine (':Method:').' IF DownLL = '' THEN ErrorMsg = 'Null parameter DownLL passed to routine (':Method:').' IF CurrTime = '' THEN ErrorMsg = 'Null parameter CurrTime passed to routine (':Method:').' IF ErrorMsg NE '' THEN RETURN thisStopDTM = ICONV(CurrTime,'DT') IF thisStopDTM = '' THEN ErrorMsg = 'Invalid value ':QUOTE(StartDTM):' passed for parameter CurrTime (':Method:').' RETURN END ReactLLRec = XLATE('REACT_LL', ReactLLKey, '','X') IF ReactLLRec EQ 1 then ReactLLRec = 0 end else ReactLLRec = 1 end Database_Services('WriteDataRow','REACT_LL',ReactLLKey, ReactLLRec,1,0,1) return