274 lines
8.8 KiB
Plaintext
274 lines
8.8 KiB
Plaintext
Compile function REACT_LL_HISTORY_EVENTS(CtrlEntId, Event, @PARAMS)
|
|
/***********************************************************************************************************************
|
|
|
|
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
|
|
permission from Infineon.
|
|
|
|
Name : REACT_LL_HISTORY_EVENTS
|
|
|
|
Description : This function acts as a commuter module for all events related to this window.
|
|
|
|
Notes : Commuter Modules are automatically called from the Promoted_Events function which is called by the
|
|
application-specific promoted event handler. This makes it possible to add QuickEvents that need to
|
|
execute Basic+ logic without having use the Form Designer to make the association, although this is
|
|
limited to the events which are currently promoted.
|
|
|
|
If the form needs to call the commuter module directly then the QuickEvent parameters should be
|
|
formatted like this:
|
|
|
|
'@SELF','@EVENT',['@PARAM1','@PARAMx']
|
|
|
|
Parameters :
|
|
CtrlEntId [in] -- The fully qualified name of the control calling the promoted event
|
|
Event [in] -- The event being executed. See the Notes section regarding "PRE" events
|
|
Param1-15 [in] -- Additional event parameter holders
|
|
EventFlow [out] -- Set to 1 or 0 so the calling event knows whether or not to chain forward. See comments in
|
|
EVENT_SETUP insert
|
|
|
|
History : (Date, Initials, Notes)
|
|
05/6/21 jro Created initial commuter module.
|
|
|
|
|
|
|
|
***********************************************************************************************************************/
|
|
|
|
#pragma precomp SRP_PreCompiler
|
|
|
|
//equ crlf$ to \0D0A\
|
|
|
|
#Window REACT_LL_HISTORY
|
|
|
|
$insert APP_INSERTS
|
|
$insert EVENT_SETUP
|
|
$insert MSG_EQUATES
|
|
$Insert REACT_LL_EQUATES
|
|
|
|
Equ MSG_WIDTH$ to 600
|
|
|
|
|
|
Declare subroutine SRP_Show_Window, Msg,SRP_Show_Window
|
|
|
|
Declare function Utility, Datetime, SRP_DateTime, SRP_SORT_ARRAY, Environment_Services
|
|
|
|
SubclassInfo = Form_Services('FindSubclassControl')
|
|
Subclass = SubclassInfo<1>
|
|
|
|
// Update the arguments so that the OpenInsight OLE event will treate the ActiveX event as a native event handler.
|
|
If Event EQ 'OLE' then
|
|
Transfer Event to OIEvent
|
|
Transfer Param1 to Event
|
|
Transfer Param2 to Param1
|
|
Transfer Param3 to Param2
|
|
* Transfer Param4 to Param3
|
|
* Transfer Param5 to Param4
|
|
* Transfer Param6 to Param5
|
|
* Transfer Param7 to Param6
|
|
* Transfer Param8 to Param7
|
|
end
|
|
|
|
GoToEvent Event for CtrlEntID
|
|
|
|
Return EventFlow else EVENT_CONTINUE$
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Events
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
Event WINDOW.CREATE(CreateParam)
|
|
|
|
GoSub Setup_OLE_Controls
|
|
|
|
IF CreateParam NE '' then
|
|
Reactor = CreateParam
|
|
Set_Property(@Window: '.REACT_NO','DEFPROP', Reactor)
|
|
Send_Event(@Window:'.SEARCH', 'CLICK')
|
|
end
|
|
FormSize = ''
|
|
SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize)
|
|
end event
|
|
|
|
|
|
Event WINDOW.READ()
|
|
|
|
end event
|
|
|
|
Event WINDOW.CLOSE(CancelFlag)
|
|
|
|
end event
|
|
|
|
|
|
|
|
Event WINDOW.CLEAR(bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus)
|
|
|
|
end event
|
|
|
|
Event SEARCH.CLICK()
|
|
|
|
Reactor = Get_Property(@WINDOW:'.REACT_NO','DEFPROP')
|
|
DateFrom = Get_Property(@WINDOW:'.DATE_FROM','DEFPROP')
|
|
DateFrom = ICONV(DateFrom,'DT')
|
|
DateTo = Get_Property(@WINDOW:'.DATE_TO','DEFPROP')
|
|
DateTo = ICONV(DateTo,'DT')
|
|
|
|
|
|
IF DateTo EQ '' then
|
|
DateTo = DateTime()
|
|
end
|
|
IF DateFrom EQ '' then
|
|
DateFrom = SRP_DateTime('AddDays', DateTo, -730)
|
|
end
|
|
|
|
dataarray = ''
|
|
open "REACT_LL" To ReactLLTable else
|
|
Status = Set_FSError()
|
|
return
|
|
|
|
end
|
|
|
|
select ReactLLTable
|
|
RecordsFound = 0
|
|
Done = 0
|
|
Loop
|
|
ReadNext @ID else Done = 1
|
|
Until Done Do
|
|
read @Record from ReactLLTable, @ID else
|
|
status = Set_FSError()
|
|
|
|
return
|
|
end
|
|
RecordID = @ID
|
|
swap '*' with @FM in RecordID
|
|
RecordReactor = RecordID<1>
|
|
RecordTime = RecordID<2>
|
|
IF RecordTime GE DateFrom AND RecordTime LE DateTo AND RecordReactor EQ Reactor Then
|
|
RecToWrite = @Record
|
|
SideDisabled = RecToWrite<REACT_LL_DISABLED$>
|
|
StartDTM = RecordTime
|
|
StartUser = RecToWrite<REACT_LL_START_USER$>
|
|
StartNote = RecToWrite<REACT_LL_START_NOTE$>
|
|
StopDTM = RecToWrite<REACT_LL_STOP_DTM$>
|
|
StopUser = RecToWrite<REACT_LL_STOP_USER$>
|
|
StopNote = RecToWrite<REACT_LL_STOP_NOTE$>
|
|
dataarray := SideDisabled :@VM:StartDTM:@VM:StartUser:@VM:StartNote:@VM:StopDTM:@VM:StopUser:@VM:StopNote:@FM
|
|
RecordsFound += 1
|
|
end
|
|
Repeat
|
|
dataarray = SRP_SORT_Array(dataarray, "DL2", 1)
|
|
For dataarraycount = 1 to DCOUNT(dataarray, @FM)
|
|
dataarray<dataarraycount, 2> = OCONV(dataarray<dataarraycount, 2>,'DT4/HS')
|
|
dataarray<dataarraycount, 5> = OCONV(dataarray<dataarraycount, 5>,'DT4/HS')
|
|
Next dataarraycount
|
|
|
|
If RecordsFound EQ 0 then
|
|
msg(@Window, 'No LL transactions found for Reactor ' : Reactor : '.')
|
|
end
|
|
Set_Property(@WINDOW:'.HISTORY_TABLE','LIST',dataarray)
|
|
HeaderText = 'LL Side':@FM:'Start Date':@FM:'Start User':@FM:'Start Note':@FM:'Stop Date': @FM:'Stop User':@FM:'Stop Note':@VM
|
|
Set_Property(@WINDOW:'.HISTORY_TABLE','LABEL',HeaderText)
|
|
end event
|
|
Event OLE_DATEPICKER_FROM.OnSelChange(FirstDate)
|
|
|
|
|
|
SelectedDate = Get_Property(CtrlEntId, 'OLE.Selection')
|
|
Set_Property(@Window : '.OLE_SCHEDULE', 'OLE.Date', SelectedDate)
|
|
Set_Property(@Window : '.DATE_FROM','DEFPROP', OCONV(SelectedDate,'DT4/HS'))
|
|
Set_Property(@Window : '.DATE_TO', "OLE.Focus", 1)
|
|
|
|
end event
|
|
|
|
Event OLE_DATEPICKER_TO.OnSelChange(FirstDate)
|
|
|
|
|
|
SelectedDate = Get_Property(CtrlEntId, 'OLE.Selection')
|
|
Set_Property(@Window : '.OLE_SCHEDULE', 'OLE.Date', SelectedDate)
|
|
Set_Property(@Window : '.DATE_TO','DEFPROP', OCONV(SelectedDate,'DT4/HS'))
|
|
|
|
end event
|
|
|
|
Event PUB_DIR_BROWSE.CLICK
|
|
Server = Environment_Services('GetServer')
|
|
value = ''
|
|
Begin Case
|
|
Case Server EQ 'MESST5202' OR Server EQ 'MESST5201'
|
|
value = "Select a directory" : @fm : '\\tsclient\C\Users\'
|
|
|
|
End Case
|
|
|
|
dir = Utility( "CHOOSEDIR", @window, value)
|
|
|
|
if dir NE '' then
|
|
Reactor = Get_Property(@Window: '.REACT_NO','DEFPROP')
|
|
Set_Property(@Window : '.FILE_PATH', 'DEFPROP', dir: '\R':Reactor:'loadlockhistory.csv')
|
|
end
|
|
|
|
end event
|
|
|
|
Event PUB_EXPORT.CLICK
|
|
|
|
|
|
|
|
tableLines = Get_Property(@WINDOW:'.HISTORY_TABLE','LIST')
|
|
HeaderOut = Get_Property(@WINDOW:'.HISTORY_TABLE','LABEL') : crlf$
|
|
swap @FM with ',' in HeaderOut
|
|
filepath = Get_Property(@Window : '.FILE_PATH', 'DEFPROP')
|
|
DataOut = ''
|
|
|
|
IF filepath NE '' then
|
|
For Each line in tableLines using @FM
|
|
For a = 1 to COUNT(line,@VM)
|
|
line<1,a> = QUOTE(line<1,a>)
|
|
Next a
|
|
|
|
swap @VM with ',' in line
|
|
DataOut := line: crlf$
|
|
Next line
|
|
end else
|
|
msg(@Window, 'No save path specified.')
|
|
return
|
|
end
|
|
|
|
OSOPEN filepath TO hFilePath THEN
|
|
OSWrite DataOut ON filepath ;* Clear file it was already there
|
|
END ELSE
|
|
OSWrite DataOut ON filepath ;* Create the file if it wasn't
|
|
OSOPEN filepath TO hFilePath ELSE
|
|
Msg(@Window, 'Unable to write the file!')
|
|
RETURN ''
|
|
END
|
|
END
|
|
|
|
SWAP @FM WITH ',' IN HeaderOut
|
|
|
|
FilePointer = 0
|
|
|
|
OSBWrite HeaderOut ON filepath AT FilePointer
|
|
FilePointer += LEN(HeaderOut)
|
|
|
|
OSBWrite DataOut ON filepath AT FilePointer
|
|
OSClose hFilePath
|
|
Msg(@Window, 'Successfuly wrote file at ' : filepath : '.')
|
|
|
|
|
|
end event
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Internal GoSubs
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
Setup_OLE_Controls:
|
|
Ctrl = @Window : '.OLE_DATEPICKER_FROM'
|
|
Set_Property(Ctrl, 'OLE.Border', 'XP Flat')
|
|
Set_Property(Ctrl, 'OLE.Font', 'Segoe UI' : @SVM : '9')
|
|
Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnSelChange', 1)
|
|
|
|
Ctrl = @Window : '.OLE_DATEPICKER_TO'
|
|
Set_Property(Ctrl, 'OLE.Border', 'XP Flat')
|
|
Set_Property(Ctrl, 'OLE.Font', 'Segoe UI' : @SVM : '9')
|
|
Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnSelChange', 1)
|
|
return
|
|
|
|
|
|
|
|
|
|
|