Compare commits

...

4 Commits

5 changed files with 1609 additions and 337 deletions

File diff suppressed because it is too large Load Diff

View File

@ -50,109 +50,112 @@ RETURN Result
* * * * * * *
Create:
* * * * * * *
obj_AppWindow('Create')
Set_Property(@WINDOW,'STATUSLINE',@WINDOW:'.STATUSLINE_FIX')
GOSUB Refresh
obj_AppWindow('Create')
Set_Property(@WINDOW,'STATUSLINE',@WINDOW:'.STATUSLINE_FIX')
GOSUB Refresh
RETURN
* * * * * * *
Refresh:
* * * * * * *
RETURN
* * * * * * *
ReactNoGF:
* * * * * * *
* Don't add a return here
* * * * * * *
LUReactor:
* * * * * * *
IF NOT(ASSIGNED(Parm1)) THEN FocusControl = '' ELSE FocusControl = Parm1
IF NOT(ASSIGNED(Parm2)) THEN FocusPos = '' ELSE FocusPos = Parm2
Set_Status(0)
TypeOver = ''
TypeOver<PSELECT$> = '2' ;* Multiple Select
TypeOver<PTYPE$> = 'E' ;* Return entire row
ReactData = Popup(@WINDOW,TypeOver,'REACTORS')
IF ReactData = '' THEN RETURN
Set_Property(@WINDOW:'.REACT_NO','LIST',ReactData)
LineCnt = COUNT(ReactData,@FM) + (ReactData NE '')
ColCnt = 7
FOR Line = 1 TO LineCnt
FOR Column = 2 TO ColCnt
stat = Send_Message(@WINDOW:'.REACT_NO','COLOR_BY_POS',Column,Line,GREEN$)
NEXT Column
NEXT Line
IF NOT(ASSIGNED(Parm1)) THEN FocusControl = '' ELSE FocusControl = Parm1
IF NOT(ASSIGNED(Parm2)) THEN FocusPos = '' ELSE FocusPos = Parm2
Set_Status(0)
TypeOver = ''
TypeOver<PSELECT$> = '2' ;* Multiple Select
TypeOver<PTYPE$> = 'E' ;* Return entire row
ReactData = Popup(@WINDOW,TypeOver,'REACTORS')
IF ReactData = '' THEN RETURN
Set_Property(@WINDOW:'.REACT_NO','LIST',ReactData)
LineCnt = COUNT(ReactData,@FM) + (ReactData NE '')
ColCnt = 7
FOR Line = 1 TO LineCnt
FOR Column = 2 TO ColCnt
stat = Send_Message(@WINDOW:'.REACT_NO','COLOR_BY_POS',Column,Line,GREEN$)
NEXT Column
NEXT Line
RETURN
* * * * * * *
Cancel:
* * * * * * *
End_Dialog(@WINDOW,'')
End_Dialog(@WINDOW,'')
RETURN
* * * * * * *
PostEntries:
* * * * * * *
ReactNos = Get_Property(@WINDOW:'.REACT_NO','ARRAY')<COL$REACT_NO>
Comment = Get_Property(@WINDOW:'.COMMENT','DEFPROP')
LOOP
TestChar = ReactNos[-1,1]
UNTIL TestChar NE @VM OR ReactNos = ''
ReactNos[-1,1] = ''
REPEAT
EventKeys = '' ;* Keys to return to the REACT_EVENT window for a browse of the newly created records
IF ReactNos NE '' AND Comment NE '' THEN
EventDTM = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTS') ;* Same DTM for all new records
EventType = 'PD' ;* Passdown
LoggedBy = @USER4
ReactCnt = COUNT(ReactNos,@VM) + (ReactNos NE '')
ReactNos = Get_Property(@WINDOW:'.REACT_NO','ARRAY')<COL$REACT_NO>
Comment = Get_Property(@WINDOW:'.COMMENT','DEFPROP')
FOR I = 1 TO ReactCnt
ReactNo = ReactNos<1,I>
CurrMode = XLATE('REACTOR',ReactNo,'CURR_MODE','X')
LOOP
TestChar = ReactNos[-1,1]
UNTIL TestChar NE @VM OR ReactNos = ''
ReactNos[-1,1] = ''
REPEAT
EventKeys = '' ;* Keys to return to the REACT_EVENT window for a browse of the newly created records
IF ReactNos NE '' AND Comment NE '' THEN
obj_React_Event('Create',ReactNo:@RM:EventDTM:@RM:EventType:@RM:LoggedBy:@RM:Comment:@RM:@RM:CurrMode)
EventKeys<I> = ReactNo:'*':ICONV(EventDTM,'DT')
NEXT I
END
End_Dialog(@WINDOW,EventKeys)
EventDTM = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTS') ;* Same DTM for all new records
EventType = 'PD' ;* Passdown
LoggedBy = @USER4
ReactCnt = COUNT(ReactNos,@VM) + (ReactNos NE '')
FOR I = 1 TO ReactCnt
ReactNo = ReactNos<1,I>
CurrMode = XLATE('REACTOR',ReactNo,'CURR_MODE','X')
obj_React_Event('Create',ReactNo:@RM:EventDTM:@RM:EventType:@RM:LoggedBy:@RM:Comment:@RM:@RM:CurrMode)
ErrCode = ''
If Get_Status(ErrCode) then
Msg(@Window, '', 'OK', '', 'Process Error':@FM:'Error posting entries. ':ErrCode)
end else
Set_Property(@Window:'.REACT_NO', 'LIST', '')
Set_Property(@Window:'.COMMENT', 'TEXT', '')
end
EventKeys<I> = ReactNo:'*':ICONV(EventDTM,'DT')
NEXT I
END else
Msg(@Window, '', 'OK', '', 'Process Error':@FM:'React No(s) and Comment must not be null!')
end
RETURN

