Commit Graph

56 Commits

Author SHA1 Message Date
cproudlock
ced4a444dc Fix printer mapping to strip underscore suffix from port name
Port names like 10.80.92.53_2 are now cleaned to 10.80.92.53 before
sending to the API for printer lookup.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:55:07 -05:00
cproudlock
d169892362 Fix PowerShell syntax error in Backup-GERegistry.ps1
Changed ${fileSizeKB} to $fileSizeKB to fix parsing error on some systems.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 14:53:22 -05:00
cproudlock
7a22b95a3d Update registry backup path to S:\DT\cameron\scan\backup\reg
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:29:26 -05:00
cproudlock
ac13437bbe Consolidate all PowerShell scripts and fix production issues
Scripts added to shopdb/scripts/:
- Backup-GERegistry.ps1
- Get-InstalledApps.ps1
- Install-AssetCollectionSchedule.ps1
- Setup-WinRM.ps1
- Test-API-Connection.ps1

Updates to existing scripts:
- Update-PC-Minimal.ps1: Added SSL bypass, added 8003 to Part Marker machines
- Update-ShopfloorPCs-Remote.ps1: Added SSL bypass, added 8003 to Part Marker machines

Part Marker machine numbers now include: 0612, 0613, 0615, 8003

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:23:56 -05:00
cproudlock
c4cf49bedf Update Invoke-RemoteAssetCollection-HTTPS.ps1 for production
- Changed DashboardURL to production: https://tsgwp00525.rd.ds.ge.com/shopdb/api.asp
- Added SSL/TLS certificate bypass
- Added TLS 1.2 protocol requirement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:21:17 -05:00
cproudlock
895cd3d1d8 Add Part Marker detection by machine number
Part Marker PCs identified by:
- Machine numbers: 0612, 0613, 0615, 8003
- Software: Part Mark, Telesis, MECCO, Pryor, Gravotech, SIC Marking

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:19:47 -05:00
cproudlock
b65363224e Add Part Marker PC type detection
Added detection for Part Marker PCs (pctypeid 10) based on installed software:
- Part Mark, PartMark
- Telesis, MECCO, Pryor, Gravotech, SIC Marking

Detection order: CMM > Wax Trace > Keyence > EAS1000 > Genspect > Heat Treat > Part Marker > Shopfloor

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:16:29 -05:00
cproudlock
60519c4588 Fix lastBootUpTime datetime format for MySQL
PowerShell was sending datetime in US locale format (12/7/2025 10:05:28 PM)
but MySQL requires ISO format (YYYY-MM-DD HH:MM:SS).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:13:46 -05:00
cproudlock
179d39eb99 Update PowerShell scripts for production API and SSL bypass
- Changed Invoke-RemoteAssetCollection.ps1 default URL to production:
  https://tsgwp00525.rd.ds.ge.com/shopdb/api.asp
- Added SSL/TLS certificate bypass for HTTPS connections in both:
  - Update-PC-CompleteAsset.ps1
  - Invoke-RemoteAssetCollection.ps1
- Set TLS 1.2 as minimum protocol version
- Security group logon\g03078610 confirmed correct

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 13:12:49 -05:00
cproudlock
869788c0e3 Update VNC link to use RealVNC protocol in displaypcs.asp
Changed vnc:// to com.realvnc.vncviewer.connect:// for proper
RealVNC Viewer integration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:58:39 -05:00
cproudlock
9f8a0577d8 Update VNC link to use RealVNC protocol
Changed vnc:// to com.realvnc.vncviewer.connect:// for proper
RealVNC Viewer integration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:58:10 -05:00
cproudlock
84d0b5d63c Update displaypc.asp: PC Type label, WinRM text, uptime display
- Changed "Function" label to "PC Type"
- Added PC Type value from pctype table (pctypename) instead of machinetype
- Changed WinRM display from badge to plain text
- Added uptime display showing days since last boot
- Added lastboottime and uptime_days to SQL query
- Added LEFT JOIN to pctype table for PC type name

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:51:28 -05:00
cproudlock
133aa29458 Add Part Marker machinetypeid and update editpc.asp filtering
sql/add_genspect_partmarker_machinetypes.sql:
- Add Genspect (machinetypeid 45) and Part Marker (machinetypeid 46)

