open-insight/LSL2/STPROC/NDW_HOLD_REMOVAL_PROMPT_EVENTS.txt

137 lines
5.8 KiB
Plaintext

Compile function NDW_HOLD_REMOVAL_PROMPT_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_HOLD_REMOVAL_PROMPT_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)
2/17/25 djm Initial programmer
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#window NDW_HOLD_REMOVAL_PROMPT
$Insert WO_MAT_EQUATES
$Insert LOGICAL
Declare Subroutine Set_Property, Form_Services, Hold_Services, Error_Services, End_Dialog
Declare function Get_Property, Hold_Services, Error_Services, End_Dialog
GoToEvent Event for CtrlEntId else
// Event not implemented
end
Return EventFlow or 1
//-----------------------------------------------------------------------------
// EVENT HANDLERS
//-----------------------------------------------------------------------------
Event WINDOW.CREATE(CreateParam)
EventFlow = 1
EntityType = Field(Param1, @VM, 1)
EntityID = Field(Param1, @VM, 2)
WOMatKey = Field(Param1, @VM, 3)
Gosub PopulateHold
End Event
Event EDB_REMOVAL_REASON.CHAR(VirtCode, ScanCode, CtrlKey, ShiftKey, AltKey)
Reason = Get_Property(CtrlEntId, 'TEXT')
If ( (Reason NE '') AND (Len(Reason) LE 255) ) or ( (Reason NE '') ) then
Set_Property(@Window : '.PUB_OK', 'ENABLED', True$)
end else
Set_Property(@Window : '.PUB_OK', 'ENABLED', False$)
end
End Event
Event PUB_OK.CLICK()
Result = ''
HoldType = ''
EntityType = Get_Property(@Window: '.EDL_ENTITY_TYPE', 'TEXT')
EntityID = Get_Property(@Window: '.EDL_ENTITY_ID', 'TEXT')
WOMatKey = Get_Property(@Window: '.EDL_WO_MAT', 'TEXT')
Reason = Get_Property(@Window: '.EDB_REMOVAL_REASON', 'TEXT')
WOMatRec = Xlate('WO_MAT', WOMatKey, '', 'X')
If WOMatRec NE '' then
If WOMatRec<WO_MAT_SHIP_HOLD$,1> EQ True$ then
HoldType = 'SHOLD'
end else
HoldType = 'HOLD'
end
If Reason NE '' then
If EntityType NE '' AND EntityType NE '' AND WOMatKey NE '' then
HoldData = @User4:@FM:Reason:@FM:''
Hold_Services('OffHold', WOMatKey, EntityType, EntityID, HoldType, HoldData, @User4, '')
If Error_Services('NoError') then
Result = True$
End_Dialog(@Window, Result)
end else
Errors = Error_Services('GetMessages')
Result = Errors
End_Dialog(@Window, Result)
end
end
end
end
end event
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
PopulateHold:
Set_Property(@Window: '.EDL_ENTITY_TYPE', 'TEXT', EntityType)
Set_Property(@Window: '.EDL_ENTITY_ID', 'TEXT', EntityID)
Set_Property(@Window: '.EDL_WO_MAT', 'TEXT', WOMatKey)
WOMatRec = Xlate('WO_MAT', WOMatKey, '', 'X')
If WOMatRec<WO_MAT_SHIP_HOLD$> NE True$ then
Set_Property(@Window: '.EDL_DATETIME', 'TEXT', Oconv(WOMatRec<WO_MAT_HOLD_START_DTM$,1>, 'D4-'))
Set_Property(@Window: '.EDL_USER_ID', 'TEXT', WOMatRec<WO_MAT_HOLD_START_USER$,1>)
UserName = OCONV(WOMatRec<WO_MAT_HOLD_START_USER$,1>,'[XLATE_CONV,LSL_USERS*FIRST_LAST]')
Set_Property(@Window: '.EDL_USER_NAME', 'TEXT', UserName)
Set_Property(@Window: '.EDB_HOLD_REASON', 'TEXT', WOMatRec<WO_MAT_HOLD_START_REASON$,1>)
Set_Property(@Window: '.CHK_EXTENDED', 'CHECK', WOMatRec<WO_MAT_HOLD_EXTENDED$,1>)
end else
Set_Property(@Window: '.EDL_DATETIME', 'TEXT', Oconv(WOMatRec<WO_MAT_SHIP_HOLD_START_DTM$,1>, 'D4-'))
Set_Property(@Window: '.EDL_USER_ID', 'TEXT', WOMatRec<WO_MAT_SHIP_HOLD_START_USER$,1>)
UserName = OCONV(WOMatRec<WO_MAT_SHIP_HOLD_START_USER$,1>,'[XLATE_CONV,LSL_USERS*FIRST_LAST]')
Set_Property(@Window: '.EDL_USER_NAME', 'TEXT', UserName)
Set_Property(@Window: '.EDB_HOLD_REASON', 'TEXT', WOMatRec<WO_MAT_SHIP_HOLD_START_REASON$,1>)
Set_Property(@Window: '.CHK_EXTENDED', 'CHECK', WOMatRec<WO_MAT_SHIP_HOLD_EXTENDED$,1>)
end
return