View File

@ -16,7 +16,8 @@ Subroutine Service_Manager_Debugger_Intercept(Void)
Metadata :
History : (Date, Initials, Notes)
07/25/23 djs Original programmer.
07/25/23 djs Original programmer.
06/04/25 djs Added LSL note creation (and email forwarding) to notify OI_ADMIN users when invoked.
***********************************************************************************************************************/
@ -24,24 +25,58 @@ Subroutine Service_Manager_Debugger_Intercept(Void)
$insert APP_INSERTS
$insert RTI_DEBUG_COMMON
$insert ENVIRON_CONSTANTS
Declare function Environment_Services, Logging_Services
Declare subroutine Logging_Services
Declare function Environment_Services, Logging_Services, Environment_Services, GetCommandLine, Datetime
Declare subroutine Logging_Services, obj_Notes, Set_Env
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ServiceManager'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' OEngine Log.csv'
Headers = 'Stored Proc Status' : @FM : 'Stored Proc Status Code' : @FM : 'Current Program' : @FM : 'Call Depth' : @FM : 'Line No' : @FM : 'Call Stack'
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
LogData = ''
LogData<1> = SPStatus@
LogData<2> = SPStatCode@
LogData<3> = Curr_Program@
LogData<4> = CallDepth@
LogData<5> = LineNo@
LogData<6> = CallStack@
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, '', '', '')
Main:
// Log event in .\LogFiles\ServiceManager\<Date> OEngine Log.csv
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ServiceManager'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' OEngine Log.csv'
Headers = 'Stored Proc Status' : @FM : 'Stored Proc Status Code' : @FM : 'Current Program' : @FM
Headers := 'Call Depth' : @FM : 'Line No' : @FM : 'Call Stack'
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
LogData = ''
LogData<1> = spStatus@
LogData<2> = spStatCode@
LogData<3> = curr_Program@
LogData<4> = callDepth@
LogData<5> = lineNo@
LogData<6> = callStack@
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, '', '', '')
// Send an LSL message to FI admins to alert them. This is forward to their email address if configured in
// their LSL_USERS record.
CmdLine = GetCommandLine()
EngIndex = Index(CmdLine, '/S=', 1)
EngNo = CmdLine[EngIndex + 3, 'F ']
Server = Environment_Services('GetServer')
Recipients = ''
SentFrom = 'SYSTEM'
Subject = 'Service Manager Debugger Intercept Invoked'
Message = OConv(Datetime(), 'DT2/^H')
Message<2> = 'RevEngineHost (OEngine) ':EngNo:' encountered a runtime error on server ':Server
Message<3> = 'Stored Procedure Status: ':spStatus@
StatCodes = spStatCode@
Swap Char(0) with ',' in StatCodes
Swap Char(23) with '' in StatCodes
Message<4> = 'Stored Procedure Status Code: ':StatCodes
Message<5> = 'Current Program: ':curr_Program@
Message<6> = 'Call Depth: ':callDepth@
Message<7> = 'Line No: ':lineNo@
Message<8> = 'Call Stack: ':\0D0A\:callStack@
Swap @FM with \0D0A\ in Message
Swap @VM with ',' in Message
AttachWindow = ''
AttachKey = ''
SendToGroup = 'OI_SYSADMIN'
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
Return

View File

