Add Heat Treat detection and PC type filter
- PowerShell scripts: Add Heat Treat detection to Update-PC-Minimal.ps1 and Update-ShopfloorPCs-Remote.ps1 with proper priority chain (CMM > Wax Trace > Keyence > EAS1000 > Genspect > Heat Treat > Shopfloor) - displaypcs.asp: Add PC Type dropdown filter using pctypeid - displaypcs.asp: Fix SQL spacing issues in WHERE clause filters 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -39,10 +39,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
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
|
||||
<option value="laptop"<% If deviceTypeFilter = "laptop" Then Response.Write(" selected") End If%>>Laptops</option>
|
||||
<option value="desktop"<% If deviceTypeFilter = "desktop" Then Response.Write(" selected") End If%>>Desktops</option>
|
||||
</select>
|
||||
<select id="pcTypeFilter" class="btn btn-secondary btn-sm" onchange="updateFilter('pctype', this.value)">
|
||||
<option value="">All PC Types</option>
|
||||
<%
|
||||
Dim rsPCType, pcTypeSelectedAttr
|
||||
Set rsPCType = objConn.Execute("SELECT pctypeid, typename FROM pctype WHERE isactive = 1 ORDER BY typename")
|
||||
While Not rsPCType.EOF
|
||||
pcTypeSelectedAttr = ""
|
||||
If CStr(rsPCType("pctypeid")) = CStr(pcTypeFilter) Then
|
||||
pcTypeSelectedAttr = " selected"
|
||||
End If
|
||||
Response.Write " <option value=""" & rsPCType("pctypeid") & """" & pcTypeSelectedAttr & ">" & rsPCType("typename") & "</option>" & vbCrLf
|
||||
rsPCType.MoveNext
|
||||
Wend
|
||||
rsPCType.Close
|
||||
Set rsPCType = Nothing
|
||||
%>
|
||||
</select>
|
||||
<select id="pcStatusSelect" class="btn btn-secondary btn-sm" onchange="updateFilter('pcstatus', this.value)">
|
||||
<option value="">All Statuses</option>
|
||||
<%
|
||||
@@ -92,7 +110,7 @@ Set rsStatus = Nothing
|
||||
<option value="">All Time</option>
|
||||
<option value="7"<% If recentFilter = "7" Then Response.Write(" selected") End If%>>Last 7 Days</option>
|
||||
</select>
|
||||
<% If currentPCStatus <> "" Or recentFilter <> "" Or deviceTypeFilter <> "" Or Request.QueryString("needsrelationship") <> "" Then %>
|
||||
<% If currentPCStatus <> "" Or recentFilter <> "" Or deviceTypeFilter <> "" Or pcTypeFilter <> "" Or Request.QueryString("needsrelationship") <> "" Then %>
|
||||
<a href="displaypcs.asp" class="btn btn-outline-secondary btn-sm">
|
||||
<i class="zmdi zmdi-close"></i> Clear
|
||||
</a>
|
||||
@@ -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
|
||||
@@ -146,7 +165,7 @@ Set rsStatus = Nothing
|
||||
' 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
|
||||
@@ -160,6 +179,11 @@ Set rsStatus = Nothing
|
||||
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" & _
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user