editpc.asp:
- Add pctypeid 10 (Part Marker) -> machinetypeid 46 filter
- Fix comment for Genspect to show machinetypeid 45

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:11:20 -05:00
cproudlock
3fa1fc3812 Add pctypeid-based equipment filtering in editpc.asp, add Genspect machinetype
editpc.asp:
- Filter equipment dropdown by pctypeid instead of pcMachineTypeId
- pctypeid 5 (CMM) -> machinetypeid 3 (CMM)
- pctypeid 6 (Wax/Trace) -> machinetypeid 5 (Wax Trace)
- pctypeid 7 (Keyence) -> machinetypeid 23 (Measuring Machine)
- pctypeid 8 (Genspect) -> machinetypeid 45 (Genspect)
- pctypeid 9 (Heat Treat) -> machinetypeid 14 (Furnace)

sql/add_genspect_machinetype.sql:
- Add Genspect equipment type (machinetypeid 45)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 11:05:45 -05:00
cproudlock
d118b49735 Inline pctypeId logic to fix production Object required error 2025-12-09 10:47:09 -05:00
cproudlock
6785a51da0 Fix pctypeid in inline UpdateCompleteAsset, add HEATTREAT variant, add relationship notification
api.asp:
- Add pctypeid to inline UPDATE and INSERT statements in UpdateCompleteAsset
- Call GetPCTypeIdFromPCType to properly map pcType string to pctypeid
- Add "HEATTREAT" (no space) variant to GetPCTypeIdFromPCType function

displaypc.asp:
- Add relationship notification for PC types that can control equipment
  (CMM=5, Wax/Trace=6, Keyence=7, Genspect=8, Heat Treat=9, Part Marker=10)
- Shows info alert with link to Edit Machine page

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 10:36:08 -05:00
cproudlock
1eb3aceeb4 Fix pctypeid UPDATE, add installedApps handling, fix network_map IDF query
- api.asp: Add pctypeid to UPDATE statement so PC type changes are saved
  (was only set on INSERT, not UPDATE - Heat Treat PCs stayed as Shopfloor)
- api.asp: Add installedApps parameter and SaveInstalledApps() function
  to save tracked apps during updateCompleteAsset calls