@ -27,19 +27,29 @@ Function Service_Services(@Service, @Params)
#pragma precomp SRP_PreCompiler
$insert LOGICAL
$insert APP_INSERTS
$insert SERVICE_SETUP
$insert SERVICES_EQUATES
$insert RLIST_EQUATES
$insert SQL_REQUESTS_EQUATES
$Insert PROC_QUEUE_EQUATES
Equ Comma$ to ','
Common /ServiceServices/ Unused1@, Unused2@, Unused3@, Unused4@, Unused5@, Unused6@, Unused7@, Unused8@, Unused9@, Unused10@
Declare function Service_Services, Memory_Services, SRP_List, SRP_FastArray, SRP_Array, Database_Services, Datetime
Declare Function GetTickCount, SRP_Decode, RTI_CREATEGUID
Declare function GetTickCount, SRP_Decode, RTI_CreateGuid, UCase, Environment_services, Logging_Services
Declare subroutine Service_Services, Memory_Services, SRP_List, SRP_FastArray, RList, Set_Status, Database_Services
Declare Subroutine Yield, WinYield, Sleepery, Btree.Extract
Declare Subroutine Yield, WinYield, Sleepery, Btree.Extract, Logging_Services, obj_Notes
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ProcQueue'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Procedure Queue Log.csv'
Headers = 'Logging DTM' : @FM : 'Machine' : @FM : 'RequestKeyId' : @FM : 'Procedure' : @FM : 'Params' : @FM : 'Result' : @FM : 'Error Message'
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, Comma$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
GoToService else
Error_Services('Add', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
@ -165,18 +175,21 @@ Service ProcessProcedureQueue()
ReadNext RequestKeyID else EOF = True$
Until EOF or Done
Lock hProcQueue, RequestKeyID then
Server = Environment_Services('GetServer')
Done = True$
Database_Services('GetKeyIDLock', 'PROC_QUEUE', RequestKeyId)
RequestRow = Database_Services('ReadDataRow', 'PROC_QUEUE', RequestKeyID)
If RequestRow NE '' then
Procedure = RequestRow<PROC_QUEUE.PROC_NAME$>
Procedure = UCase(Procedure)
Params = RequestRow<PROC_QUEUE.PARAMS$>
If Procedure NE '' then
Dim ProcParams(11)
Dim ProcParams(12)
For each Param in Params using @VM setting pPos
ProcParams(pPos) = Param
Next Param
NumArguments = DCount(Params, @VM)
Begin Case
Case NumArguments EQ 0 ; Call @Procedure()
Case NumArguments EQ 1 ; Call @Procedure(ProcParams(1))
@ -194,17 +207,40 @@ Service ProcessProcedureQueue()
Error_Services('Add', 'Error in ':Service:' service. More than 11 arguments are not currently supported.')
End Case
end
If Error_Services('NoError') then
Database_Services('DeleteDataRow', 'PROC_QUEUE', RequestKeyId, True$, False$) ; // This call will release the lock
Swap @VM with ',' in Params
LogData = LoggingDTM
LogData<2> = Server
LogData<3> = RequestKeyId
LogData<4> = Procedure
LogData<5> = Params
ErrCode = ''
If ( Get_Status(ErrCode) or Error_Services('HasError') ) then
ErrorMessage = Error_Services('GetMessage')
Recipients = ''
SentFrom = 'SYSTEM'
Subject = 'Background Procedure Queue Error'
Message = OConv(Datetime(), 'DT2/^H')
Message<2> = 'Error on server ':Server
Message<3> = 'Stored Procedure: ':Procedure
StatCodes = 'Parameters: ':Params
Message<4> = 'Error_Services error message: ':ErrorMessage
Message<5> = 'Get_Status error code: ':ErrCode
Swap @FM with \0D0A\ in Message
AttachWindow = ''
AttachKey = ''
SendToGroup = 'OI_SYSADMIN'
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
LogData<6> = 'Failed'
LogData<7> = 'Error_Services error message: ':ErrorMessage:' Get_Status error code: ':ErrCode
end else
RequestRow<PROC_QUEUE.LAST_ATTEMPT_DTM$> = DateTime()
RequestRow<PROC_QUEUE.ERROR$> = Error_Services('GetMessage')
Database_Services('WriteDataRow', 'PROC_QUEUE', RequestKeyID, RequestRow, True$, False$, False$) ; // This call will release the lock
LogData<6> = 'Success'
end
end else
// Empty request, so delete it from the queue
Database_Services('DeleteDataRow', 'PROC_QUEUE', RequestKeyId, True$, False$) ; // This call will release the lock
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
end
Database_Services('DeleteDataRow', 'PROC_QUEUE', RequestKeyId, True$, False$) ; // This call should release the lock
Unlock hProcQueue, RequestKeyID else Null
end
Repeat
end
@ -258,4 +294,3 @@ return
/// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1231,19 +1231,23 @@ Service SignVoidNonEpp(WOMatKey, Username)
Service_Services('PostProcedure', 'RDS_SERVICES', 'DetachRDSFromWO':@vm:RDSNo)
If Error_Services('NoError') then
LotEventParams = ''
LotEventParams<1,1> = 'CreateLotEvent'
LotEventParams<1,4> = DateTime()
LotEventParams<1,5> = 'VOID'
LotEventParams<1,6> = 'Lot voided by ' : Username
LotEventParams<1,11> = Username
LotEventParams<1,1> = 'CreateLotEvent' ; //Service Module
LotEventParams<1,2> = ''; //Legacy Lot Id, set below
LotEventParams<1,3> = DateTime(); //Datetime
LotEventParams<1,4> = 'VOID'; //Event Type
LotEventParams<1,5> = 'Lot voided by ' : Username; //Event Note
LotEventParams<1,6> = ''; //Equipment id
LotEventParams<1,7> = Username ;//User Id
LotEventParams<1,8> = True$; //IsLegacyLotId
LotEventParams<1,9> = ''; //Legacy Lot Type, set below
If RDSNo NE '' then
LotEventParams<1,2> = RDSNo
LotEventParams<1,3> = 'RDS'
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
LotEventParams<1,9> = 'RDS'; //Legacy Lot Type
Service_Services('PostProcedure', 'LOT_EVENT_SERVICES', LotEventParams)
end else
LotEventParams<1,2> = WoMatKey
LotEventParams<1,3> = 'WO_MAT'
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
LotEventParams<1,9> = 'WO_MAT'
Service_Services('PostProcedure', 'LOT_EVENT_SERVICES', LotEventParams)
end
If Error_Services('NoError') then
//Add inventory transaction
@ -1311,13 +1315,15 @@ Service SignVoidWMI(WMInKey, Username)
If Error_Services('NoError') then
LotEventParams = ''
LotEventParams<1,1> = 'CreateLotEvent'
LotEventParams<1,4> = DateTime()
LotEventParams<1,5> = 'VOID'
LotEventParams<1,6> = 'Lot voided by ' : Username
LotEventParams<1,11> = Username
LotEventParams<1,2> = WMInKey
LotEventParams<1,3> = 'WM_IN'
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
LotEventParams<1,3> = DateTime()
LotEventParams<1,4> = 'VOID'
LotEventParams<1,5> = 'Lot voided by ' : Username
LotEventParams<1,6> = ''
LotEventParams<1,7> = Username
LotEventParams<1,8> = True$
LotEventParams<1,9> = 'WM_IN'
Service_Services('PostProcedure', 'LOT_EVENT_SERVICES', LotEventParams)
If Error_Services('NoError') then
//Check if WMO is also voided. If it is, remove it from the WO_MAT_KEY field in WO_LOG, and void the WO_MAT record
WMOKey = WMInKey; //the paired WMO key is the same as the WMIKey
@ -1386,13 +1392,15 @@ Service SignVoidWMO(WMOutKey, Username)
If Error_Services('NoError') then
LotEventParams = ''
LotEventParams<1,1> = 'CreateLotEvent'
LotEventParams<1,4> = DateTime()
LotEventParams<1,5> = 'VOID'
LotEventParams<1,6> = 'Lot voided by ' : Username
LotEventParams<1,11> = Username
LotEventParams<1,2> = WMOutKey
LotEventParams<1,3> = 'WM_OUT'
Service_Services('PostProcedure', 'LOT_SERVICES', LotEventParams)
LotEventParams<1,3> = DateTime()
LotEventParams<1,4> = 'VOID'
LotEventParams<1,5> = 'Lot voided by ' : Username
LotEventParams<1,6> = ''
LotEventParams<1,7> = Username
LotEventParams<1,8> = True$
LotEventParams<1,9> = 'WM_OUT'
Service_Services('PostProcedure', 'LOT_EVENT_SERVICES', LotEventParams)
If Error_Services('NoError') then
//Check if WMI is also voided. If it is, remove it from the WO_MAT_KEY field in WO_LOG, and void the WO_MAT record
WMIKey = WMOutKey; //the paired WMO key is the same as the WMIKey
@ -1558,3 +1566,4 @@ ClearCursors:
return