226 lines
6.5 KiB
Plaintext
226 lines
6.5 KiB
Plaintext
Compile function NDW_LOT_HISTORY_QUERY_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 : NDW_LOT_HISTORY_QUERY_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)
|
|
9/8/23 djm Initial Program
|
|
|
|
***********************************************************************************************************************/
|
|
|
|
#pragma precomp SRP_PreCompiler
|
|
|
|
equ crlf$$ to \0D0A\
|
|
|
|
$insert APP_INSERTS
|
|
$insert EVENT_SETUP
|
|
$insert MSG_EQUATES
|
|
|
|
|
|
|
|
|
|
Declare subroutine SRP_Show_Window, Msg, Material_Services
|
|
Declare function Utility, Datetime, SRP_DateTime, SRP_SORT_ARRAY, Material_Services
|
|
|
|
// 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$
|
|
|
|
Event WINDOW.CREATE(CreateParam)
|
|
|
|
GoSub Setup_OLE_Controls
|
|
FormSize = ''
|
|
SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize)
|
|
|
|
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'))
|
|
|
|
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_DATE_FROM.CLICK:
|
|
|
|
target = '.OLE_DATEPICKER_FROM'
|
|
GoSub ToggleVisible
|
|
|
|
return
|
|
|
|
Event PUB_DATE_TO.CLICK:
|
|
|
|
target = '.OLE_DATEPICKER_TO'
|
|
GoSub ToggleVisible
|
|
|
|
return
|
|
|
|
Event PUB_DIR_BROWSE.CLICK
|
|
|
|
value = "Select a directory" : @fm : "c:\temp"
|
|
dir = Utility( "CHOOSEDIR", @window, value)
|
|
|
|
if dir NE '' then
|
|
Set_Property(@Window : '.FILE_PATH', 'DEFPROP', dir: '\LotHistory.csv')
|
|
end
|
|
|
|
end event
|
|
|
|
Event PUB_EXPORT.CLICK
|
|
|
|
tableLines = Get_Property(@WINDOW:'.EDT_LOTHISTORY','LIST')
|
|
HeaderOut = Get_Property(@WINDOW:'.EDT_LOTHISTORY','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
|
|
OSDelete filepath
|
|
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
|
|
|
|
Event SEARCH.CLICK
|
|
|
|
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, -7)
|
|
* end
|
|
|
|
LotID = Get_Property(@WINDOW:'.TXT_LOTID','TEXT')
|
|
IDType = Get_Property(@WINDOW:'.REPORT_BY','VALUE')
|
|
If LotID NE '' then
|
|
Gosub GetLotHistory
|
|
End
|
|
|
|
end event
|
|
|
|
|
|
|
|
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
|
|
|
|
* * * * * * * *
|
|
ToggleVisible:
|
|
* * * * * * * *
|
|
|
|
visible = Get_Property(@Window : target , 'VISIBLE')
|
|
|
|
if visible then
|
|
Set_Property(@Window : target, 'VISIBLE', 0)
|
|
end else
|
|
Set_Property(@Window : target, 'VISIBLE', 1)
|
|
end
|
|
target = ''
|
|
return
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Internal GoSubs
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
GetLotHistory:
|
|
LotHistoryArray = Material_Services('GetLotHistory', IDType, LotID, DateFrom, DateTo)
|
|
Ctrl = @Window : '.EDT_LotHistory'
|
|
Set_Property(Ctrl, 'LIST', LotHistoryArray)
|
|
return
|
|
|
|
|
|
|