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:
cproudlock
2025-12-09 09:23:40 -05:00
parent 9f58adaf19
commit 01d4aae38d
3 changed files with 66 additions and 15 deletions

View File

@@ -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
@@ -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"