Add PC-machine relationships API and report, fix shopfloor dashboard

- Add getPCMachineRelationships API endpoint for PC-to-machine mappings
- Add pcmachinerelationships.asp report page with copy table/CSV/JSON export
- Fix shopfloor dashboard to immediately hide deactivated notifications
- Add Firewall (machinetypeid 46) support to network device pages
- Add model migration warning banner to networkdevices.asp
- Create SQL script for hybrid model/machine type view

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-01-29 16:06:33 -05:00
parent 603de062e5
commit 8945fe2a0a
10 changed files with 487 additions and 24 deletions

View File

@@ -8,6 +8,13 @@ Response.AddHeader "Cache-Control", "no-cache, no-store, must-revalidate"
Dim strSQL, jsonOutput, isFirstCurrent, isFirstUpcoming
Dim businessUnitFilter
Dim st, et, isCurrent, isResolved, isUpcoming
Dim typeName, empSsoRaw, ssoArr, idx
Dim singleSSO, singleName, singlePicture
Dim empName, empPicture
Dim upTypeName, upEmpSsoRaw, upSsoArr, upIdx
Dim upSingleSSO, upSingleName, upSinglePicture
Dim upEmpName, upEmpPicture
' Get business unit filter from query string
businessUnitFilter = Request.QueryString("businessunit")
@@ -16,11 +23,12 @@ strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, " & _
"n.ticketnumber, n.link, n.isactive, n.isshopfloor, n.businessunitid, " & _
"n.employeesso, nt.typename, nt.typecolor, bu.businessunit, " & _
"CASE " & _
" WHEN n.starttime <= NOW() AND (n.endtime IS NULL OR n.endtime >= NOW()) THEN 1 " & _
" WHEN n.starttime <= NOW() AND (n.endtime IS NULL OR n.endtime >= NOW()) AND n.isactive = 1 THEN 1 " & _
" WHEN n.endtime IS NOT NULL AND n.endtime < NOW() AND DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW() THEN 1 " & _
" ELSE 0 " & _
"END as is_current, " & _
"CASE " & _
" WHEN n.isactive = 0 THEN 1 " & _
" WHEN n.endtime IS NOT NULL AND n.endtime < NOW() THEN 1 " & _
" ELSE 0 " & _
"END as is_resolved, " & _
@@ -32,10 +40,9 @@ strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, " & _
"FROM notifications n " & _
"LEFT JOIN notificationtypes nt ON n.notificationtypeid = nt.notificationtypeid " & _
"LEFT JOIN businessunits bu ON n.businessunitid = bu.businessunitid " & _
"WHERE n.isshopfloor = 1 AND (" & _
" n.isactive = 1 OR " & _
" (n.isactive = 0 AND n.endtime IS NOT NULL AND " & _
" DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW())" & _
"WHERE n.isshopfloor = 1 AND n.isactive = 1 AND (" & _
" n.endtime IS NULL OR " & _
" DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW()" & _
")"
' Add business unit filter
@@ -51,11 +58,10 @@ strSQL = strSQL & " ORDER BY n.notificationid DESC"
Set rs = objConn.Execute(strSQL)
jsonOutput = "{""success"":true,""timestamp"":""" & FormatDateTime(Now(), 2) & " " & FormatDateTime(Now(), 4) & """,""current"":["
jsonOutput = "{""success"":true,""version"":""v2"",""timestamp"":""" & FormatDateTime(Now(), 2) & " " & FormatDateTime(Now(), 4) & """,""current"":["
isFirstCurrent = True
Do While Not rs.EOF
Dim st, et, isCurrent, isResolved
st = rs("starttime")
et = rs("endtime")
isCurrent = rs("is_current")
@@ -63,17 +69,14 @@ Do While Not rs.EOF
If isCurrent = 1 Then
' Check if this is a Recognition with multiple employees
Dim typeName, empSsoRaw
typeName = rs("typename") & ""
empSsoRaw = rs("employeesso") & ""
If LCase(typeName) = "recognition" And Len(empSsoRaw) > 0 And InStr(empSsoRaw, ",") > 0 Then
' Split into individual cards for each employee
Dim ssoArr, idx
ssoArr = Split(empSsoRaw, ",")
For idx = 0 To UBound(ssoArr)
Dim singleSSO, singleName, singlePicture
singleSSO = Trim(ssoArr(idx))
singleName = LookupSingleEmployeeName(singleSSO)
singlePicture = LookupSingleEmployeePicture(singleSSO)
@@ -128,7 +131,6 @@ Do While Not rs.EOF
jsonOutput = jsonOutput & """typecolor"":""" & JSEscape(rs("typecolor") & "") & ""","
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ","
' Handle employeesso - can be SSO or NAME:customname
Dim empName, empPicture
If Left(empSsoRaw, 5) = "NAME:" Then
' Custom name - extract name, no picture
empName = Mid(empSsoRaw, 6)
@@ -156,24 +158,20 @@ jsonOutput = jsonOutput & "],""upcoming"":["
isFirstUpcoming = True
Do While Not rs.EOF
Dim isUpcoming
st = rs("starttime")
et = rs("endtime")
isUpcoming = rs("is_upcoming")
If isUpcoming = 1 Then
' Check if this is a Recognition with multiple employees
Dim upTypeName, upEmpSsoRaw
upTypeName = rs("typename") & ""
upEmpSsoRaw = rs("employeesso") & ""
If LCase(upTypeName) = "recognition" And Len(upEmpSsoRaw) > 0 And InStr(upEmpSsoRaw, ",") > 0 Then
' Split into individual cards for each employee
Dim upSsoArr, upIdx
upSsoArr = Split(upEmpSsoRaw, ",")
For upIdx = 0 To UBound(upSsoArr)
Dim upSingleSSO, upSingleName, upSinglePicture
upSingleSSO = Trim(upSsoArr(upIdx))
upSingleName = LookupSingleEmployeeName(upSingleSSO)
upSinglePicture = LookupSingleEmployeePicture(upSingleSSO)
@@ -216,7 +214,6 @@ Do While Not rs.EOF
jsonOutput = jsonOutput & """typecolor"":""" & JSEscape(rs("typecolor") & "") & ""","
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ","
' Handle employeesso - can be SSO or NAME:customname
Dim upEmpName, upEmpPicture
If Left(upEmpSsoRaw, 5) = "NAME:" Then
' Custom name - extract name, no picture
upEmpName = Mid(upEmpSsoRaw, 6)