- 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>
63 lines
1.8 KiB
Plaintext
63 lines
1.8 KiB
Plaintext
<%
|
|
' 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 - simple 5-minute cache
|
|
Function GetAllPrinterSuppliesCached(hostIP)
|
|
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)
|
|
|
|
' Check if valid cache exists (without locking)
|
|
If Not forceRefresh Then
|
|
cachedData = Application(cacheKey)
|
|
cacheTime = Application(cacheKey & "_time")
|
|
|
|
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
|
|
End If
|
|
|
|
' Cache miss or stale - fetch fresh data
|
|
Dim zabbixConnected, pingStatus, suppliesJSON
|
|
|
|
zabbixConnected = ZabbixLogin()
|
|
|
|
If zabbixConnected = "1" Then
|
|
pingStatus = GetPrinterPingStatus(hostIP)
|
|
suppliesJSON = GetAllPrinterSupplies(hostIP)
|
|
Else
|
|
pingStatus = "-1"
|
|
suppliesJSON = ""
|
|
End If
|
|
|
|
' Store as array: [connected, pingStatus, suppliesJSON]
|
|
Dim resultData(2)
|
|
resultData(0) = zabbixConnected
|
|
resultData(1) = pingStatus
|
|
resultData(2) = suppliesJSON
|
|
|
|
' Cache the result (brief lock)
|
|
Application.Lock
|
|
Application(cacheKey) = resultData
|
|
Application(cacheKey & "_time") = Now()
|
|
Application.Unlock
|
|
|
|
On Error Goto 0
|
|
GetAllPrinterSuppliesCached = resultData
|
|
End Function
|
|
|
|
%>
|