added LSL2 stored procedures
This commit is contained in:
291
LSL2/STPROC/GAN_THEO_CYCLE_TIME_EVENTS.txt
Normal file
291
LSL2/STPROC/GAN_THEO_CYCLE_TIME_EVENTS.txt
Normal file
@ -0,0 +1,291 @@
|
||||
Function GAN_THEO_CYCLE_TIME_EVENTS(CtrlEntId, Event, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15)
|
||||
/***********************************************************************************************************************
|
||||
|
||||
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 SRP Computer Solutions, Inc.
|
||||
|
||||
Name : NDW_GAN_THEO_CYCLE_TIME_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)
|
||||
12/10/20 jro Original programmer.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma precomp SRP_PreCompiler
|
||||
#window GROUP_AUDIT
|
||||
|
||||
$insert MSG_EQUATES
|
||||
$insert POPUP_EQUATES
|
||||
|
||||
Equ EVENT_CONTINUE$ to 1
|
||||
Equ EVENT_CONTINUE_NO_SYSTEM$ to 3
|
||||
Equ EVENT_STOP$ to 0
|
||||
Equ CRLF$ to \0D0A\
|
||||
|
||||
Declare subroutine Set_Property, Send_Event, Post_Event, Send_Message, SendMessage, Error_Services, Database_Services, Copy_Record_To_Sql
|
||||
Declare function Get_Property, Send_Message, SendMessage, Lsl_Users_Services, Error_Services, Popup, Gan_Services
|
||||
Declare function Database_Services
|
||||
|
||||
// Get the design time name of the window in case this is a multi-instance window.
|
||||
Window = @Window[1, 'F*']
|
||||
|
||||
// Always get the CtrlClassID since we are not passing it through the event parameters.
|
||||
CtrlClassId = Get_Property(CtrlEntId, 'TYPE')
|
||||
|
||||
// Get the name of the control on the window based on the CtrlClassId.
|
||||
Begin Case
|
||||
Case CtrlClassId EQ 'WINDOW'
|
||||
Control = Window
|
||||
Case CtrlClassId EQ 'RADIOBUTTON'
|
||||
Control = Field(CtrlEntId, '.', 2, 2)
|
||||
Case CtrlClassId EQ 'MENU'
|
||||
Control = CtrlEntId[-1, 'B.']
|
||||
Case 1
|
||||
Control = Field(CtrlEntId, '.', 2, 1)
|
||||
End Case
|
||||
|
||||
If Event EQ 'OLE' then GoSub TransferParams
|
||||
GoToEvent Event for CtrlEntID
|
||||
If Event EQ 'OLE' then GoSub RestoreParams
|
||||
|
||||
Return EventFlow OR EVENT_CONTINUE$
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Events
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Event WINDOW.CREATE(CreateParam)
|
||||
|
||||
GoSub SetupOLEControls
|
||||
|
||||
//Get a list of all GaN Stages
|
||||
Stages = ''
|
||||
GaNStageArray = Database_Services('ReadDataRow', 'APP_INFO', 'GAN_STAGES')
|
||||
For each Row in GaNStageArray using @FM setting RowIndex
|
||||
Stages<-1> = Row<0, 1>
|
||||
Next Row
|
||||
Set_Property(@Window:'.CMB_STAGE_SELECT','LIST',Stages)
|
||||
Set_Property(@Window:'.EDT_CYCLE_TIME_DATA','LIST','')
|
||||
|
||||
|
||||
end event
|
||||
Event WINDOW.READ()
|
||||
PartNo = Get_Property(@Window:'.TXT_PART_NO','TEXT')
|
||||
|
||||
CycleTimeRec = ''
|
||||
if PartNo NE '' then
|
||||
CurrentData = Database_Services('ReadDataRow','GAN_THEO_CYCLE_TIME',PartNo)
|
||||
If CurrentData EQ '' then
|
||||
Set_Property(@Window:'.LBL_STATUS','TEXT', 'Creating ' : PartNo)
|
||||
Set_Property(@Window:'.EDITING','TEXT', 1)
|
||||
//GoSub CreateNewCycleTimeSet
|
||||
//Set_Property(@Window:'.EDT_CYCLE_TIME_DATA', 'LIST', CycleTimeRec)
|
||||
end else
|
||||
Set_Property(@Window:'.EDITING','TEXT', 1)
|
||||
GaNTheoCycleTimeRec = Database_Services('ReadDataRow','GAN_THEO_CYCLE_TIME',PartNo)
|
||||
NumOfStages = DCOUNT(GaNTheoCycleTimeRec<1>,@VM)
|
||||
RecToDisplay = ''
|
||||
|
||||
for StageIndex = 1 to NumOfStages
|
||||
RecToDisplay<StageIndex,1> = GaNTheoCycleTimeRec<1,StageIndex>
|
||||
RecToDisplay<StageIndex,2> = GaNTheoCycleTimeRec<2,StageIndex>
|
||||
RecToDisplay<StageIndex,3> = GaNTheoCycleTimeRec<3,StageIndex>
|
||||
|
||||
Next StageIndex
|
||||
Set_Property(@Window:'.EDT_RUNS_PER_WEEK','TEXT', GaNTheoCycleTimeRec<4>)
|
||||
Set_Property(@Window:'.LBL_STATUS','TEXT', 'Editing ' : PartNo)
|
||||
Set_Property(@Window:'.EDT_CYCLE_TIME_DATA', 'LIST', RecToDisplay)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
GoSub CalculateTotalTime
|
||||
end event
|
||||
|
||||
Event EDT_CYCLE_TIME_DATA.CHANGED
|
||||
debug
|
||||
|
||||
debug
|
||||
end event
|
||||
|
||||
Event PUB_SEARCH_PART.CLICK()
|
||||
Set_Property(@Window:'.EDT_CYCLE_TIME_DATA','LIST','')
|
||||
GoSub WINDOW.READ
|
||||
|
||||
end event
|
||||
|
||||
Event PUB_ADD_STAGE.CLICK()
|
||||
|
||||
StageToAdd = Get_Property(@Window:'.CMB_STAGE_SELECT', 'TEXT')
|
||||
CurrentDataArray = Get_Property(@Window:'.EDT_CYCLE_TIME_DATA', 'LIST')
|
||||
CurrentStages = ''
|
||||
NewDataArray = ''
|
||||
for each DataSet in CurrentDataArray using @FM
|
||||
CurrentStages := DataSet<1,1> : @VM
|
||||
Next DataSet
|
||||
Locate StageToAdd in CurrentStages using @VM setting StagePos then
|
||||
|
||||
end else
|
||||
NewDataArray = CurrentDataArray
|
||||
NewDataArray<-1> = StageToAdd
|
||||
Set_Property(@Window:'.EDT_CYCLE_TIME_DATA', 'LIST', NewDataArray)
|
||||
end
|
||||
|
||||
|
||||
end event
|
||||
|
||||
Event PUB_SAVE.CLICK()
|
||||
RecordId = Get_Property(@Window:'.TXT_PART_NO','TEXT')
|
||||
CurrentDataArray = Get_Property(@Window:'.EDT_CYCLE_TIME_DATA', 'LIST')
|
||||
GaNTheoCycleTimeRec = ''
|
||||
|
||||
//Transpose Data
|
||||
for each DataSet in CurrentDataArray using @FM
|
||||
GaNTheoCycleTimeRec<1, -1> = DataSet<1,1>
|
||||
GaNTheoCycleTimeRec<2, -1> = DataSet<1,2>
|
||||
GaNTheoCycleTimeRec<3, -1> = DataSet<1,3>
|
||||
Next DataSet
|
||||
GaNTheoCycleTimeRec<4> = Get_Property(@Window:'.EDT_RUNS_PER_WEEK','TEXT')
|
||||
Database_Services('WriteDataRow','GAN_THEO_CYCLE_TIME',RecordId,GaNTheoCycleTimeRec)
|
||||
|
||||
Copy_Record_To_Sql('GAN_THEO_CYCLE_TIME', RecordId)
|
||||
|
||||
Set_Property(@Window:'.LBL_STATUS','TEXT', 'Saved ' : RecordId)
|
||||
end event
|
||||
|
||||
* Event PUB_SELECT_GROUP.CLICK()
|
||||
* Groups = Lsl_Users_Services('GetGroups')
|
||||
* if Error_Services('NoError') then
|
||||
* Convert @FM to @VM in Groups
|
||||
* PopupOverride = ''
|
||||
* PopupOverride<PDISPLAY$> = Groups
|
||||
* GroupArray = Popup(@Window,PopupOverride, 'GROUP_SELECTION')
|
||||
* Set_Property(@Window:'.EDT_SECURITY_GROUPS', 'LIST', GroupArray)
|
||||
* end else
|
||||
* Error_Services('DisplayError')
|
||||
* end
|
||||
* end event
|
||||
*
|
||||
* Event PUB_SEARCH.CLICK()
|
||||
* Groups = Get_Property(@Window:'.EDT_SECURITY_GROUPS', 'ARRAY')<1>
|
||||
* IF Groups NE '' then
|
||||
* Convert @VM to @FM in Groups
|
||||
* SearchResults = Lsl_Users_Services('GetMembersInGroup', Groups)
|
||||
* Set_Property(@Window:'.EDT_SEARCH_RESULTS','LIST',SearchResults)
|
||||
* end else
|
||||
* Msg(@Window,'No Group Selec')
|
||||
* end
|
||||
*
|
||||
* end event
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal Gosubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SetupOLEControls:
|
||||
|
||||
// All OLE controls can use this qualify configuration.
|
||||
Qualify = ''
|
||||
Qualify<1> = 1
|
||||
Qualify<3> = ''
|
||||
Qualify<4> = 0
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
TransferParams:
|
||||
|
||||
// ActiveX controls pass their own event names through Param1. Modify the parameter values so they conform to
|
||||
// OpenInsight event parameter values. This will allow commuter modules to be structured the same for OpenInsight
|
||||
// event and ActiveX (OLE) events.
|
||||
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
|
||||
Transfer Param9 to Param8
|
||||
Transfer Param10 to Param9
|
||||
Transfer Param11 to Param10
|
||||
Transfer Param12 to Param11
|
||||
Transfer Param13 to Param12
|
||||
Transfer Param14 to Param13
|
||||
Transfer Param15 to Param14
|
||||
|
||||
return
|
||||
|
||||
|
||||
RestoreParams:
|
||||
|
||||
// Restore the event parameters so the rest of the event chain will see the parameter values as they were originally
|
||||
// created by OpenInsight. This will also prevent the parameter values from being transferred multiple times in case
|
||||
// there are multiple OLE promoted event handlers (e.g. APPNAME*..OIWIN* and APPNAME*OLE..OIWIN*).
|
||||
Transfer Param14 to Param15
|
||||
Transfer Param13 to Param14
|
||||
Transfer Param12 to Param13
|
||||
Transfer Param11 to Param12
|
||||
Transfer Param10 to Param11
|
||||
Transfer Param9 to Param10
|
||||
Transfer Param8 to Param9
|
||||
Transfer Param7 to Param8
|
||||
Transfer Param6 to Param7
|
||||
Transfer Param5 to Param6
|
||||
Transfer Param4 to Param5
|
||||
Transfer Param3 to Param4
|
||||
Transfer Param2 to Param3
|
||||
Transfer Param1 to Param2
|
||||
Transfer Event to Param1
|
||||
Event = 'OLE'
|
||||
|
||||
return
|
||||
|
||||
CreateNewCycleTimeSet:
|
||||
CycleTimeRec = 0:@VM:0:@VM:0:@VM:0:@FM
|
||||
return
|
||||
|
||||
CalculateTotalTime:
|
||||
CurrentDataArray = Get_Property(@Window:'.EDT_CYCLE_TIME_DATA', 'LIST')
|
||||
|
||||
TotalTime = 0
|
||||
|
||||
for each line in CurrentDataArray using @FM
|
||||
|
||||
RecipeTime = line<1,2>
|
||||
TouchTime = line<1,3>
|
||||
TotalTime = (TotalTime + RecipeTime + TouchTime)
|
||||
|
||||
Next line
|
||||
Set_Property(@Window:'.EDT_TOTAL_TIME', 'TEXT', TotalTime / 60)
|
||||
return
|
||||
|
Reference in New Issue
Block a user