# ShopfloorConnect MTC Service Installer

Single-click installer for the ShopfloorConnect Machine Tool Client (MTC) Service for West Jefferson CA-LR facility.

## Overview

This Inno Setup installer automates the manual 9-step installation process for the MTC Service, which integrates shop floor machines with the Teamcenter PLM system.

**Configuration:**
- **Site**: West Jefferson CA-LR
- **Teamcenter Server**: 10.233.113.141
- **Shop Floor PC FQDN**: Auto-detected (hostname.logon.ds.ge.com format)
- **Installation Path**: C:\ShopFloorConnect\

## What the Installer Does

1. **Copies Files** - Installs 175MB of MTC Service files to C:\ShopFloorConnect\
   - Java runtime environment
   - MTC Service application
   - Configuration scripts
   - Documentation

2. **Sets Environment Variable** - Creates `TCFITDIR=C:\ShopFloorConnect`

3. **Installs MTC Service** - Runs `install.bat` to register Windows service

4. **Configures Connection** - Runs West Jefferson configuration batch file to:
   - Auto-detect local PC's FQDN
   - Configure mi_server.ini with Teamcenter IP and local FQDN
   - Set site-specific parameters

## Files

```
ShopfloorConnect/
├── ShopfloorConnect.iss              # Main installer script
├── Run_ShopfloorConnect_Installer.bat # Batch launcher (admin check)
├── gea-logo.ico                      # GE Aerospace logo
├── patrick.bmp                       # Wizard image
├── patrick-sm.bmp                    # Small wizard image
└── ShopFloorConnect/                 # Source files (175MB)
    ├── Java/                         # Java runtime
    ├── MachineToolClient_Service/    # MTC service files
    ├── FIT-MI_Server/                # Server configuration
    └── *.bat                         # Installation scripts
```

## Building the Installer

**Requirements:**
- Windows machine with Inno Setup 6 installed
- All source files in ShopFloorConnect/ directory

**Steps:**
1. Copy entire ShopfloorConnect project folder to Windows machine
2. Open `ShopfloorConnect.iss` in Inno Setup Compiler
3. Press F9 to compile
4. Output: `ShopfloorConnect_Installer.exe` in configured OutputDir

## Running the Installer

### Method 1: Direct (Requires Admin)
```cmd
ShopfloorConnect_Installer.exe
```

### Method 2: Using Batch Launcher (Recommended)
```cmd
Run_ShopfloorConnect_Installer.bat
```
The batch file checks for admin privileges and shows clear error messages if not running as administrator.

## Post-Installation

**Windows Service:**
- **Service Name**: `SFCMTCService`
- **Display Name**: ShopfloorConnect MTC Service
- **Startup Type**: Delayed Automatic
- **Status**: Installed (not started automatically)

**To Start the Service:**
1. Open Services (Win+R, type `services.msc`)
2. Find "SFCMTCService"
3. Right-click → Start

Or via command line:
```cmd
sc start SFCMTCService
```

**Configuration File Location:**
```
C:\ShopFloorConnect\FIT-MI_Server\webapps\wut\WEB-INF\conf\mi_server.ini
```

**Key Settings:**
- `fsw_ip=10.233.113.141` (Teamcenter server)
- `local_ip=<your-hostname>.logon.ds.ge.com` (Auto-detected)
- `fsw_port=8080/tcdnc/services` (Teamcenter port)

## Manual Installation Alternative

If you need to install manually, see the Word document in the extracted files for the 9-step process:
```
ShopFloorConnect/ShopFloorConnect_Installation_Instructions.doc
```

## Troubleshooting

**Issue**: Installer fails with "Access Denied"
- **Solution**: Run as Administrator using the batch launcher

**Issue**: "Failed to set TCFITDIR environment variable"
- **Solution**: Ensure you're running as Administrator
- Manually set via: System Properties → Advanced → Environment Variables
- Add system variable: `TCFITDIR=C:\ShopFloorConnect`

**Issue**: "Failed to execute MTC Service installer"
- **Solution**: Check that all files were copied to C:\ShopFloorConnect
- Verify Java runtime exists at C:\ShopFloorConnect\Java\j2sdk
- Check Windows Event Viewer for detailed errors

**Issue**: "Failed to configure site settings"
- **Solution**: The service may be installed but not configured
- Manually run: `C:\ShopFloorConnect\3 - West_Jeff_CA_LR_Update_ini_File.bat`
- Verify FIT-MI_Server folder was created by install.bat

**Issue**: "FIT-MI_Server folder not created"
- **Solution**: The install.bat Ant build script failed
- Check that TCFITDIR environment variable was set
- Verify Java runtime exists at: `C:\ShopFloorConnect\Java\j2sdk`
- Check you have write permissions to C:\ShopFloorConnect
- Try running install.bat manually from: `C:\ShopFloorConnect\MachineToolClient_Service\`

**Issue**: "Service Registration Failed"
- **Solution**: The Windows service SFCMTCService was not created
- Check Windows Event Viewer for service registration errors
- Verify you're running as Administrator
- Manually register the service:
  ```cmd
  cd C:\ShopFloorConnect\FIT-MI_Server\Tomcat 5.0\bin
  SFC_MTC_Tomcat_service.bat install
  ```

**Issue**: "Configuration file not found"
- **Solution**: The mi_server.ini file was not created
- This usually means the Ant build script didn't complete
- Verify FIT-MI_Server folder exists
- Check that install.bat completed without errors

**Issue**: Service won't start
- **Solution**: Check that TCFITDIR environment variable is set correctly
- Verify mi_server.ini configuration exists and is valid
- Check Windows Event Viewer for service errors
- Verify Windows service "SFCMTCService" is registered

**Issue**: Cannot connect to Teamcenter
- **Solution**: Verify network connectivity to 10.233.113.141
- Check FQDN in mi_server.ini matches your PC
- Verify Windows Firewall settings
- Check if port 8080 is accessible

## Configuration for Other Sites

This installer is configured specifically for West Jefferson CA-LR. For other sites:

1. Edit `ShopfloorConnect.iss` line 59
2. Change to appropriate batch file:
   - `3 - West_Jeff_CA_LR_Update_ini_File.bat` (current)
   - `3 - Rotating_Parts_Lean_Lab_Update_ini_File.bat`
   - `3 - Wilmington_Update_ini_File.bat`
3. Update welcome message in `[Messages]` section
4. Rebuild installer

## Technical Details

**Installer Engine**: Inno Setup 6
**Compression**: Solid compression (lzma)
**Admin Required**: Yes
**Install Directory**: Fixed (C:\ShopFloorConnect)
**Uninstaller**: Standard Windows uninstall

**Source Files**: Extracted from `ShopFloorConnect.zip` (175MB)

## Support

For issues or questions:
- **Internal URL**: http://tsgwp00524.logon.ds.ge.com
- **Project Location**: `/home/camp/projects/inno/ShopfloorConnect/`

---

**Last Updated**: 2025-10-10
