Fix dualpath propagation, getShopfloorPCs filtering, USB management, and printer features

- Fix dualpath PC propagation direction (Equipment->PC) in api.asp and db_helpers.asp
- Fix early exit in CreatePCMachineRelationship preventing propagation
- Fix getShopfloorPCs to filter machinetypeid IN (33,34,35) instead of >= 33
- Fix getShopfloorPCs to show equipment numbers via GROUP_CONCAT subquery
- Add detailed PropagateDP logging for dualpath debugging
- Default "Show on Shopfloor Dashboard" checkbox to checked in addnotification.asp
- Add USB label batch printing, single USB labels, and USB history pages
- Add printer supplies tracking and toner report enhancements
- Add uptime map visualization page
- Add dashboard/lobby display SQL migration
- Update CLAUDE.md with IIS 401 workaround documentation
- Update TODO.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-02-03 10:44:55 -05:00
parent 8945fe2a0a
commit e382a3246e
27 changed files with 1926 additions and 255 deletions

View File

@@ -1,54 +1,37 @@
<%
' Cached Zabbix API wrapper for ALL supply levels (toner, ink, drums, maintenance kits, etc.)
' Simplified caching - no background refresh, minimal locking
%>
<!--#include file="./zabbix_all_supplies.asp"-->
<%
' Cached function for all supply levels - returns data immediately, refreshes in background if stale
' Cached function for all supply levels - simple 5-minute cache
Function GetAllPrinterSuppliesCached(hostIP)
Dim cacheKey, cacheAge, forceRefresh
On Error Resume Next
Dim cacheKey, cacheTime, cacheAge, cachedData, forceRefresh
cacheKey = "zabbix_all_supplies_" & hostIP
' Check if manual refresh was requested
forceRefresh = (Request.QueryString("refresh") = "1" And Request.QueryString("ip") = hostIP)
If forceRefresh Then
' Clear cache for manual refresh
Application.Lock
Application(cacheKey) = Empty
Application(cacheKey & "_time") = Empty
Application(cacheKey & "_refreshing") = "false"
Application.Unlock
End If
' Check if valid cache exists (without locking)
If Not forceRefresh Then
cachedData = Application(cacheKey)
cacheTime = Application(cacheKey & "_time")
' Check if cache exists
If Not IsEmpty(Application(cacheKey)) And Not forceRefresh Then
cacheAge = DateDiff("n", Application(cacheKey & "_time"), Now())
' If cache is stale (>5 min) AND not already refreshing, trigger background update
If cacheAge >= 5 And Application(cacheKey & "_refreshing") <> "true" Then
' Mark as refreshing
Application.Lock
Application(cacheKey & "_refreshing") = "true"
Application.Unlock
' Trigger async background refresh (non-blocking)
On Error Resume Next
Dim http
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
http.Open "GET", "http://localhost/refresh_all_supplies_cache.asp?ip=" & Server.URLEncode(hostIP), True
http.Send
Set http = Nothing
On Error Goto 0
If Not IsEmpty(cachedData) And Not IsEmpty(cacheTime) Then
cacheAge = DateDiff("n", cacheTime, Now())
If cacheAge < 5 Then
' Cache is fresh, return it
GetAllPrinterSuppliesCached = cachedData
Exit Function
End If
End If
' Return cached data immediately
GetAllPrinterSuppliesCached = Application(cacheKey)
Exit Function
End If
' No cache exists - fetch initial data
Dim freshData, zabbixConnected, pingStatus, suppliesJSON
' Cache miss or stale - fetch fresh data
Dim zabbixConnected, pingStatus, suppliesJSON
zabbixConnected = ZabbixLogin()
@@ -66,13 +49,13 @@ Function GetAllPrinterSuppliesCached(hostIP)
resultData(1) = pingStatus
resultData(2) = suppliesJSON
' Cache the result
' Cache the result (brief lock)
Application.Lock
Application(cacheKey) = resultData
Application(cacheKey & "_time") = Now()
Application(cacheKey & "_refreshing") = "false"
Application.Unlock
On Error Goto 0
GetAllPrinterSuppliesCached = resultData
End Function