Function NDW_Main_Events_Dev(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_Main_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/08/18 dmb Created initial commuter module. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler #Window NDW_MAIN $insert APP_INSERTS $insert EVENT_SETUP $insert MSG_EQUATES $insert ENVIRON_CONSTANTS $insert NOTIFICATION_EQUATES $insert REACT_MODE_EQU $insert REACT_UTIL_EQU $insert TOOL_EQUATES $insert RLIST_EQUATES Equ WIDTH$ to 3 Equ HEIGHT$ to 4 Declare function GetCommandLine, MemberOf, obj_Install, obj_Notes_Sent, FindWindow, ShowWindow, Next_Key Declare function Environment_Services, Reactor_Services, Database_Services, obj_Tool, Messaging_Services, SRP_JSON Declare subroutine Set_Env, obj_Appwindow, Get_BMP_Info, obj_Login, obj_Calib_List, End_Window, Start_Window, Next_Key Declare subroutine Database_Services, obj_React_Status, Obj_React_Mode, obj_Tool_Log, RList, Messaging_Services, RTP27 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) GoSub Setup_OLE_Controls Server = Environment_Services('GetServer') Command = GetCommandLine() Command = Trim(Command) Convert ' ' to @FM in Command Convert @Lower_Case to @Upper_Case in Command NumArguments = DCount(Command, @FM) Done = False$ For ArgCnt = 1 to NumArguments Argument = Command If Argument[1, 3] EQ '/UN' then @USER4 = Argument[-1, 'B='] Done = True$ end Until Done Next ArgCnt IF @USER4 = 'INDEXER' THEN void = Start_Window( 'IDXSVR', '', '', '', '' ) Post_Event(@Window, 'CLOSE') RETURN 0 END IF @USER4 = 'VISION' THEN void = Start_Window( 'VISION_COMM', @WINDOW, '', '', '' ) RETURN 0 END IF @USER4 = 'ADCSVR' THEN * void = Start_Window( 'ADCSVR', @window, '', '', '' ) void = Start_Window( 'SERVICE_MANAGER', '', '', '', '' ) Post_Event(@Window, 'CLOSE') RETURN 0 END IF @USER4 = 'SAP' THEN void = Start_Window( 'DIALOG_SAP_COMM', '', '', '', '') Post_Event(@Window, 'CLOSE') RETURN 0 END Start_Window('NDW_MESSAGING_PROCESSOR', @Window) @USER4 = @USERNAME AccessLevel = Dialog_Box('LOGON', @Window) If (AccessLevel EQ -1) OR (AccessLevel EQ '') then Set_Property(@Window, '@CLOSE', 1) end If AccessLevel GE 0 then IF MemberOf(@USER4, 'OI_ADMIN') OR @USER4 = 'MIS' THEN Set_Env(ENV_DEBUGGER_ENABLED$, 1, 1) Set_Env(ENV_DEBUGGER_INTERCEPT_PROC$,'',1) * This section added 9/17/2014 JCH for FTPQueueing for manual batch transmits OPEN 'FTP_QUEUE' TO FTPQueue THEN SELECT FTPQueue RecCnt = 0 Done = 0 LOOP READNEXT QueueKey ELSE Done = 1 UNTIL Done RecCnt += 1 REPEAT Set_Property(@Window : '.PUB_SHIP_DATA_QUEUE','DEFPROP',RecCnt:' in Ship Data Queue') Set_Property(@Window : '.PUB_SHIP_DATA_QUEUE','VISIBLE',1) END END ELSE Set_Env(ENV_DEBUGGER_ENABLED$, 2, 1) Set_Env(ENV_DEBUGGER_INTERCEPT_PROC$,'EPI_USER_DEBUG',1) Set_Property(@Window : '.PUB_SHIP_DATA_QUEUE','VISIBLE',0) END IF MemberOf(@USER4,'EMAIL_PDF_QUEUE') THEN * This section added 7/31/2015 JCH for Shipment eMail Queueing for manual batch transmits OPEN 'SHIP_EMAIL_QUEUE' TO Ship_eMailQueue THEN SELECT Ship_eMailQueue RecCnt = 0 Done = 0 LOOP READNEXT QueueKey ELSE Done = 1 UNTIL Done RecCnt += 1 REPEAT Set_Property(@Window : '.PUB_SHIP_DOC_QUEUE','DEFPROP',RecCnt:' in Ship Doc Queue') Set_Property(@Window : '.PUB_SHIP_DOC_QUEUE','VISIBLE',1) END END GraphicPath = obj_Install('Get_Prop','ColorBMP') IF GraphicPath NE '' THEN Set_Property(@WINDOW:'.BITMAP_2','BITMAP',GraphicPath) Get_BMP_Info(GraphicPath,BmSize,BmWidth,BmHeight) BMAspectRatio = BmWidth/BmHeight MainSize = Get_Property(@WINDOW,'SIZE') WinWidth = MainSize WinHeight = MainSize IF BmHeight > INT(WinHeight * .666) THEN Set_Property(@WINDOW:'.BITMAP_2','IMAGECLIP',0) ;* Allow Resize of bitmap BmDispHeight = INT(WinHeight * .666) BmDispWidth = INT(BmDispHeight*(BmWidth/BmHeight)) END ELSE Set_Property(@WINDOW:'.BITMAP_2','IMAGECLIP',0) ;* Allow Resize of bitmap BmDispHeight = INT(WinHeight * .20) BmDispWidth = INT(BmDispHeight * BMAspectRatio) END Xorg = INT((WinWidth - BmDispWidth) / 2 ) Yorg = INT((WinHeight - BmDispHeight) / 3) Set_Property(@WINDOW:'.BITMAP_2','SIZE',Xorg:@FM:Yorg:@FM:BmDispWidth:@FM:BmDispHeight) Set_Property(@WINDOW:'.BITMAP_2','VISIBLE',1) END Company = obj_Install('Get_Prop','CompTitle') WinTitle = Get_Property(@WINDOW,'TEXT') Machine = '' If (Server EQ 'MESST6501') or (Server EQ 'MESST6502') or (Server EQ 'MESTST1006')then Machine = 'Server' end else Machine = 'Client' end WinTitle = Get_Property(@WINDOW,'TEXT') LSL2Version = Xlate('LSL_USERS', @User4, 'LSL2_VERSION', 'X') OCXVersion = Xlate('LSL_USERS', @User4, 'OCX_VERSION', 'X') Set_Property(@WINDOW,'TEXT',Company:' ':WinTitle: ' - ':Machine: ' - v':LSL2Version:' - ocx.v':OCXVersion) rv = Set_Property(@WINDOW:'.CURRENT_USER', 'TEXT', 'User: ':oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )) rv = Set_Property(@WINDOW:'.OLE_PIC_CURRENT_USER','OLE.Caption','User: ':OCONV( @USER4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )) rv = Set_Property(@WINDOW:'.GROUP_1', 'VISIBLE', 1) Recipients = XLATE('NOTIFICATION','CONFIG_LIMITED',NOTIFICATION_USER_ID$,'X') LOCATE @USER4 IN Recipients USING @VM SETTING Pos THEN obj_Login('LateShip') END NotesSent = obj_Notes_Sent('GetUserKeys',@USER4) NewMessages = XLATE('NOTE_PTRS',@USER4,'NEW_MESSAGES','X') IF NotesSent NE '' OR NewMessages > 0 THEN Void = Start_Window( 'NOTE_PTRS', @WINDOW, '*CENTER', '', '' ) END IF MemberOf(@USER4, 'SPEC_CHANGE') OR MemberOf(@USER4, 'OI_ADMIN') THEN Set_Property(@WINDOW:'.MENU.ENGINEERING.TOOL_CLASS_-_RECIPES__PATTERNS','VISIBLE',1) END ELSE Set_Property(@WINDOW:'.MENU.ENGINEERING.TOOL_CLASS_-_RECIPES__PATTERNS','VISIBLE',0) END Ctrls = @WINDOW:'.MENU.ADMIN.FABTIME_SUPPORT':@RM ; Props = 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.MAINT.REACTOR_MAINTENANCE':@RM ; Props := 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.ADM.SYSTEM_CONFIG':@RM ; Props := 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.ADM.TOOLS':@RM ; Props := 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.ADM.RAS':@RM ; Props := 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.ADM.DEVELOPER':@RM ; Props := 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.ADMIN.DEV.ARCHIVE' ; Props := 'ENABLED' IF Memberof(@user4, 'OI_ADMIN') THEN Vals = 1 END ELSE Vals = 0 END Set_Property(Ctrls,Props,Vals) ; * Sets the enabled property ON/OFF for the record mark delimited variables Ctrls,Props, and Vals Ctrls := @WINDOW:'.MENU.ADMIN.SAP_INTERFACE':@RM ; Props := 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.ADM.WAREHOUSE':@RM ; Props := 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.ADMIN.SAP_INTERFACE.SAP_COMM_MONITOR':@RM ; Props := 'VISIBLE':@RM IF Memberof(@user4, 'OI_ADMIN') OR Memberof(@user4, 'OI_SUPERUSER') THEN Vals = 1 END ELSE Vals = 0 END Set_Property(Ctrls,Props,Vals) ; * Sets the enabled property ON/OFF for the record mark delimited variables Ctrls,Props, and Vals Ctrls = @WINDOW:'.MENU.ADM.THRUPUT_TARGETS':@RM ; Props = 'ENABLED':@RM Ctrls := @WINDOW:'.MENU.PROD.REACTOR_RUN' ; Props := 'ENABLED' IF Memberof(@user4,'CONFIG_LIMITED') THEN Vals = 1 END ELSE Vals = 0 END Set_Property(Ctrls,Props,Vals) ; * Sets the enabled property ON/OFF for the record mark delimited variables Ctrls,Props, and Vals If Not(MemberOf(@USER4, 'LEAD')) AND Not(MemberOf(@USER4, 'SUPERVISOR')) then Set_Property(@Window : '.MENU.ADMIN.TOOLS_EVAC', 'VISIBLE', 0) end If @User4 NE 'DAN_CR' then Set_Property(@Window : '.MENU.MATERIAL.PTO_MATERIAL_SCAN', 'VISIBLE', 0) end CalDueRecipients = XLATE('NOTIFICATION','CALIB_DUE_NOTIFY',NOTIFICATION_USER_ID$,'X') LOCATE @USER4 IN CalDueRecipients USING @VM SETTING POS THEN obj_Calib_List('SendReminders') ;* New system added 3/18/2010 JCH END stat = Set_Property(@WINDOW,'TIMER',1200000:@FM:0) ;* Start the Keep Alive Timer event and run every 20 Minutes * * * * * * * * * * * * stat = Set_Property(@WINDOW,'STATUSLINE',@WINDOW:'.STATUS_LINE') ;* Setup status line SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$) Eventflow = 0 end else End_Window(@Window) end end event Event WINDOW.READ() end event Event WINDOW.CLOSE(CancelFlag) Void = Set_Property(@WINDOW,'TIMER','') UNLOCK All end event Event WINDOW.CLEAR(bSaveKey, bSuppressWarning, bMaintainFocus, CtrlIDFocus) end event Event WINDOW.TIMER() Close = Get_Property(@Window, '@CLOSE') CurrDTM = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTS') OPEN 'SYSLISTS' TO ListsFile THEN Station = @STATION Station = Station[1,'_'] ListKey = Station:'*KEEP_ALIVE' ListRec = @USERNAME:@FM:CurrDTM WRITE ListRec ON ListsFile,ListKey ELSE NULL END Set_Property(@WINDOW:'.CURRENT_TIME','TEXT','Current Time: ':OCONV( TIME(), 'MTHS' )) Set_Property(@WINDOW:'.CURRENT_DATE','TEXT','Date: ':OCONV( DATE(), 'D2/' )) If Get_Property(@Window, '@CLOSE') then Send_Event(@Window, 'CLOSE') end end event Event OLE_LAUNCHER.OnLaunchAttempt(Params) end event Event PUB_SHIP_DATA_QUEUE.CLICK() Start_Window('DIALOG_FTP_QUEUE', @Window) end event Event PUB_SHIP_DOC_QUEUE.CLICK() Start_Window('DIALOG_EMAIL_SHIPMENT', @Window) * Send_Message(@Window : '.OLE_DIRECT_CONNECT', 'OLE.Broadcast', 'Booyaa!') end event Event MENU.REACT_STAT.MENU() Start_Window('REACT_STATUS_EVEN',@WINDOW,'') Start_Window('REACT_STATUS_ODD',@WINDOW,'') Start_Window('NDW_TOOL_STATUS_GAN',@WINDOW,'') Start_Window('TOOL_STATUS',@WINDOW,'') end event Event MENU.WIN.PROD.RMC.MENU() IF MemberOf(@USER4, 'DATA_ENTRY') OR MemberOf(@USER4, 'SUPERVISOR') THEN Start_Window('REACT_MODE_CHG', @WINDOW, '*CENTER','','') END ELSE MsgInfo = '' MsgInfo = -2 MsgInfo = -2 MsgInfo = 'You must be a Supervisor or Technician in order to change reactor modes...' MsgInfo = 'H' void = Msg('',MsgInfo) END end event Event MENU.ADMIN.SAP_INTERFACE.SAP_COMM_MONITOR.MENU() rv = Start_Window('DIALOG_SAP_COMM', '') end event Event MENU.ADMIN.TOOLS_EVAC.MENU() // Require the user to acknowledge using their application password. * Valid = Dialog_Box('QUOTE_SIG_PWD_ENTRY', @WINDOW, @USER4 : @VM : XLATE('LSL_USERS', @USER4, LSL_USERS_PASSWORD$, 'X')) MsgOverride = '' MsgOverride = 2 ; // Default to Cancel button. Valid = Msg(@Window, MsgOverride, 'OK_CANCEL', '', 'Evac Procedures' : @FM : 'Please confirm that you wish to put all tools into Evac mode.') If Valid EQ '' then UserName = Oconv(@USER4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]') CurrDate = Date() CurrTime = Time() EvacMode = 'Facilities (UnSched)' EvacNotes = 'Fab Evac' NumberTools = 0 // Step 1 - Update the Reactor Tools. This logic is based on the script event handler in the REACT_MODE_CHG.APPLY // pushbutton control. ReactorNos = Reactor_Services('GetReactorNumbers') For Each ReactorNo in ReactorNos using @FM ReactModeRow = Database_Services('ReadDataRow', 'CONFIG', 'REACT_MODE' : ReactorNo) ReactModeDesc = ReactModeRow If ReactModeDesc _NEC 'Shutdown' then ReactUtilID = ReactModeRow ReactLogID = ReactModeRow If ReactUtilID NE '' then ReactUtilRow = Database_Services('ReadDataRow', 'REACT_UTIL', ReactUtilID) ReactUtilRow = CurrDate ReactUtilRow = CurrTime ReactUtilRow = @USER4 Database_Services('WriteDataRow', 'REACT_UTIL', ReactUtilID, ReactUtilRow, True$, '', True$) end else ReactUtilRow = '' end hReactUtil = Database_Services('GetTableHandle', 'REACT_UTIL') KeyToUse = Next_Key('REACT_UTIL', hReactUtil, 'NEXT', '') NewReactUtilRow = '' NewReactUtilRow = ReactorNo NewReactUtilRow = EvacNotes NewReactUtilRow = 'S' NewReactUtilRow = CurrDate NewReactUtilRow = CurrTime NewReactUtilRow = @USER4 WorkOrderNo = ReactUtilRow NewReactUtilRow = WorkOrderNo NewReactUtilRow = Xlate('WO_LOG', WorkOrderNo, WO_LOG_CUST_NO$, 'X') NewReactUtilRow = '' Database_Services('WriteDataRow', 'REACT_UTIL', KeyToUse, NewReactUtilRow, True$, '', True$) Database_Services('ReleaseKeyIDLock', 'REACT_UTIL', KeyToUse) Next_Key('REACT_UTIL', HReactUtil, 'UPDATE', KeyToUse) NewReactModeRow = '' NewReactModeRow = EvacMode NewReactModeRow = UserName NewReactModeRow = Oconv(CurrDate, 'D4/') NewReactModeRow = Oconv(CurrTime, 'MTH') NewReactModeRow = KeyToUse NewReactModeRow = '' NewReactModeRow = EvacNotes CurrDTM = NewReactModeRow : ' ' : NewReactModeRow PrevModeKey = Xlate('REACTOR_CHILD_KEY_IDS', ReactorNo, REACTOR_CHILD_KEY_IDS_REACT_MODE_KEY_IDS$, 'X')<1, 1> OpenDTM = Field(PrevModeKey, '*', 2) OpenDTM = Oconv(OpenDTM, 'DT4/^S') CurrMode = Oconv(Xlate('REACTOR', ReactorNo, 'CURR_MODE', 'X'), '[REACT_MODE_CONV]') ProdModes = 'Production':@VM ProdModes := 'Production (incr sampling)' Locate CurrMode in ProdModes Using @VM Setting vPos then Locate EvacMode in ProdModes Using @VM Setting vPos else OutOfProdDTM = NewReactModeRow : ' ' : NewReactModeRow obj_React_Status('SetOutOfProdDTM', ReactorNo : @RM : OutOfProdDTM) end ; // End of check on New Mode end ; // End of check on Current Mode Database_Services('WriteDataRow', 'CONFIG', 'REACT_MODE' : ReactorNo, NewReactModeRow, True$, '', True$) If Error_Services('NoError') then NumberTools += 1 If CurrMode NE '' then // Close the currently active mode crParms = ReactorNo crParms := @RM : OpenDTM crParms := @RM : CurrDTM crParms := @RM : @USER4 crParms := @RM : NewReactModeRow crParms := @RM : NewReactModeRow crParms := @RM : NewReactModeRow obj_React_Mode('Close', crParms) end // Create new active mode record crParms = ReactorNo crParms := @RM : CurrDTM crParms := @RM : @USER4 crParms := @RM : NewReactModeRow crParms := @RM : NewReactModeRow crParms := @RM : NewReactModeRow crParms := @RM : NewReactModeRow obj_React_Mode('Create', crParms) end end Next ReactorNo // Step 2 - Update the Silicon Tools. This logic is based on the TBClick gosub in the Comm_Dialog_Tool_Status // commuter module. This commuter module supports the TOOL_STATUS form. ToolIDs = obj_Tool('KeysByType') ; // All tool IDs sorted by TOOL_TYPE For Each ToolID in ToolIDs using @VM ToolRow = Database_Services('ReadDataRow', 'TOOL', ToolID) CurrModeKey = ToolRow CurrMode = Xlate('TOOL', ToolID, 'CURR_MODE', 'X')<1, 1> If CurrMode NE 'OUT' AND CurrMode NE 'FACILITIES (UnSched)' then If CurrMode EQ '' then obj_Tool_Log('InitialLog', ToolID) CurrMode = 'OUT' end NumberTools += 1 CurrModeDTM = Field(CurrModeKey, '*', 2) CurrModeDTM = Oconv(CurrModeDTM, 'DT4/^S') Parms = ToolID : @RM Parms := CurrModeDTM : @RM Parms := 'FACILITIES (UnSched)' : @RM Parms := EvacNotes obj_Tool_Log('SetMode', Parms) end Next ToolID // Step 3 - Update the GaN Tools. This logic is based on the ToolOptions gosub in the GaN_Tool_Status commuter // module. This commuter module supports the GAN_TOOL_STATUS form. SelectSent = 'SELECT TOOL WITH TOOL_PROC "G" AND WITH CLASS NE "G_REACT" BY TOOL_WH BY TOOL_TYPE' RList(SelectSent, TARGET_ACTIVELIST$, '', '', '') EOF = False$ Loop Readnext ToolID else EOF = True$ Until EOF ToolRow = Database_Services('ReadDataRow', 'TOOL', ToolID) CurrModeKey = ToolRow CurrMode = Xlate('TOOL', ToolID, 'CURR_MODE', 'X')<1, 1> If CurrMode NE 'OUT' AND CurrMode NE 'FACILITIES (UnSched)' then If CurrMode EQ '' then obj_Tool_Log('InitialLog', ToolID) CurrMode = 'OUT' end NumberTools += 1 CurrModeDTM = Field(CurrModeKey, '*', 2) CurrModeDTM = Oconv(CurrModeDTM, 'DT4/^S') Parms = ToolID : @RM Parms := CurrModeDTM : @RM Parms := 'FACILITIES (UnSched)' : @RM Parms := EvacNotes obj_Tool_Log('SetMode', Parms) end Repeat Msg(@Window, '', 'OK', '', 'Evac Procedures' : @FM : NumberTools : ' tools have been placed into Evac mode.') end end event Event MENU.ADMIN.DEVELOPER.SESSION_MANAGER.MENU() rv = Start_Window('NDW_SESSION_MANAGER', '') end event //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Setup_OLE_Controls: Qualify = '' Qualify<1> = 1 Qualify<4> = 0 Ctrl = @Window : '.OLE_LAUNCHER' Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnLaunchAttempt', Qualify) return