Fix Part Marker machine number detection in minimal script
- Separate valid machine type indicators from generic placeholders - Part Marker numbers (0612, 0613, 0615, 8003) are now sent to API - Wax Trace (0600) also sent as valid machine number - Only WJPRT, WJCMM, WJMEAS prefixes treated as generic/placeholder - Add machineTypeHint for PC type detection from valid machine numbers Previously these valid machine numbers were incorrectly treated as generic placeholders and not submitted to the API. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user