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>
This commit is contained in:
cproudlock
2025-12-09 07:24:20 -05:00
parent a52dd2e932
commit 81f905f0b0
8 changed files with 26 additions and 39 deletions

View File

@@ -373,7 +373,7 @@ strControlledEquipSQL = "SELECT m.machineid, m.machinenumber FROM machinerelatio
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
"JOIN machines m ON mr.related_machineid = m.machineid " & _
"WHERE mr.machineid = ? AND rt.relationshiptype = 'Controls' AND mr.isactive = 1 " & _
"AND m.machinetypeid < 33 LIMIT 1"
"AND m.pctypeid IS NULL LIMIT 1"
Set rsControlledEquip = ExecuteParameterizedQuery(objConn, strControlledEquipSQL, Array(machineid))
If rsControlledEquip.EOF Then
@@ -383,7 +383,7 @@ If rsControlledEquip.EOF Then
"JOIN relationshiptypes rt ON mr.relationshiptypeid = rt.relationshiptypeid " & _
"JOIN machines m ON mr.machineid = m.machineid " & _
"WHERE mr.related_machineid = ? AND rt.relationshiptype = 'Controls' AND mr.isactive = 1 " & _
"AND m.machinetypeid < 33 LIMIT 1"
"AND m.pctypeid IS NULL LIMIT 1"
Set rsControlledEquip = ExecuteParameterizedQuery(objConn, strControlledEquipSQL, Array(machineid))
End If
@@ -495,7 +495,7 @@ End If
<tbody>
<%
' Query machines that THIS PC controls
' Check both directions - the equipment is identified by machinetypeid NOT IN (33-43)
' Check both directions - the equipment is identified by pctypeid IS NULL
strSQL2 = "SELECT m.machineid, m.machinenumber, mt.machinetype, mo.modelnumber, 'Controls' as relationshiptype " & _
"FROM machinerelationships mr " & _
"JOIN machines m ON (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) " & _