open-insight/LSL2/STPROC/NDW_REMOVE_SUPPLEMENTS_EVENTS.txt
2024-10-10 22:05:31 +02:00

192 lines
6.0 KiB
Plaintext

Function NDW_Remove_Supplements_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_Remove_Supplements_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/24/18 djs Created initial commuter module.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#Window NDW_ADD_SUPPLEMENT
$insert APP_INSERTS
$insert EVENT_SETUP
$insert MSG_EQUATES
$Insert SUPPLEMENTS_EQUATES
Declare subroutine SRP_Show_Window, Supplement_Services
Declare function SRP_Array, Supplement_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)
Result = ''
SupplInst = ''
GoSub Setup_OLE_Controls
If CreateParam NE '' then
Gosub PopulateStages
Set_Property(@Window : '.CMB_STAGE', 'LIST', StageList)
Set_Property(@Window : '.CMB_STAGE', 'SELPOS', 1)
Set_Property(@Window : '.PUB_OK', 'ENABLED', True$)
end
Gosub CheckForSupplements
SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize)
end event
Event WINDOW.CLOSE(CancelFlag)
Result = ''
Result<1> = False$
End_Dialog(@Window, Result)
end event
Event CMB_STAGE.CHANGED(CreateParam)
Gosub CheckForSupplements
end event
Event PUB_OK.CLICK()
Removal = ''
StageSel = Get_Property(@Window : '.CMB_STAGE', 'TEXT')
StageSel = Field(StageSel, '-', 2)
For Each RDSKey in @ReCur1 Using @VM
Removal = Supplement_Services('DeleteSupplementByLotStage', @USER4, 'RDS', RDSKey, StageSel)
Next RDSKey
RDSNotifyList = @ReCur1
Swap @VM with @FM in RDSNotifyList
If RDSNotifyList NE '' then Supplement_Services('SendNotifications', RDSNotifyList, 'Deleted', '', @User4)
If Error_Services('NoError') then
Result = True$
End else
Result = ''
End
End_Dialog(@Window, Result)
end event
Event PUB_CANCEL.CLICK()
Result = ''
Result<1> = False$
End_Dialog(@Window, Result)
end event
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Setup_OLE_Controls:
Qualify = ''
Qualify<1> = 1
Qualify<4> = 0
return
PopulateStages:
DraftStageList = ''
PlainTextStages = ''
RDSList = SRP_Array("Rotate", CreateParam)
@ReCur1 = RDSList<5>
For Each RDSKey in @ReCur1 Using @VM
RDSStageList = Supplement_Services('GetStagesForLot', 'RDS', RDSKey)
RDSStageList2 = RDSStageList<2> :@FM: RDSStageList<1>
RDSStageList3 = SRP_Array("Rotate", RDSStageList2)
DraftStageList := RDSStageList3 :@FM
Next RDSKey
Swap @VM with ' -' in DraftStageList
StageList = SRP_Array('Clean', DraftStageList, "TrimAndMakeUnique", @FM)
return
CheckForSupplements:
SuppFound = ''
StageSel = Get_Property(@Window : '.CMB_STAGE', 'TEXT')
Stage = Field(StageSel, '-', 2)
For Each RDSKey in @ReCur1 Using @VM
SuppFound = Supplement_Services('GetSupplementsForLot', 'RDS', RDSKey, Stage)
Until SuppFound NE False$
Next RDSKey
If SuppFound NE False$ then
SuppText = Xlate('SUPPLEMENTS', SuppFound, SUPPLEMENTS_SUPPL_TEXT$, 'X', '')
If SuppText NE '' then
Set_Property(@Window : '.EDL_SUPPL_INST', 'TEXT', SuppText)
Set_Property(@Window : '.PUB_OK', 'ENABLED', True$)
end else
Set_Property(@Window : '.EDL_SUPPL_INST', 'TEXT', '')
Set_Property(@Window : '.PUB_OK', 'ENABLED', False$)
end
end else
Set_Property(@Window : '.EDL_SUPPL_INST', 'TEXT', '')
Set_Property(@Window : '.PUB_OK', 'ENABLED', False$)
end
return