diff --git a/minimal-asset/Update-PC-Minimal.ps1 b/minimal-asset/Update-PC-Minimal.ps1 index 8c4ed75..7f42ce3 100644 --- a/minimal-asset/Update-PC-Minimal.ps1 +++ b/minimal-asset/Update-PC-Minimal.ps1 @@ -157,18 +157,29 @@ try { } if ($machineNo) { - # Check if machine number is a generic/placeholder value - # These should not be sent to API - must be set manually - # Generic machine numbers - don't send to API but can help identify PC type - $genericMachineTypes = @{ + # Machine numbers that indicate specific PC types (these ARE valid machine numbers) + $machineTypeIndicators = @{ + "^0?600$" = "Wax Trace" # Wax trace machines + "^0?(612|613|615)$" = "Part Marker" # Part marker machines + "^M?(612|613|615)$" = "Part Marker" # Part marker machines (M prefix) + "^8003$" = "Part Marker" # Part marker machines + } + + # Check if machine number indicates a specific PC type + $script:machineTypeHint = $null + foreach ($pattern in $machineTypeIndicators.Keys) { + if ($machineNo -match $pattern) { + $script:machineTypeHint = $machineTypeIndicators[$pattern] + "Machine # '$machineNo' indicates PC type: $($script:machineTypeHint)" | Tee-Object -FilePath $logFile -Append + break + } + } + + # Generic/placeholder machine numbers - don't send to API + $genericPatterns = @{ "^WJPRT" = "Measuring" # Generic printer/measuring tool "^WJCMM" = "CMM" # Generic CMM "^WJMEAS" = "Measuring" # Generic measuring - "^0600$" = "Wax Trace" # Wax trace machines - "^0612$" = "Part Marker" # Part markers - "^0613$" = "Part Marker" # Part markers - "^0615" = "Part Marker" # Part markers - "^8003$" = "Part Marker" # Part markers "^TEST" = $null # Test machines - no type hint "^TEMP" = $null # Temporary - no type hint "^DEFAULT"= $null # Default value - no type hint @@ -177,10 +188,10 @@ try { $isGeneric = $false $genericTypeHint = $null - foreach ($pattern in $genericMachineTypes.Keys) { + foreach ($pattern in $genericPatterns.Keys) { if ($machineNo -match $pattern) { $isGeneric = $true - $genericTypeHint = $genericMachineTypes[$pattern] + $genericTypeHint = $genericPatterns[$pattern] break } } @@ -188,8 +199,9 @@ try { if ($isGeneric) { if ($genericTypeHint) { "Machine # '$machineNo' is generic ($genericTypeHint) - NOT sending to API (requires manual assignment)" | Tee-Object -FilePath $logFile -Append - # Store the type hint for later use in PC type detection - $script:genericTypeHint = $genericTypeHint + if (-not $script:machineTypeHint) { + $script:machineTypeHint = $genericTypeHint + } } else { "Machine # '$machineNo' is generic/placeholder - NOT sending to API (requires manual assignment)" | Tee-Object -FilePath $logFile -Append }