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>
This commit is contained in:
cproudlock
2025-12-09 11:05:45 -05:00
parent d118b49735
commit 3fa1fc3812
2 changed files with 44 additions and 19 deletions

View File

@@ -54,7 +54,7 @@
End If End If
' Store machine data ' Store machine data
Dim serialnumber, hostname, machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop, pcMachineTypeId, currentMachineStatusId Dim serialnumber, hostname, machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop, pcMachineTypeId, currentMachineStatusId, currentPcTypeId
serialnumber = "" : If NOT IsNull(rsMachine("serialnumber")) Then serialnumber = rsMachine("serialnumber") & "" serialnumber = "" : If NOT IsNull(rsMachine("serialnumber")) Then serialnumber = rsMachine("serialnumber") & ""
hostname = "" : If NOT IsNull(rsMachine("hostname")) Then hostname = rsMachine("hostname") & "" hostname = "" : If NOT IsNull(rsMachine("hostname")) Then hostname = rsMachine("hostname") & ""
machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & "" machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & ""
@@ -65,6 +65,7 @@
mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft") mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft")
maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop") maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop")
pcMachineTypeId = 0 : If NOT IsNull(rsMachine("pcmachinetypeid")) Then pcMachineTypeId = CLng(rsMachine("pcmachinetypeid")) pcMachineTypeId = 0 : If NOT IsNull(rsMachine("pcmachinetypeid")) Then pcMachineTypeId = CLng(rsMachine("pcmachinetypeid"))
currentPcTypeId = 0 : If NOT IsNull(rsMachine("pctypeid")) Then currentPcTypeId = CLng(rsMachine("pctypeid"))
currentMachineStatusId = "" : If NOT IsNull(rsMachine("machinestatusid")) Then currentMachineStatusId = rsMachine("machinestatusid") currentMachineStatusId = "" : If NOT IsNull(rsMachine("machinestatusid")) Then currentMachineStatusId = rsMachine("machinestatusid")
rsMachine.Close rsMachine.Close
@@ -587,19 +588,32 @@ Set rsMachineStatus = Nothing
<select class="form-control" id="controllingpc" name="controllingpc"> <select class="form-control" id="controllingpc" name="controllingpc">
<option value="">-- None --</option> <option value="">-- None --</option>
<% <%
' Filter controlled machines based on PC type ' Filter controlled machines based on pctypeid
' PC - CMM (41) -> CMM equipment (machinetypeid 3) ' pctypeid 5 (CMM) -> CMM equipment (machinetypeid 3)
' PC - Wax Trace (42) -> Wax Trace equipment (machinetypeid 5) ' pctypeid 6 (Wax/Trace) -> Wax Trace equipment (machinetypeid 5)
' PC - Measuring Tool (43) -> Measuring Machine equipment (machinetypeid 23) ' pctypeid 7 (Keyence) -> Measuring Machine equipment (machinetypeid 23)
Dim rsControlPCs, equipmentTypeFilter ' pctypeid 8 (Genspect/EAS1000) -> Measuring Machine equipment (machinetypeid 23)
' pctypeid 9 (Heat Treat) -> Furnace equipment (machinetypeid 14)
' pctypeid 10 (Part Marker) -> no filter (show all equipment)
Dim rsControlPCs, equipmentTypeFilter, filterDescription
equipmentTypeFilter = "" equipmentTypeFilter = ""
Select Case pcMachineTypeId filterDescription = ""
Case 41 Select Case currentPcTypeId
equipmentTypeFilter = " AND m.machinetypeid = 3" ' CMM Case 5
Case 42 equipmentTypeFilter = " AND m.machinetypeid = 3"
equipmentTypeFilter = " AND m.machinetypeid = 5" ' Wax Trace filterDescription = "CMM"
Case 43 Case 6
equipmentTypeFilter = " AND m.machinetypeid = 23" ' Measuring Machine equipmentTypeFilter = " AND m.machinetypeid = 5"
filterDescription = "Wax Trace"
Case 7
equipmentTypeFilter = " AND m.machinetypeid = 23"
filterDescription = "Keyence/Measuring Machine"
Case 8
equipmentTypeFilter = " AND m.machinetypeid = 45"
filterDescription = "Genspect/EAS1000"
Case 9
equipmentTypeFilter = " AND m.machinetypeid = 14"
filterDescription = "Furnace (Heat Treat)"
End Select End Select
strSQL = "SELECT m.machineid, m.machinenumber, m.alias FROM machines m " &_ strSQL = "SELECT m.machineid, m.machinenumber, m.alias FROM machines m " &_
"LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " &_ "LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " &_
@@ -627,12 +641,8 @@ Set rsMachineStatus = Nothing
</select> </select>
<% <%
' Show filter info for specialized PCs ' Show filter info for specialized PCs
If pcMachineTypeId = 41 Then If filterDescription <> "" Then
Response.Write("<small class='form-text text-info'><i class='zmdi zmdi-filter-list'></i> Filtered to CMM equipment only</small>") Response.Write("<small class='form-text text-info'><i class='zmdi zmdi-filter-list'></i> Filtered to " & filterDescription & " equipment only</small>")
ElseIf pcMachineTypeId = 42 Then
Response.Write("<small class='form-text text-info'><i class='zmdi zmdi-filter-list'></i> Filtered to Wax Trace equipment only</small>")
ElseIf pcMachineTypeId = 43 Then
Response.Write("<small class='form-text text-info'><i class='zmdi zmdi-filter-list'></i> Filtered to Measuring Machine equipment only</small>")
Else Else
Response.Write("<small class='form-text text-muted'>Select a machine that this PC controls</small>") Response.Write("<small class='form-text text-muted'>Select a machine that this PC controls</small>")
End If End If

View File

@@ -0,0 +1,15 @@
-- Add Genspect/EAS1000 equipment type
-- Run on production database
-- Date: 2025-12-09
-- Check if Genspect machinetype already exists
SET @genspect_exists = (SELECT COUNT(*) FROM machinetypes WHERE machinetype = 'Genspect');
-- Insert only if it doesn't exist
INSERT INTO machinetypes (machinetype, isactive)
SELECT 'Genspect', 1
FROM dual
WHERE @genspect_exists = 0;
-- Show result
SELECT machinetypeid, machinetype FROM machinetypes WHERE machinetype = 'Genspect';