Function Environment_Services(@Service, @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 SRP Computer Solutions, Inc. Name : Environment_Services Description : Handler program for all module related services. Notes : Service module to support environmental state issues. Environmental refers to the state of the operating system, which includes version, client vs. server, and path to critical systems. 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) 11/18/17 dmb Original programmer. 06/21/18 dmb Update various services to support the MESSA005 server (Application Server). Refactor various services to use the GetServer service instead of parsing @STATION and to use the GetLocalRootPath service instead of hardcoding the drive letter. - [IREPIOI-50] 06/21/18 dmb Update various services to support the MESST1002 and MESST1003 terminal servers. - [IREPIOI-50] 06/22/18 dmb Update GetLocalRootPath service to use V: for the terminal servers. - [IREPIOI-50] 06/22/18 dmb Update GetApplicationRootPath service to use the GetApplicationRootIP service. - [IREPIOI-50] 07/03/18 dmb Add GetLabelPrintMethod service. - [IREPIOI-54] 08/06/19 fdr Added GetMetrologyProductionPath 09/25/23 djs Updated services to support Stealth migration. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler $insert LOGICAL $insert SERVICE_SETUP $insert SRPMail_Inserts Common /EnvironmentServices/ Unused1@, Unused2@, Unused3@, Unused4@, Unused5@, Unused6@, Unused7@, Unused8@, Unused9@, Unused10@ Declare function Environment_Services, Memory_Services, SRP_List, SRP_FastArray, SRP_Array, Database_Services Declare function Active_Directory_Services, SRP_Send_Mail, RTI_GetNetworkUserName, Utility Declare subroutine Environment_Services, Memory_Services, SRP_List, SRP_FastArray, Database_Services, GetTempPath Declare function GetEnvironmentVariable GoToService else Error_Services('Add', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.') end Return Response OR '' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Service Parameter Options //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Options BOOLEAN = True$, False$ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Services //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- // GetServer // // Returns the current server name. Note: this assumes that the current Process ID has been apended to @STATION. // Therefore, this will be removed before returning to the caller. //---------------------------------------------------------------------------------------------------------------------- Service GetServer() NumFields = DCount(@Station, '_') Server = Field(@Station, '_', 1, NumFields - 1) Response = Server end service Service IsProd() Machine = Environment_Services('GetServer') IsProd = False$ If Machine _NEC "messa012" and Machine _NEC "mestsa01ec" and Machine _NEC "mestsa09ec" and Machine _NEC "mestsa010ec" and Machine _NEC "mestsa011ec" and Machine _NEC "mestsa012ec" and Machine _NEC "MESTST1010" and Machine _NEC "MESTST1009" then IsProd = True$ end Response = IsProd end service //---------------------------------------------------------------------------------------------------------------------- // GetApplicationRootPath // // Returns the application's root path. If this is a server, the shared folder will be included. //---------------------------------------------------------------------------------------------------------------------- Service GetApplicationRootPath() RootIP = Environment_Services('GetApplicationRootIP') ApplicationRootPath = RootIP : '\Apps' Response = ApplicationRootPath end service //---------------------------------------------------------------------------------------------------------------------- // GetApplicationRootIP // // Returns the application's root IP. //---------------------------------------------------------------------------------------------------------------------- Service GetApplicationRootIP() Machine = Environment_Services('GetServer') Begin Case Case Machine EQ 'MESSA005' ; ApplicationRootIP = '\\messa005.infineon.com' Case Machine EQ 'MESTSA01EC' ; ApplicationRootIP = '\\10.95.140.13' Case Machine EQ 'MESTSA09EC' ; ApplicationRootIP = '\\10.95.140.62' Case Machine EQ 'MESTSA010EC' ; ApplicationRootIP = '\\10.95.140.63' Case Machine EQ 'MESTSA011EC' ; ApplicationRootIP = '\\10.95.140.64' Case Machine EQ 'MESTSA012EC' ; ApplicationRootIP = '\\10.95.140.65' Case Machine EQ 'MESSA012' ; ApplicationRootIP = '\\10.95.176.50' Case Machine EQ 'MESST5201' ; ApplicationRootIP = '\\10.95.140.14' Case Machine EQ 'MESST5202' ; ApplicationRootIP = '\\10.95.140.14' Case Machine EQ 'MESTST1009' ; ApplicationRootIP = '\\10.95.140.13' Case Machine EQ 'MESTST1010' ; ApplicationRootIP = '\\10.95.140.13' Case Otherwise$ ; ApplicationRootIP = '\\10.95.140.14' End Case Response = ApplicationRootIP end service //---------------------------------------------------------------------------------------------------------------------- // GetFTPRootPath // // Returns the FTP root path. This is where the scripts and FTP transfer files will be located. //---------------------------------------------------------------------------------------------------------------------- Service GetFTPRootPath() Machine = Environment_Services('GetServer') RootPath = Environment_Services('GetLocalRootPath') Begin Case Case Machine EQ 'MESIRWAP001' ; FTPRootPath = RootPath Case Machine EQ 'MESSA005' ; FTPRootPath = RootPath : '\FTP' Case Machine EQ 'MESSA01EC' ; FTPRootPath = RootPath : '\FTP' Case Machine EQ 'MESST6501' ; FTPRootPath = RootPath : '\FTP' Case Machine EQ 'MESST6502' ; FTPRootPath = RootPath : '\FTP' Case Otherwise$ ; FTPRootPath = RootPath : '\FTP' End Case Response = FTPRootPath end service //---------------------------------------------------------------------------------------------------------------------- // GetReportsRootPath // // Returns the Reports root path. This is where various reports will be located. //---------------------------------------------------------------------------------------------------------------------- Service GetReportsRootPath() RootPath = Environment_Services('GetLocalRootPath') Response = RootPath : '\OIReports' end service //---------------------------------------------------------------------------------------------------------------------- // GetUserDataRootPath // // Returns the user data root path. This is where various reports will be located. //---------------------------------------------------------------------------------------------------------------------- Service GetUserDataRootPath() UserDataRootPath = '\\messdv002.na.infineon.com' Response = UserDataRootPath end service //---------------------------------------------------------------------------------------------------------------------- // GetUserDataProductionPath // // Returns the user data production path. This is where various reports will be located. //---------------------------------------------------------------------------------------------------------------------- Service GetUserDataProductionPath() ProductionPath = Environment_Services('GetUserDataRootPath') : '\IT' Response = ProductionPath end service //---------------------------------------------------------------------------------------------------------------------- // GetSpcFilesharePath // // Returns the SPC data path. //---------------------------------------------------------------------------------------------------------------------- Service GetSpcFilesharePath() IsProd = Environment_Services("IsProd") If IsProd EQ True$ then Response = '\\mesfs.infineon.com\EC_SPC_Si_Import\TXT' end else Path = Environment_Services('GetApplicationRootPath'):'\SPC_Data' MakeDirSuccess = Utility("MAKEDIR", Path) Response = Path end end service //---------------------------------------------------------------------------------------------------------------------- // GetSPCDataPath // // Returns the SPC data path. //---------------------------------------------------------------------------------------------------------------------- Service GetSPCDataPath() IsProd = Environment_Services("IsProd") If IsProd EQ True$ then Response = '\\messa04ec.infineon.com\OI_SPC_Data_Transfer' end else Path = Environment_Services('GetApplicationRootPath'):'\SPC_Data' MakeDirSuccess = Utility("MAKEDIR", Path) Response = Path end end service //---------------------------------------------------------------------------------------------------------------------- // GetMetrologyViewerURL // // Returns the Metrology Viewer URL. //---------------------------------------------------------------------------------------------------------------------- Service GetMetrologyViewerURL() ProductionPath = 'http://messa010ec.infineon.com/' Response = ProductionPath end service //---------------------------------------------------------------------------------------------------------------------- // GetWaferMapProductionPath // // Returns the wafer map production path. //---------------------------------------------------------------------------------------------------------------------- Service GetWaferMapProductionPath() ProductionPath = '\\mesfs.infineon.com\EC_Metrology_Si\MetrologyAttachments\TencorRunData' Response = ProductionPath end service //---------------------------------------------------------------------------------------------------------------------- // GetMetrologyProductionPath // // Returns the Metrology data production path. //---------------------------------------------------------------------------------------------------------------------- Service GetMetrologyProductionPath() ProductionPath = 'messqlec1.infineon.com\PROD1,53959' Response = ProductionPath end service //---------------------------------------------------------------------------------------------------------------------- // GetControlPlanProductionPath // // Returns the Control Plan production path. //---------------------------------------------------------------------------------------------------------------------- Service GetControlPlanProductionPath() ProductionPath = 'iqsdms1' Response = ProductionPath end service //---------------------------------------------------------------------------------------------------------------------- // GetWaferTrackProductionPath // // Returns the Wafer Track data production path. //---------------------------------------------------------------------------------------------------------------------- Service GetWaferTrackProductionPath() ProductionPath = 'IQSDMS1' Response = ProductionPath end service //---------------------------------------------------------------------------------------------------------------------- // GetLocalRootPath // // Returns the local root path. This is where the scripts and FTP transfer files will be located. //---------------------------------------------------------------------------------------------------------------------- Service GetLocalRootPath() Machine = Environment_Services('GetServer') Begin Case Case Machine EQ 'MESIRWAP001' ; LocalRootPath = 'C:' Case Machine EQ 'MESSA005' ; LocalRootPath = 'D:' Case Machine EQ 'MESSA012' ; LocalRootPath = 'D:' Case Machine EQ 'MESSA01EC' ; LocalRootPath = 'D:' Case Machine EQ 'MESTSA01EC' ; LocalRootPath = 'D:' Case Machine EQ 'MESTSA09EC' ; LocalRootPath = 'D:' Case Machine EQ 'MESTSA010EC' ; LocalRootPath = 'D:' Case Machine EQ 'MESTSA011EC' ; LocalRootPath = 'D:' Case Machine EQ 'MESTSA012EC' ; LocalRootPath = 'D:' Case Machine EQ 'MESST6501' ; LocalRootPath = 'C:' ; // This is a map to the user's actual C drive. Case Machine EQ 'MESST6502' ; LocalRootPath = 'C:' ; // This is a map to the user's actual C drive. Case Machine EQ 'MESTST1006' ; LocalRootPath = 'C:' ; // This is a map to the user's actual C drive. Case Machine EQ 'MESTST1007' ; LocalRootPath = 'C:' ; // This is a map to the user's actual C drive. Case Otherwise$ ; LocalRootPath = 'C:' End Case Response = LocalRootPath end service //---------------------------------------------------------------------------------------------------------------------- // GetLabelPrintMethod // // Returns the method that label programs should use for printing (i.e., OIPI or DirectPrint). //---------------------------------------------------------------------------------------------------------------------- Service GetLabelPrintMethod() LabelPrintMethod = Database_Services('ReadDataRow', 'APP_INFO', 'LABEL_PRINT_METHOD')<1> Locate LabelPrintMethod in 'OIPI,DirectPrint' using ',' setting cPos else LabelPrintMethod = 'OIPI' Response = LabelPrintMethod end service //---------------------------------------------------------------------------------------------------------------------- // GetDispositionReportPath // // Returns the path to where disposition reports are stored. This is used for GaN Run Data Sheets. //---------------------------------------------------------------------------------------------------------------------- Service GetDispositionReportPath() ! Deprecated - GaN ReportPath = '\\messdv002.na.infineon.com\Characterization\Disposition Reports' Response = ReportPath end service //---------------------------------------------------------------------------------------------------------------------- // GetPrintServerPath // // Returns printer server UNC path. //---------------------------------------------------------------------------------------------------------------------- Service GetPrintServerPath() ServerPath = '\\messp1002.na.infineon.com\' Response = ServerPath end service //---------------------------------------------------------------------------------------------------------------------- // GetDispositionReportPath // // Returns the path to where GaN reactor schedule excel spreadsheets are stored. //---------------------------------------------------------------------------------------------------------------------- Service GetGaNSchedulePath() ! Deprecated - GaN ReportPath = '\\messv02ecc1.ec.local\EC_MOCVD\Aixtron Reactor Schedulers' Response = ReportPath end service //---------------------------------------------------------------------------------------------------------------------- // SetServerCanary // // Sets a datetime stamp into the APP_INFO table and the canary.txt file to establish the last time it was successful in // accessing the database. //---------------------------------------------------------------------------------------------------------------------- Service SetServerCanary() hSysLists = Database_Services('GetTableHandle', 'SYSLISTS') Lock hSysLists, ServiceKeyID then DateTimeStamp = Oconv(Date(), 'D4/') : ' - ' : Oconv(Time(), 'MTHS') Database_Services('WriteDataRow', 'APP_INFO', 'CANARY', DateTimeStamp, True$, False$, True$) If Error_Services('NoError') then OSWrite DateTimeStamp to Environment_Services('GetApplicationRootPath') : '\LogFiles\Canary\Canary.txt' // Call SRP Send Mail to make sure it is already cached. Result = SRP_Send_Mail('', '') end else Error = Error_Services('GetMessage') Message = '' Message<1> = 'Message from the ' : Service : ' service.' Message<2> = 'oinotify@infineon.com' Message<3> = 'dstieber@srpcs.com,dbakke@srpcs.com,Dan.Crisp@infineon.com,4805890050@vtext.com,7143924402@tmomail.net,jonathan.ouellette@infineon.com' Message<7> = 'TEXT' Message<8> = 'Error in ' : Service : ' service. Message: ' : Error Message<9> = '' Config = '' Config<1> = SendUsing_Port$ Config<3> = 25 Config<4> = 'mailrelay-external.infineon.com' ; //'appmail.eu.infineon.com' Config<5> = True$ Config<6> = 'oinotify@infineon.com' Config<7> = 'oinotify1' Config<8> = False$ Result = SRP_Send_Mail(Message, Config) end Unlock hSysLists, ServiceKeyID else Null end end service Service GetSAPPath() Machine = Environment_Services('GetServer') Environment = 'QA' Begin Case Case Machine EQ 'MESSA005' ; Environment = 'PRD' Case Machine EQ 'MESSA01EC' ; Environment = 'PRD' End Case Response = Environment end service Service GetSQLScrapeConnectionString() Machine = Environment_Services('GetServer') Begin Case Case Machine = 'MESSA01EC' // PROD SQL Servers ConnectionString = 'Provider=MSOLEDBSQL.1;Password=0okm9ijn;Persist Security Info=True;User ID=srpadmin;Initial Catalog=LSL2SQL;Data Source=MESSQLEC1.infineon.com\PROD1,53959;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""' Case ( (Machine = 'MESTSA01EC') or (Machine = 'MESTSA09EC') or (Machine = 'MESTSA010EC') or (Machine = 'MESTSA011EC') or (Machine = 'MESTSA012EC') ) // DEV SQL Servers ConnectionString = 'Provider=MSOLEDBSQL.1;Password=Fisql2023!;Persist Security Info=True;User ID=fisql;Initial Catalog=LSL2SQL;Data Source=10.95.140.27\TEST1,50572;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""' Case Otherwise$ // Default to DEV SQL Servers just in case ConnectionString = 'Provider=MSOLEDBSQL.1;Password=Fisql2023!;Persist Security Info=True;User ID=fisql;Initial Catalog=LSL2SQL;Data Source=10.95.140.27\TEST1,50572;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""' End Case Response = ConnectionString end service Service GetUserDesktopPath() Response = '' UserRootPath = '' UserName = RTI_GetNetworkUserName() Machine = Environment_Services('GetServer') If Machine EQ 'MESST5201' OR Machine EQ 'MESST5202' OR Machine EQ 'MESTST1009' OR Machine EQ 'MESTST1010' then RootPath = '\\tsclient\C\Users\' end else RootPath = 'C:\Users\' end If UserName NE '' then Response = RootPath : UserName : '\Desktop\' end end service Service GetTempPath() TempDirectory = Str(\00\, 1024) GetTempPath(Len(TempDirectory), TempDirectory) Convert \00\ to '' in TempDirectory Response = TempDirectory end service Service GetMonaResource() If Environment_Services("IsProd") then Response = "OPENINSIGHT_MES_OP_FE" end else Response = "OPENINSIGHT_MES_OP_FE_DEV" end end service Service GetMonInBufferedWorkerApiUrl() If Environment_Services("IsProd") then Response = "https://messa014.infineon.com:7851" end else Response = "https://mestsa008.infineon.com:7851" end end service Service GetProveInApiUrl() If Environment_Services("IsProd") then Response = "https://messa014.infineon.com:8851" end else Response = "https://mestsa008.infineon.com:8851" end end service Service GetIfxEmailServer() Response = 'smtp.intra.infineon.com' end service Service GetEnvironmentVariable(VariableName) If VariableName NE '' then VarLength = GetEnvironmentVariable(VariableName, "", 0) + 1 VarValue = space(VarLength+1) VarLength = GetEnvironmentVariable(VariableName, VarValue, VarLength) VarValue = VarValue[1, VarLength] Response = VarValue end else Error_Services('Add', 'Error in service ':Service:'. Null VariableName passed in') end end service //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////