diff --git a/displaypcs.asp b/displaypcs.asp index aecb00b..3dc54ce 100644 --- a/displaypcs.asp +++ b/displaypcs.asp @@ -39,10 +39,11 @@ <% -Dim currentPCStatus, recentFilter, deviceTypeFilter, sel +Dim currentPCStatus, recentFilter, deviceTypeFilter, pcTypeFilter, sel currentPCStatus = Request.QueryString("pcstatus") recentFilter = Request.QueryString("recent") deviceTypeFilter = Request.QueryString("devicetype") +pcTypeFilter = Request.QueryString("pctype") ' Check for specialized PCs (CMM, Wax Trace, Measuring Tool) without equipment relationships Dim rsUnlinked, unlinkedCount @@ -71,6 +72,23 @@ End If + - <% If currentPCStatus <> "" Or recentFilter <> "" Or deviceTypeFilter <> "" Or Request.QueryString("needsrelationship") <> "" Then %> + <% If currentPCStatus <> "" Or recentFilter <> "" Or deviceTypeFilter <> "" Or pcTypeFilter <> "" Or Request.QueryString("needsrelationship") <> "" Then %> Clear @@ -119,11 +137,12 @@ Set rsStatus = Nothing <% ' Build query based on filters - Dim pcStatusFilter, recentDaysFilter, deviceTypeFilterSQL, needsRelationshipFilter, whereClause + Dim pcStatusFilter, recentDaysFilter, deviceTypeFilterSQL, pcTypeFilterSQL, needsRelationshipFilter, whereClause Dim displayName, hasVnc, vncHost, hasWinrm pcStatusFilter = Request.QueryString("pcstatus") recentDaysFilter = Request.QueryString("recent") deviceTypeFilterSQL = Request.QueryString("devicetype") + pcTypeFilterSQL = Request.QueryString("pctype") needsRelationshipFilter = Request.QueryString("needsrelationship") ' Base query with LEFT JOINs to show all PCs @@ -141,29 +160,34 @@ Set rsStatus = Nothing "LEFT JOIN machinestatus ON m.machinestatusid = machinestatus.machinestatusid " & _ "LEFT JOIN machinerelationships mr ON (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.isactive = 1 AND mr.relationshiptypeid = 3 " & _ "LEFT JOIN machines eq ON (eq.machineid = mr.related_machineid OR eq.machineid = mr.machineid) AND eq.machineid <> m.machineid AND eq.pctypeid IS NULL " & _ - "WHERE m.isactive = 1 AND m.pctypeid IS NOT NULL" + "WHERE m.isactive = 1 AND m.pctypeid IS NOT NULL " ' Apply filters whereClause = "" If pcStatusFilter <> "" Then - whereClause = whereClause & "AND m.machinestatusid = " & pcStatusFilter & " " + whereClause = whereClause & " AND m.machinestatusid = " & pcStatusFilter End If If recentDaysFilter <> "" And IsNumeric(recentDaysFilter) Then - whereClause = whereClause & "AND m.lastupdated >= DATE_SUB(NOW(), INTERVAL " & recentDaysFilter & " DAY) " + whereClause = whereClause & " AND m.lastupdated >= DATE_SUB(NOW(), INTERVAL " & recentDaysFilter & " DAY)" End If ' Filter by device type (laptop vs desktop) based on model name patterns If deviceTypeFilterSQL = "laptop" Then - whereClause = whereClause & "AND (models.modelnumber LIKE '%Latitude%' OR models.modelnumber LIKE '%Precision%' AND (models.modelnumber NOT LIKE '%Tower%')) " + whereClause = whereClause & " AND (models.modelnumber LIKE '%Latitude%' OR models.modelnumber LIKE '%Precision%' AND (models.modelnumber NOT LIKE '%Tower%'))" ElseIf deviceTypeFilterSQL = "desktop" Then - whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') " + whereClause = whereClause & " AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%')" + End If + + ' Filter by PC type (pctypeid) + If pcTypeFilterSQL <> "" And IsNumeric(pcTypeFilterSQL) Then + whereClause = whereClause & " AND m.pctypeid = " & pcTypeFilterSQL End If ' Filter for specialized PCs needing equipment relationships If needsRelationshipFilter = "1" Then - whereClause = whereClause & "AND m.pctypeid = 7 " & _ - "AND NOT EXISTS (SELECT 1 FROM machinerelationships mr WHERE (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.relationshiptypeid = 3 AND mr.isactive = 1) " + whereClause = whereClause & " AND m.pctypeid = 7" & _ + " AND NOT EXISTS (SELECT 1 FROM machinerelationships mr WHERE (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.relationshiptypeid = 3 AND mr.isactive = 1)" End If strSQL = strSQL & whereClause & " GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC" diff --git a/scripts/Update-PC-Minimal.ps1 b/scripts/Update-PC-Minimal.ps1 index baf29b2..58dcc43 100644 --- a/scripts/Update-PC-Minimal.ps1 +++ b/scripts/Update-PC-Minimal.ps1 @@ -282,6 +282,8 @@ $hasDODA = $false $hasFormStatusMonitor = $false $hasGageCal = $false $hasNISoftware = $false +$hasGenspect = $false +$hasHeatTreat = $false try { $regPaths = @( "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*", @@ -336,6 +338,8 @@ try { "Keyence VR Series" { $hasKeyence = $true } "GageCal" { $hasGageCal = $true } "NI Software" { $hasNISoftware = $true } + "Genspect" { $hasGenspect = $true } + "HeatTreat" { $hasHeatTreat = $true } } } break @@ -419,7 +423,7 @@ if ($matchedApps.Count -gt 0) { } # Set PC type based on application detection -# Priority: CMM > Wax Trace > Keyence > EAS1000 > Part Marker > Generic hint > default Measuring +# Priority: CMM > Wax Trace > Keyence > EAS1000 > Genspect > Heat Treat > Generic hint > default Shopfloor $isCMM = ($hasPcDmis -or $hasGoCMM -or $hasDODA) $isWaxTrace = ($hasFormTracePak -or $hasFormStatusMonitor) $isEAS1000 = ($hasGageCal -or $hasNISoftware) @@ -446,12 +450,19 @@ if ($isCMM) { if ($hasGageCal) { $detected += "GageCal" } if ($hasNISoftware) { $detected += "NI Software" } "PC Type set to: EAS1000 ($($detected -join ', '))" | Tee-Object -FilePath $logFile -Append +} elseif ($hasGenspect) { + $data.pcType = "Genspect" + "PC Type set to: Genspect" | Tee-Object -FilePath $logFile -Append +} elseif ($hasHeatTreat) { + $data.pcType = "Heat Treat" + "PC Type set to: Heat Treat" | Tee-Object -FilePath $logFile -Append } elseif ($script:genericTypeHint) { # Use generic machine number hint when no software detected $data.pcType = $script:genericTypeHint "PC Type set to: $($script:genericTypeHint) (from generic machine # - requires manual assignment)" | Tee-Object -FilePath $logFile -Append } else { - "No specialized apps detected, keeping type: $($data.pcType)" | Tee-Object -FilePath $logFile -Append + $data.pcType = "Shopfloor" + "No specialized apps detected, defaulting to: Shopfloor" | Tee-Object -FilePath $logFile -Append } # Send to API diff --git a/scripts/Update-ShopfloorPCs-Remote.ps1 b/scripts/Update-ShopfloorPCs-Remote.ps1 index 0cd9bb2..14a5df1 100644 --- a/scripts/Update-ShopfloorPCs-Remote.ps1 +++ b/scripts/Update-ShopfloorPCs-Remote.ps1 @@ -498,6 +498,7 @@ function Get-RemotePCInfo { @{ app_id = 73; app_name = "goCMM"; patterns = @("goCMM") } @{ app_id = 74; app_name = "DODA"; patterns = @("Dovetail Digital Analysis", "DODA") } @{ app_id = 75; app_name = "FormStatusMonitor"; patterns = @("FormStatusMonitor") } + @{ app_id = 77; app_name = "HeatTreat"; patterns = @("HeatTreat") } ) $matchedApps = @() @@ -605,7 +606,7 @@ function Get-RemotePCInfo { $result.HasNISoftware = $hasNISoftware $result.IsEAS1000 = ($hasGageCal -or $hasNISoftware) - # Genspect Detection (could be Keyence or EAS1000) + # Genspect Detection $hasGenspect = $false foreach ($app in $installedApps) { if ($app -match "^Genspect") { @@ -615,9 +616,19 @@ function Get-RemotePCInfo { } $result.HasGenspect = $hasGenspect + # Heat Treat Detection + $hasHeatTreat = $false + foreach ($app in $installedApps) { + if ($app -match "^HeatTreat") { + $hasHeatTreat = $true + break + } + } + $result.HasHeatTreat = $hasHeatTreat + # Determine PC Type based on detected software - # Priority: CMM > Wax Trace > Keyence > EAS1000 > Generic hint > Measuring (default) - $detectedPcType = "Measuring" # Default for shopfloor PCs + # Priority: CMM > Wax Trace > Keyence > EAS1000 > Genspect > Heat Treat > Generic hint > Shopfloor (default) + $detectedPcType = "Shopfloor" # Default for shopfloor PCs if ($result.IsCMM) { $detectedPcType = "CMM" } elseif ($result.IsWaxTrace) { @@ -626,6 +637,10 @@ function Get-RemotePCInfo { $detectedPcType = "Keyence" } elseif ($result.IsEAS1000) { $detectedPcType = "EAS1000" + } elseif ($hasGenspect) { + $detectedPcType = "Genspect" + } elseif ($hasHeatTreat) { + $detectedPcType = "Heat Treat" } elseif ($result.GenericTypeHint) { # Use generic machine number hint when no software detected $detectedPcType = $result.GenericTypeHint @@ -910,6 +925,7 @@ foreach ($result in $results) { if ($result.HasGageCal) { $detectedSoftware += "GageCal" } if ($result.HasNISoftware) { $detectedSoftware += "NI Software" } if ($result.HasGenspect) { $detectedSoftware += "Genspect" } + if ($result.HasHeatTreat) { $detectedSoftware += "HeatTreat" } $softwareStr = if ($detectedSoftware.Count -gt 0) { " (" + ($detectedSoftware -join ", ") + ")" } else { "" } Write-Log " PC Type: $($result.DetectedPcType)$softwareStr" -Level "INFO"