Update displaysubnet.asp to match displaypc.asp style, add email API helper
- Rewrite displaysubnet.asp with two-column layout and profile card - Add Details, Devices, and Edit tabs matching other display pages - Use parameterized queries and HTML encoding for security - Fix device queries to use machines/communications tables - Add includes/email.asp helper for Python Email API integration - Update api.asp GetShopfloorPCs to include all PC types with 10.134.* IPs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
31
api.asp
31
api.asp
@@ -828,22 +828,27 @@ Sub GetDashboardData()
|
||||
End Sub
|
||||
|
||||
Sub GetShopfloorPCs()
|
||||
' Returns list of all active shopfloor PCs for remote management
|
||||
' Returns list of all active PCs with shop floor IPs (10.134.*) for remote management
|
||||
' This includes all PC types: Shopfloor, CMM, Wax Trace, Keyence, etc.
|
||||
' PCs are identified by machinetypeid >= 33, pctypeid can be NULL
|
||||
On Error Resume Next
|
||||
|
||||
Dim rsPC, strSQL, pcList, pcCount, pcData
|
||||
|
||||
' Query active shopfloor PCs only (pctype = 'Shopfloor')
|
||||
' Include hostname, machineid, machinenumber (equipment), IP address, last updated
|
||||
' Query all active PCs with shop floor IP addresses (10.134.*)
|
||||
' - machinetypeid >= 33 ensures we only get PCs (not equipment)
|
||||
' - LEFT JOIN pctype to include PCs with NULL pctypeid
|
||||
' - EXISTS subquery finds any PC with a 10.134.* address
|
||||
strSQL = "SELECT m.machineid, m.hostname, m.machinenumber, m.serialnumber, " & _
|
||||
"m.loggedinuser, m.lastupdated, " & _
|
||||
"c.address AS ipaddress, " & _
|
||||
"pt.typename AS pctype " & _
|
||||
"COALESCE(pt.typename, 'Uncategorized') AS pctype " & _
|
||||
"FROM machines m " & _
|
||||
"LEFT JOIN communications c ON m.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _
|
||||
"INNER JOIN pctype pt ON m.pctypeid = pt.pctypeid " & _
|
||||
"LEFT JOIN pctype pt ON m.pctypeid = pt.pctypeid " & _
|
||||
"WHERE m.isactive = 1 " & _
|
||||
"AND pt.typename = 'Shopfloor' " & _
|
||||
"AND m.machinetypeid >= 33 " & _
|
||||
"AND EXISTS (SELECT 1 FROM communications c2 WHERE c2.machineid = m.machineid AND c2.address LIKE '10.134.%') " & _
|
||||
"ORDER BY m.hostname ASC"
|
||||
|
||||
Set rsPC = objConn.Execute(strSQL)
|
||||
@@ -1300,15 +1305,13 @@ Function InsertNetworkInterfaces(machineid, networkInterfacesJSON)
|
||||
|
||||
If interfaceName = "" Then interfaceName = "Interface " & (i + 1)
|
||||
|
||||
' Determine if primary - 10.134.*.* is always primary for shopfloor PCs
|
||||
Dim isPrimary, isPrimaryFromJson
|
||||
isPrimary = 0
|
||||
isPrimaryFromJson = GetJSONValue(interfacesArray(i), "IsPrimary")
|
||||
If isPrimaryFromJson = True Or isPrimaryFromJson = "true" Or isPrimaryFromJson = "True" Then
|
||||
isPrimary = 1
|
||||
ElseIf Left(ipAddress, 7) = "10.134." Then
|
||||
' Fallback: 10.134.*.* is always primary
|
||||
' Determine if primary - 10.134.*.* is ALWAYS primary for shopfloor PCs
|
||||
' Ignore JSON value, enforce by IP address pattern
|
||||
Dim isPrimary
|
||||
If Left(ipAddress, 7) = "10.134." Then
|
||||
isPrimary = 1
|
||||
Else
|
||||
isPrimary = 0
|
||||
End If
|
||||
|
||||
' Insert into communications table
|
||||
|
||||
Reference in New Issue
Block a user