open-insight/LSL2/STPROC/PROD_SPEC_EVENTS.txt
2024-09-18 23:39:22 +02:00

108 lines
4.5 KiB
Plaintext

Compile function PROD_SPEC_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 : PROD_SPEC_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)
03/08/22 djs Created initial commuter module.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#window PROD_SPEC
$Insert APP_INSERTS
$Insert EVENT_SETUP
$Insert PROD_SPEC_EQUATES
$Insert SECURITY_RIGHTS_EQU
$Insert MSG_EQUATES
Declare function NextKey, Error_Services, Security_Check
Declare subroutine Database_Services, Comm_Prod_Spec, Security_Err_Msg
GoToEvent Event for CtrlEntId else
// Event not implemented
end
Return EventFlow or 1
//-----------------------------------------------------------------------------
// EVENT HANDLERS
//-----------------------------------------------------------------------------
Event PUB_CREATE_NEW_PSN.CLICK()
If Security_Check('Prod Spec', Write$) then
NewKey = NextKey('PROD_SPEC')
If NewKey NE '' then
NewRec = ''
// Initialize new record status as Inactive, record the user that created the record,
// and the date it was created.
NewRec<PROD_SPEC_STATUS$> = 'I'
NewRec<PROD_SPEC_ENTRY_ID$> = @User4
NewRec<PROD_SPEC_ENTRY_DATE$> = Date()
Database_Services('WriteDataRow', 'PROD_SPEC', NewKey, NewRec)
If Error_Services('NoError') then
Send_Event(@Window, 'CLEAR')
Set_Property(@Window:'.PROD_SPEC_ID', 'TEXT', NewKey)
Set_Property(@Window:'.STATUS', 'VALUE', NewRec<PROD_SPEC_STATUS$>)
Set_Property(@Window:'.ENTRY_ID', 'TEXT', NewRec<PROD_SPEC_ENTRY_ID$>)
Set_Property(@Window:'.ENTRY_DATE', 'TEXT', OConv(NewRec<PROD_SPEC_ENTRY_DATE$>, 'D2/'))
Comm_Prod_Spec('Read')
end else
ErrorMsg = 'Error creating new PROD_SPEC record! Contact FI for assistance.'
Msg(@Window, '', 'OK', '', 'Error':@FM:ErrorMsg)
end
end else
ErrorMsg = 'Error retrieving next PROD_SPEC key! Contact FI for assistance.'
Msg(@Window, '', 'OK', '', 'Error':@FM:ErrorMsg)
end
end else
Security_Err_Msg('Prod Spec', Write$)
Set_Property(@Window:'.PROD_SPEC_ID', 'TEXT', '')
Post_Event(@Window, 'CLEAR')
end
end event
Event PUB_LU_PSN.CLICK()
Def = ""
Def<MCOL$> = '-2'
Def<MROW$> = '-2'
Def<MTEXT$> = "Loading all PSNs. Please wait..."
Def<MTYPE$> = "U"
MsgUp = Msg(@window, Def) ;* display the processing message
SelPSN = Popup(@Window, '', 'PSN_QUERY')
Msg(@window, MsgUp) ;* take down the processing message
If SelPSN NE '' then
Set_Property(@Window:'.PROD_SPEC_ID', 'TEXT', SelPSN)
Post_Event(@Window, 'READ')
end
end event