Compile function NDW_GAN_RETAIN_MANAGER_TASK_DESTROY_EVENTS(CtrlEntId, Event, @PARAMS) /*********************************************************************************************************************** Name : NDW_GAN_RETAIN_MANAGER_TASK_DESTROY_EVENTS Description : Commuter module for the NDW_GAN_RETAIN_MANAGER_TASK_DESTROY_EVENTS form. Notes : Application errors should be logged using the Error Services module. There are a few methodological assumptions built into way errors are managed which are important to understand in order to properly work with Error Services: - The term 'top' refers to the originating procedure of a call stack and the term 'bottom' refers to the last routine (or the current routine) within a call stack. Within the OpenInsight Debugger this will appear backwards since the originating procedure always appears at the bottom of the list and the current routine appears at the top of the list. We are using this orientation because it is common to refer to the process of calling other procedures as 'drilling down'. - The reason for defining the orientation of the call stack is because Error_Services allows for multiple error conditions to be appended to an original error. In most cases this will happen when a procedure at the bottom of the stack generates an error condition and then returns to its calling procedure. This higher level procedure can optionally add more information relevant to itself. This continues as the call stack 'bubbles' its way back to the top to where the originating procedure is waiting. - Native OpenInsight commands that handle errors (e.g., Set_Status, Set_FSError, Set_EventStatus) preserve their error state until explicitly cleared. This can hinder the normal execution of code since subsequent procedures (usually SSPs) will fail if a pre-existing error condition exists. Our philosophy is that error conditions should automatically be cleared before a new procedure is executed to avoid this problem. However, the nature of Basic+ does not make this easy to automate for any given stored procedure. Therefore, if a stored procedure wants to conform to our philosophy then it should include a call into the 'Clear' service request at the top of the program. Alternatively this can be done through a common insert (see SERVICE_SETUP for example.) - Service modules will use the SERVICE_SETUP insert and therefore automatically clear out any error conditions that were set before. Parameters : Service [in] -- Name of the service being requested Param1-10 [in/out] -- Additional request parameter holders Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure Metadata : History : (Date, Initials, Notes) 05/14/20 cn Original programmer. 06/22/20 cn Split Retain and Destroy forms into separate forms ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler #window NDW_GAN_RETAIN_MANAGER_TASK_DESTROY $Insert LOGICAL $Insert APPCOLORS $Insert RETAINED_WAFERS_EQUATES $Insert MSG_EQUATES // Control Name equates Equ DestroyedTable$ To @Window : '.OLE_EDT_DESTROYED' Equ StatusBar$ To @Window : '.OLE_STATUSBAR' // Reduce modes (for Select statement) Equ NEW_EXIST$ To 0 Equ NEXT_CUR$ To 1 Equ ADD_EXIST$ To 2 // OLE Edit Table Columns Equ RUN_ID$ To 1 Equ POCKET$ To 2 Equ SCRIBE$ To 3 Equ WO_NO$ To 4 Equ RETAIN_BOX$ To 5 Equ RETAIN_SLOT$ To 6 Equ Selection$ To 7 Equ WAFER_ID$ To 8 Declare Function Form_Services, Get_Property, Send_Message, SRP_Array, SRP_Sort_Array Declare Function Gan_Services, Retain_Manager_Services, MSG, MemberOf Declare Subroutine SRP_Show_Window, Set_Property, Send_Message, SRP_Set_MinMaxInfo Declare Subroutine SRP_Edittable_Manager, Form_Services, Gan_Services, Retain_Manager_Services SubclassInfo = Form_Services('FindSubclassControl') Subclass = SubclassInfo<1> If Assigned(Param8) else Param8 = '' 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 Type = Get_Property(CtrlEntId, 'TYPE') If Type EQ 'RADIOBUTTON' then Convert ' ' to '_' in CtrlEntID end GoToEvent Event for CtrlEntId else // Event not implemented end Return EventFlow or 1 //----------------------------------------------------------------------------- // EVENT HANDLERS //----------------------------------------------------------------------------- Event WINDOW.CREATE(CreateParam) GoSub SetupOLEControls Set_Property(@Window, 'TIMER', 30000 : @FM : 30000) SRP_Set_MinMaxInfo(@Window, 'DEF', 'DEF', 'DEF') SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, '', 1) End Event Event WINDOW.TIMER() GoSub UpdateServiceLastRunTime end event Event RAG_WAFER_TYPE.150_MM_6_IN.CLICK() Event RAG_WAFER_TYPE.200_MM_8_IN.CLICK() GoSub UpdateServiceLastRunTime Form_Services('DisplayWaitScreen', '', 'Refreshing Data') GoSub LoadDestroyedWaferData Form_Services('CloseWaitScreen') end event Event PUB_DESTROY.CLICK() GoSub SignDestroyedWafers GoSub UpdateServiceLastRunTime Set_Property(@Window, '@DESTROYEDCHECKCOUNTER', '') Set_Property(@Window : '.PUB_DESTROY', 'ENABLED', False$) end event Event OLE_EDT_DESTROYED.OnCheckChanged(Cell, OldValue, NewValue) DestroyedCheckCounter = Get_Property(@Window, '@DESTROYEDCHECKCOUNTER') If OldValue EQ True$ then DestroyedCheckCounter -= 1 end else DestroyedCheckCounter += 1 end Set_Property(@Window, '@DESTROYEDCHECKCOUNTER', DestroyedCheckCounter) If DestroyedCheckCounter GT 0 then Set_Property(@Window : '.PUB_DESTROY', 'ENABLED', True$) end else Set_Property(@Window : '.PUB_DESTROY', 'ENABLED', False$) end end event Event EDL_SCRAP_WAREHOUSE_RETENTION_PERIOD.LOSTFOCUS(Flag, FocusID) RetainedPeriod = Retain_Manager_Services('GetRetentionPeriod') NewRetainedPeriod = Get_Property(@Window : '.EDL_SCRAP_WAREHOUSE_RETENTION_PERIOD', 'TEXT') If NewRetainedPeriod NE RetainedPeriod then Message = '' Message = 'Set ' : NewRetainedPeriod : ' days as new retain period?' Message = "BNY" Status = Msg(@Window, Message) If Status EQ True$ then Retain_Manager_Services('SetRetentionPeriod', NewRetainedPeriod) end end end event Event OLE_EDT_DESTROYED.OnClick(Cell, Point, Button, Shift, Ctrl) If Button EQ 'Right' then Menu = '' ColPos = Cell[1, ';'] RowPos = Cell[Col2() + 1, ';'] RetainBox = Get_Property(DestroyedTable$, 'OLE.CellText[' : RETAIN_BOX$ : ';' : RowPos : ']') Menu<-1> = 'Select' : @VM : 'Select all wafers in box ' : RetainBox : @VM : 1 Menu<-1> = 'Unselect' : @VM : 'Unselect all wafers in box ' : RetainBox : @VM : 1 Send_Message(DestroyedTable$, 'OLE.ShowContextMenu', Point, Menu, RetainBox) end end event Event OLE_EDT_DESTROYED.OnContextMenuClick(Item, UserData) Set_Property(DestroyedTable$, 'OLE.Redraw', False$) RetainedBox = UserData DestroyedWaferArray = Get_Property(DestroyedTable$, 'OLE.ARRAY') DestroyedWaferArray = SRP_Array('Rotate', DestroyedWaferArray, @FM, @VM) DestroyedCheckCounter = Get_Property(@Window, '@DESTROYEDCHECKCOUNTER') Begin Case Case Item EQ 'Select' For Each DestroyedWafer in DestroyedWaferArray using @FM setting WaferPos then If RetainedBox EQ DestroyedWafer<1, RETAIN_BOX$> then Set_Property(DestroyedTable$, 'OLE.CellCheck[' : Selection$ : ';' : WaferPos : ']', True$) DestroyedCheckCounter += 1 end Next DestroyedWafer Case Item EQ 'Unselect' AND DestroyedCheckCounter NE 0 AND DestroyedCheckCounter NE '' For Each DestroyedWafer in DestroyedWaferArray using @FM setting WaferPos then If RetainedBox EQ DestroyedWafer<1, RETAIN_BOX$> then Set_Property(DestroyedTable$, 'OLE.CellCheck[' : Selection$ : ';' : WaferPos : ']', False$) DestroyedCheckCounter -= 1 end Next DestroyedWafer End Case If DestroyedCheckCounter NE '' AND DestroyedCheckCounter NE 0 then Set_Property(@Window : '.PUB_DESTROY', 'ENABLED', True$) end else Set_Property(@Window : '.PUB_DESTROY', 'ENABLED', False$) end Set_Property(@Window, '@DESTROYEDCHECKCOUNTER', DestroyedCheckCounter) Set_Property(DestroyedTable$, 'OLE.Redraw', True$) end event Event WINDOW.CLOSE(CancelFlag) end event //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SetupOLEControls: ArrayDimension = 8 : @FM : 50 TitleList = 'Run ID' : @VM : 'Pocket' : @VM : 'Scribe' : @VM : 'WO' : @VM : 'Retain Box' : @VM : 'Slot' : @VM : 'Select' : @VM : 'Wafer ID' : @VM ColumnWidths = 'A' : @FM : '45' : @FM : '70' : @FM : '65' : @FM : '75' : @FM : '40' : @FM : '40' : @FM : '45' : @FM ColumnAlignments = 'L' : @FM : 'C' : @FM : 'C' : @FM : 'C' : @FM : 'C' : @FM : 'C' : @FM : 'C' : @FM : 'L' : @FM VirtualPos = '' RowsAsColumns = '' CellsAsFields = '' ClearFill = '' OIEditTable = '' SRP_EditTable_Manager('Setup1', DestroyedTable$, ArrayDimension, TitleList, ColumnWidths, ColumnAlignments, VirtualPos, RowsAsColumns, CellsAsFields, ClearFill, OIEditTable) Set_Property(DestroyedTable$, 'OLE.SelectionStyle', 'Black' : @VM : OI_HOT_BLUE$ : ' L=70' : @FM : 'Black' : @VM : OI_HOT_BLUE$) ; // Automatically highlight the current row with one color and highlight the current row with another color. Set_Property(DestroyedTable$, 'OLE.HeaderFont[All; All]', 'Segoe UI' : @SVM : 8) Set_Property(DestroyedTable$, 'OLE.CellFont[All; All]', 'Segoe UI' : @SVM : 8) Set_Property(DestroyedTable$, 'OLE.HeaderColumn[1]', '' : @FM : False$ : @FM : False$ : @FM) Set_Property(DestroyedTable$, 'OLE.CellProtection[ALL; All]', 'SEL') Set_Property(DestroyedTable$, 'OLE.NewRowCount', 0) Set_Property(DestroyedTable$, 'OLE.HeaderRow[ALL]', '' : @FM : '' : @FM : False$ : @FM) Set_Property(DestroyedTable$, 'OLE.DataColumn[ALL]', '' : @FM : '' : @FM : False$ : @FM) Set_Property(DestroyedTable$, 'OLE.DataRow[ALL]', '' : @FM : '' : @FM : False$ : @FM) Set_Property(DestroyedTable$, 'OLE.HeaderColors[All; All]', 'Auto' : @FM : 'None' : @FM : 'None' : @FM : OI_HOT_BLUE$ : @FM : False$) Set_Property(DestroyedTable$, 'OLE.ResetSelPos', False$) Set_Property(DestroyedTable$, 'OLE.AllowDeletions', False$) Set_Property(DestroyedTable$, 'OLE.AllowInserts', False$) Set_Property(DestroyedTable$, 'OLE.CellType[' : Selection$ : ';ALL]', 'Check Box' : @FM : 0 : @VM : 1) // Begin with hidden destroyed sig and date Set_Property(DestroyedTable$, 'OLE.DataColumn[' : WAFER_ID$ : ']', '' : @FM : False$) // Qualify OLE events that we want to intercept Qualifier = '' Qualifier<1> = 1 Qualifier<4> = 0 ; * process synchronously (i.e. immediately) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.AfterUpdate', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.OnClick', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.OnButtonClick', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.OnContextMenuClick', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.PosChanged', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.OnComboClicked', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.OnHeaderClick', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.OnCheckChanged', Qualifier) Send_Message(DestroyedTable$, 'QUALIFY_EVENT', 'OLE.OnDblClick', Qualifier) RetentionPeriod = Retain_Manager_Services('GetRetentionPeriod') Set_Property(@Window : '.EDL_SCRAP_WAREHOUSE_RETENTION_PERIOD', 'TEXT', RetentionPeriod) // APP_INFO RETAINED_WAFER Fields Equ RETAIN_WAFER_RUN_ID$ To 1 Equ RETAIN_WAFER_RECIPE$ To 2 Equ RETAIN_WAFER_POCKET$ To 3 Equ RETAIN_WAFER_SCRIBE$ To 4 Equ RETAIN_WAFER_GRADE$ To 5 Equ RETAIN_WAFER_PART$ To 6 Equ RETAIN_WAFER_WO_NO$ To 7 Equ RETAIN_WAFER_RETAIN_BOX$ To 8 Equ RETAIN_WAFER_RETAIN_SLOT$ To 9 Equ RETAIN_WAFER_RETAIN_LOC$ To 10 Equ RETAIN_WAFER_STATUS$ To 11 Equ RETAIN_WAFER_COMMENT$ To 12 Equ RETAIN_WAFER_OPERATOR$ To 13 Equ RETAIN_WAFER_RETAIN_DATE$ To 14 Equ RETAIN_WAFER_DESTROY_SIG$ To 15 Equ RETAIN_WAFER_DESTROY_DATE$ To 16 Equ RETAIN_WAFER_WAFER_ID$ To 17 GoSub LoadDestroyedWaferData If MemberOf(@USER4, 'GAN_PARAMETERS') then Set_Property(@Window: '.EDL_SCRAP_WAREHOUSE_RETENTION_PERIOD', 'ENABLED', True$) end Set_Property(StatusBar$, 'OLE.PaneCount', 1) Set_Property(StatusBar$, 'OLE.Resizable', False$) Set_Property(StatusBar$, 'OLE.PaneType[1]', 'NOR') GoSub UpdateServiceLastRunTime return SignDestroyedWafers: Set_Property(DestroyedTable$, 'OLE.Redraw', False$) WaferList = Get_Property(DestroyedTable$, 'OLE.ARRAY') WaferList = SRP_Array('Rotate', WaferList, @FM, @VM) DestroyWaferList = '' For Each Wafer in WaferList using @FM setting WaferPos then SelectedWafer = Wafer<1, Selection$> If SelectedWafer EQ True$ then DestroyWaferList := WaferPos : @FM InboundWfrID = Wafer<1, WAFER_ID$> Gan_Services('SignDestroyedWafer', InboundWfrID) end Next Wafer DestroyWaferList[-1, 1] = '' DestroyWaferList = SRP_Sort_Array(DestroyWaferList, 'DN1', 1) For Each DestroyWaferPos in DestroyWaferList using @FM setting dummypos then Send_Message(DestroyedTable$, 'OLE.DeleteRecords', DestroyWaferPos, 1) Next DestroyWaferPos Set_Property(DestroyedTable$, 'OLE.Redraw', True$) return LoadDestroyedWaferData: Set_Property(DestroyedTable$, 'OLE.Redraw', False$) RetainedPeriod = Get_Property(@Window : '.EDL_SCRAP_WAREHOUSE_RETENTION_PERIOD', 'TEXT') WaferSize = Get_Property(@Window : '.RAG_WAFER_TYPE', 'VALUE') CurrentDate = Date() DestroyedWaferList = '' FullWaferList = Retain_Manager_Services('GetWaferData', WaferSize) For Each Wafer in FullWaferList using @FM setting WaferPos then CheckDate = Wafer<1, RETAIN_WAFER_RETAIN_DATE$> + RetainedPeriod Location = Wafer<1, RETAIN_WAFER_RETAIN_LOC$> WaferStatus = Wafer<1, RETAIN_WAFER_STATUS$> If Location _NEC 'Wafer Destroyed' AND WaferStatus _NEC 'Do Not Destroy' then If CheckDate LE CurrentDate then DestroyedWaferList := Wafer<1, RETAIN_WAFER_RUN_ID$> : @VM : Wafer<1, RETAIN_WAFER_POCKET$> : @VM : Wafer<1, RETAIN_WAFER_SCRIBE$> : @VM DestroyedWaferList := Wafer<1, RETAIN_WAFER_WO_NO$> : @VM : Wafer<1, RETAIN_WAFER_RETAIN_BOX$> : @VM : Wafer<1, RETAIN_WAFER_RETAIN_SLOT$> : @VM DestroyedWaferList := False$ : @VM : Wafer<1, RETAIN_WAFER_WAFER_ID$> : @FM end end Next Wafer DestroyedWaferList[-1, 1] = '' DestroyedWaferList = SRP_Array('Rotate', DestroyedWaferList, @FM, @VM) DestroyedWaferList = SRP_Sort_Array(DestroyedWaferList, 'AN5' : @FM : 'DN6', 0) Set_Property(DestroyedTable$, 'OLE.ARRAY', DestroyedWaferList) Set_Property(DestroyedTable$, 'OLE.Redraw', True$) return UpdateServiceLastRunTime: LastRunDTM = Retain_Manager_Services('GetRetainServiceLastRunTime') Set_Property(StatusBar$, 'OLE.PaneCaption[1]', 'Retain Wafer Service last ran at: ' : LastRunDTM) return