- network_map.asp: Fix query to use m.machinetypeid instead of mo.machinetypeid
  (IDFs and other network devices weren't appearing on map)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 10:23:01 -05:00
cproudlock
5c2b9105b8 Update SQL script with view changes for uptime tracking
- Replaced add_lastboottime_column.sql with comprehensive add_uptime_tracking.sql
- Updates 3 views to include lastboottime and uptime_days columns:
  - vw_active_pcs: Active PCs with warranty info
  - vw_shopfloor_pcs: Shopfloor PCs
  - vw_recent_updates: Recently updated machines
- Includes verification queries

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 09:54:02 -05:00
cproudlock
cd9058d81e Add PC uptime tracking feature
- Database: Add lastboottime column to machines table
- API: Accept lastBootUpTime parameter and store in lastboottime column
- PowerShell: Collect LastBootUpTime from Win32_OperatingSystem
  - Update-PC-Minimal.ps1: Add last boot time collection
  - Update-ShopfloorPCs-Remote.ps1: Add last boot time collection and API posting
- Display: Add Uptime column to displaypcs.asp with color-coded badges
  - > 90 days: red badge
  - > 30 days: yellow badge
  - > 7 days: blue badge
  - <= 7 days: muted text
- Filter: Add "Uptime > X days" filter dropdown (7, 30, 90 days)
- SQL: Production migration script for lastboottime column

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 09:36:23 -05:00
cproudlock
01d4aae38d 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>
2025-12-09 09:23:40 -05:00
cproudlock
9f58adaf19 Add SQL script for HeatTreat application
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 08:11:13 -05:00
cproudlock
a05df96cbf Add HeatTreat application tracking
- Added HeatTreat (appid 77) to applications.csv for detection

Also updated PowerShell script (separate folder):
- Added Heat Treat PC type detection via "HeatTreat" application
- Fixed Genspect to return "Genspect" instead of "Measuring"
- Updated detection priority comment

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 08:10:27 -05:00
cproudlock
53fd7e2214 Consolidate PC machinetypeid: all PCs use 33, pctypeid determines type
- Simplified GetMachineTypeIdFromPCType() to always return 33 (PC)
- PC type differentiation now handled entirely by pctypeid
- Updated savedevice.asp: 28 -> 33
- Updated savedevice_direct.asp: 36 -> 33, added pctypeid
- Removed redundant machinetypeid mapping logic (36-43)
- All 317 existing PCs already use machinetypeid=33

Schema simplified:
  machinetypeid=33 (PC) + pctypeid determines specific type
  pctypeid: 1=Standard, 2=Engineer, 3=Shopfloor, 5=CMM, etc.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 07:53:27 -05:00
cproudlock
adeff46d80 Fix API to set pctypeid when inserting new PCs
- Added GetPCTypeIdFromPCType() function to map pcType strings to pctypeid
- INSERT now includes pctypeid column (was missing, causing PCs to not be
  properly identified as PCs in Phase 2 schema)
- pctypeid mapping: Standard=1, Engineer=2, Shopfloor=3, CMM=5, Wax/Trace=6,
  Keyence=7, Genspect/EAS1000=8, Heat Treat=9, Part Marker=10
- WJPRT* pattern override now sets both machinetypeid and pctypeid
- Fixed EAS1000/GENSPECT to map to same pctypeid (8)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 07:33:37 -05:00
cproudlock
81f905f0b0 Replace machinetypeid 33-43 checks with pctypeid throughout codebase
- PCs now identified by pctypeid IS NOT NULL (not machinetypeid >= 33)
- Equipment identified by pctypeid IS NULL (not machinetypeid < 33)
- Updated 8 files: search.asp, savemachineedit.asp, displaymachine.asp,
  displaypc.asp, displaypcs.asp, machine_map.asp, displaymachines.asp, api.asp
- Simplified queries and removed redundant machinetypeid checks
- Updated all related comments to reflect new pattern

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 07:24:20 -05:00
cproudlock
a52dd2e932 Fix SQL syntax error and add CMM equipment filtering
- Fix missing space before GROUP BY in PC list pages (displaypcs, computers, listpcs, pclist, pcs)
- Add pctypeid-based equipment filtering in editdevice.asp (CMM PCs only see CMM equipment)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 16:25:16 -05:00
cproudlock
659e8bad4b Update pages to use pctypeid instead of machinetypeid IN (33-43)
- PCs identified by pctypeid IS NOT NULL instead of machinetypeid list
- Equipment identified by pctypeid IS NULL instead of NOT IN list
- Fixed devicecamera.asp: IDF dropdown uses machinetypeid 17, not 34
- Fixed displaypcs.asp: measuring tool filter uses pctypeid = 7

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 15:46:48 -05:00
cproudlock
e2e7cb1466 Consolidate PC types: use pctypeid instead of multiple machinetypeids
All PCs now use machinetypeid 33 (PC) with pctypeid for sub-type:
- Standard, Engineer, Shopfloor, CMM, Wax/Trace, Keyence, Genspect, Heat Treat

Added new pctypes: Keyence, Genspect, Heat Treat

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 15:33:08 -05:00
cproudlock
810dda29a8 Fix auto-populate: use attr() instead of data() for reliable reading
jQuery's data() caches values; attr() reads directly from DOM

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 15:21:17 -05:00
cproudlock
db797cb60f Fix auto-populate: wait for model + (machine OR CSF name)
Printer name only generates when there's enough info:
- Model must be selected (vendor available)
- AND either CSF name entered OR machine selected

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 15:18:57 -05:00
cproudlock
3ca48469fc Auto-populate printer name and FQDN on add printer form
- Printer name auto-generates from CSF name, machine/location, vendor, model
- Format: CSFName-Location-VendorDescription (e.g., CSF21-7701-HP-LaserJet)
- FQDN auto-generates from IP: Printer-10-80-92-69.printer.geaerospace.net
- Added data attributes to model and machine dropdowns for JS access

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 14:49:20 -05:00
cproudlock
0887f8df45 HP/Xerox use universal installer, warn about unsupported vendors
- HP and Xerox printers: universal installer (one batch call)
- Non-HP/Xerox with installpath: use specific installer
- Non-HP/Xerox without installpath: show warning for manual install

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 13:34:03 -05:00
cproudlock
d28cc0f1d2 Force all printers through universal installer
- Removed specific installer logic - all printers now use PrinterInstaller.exe
- Fixed /PRINTER= parameter quoting: /PRINTER="Name1,Name2" (quotes around value)
- Single call with comma-separated printer names

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 13:32:47 -05:00
cproudlock
9b266ef826 Fix /PRINTER= parameter quoting for multi-printer selection
Changed from: "/PRINTER=Name1,Name2"  (quotes around entire param)
Changed to:   /PRINTER="Name1,Name2"  (quotes around value only)

This matches the expected format in PrinterInstaller.iss comment:
// Or multiple: /PRINTER="Printer1,Printer2,Printer3"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 13:22:16 -05:00
cproudlock
c5fd338441 Batch universal installer printers into single call
Instead of calling PrinterInstaller.exe separately for each printer
(which opened multiple GUI wizards), now collects all printers without
specific installers and passes them comma-separated in one call.

- Specific installers still run individually with /SILENT
- Universal installer printers batched: /PRINTER=Name1,Name2,Name3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 13:10:59 -05:00
cproudlock
97683e9b1a Fix multi-printer selection bug in printer installer map
Removed VBScript Dim statements from inside while loop which caused
re-declaration errors on subsequent iterations. Now uses standardized
printer names directly from database instead of generating them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 13:06:17 -05:00
cproudlock
1e97522831 Add SQL script to standardize printer names
Follows convention: CSFNAME-Location-Brand-Description
Examples:
- CSF21-7701-HP-LaserJet (with CSF)
- Coaching115-Xerox-Versalink (without CSF)

Fixes Coaching 115 and all other printer naming inconsistencies.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 12:58:13 -05:00
cproudlock
14caad857d Fix printer selection panel showing N/A when CSF name is empty
Use location (machine number/alias) as display name fallback when
printercsfname is not set. Show model number as secondary info instead
of location to avoid redundancy.

Fixes Coaching 115 and similar printers without CSF names assigned.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 12:39:34 -05:00
cproudlock
a8fed88a18 Fix displayprofile.asp to work with production employees database
- Restored original structure using wjf_employees-sql.asp include
- Added USB History tab with separate shopdb connection
- Fixed 500 error caused by trying to handle missing employees DB
- Employee profile now works on production, USB history gracefully
  degrades if shopdb unavailable
- Added DataTables for USB checkout history display
- Uses 12-hour date format (MM/DD/YYYY h:mm AM/PM)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:59:02 -05:00
cproudlock
65b622c361 Add USB checkout system and SSO profile page
New Features:
- USB Device checkout/check-in system with barcode scanning
  - displayusb.asp: List all USB devices with status
  - addusb.asp: Add new USB devices via barcode scan
  - checkout_usb.asp/savecheckout_usb.asp: Check out USB to SSO
  - checkin_usb.asp/savecheckin_usb.asp: Check in with wipe confirmation
  - usb_history.asp: Full checkout history with filters
  - api_usb.asp: JSON API for AJAX lookups
- displayprofile.asp: SSO profile page showing user info and USB history
- Date/time format changed to 12-hour (MM/DD/YYYY h:mm AM/PM)
- SSO links in USB history now link to profile page via search

Database:
- New machinetypeid 44 for USB devices
- New usb_checkouts table for tracking checkouts

Cleanup:
- Removed v2 folder (duplicate/old files)
- Removed old debug/test files
- Removed completed migration documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:16:14 -05:00
cproudlock
c7834d4b99 Enhance WinRM remote script with app tracking and IP fallback
- Fix FormTracePak app_id from 68 to 76 (68 is Media Creator Full Edition)
- Add installed app tracking to remote WinRM script with embedded patterns
- Add IP fallback for failed hostname connections (uses recorded 10.134.* IPs)
- Add getRecordedIP API endpoint to lookup primary IP by hostname
- Mark 10.134.*.* as primary IPs, other ranges as secondary/equipment IPs
- Fix WinRM serialization issue by converting matched apps to JSON before return

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 16:36:44 -05:00
cproudlock
b0c60ebbd5 Fix search routing for PCs and WinRM remote update script
- search.asp: Route to displaypc.asp for PCs (machinetypeid 33-43 or
  machinetypeid 1 with hostname), displaymachine.asp for equipment
- search.asp: Add hostname search capability for PCs
- Update-ShopfloorPCs-Remote.ps1: Fix hashtable conversion bug that caused
  empty API errors - pass $result directly instead of PSObject.Properties

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 17:18:45 -05:00
cproudlock
5413b20bba Add FQDN support for network devices and fix printer installer map
## Printer Installer Map Fixes
- Fixed printer_installer_map.asp to pass printer IDs instead of generated names
- Fixed install_printer.asp dictionary key collision by using printerid

## Network Device FQDN Support
- Added fqdn column to machines table (migration script included)
- Updated device edit pages: deviceaccesspoint.asp, deviceserver.asp,
  deviceswitch.asp, devicecamera.asp
- Updated save_network_device.asp to handle FQDN in INSERT/UPDATE
- Updated network_devices.asp to display FQDN for Server, Switch, Camera
- Updated vw_network_devices view to include FQDN from machines table
- Added FQDN field to machine_edit.asp Network tab
- Updated savemachineedit.asp to save FQDN

## Printer Install Path Edit
- Added installpath field to displayprinter.asp Edit tab
- Updated editprinter.asp to save installpath changes

## Documentation
- Added IIS log location to CLAUDE.md

## Production Migration
- sql/add_fqdn_to_machines.sql - Run on production to add column and update view

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 08:50:45 -05:00
cproudlock
996705b4fd Add daily log rotation to api.asp
Issue: api.log was growing indefinitely with no rotation
Impact: With 200+ PCs reporting daily, log file would grow to 2+ GB/year

Fix: Changed logging to create daily log files
- Old: logs/api.log (single file, grows forever)
- New: logs/api-YYYY-MM-DD.log (one file per day)

Example log files:
- logs/api-2025-11-21.log
- logs/api-2025-11-22.log
- logs/api-2025-11-23.log

Benefits:
- Easier to troubleshoot (find logs by date)
- Automatic separation (no manual log rotation needed)
- Can delete old logs after N days
- File sizes manageable (~6MB/day estimated)

Cleanup Recommendation:
Delete logs older than 30 days:
  forfiles /p "C:\inetpub\wwwroot\shopdb\logs" /s /m api-*.log /d -30 /c "cmd /c del @path"

Or use Windows Task Scheduler to automate cleanup

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 11:23:11 -05:00
cproudlock
bb95615ca9 Fix application tracking in api.asp for Phase 2 schema
Issues Fixed:
1. UpdateInstalledApps() was using wrong table name 'machineapplications'
   - Changed to correct table 'installedapps'
2. INSERT was missing 'isactive' column required by installedapps table
3. GetOrCreateApplication() was using wrong column names:
   - 'applicationid' → 'appid' (primary key)
   - 'applicationname' → 'appname'
   - Removed 'version' column (doesn't exist in applications table)
   - Now stores version info in 'appdescription' field

How It Works Now:
- PowerShell script collects installed apps from registry
- Filters to tracked apps (UDC, PPDCS, Oracle, Tanium, eDNC, etc.)
- Sends to api.asp with action=updateInstalledApps
- API deletes old app mappings for PC: DELETE FROM installedapps
- API creates/finds apps in 'applications' table
- API inserts new mappings: INSERT INTO installedapps (machineid, appid, isactive)

Tables Used:
- applications (appid, appname, appdescription, isactive)
- installedapps (machineid, appid, isactive)

Impact: Application tracking now works correctly with Phase 2 schema

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 10:44:56 -05:00
cproudlock
bfaa68d5d0 Fix notifications 'Active Only' filter showing completed notifications
Issue: Active Only mode was showing notifications marked isactive=1 even if
their endtime had passed, displaying them with 'Complete' status.

Root Cause: WHERE clause only checked isactive=1, not whether endtime < NOW()

Fix: Updated WHERE clause to exclude notifications past their endtime:
- Active notifications now require: isactive=1 AND (endtime IS NULL OR endtime >= NOW())
- Still shows recently completed notifications within 30-min grace period for fade-out
- 'Active Only' badge now accurately reflects truly active notifications

Impact: Users will no longer see 'Complete' notifications when filtering to Active Only

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 09:49:01 -05:00
cproudlock
08d95f579a Phase 2 Migration: Complete PC consolidation and fixes
## Phase 2 Migration Complete
Successfully migrated all 286 active PCs from pc table to machines table.

### Migration Scripts Added/Updated:
- **Phase 1.0**: Added ensure_all_machinetypes.sql (machinetypes 15-20)
- **Phase 1.5**: Added migrate_equipment_ips_to_communications.sql
- **Phase 2**: Updated 01_migrate_pcs_to_machines.sql for duplicate handling
- **Phase 2**: Updated 08_update_schema_for_api.sql (rename pcid→machineid)
- **Phase 2 Fixes**: Added FIX_migrate_remaining_pcs.sql (60 unmigrated PCs)
- **Phase 2 Fixes**: Added FIX_pc_machine_types.sql

### Network Devices View Updated:
- **CREATE_vw_network_devices_with_fqdn.sql**: Complete rewrite for Phase 2
  - Infrastructure devices (IDF, Server, Switch, Camera, Access Point) query machines table
  - Printers remain in separate printers table (has fqdn column)
  - UNION approach: machines (machinetypeid 15-19) + printers table

### Documentation Added:
- DATA_MIGRATION_EXPLAINED.md - Full migration architecture
- PRODUCTION_MIGRATION_PLAN.md - Production deployment plan
- VIEWS_MIGRATION_ANALYSIS.md - Views requiring updates
- PRINTER_INSTALLER_FIX_2025-11-20.md - Printer installer fixes
- SCHEMA_COMPARISON_REPORT_2025-11-20.md - Phase 2 schema comparison

### ASP Files Updated:
- api_printers.asp - Printer API fixes
- displaynotifications.asp - UI improvements
- install_printer.asp - Installer fixes
- v2/api_printers.asp - V2 API updates
- v2/install_printer.asp - V2 installer updates

### Migration Results (DEV):
- Total machines: 523 (237 equipment + 286 PCs)
- Communications: 1,309
- Warranties: 212
- Machine relationships: 201
- PC migration: 286/286 ✓
- Duplicate PCs removed: 166 duplicates cleaned

### Key Achievements:
✓ All 286 active PCs migrated to machines table
✓ Network devices view updated for Phase 2 architecture
✓ pc_to_machine_id_mapping table populated (286 entries)
✓ Duplicate PC records cleaned (452→286)
✓ Schema updates for API compatibility (pcid→machineid)

### Next Steps:
- Update PHP Dashboard API for Phase 2 schema (CRITICAL - see POWERSHELL_API_PHASE2_ISSUES.md)
- Update PowerShell scripts for Phase 2 schema
- Test Update-PC-CompleteAsset-Silent.bat
- Production deployment planning

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 09:15:47 -05:00
cproudlock
4cabc823ef Increase upcoming events window from 72 hours to 5 days
Extended the shopfloor dashboard upcoming events window to show more
advance notice of scheduled changes and incidents.

Changes:
- api_shopfloor.asp: Changed INTERVAL 72 HOUR to INTERVAL 5 DAY
- Dashboard display: "Next 72 Hours" → "Next 5 Days"
- No events message: Updated to reflect 5-day window

Benefits:
- Better visibility for weekly planned maintenance
- More advance notice for upcoming changes
- Aligns with typical weekly planning cycles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 08:15:34 -05:00
cproudlock
73438f593b Add smart refresh delay during carousel transitions
Prevents data refresh from interrupting carousel animations, especially
when looping from last event back to first.

Problem:
- Carousel rotates every 5 seconds
- Data refreshes every 10 seconds
- With 4 events: collision at 20s when looping back to index 0
- Refresh would cut off the smooth slide-up transition

Solution:
- Track transition state with isTransitioning flag
- If renderEvents() called during transition, store data and return early
- After 800ms transition completes, render pending data automatically
- Max delay: 800ms, only when collision occurs
- 99% of refreshes happen instantly (no collision)

Benefits:
- Works with ANY number of events (4 or 400)
- Smooth transitions every time
- Minimal delay (max 800ms, rarely happens)
- Future-proof - no magic timing numbers
- Console logs show when delay occurs

Timeline example (4 events):
- 0s: test 2 (index 0)
- 5s: test again (index 1) - transition starts, isTransitioning=true
- 5.8s: transition completes, isTransitioning=false
- 10s: REFRESH (no collision, renders immediately)
- 15s: test 3 (index 2)
- 20s: test (index 3) - transition starts
- 20s: REFRESH (collision! delayed)
- 20.8s: transition completes, pending data renders 

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 09:18:20 -05:00
cproudlock
0d6bef5c41 Fix carousel reset on data refresh - preserve index
The carousel was resetting to index 0 every 10 seconds when the dashboard
refreshed data from the API. This caused the carousel to show:
- 0s: test 2 (index 0)
- 5s: test again (index 1)
- 10s: DATA REFRESH → reset to test 2 (index 0) 

Fixed by:
- Preserving currentUpcomingIndex across renderEvents() calls
- Only reset index if it's out of range for new data
- Render the currently active event instead of always starting at 0
- Added logging to show index preservation

Now the carousel cycles continuously through all 4 events without
resetting when the page refreshes data every 10 seconds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 09:13:56 -05:00