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>
This commit is contained in:
30
api.asp
30
api.asp
@@ -246,24 +246,14 @@ Sub UpdateCompleteAsset()
|
|||||||
End If
|
End If
|
||||||
debugMsg = debugMsg & "6-modelId=" & modelId & ","
|
debugMsg = debugMsg & "6-modelId=" & modelId & ","
|
||||||
|
|
||||||
' Get machine type ID
|
' Get machine type ID (all PCs use 33)
|
||||||
Select Case LCase(pcType)
|
|
||||||
Case "standard"
|
|
||||||
machineTypeId = 33
|
machineTypeId = 33
|
||||||
Case "engineer", "engineering"
|
debugMsg = debugMsg & "7-machineTypeId=" & machineTypeId & ","
|
||||||
machineTypeId = 34
|
|
||||||
Case "shopfloor", "shop floor"
|
' Get PC type ID from pcType string
|
||||||
machineTypeId = 35
|
Dim pctypeId
|
||||||
Case "cmm"
|
pctypeId = GetPCTypeIdFromPCType(pcType)
|
||||||
machineTypeId = 41
|
debugMsg = debugMsg & "7b-pctypeId=" & pctypeId & ","
|
||||||
Case "wax trace", "waxtrace", "wax"
|
|
||||||
machineTypeId = 42
|
|
||||||
Case "keyence", "measuring", "measuring tool"
|
|
||||||
machineTypeId = 43
|
|
||||||
Case Else
|
|
||||||
machineTypeId = 33
|
|
||||||
End Select
|
|
||||||
debugMsg = debugMsg & "7-typeId=" & machineTypeId & ","
|
|
||||||
|
|
||||||
' Check if PC exists
|
' Check if PC exists
|
||||||
Dim strSQL, rsResult, safeHostname, safeSerial
|
Dim strSQL, rsResult, safeHostname, safeSerial
|
||||||
@@ -308,7 +298,7 @@ Sub UpdateCompleteAsset()
|
|||||||
Else
|
Else
|
||||||
lastBootPart = ""
|
lastBootPart = ""
|
||||||
End If
|
End If
|
||||||
strSQL = "UPDATE machines SET serialnumber='" & safeSerial & "', modelnumberid=" & modelId & ", machinetypeid=" & machineTypeId & ", osid=" & osid & ", isvnc=" & vncValue & ", iswinrm=" & winrmValue & lastBootPart & ", lastupdated=NOW() WHERE machineid=" & machineid
|
strSQL = "UPDATE machines SET serialnumber='" & safeSerial & "', modelnumberid=" & modelId & ", machinetypeid=" & machineTypeId & ", pctypeid=" & pctypeId & ", osid=" & osid & ", isvnc=" & vncValue & ", iswinrm=" & winrmValue & lastBootPart & ", lastupdated=NOW() WHERE machineid=" & machineid
|
||||||
objConn.Execute strSQL
|
objConn.Execute strSQL
|
||||||
If Err.Number <> 0 Then
|
If Err.Number <> 0 Then
|
||||||
SendError debugMsg & "10-UPDATE failed: " & Err.Description
|
SendError debugMsg & "10-UPDATE failed: " & Err.Description
|
||||||
@@ -348,7 +338,7 @@ Sub UpdateCompleteAsset()
|
|||||||
lastBootColInsert = ""
|
lastBootColInsert = ""
|
||||||
lastBootValInsert = ""
|
lastBootValInsert = ""
|
||||||
End If
|
End If
|
||||||
strSQL = "INSERT INTO machines (hostname, serialnumber, modelnumberid, machinetypeid, osid, machinestatusid, isvnc, iswinrm, lastupdated" & lastBootColInsert & ") VALUES ('" & safeHostname & "', '" & safeSerial & "', " & modelId & ", " & machineTypeId & ", " & osid & ", " & pcstatusid & ", " & vncValueInsert & ", " & winrmValueInsert & ", NOW()" & lastBootValInsert & ")"
|
strSQL = "INSERT INTO machines (hostname, serialnumber, modelnumberid, machinetypeid, pctypeid, osid, machinestatusid, isvnc, iswinrm, lastupdated" & lastBootColInsert & ") VALUES ('" & safeHostname & "', '" & safeSerial & "', " & modelId & ", " & machineTypeId & ", " & pctypeId & ", " & osid & ", " & pcstatusid & ", " & vncValueInsert & ", " & winrmValueInsert & ", NOW()" & lastBootValInsert & ")"
|
||||||
objConn.Execute strSQL
|
objConn.Execute strSQL
|
||||||
If Err.Number <> 0 Then
|
If Err.Number <> 0 Then
|
||||||
SendError debugMsg & "10-INSERT failed: " & Err.Description
|
SendError debugMsg & "10-INSERT failed: " & Err.Description
|
||||||
@@ -2041,7 +2031,7 @@ Function GetPCTypeIdFromPCType(pcTypeString)
|
|||||||
GetPCTypeIdFromPCType = 7
|
GetPCTypeIdFromPCType = 7
|
||||||
Case "GENSPECT", "EAS1000"
|
Case "GENSPECT", "EAS1000"
|
||||||
GetPCTypeIdFromPCType = 8 ' Genspect / EAS1000
|
GetPCTypeIdFromPCType = 8 ' Genspect / EAS1000
|
||||||
Case "HEAT TREAT", "HEATTTREAT"
|
Case "HEAT TREAT", "HEATTTREAT", "HEATTEAT", "HEAT_TREAT", "HEATTREAT"
|
||||||
GetPCTypeIdFromPCType = 9
|
GetPCTypeIdFromPCType = 9
|
||||||
Case "PART MARKER", "PARTMARKER"
|
Case "PART MARKER", "PARTMARKER"
|
||||||
GetPCTypeIdFromPCType = 10
|
GetPCTypeIdFromPCType = 10
|
||||||
|
|||||||
@@ -253,6 +253,11 @@ If machineTypeVal = "" Then machineTypeVal = "N/A"
|
|||||||
|
|
||||||
buVal = rs("businessunit") & ""
|
buVal = rs("businessunit") & ""
|
||||||
If buVal = "" Then buVal = "N/A"
|
If buVal = "" Then buVal = "N/A"
|
||||||
|
|
||||||
|
' Get pctypeid for relationship notification
|
||||||
|
Dim pctypeidVal
|
||||||
|
pctypeidVal = 0
|
||||||
|
If Not IsNull(rs("pctypeid")) Then pctypeidVal = CLng(rs("pctypeid"))
|
||||||
%>
|
%>
|
||||||
<p class="mb-2"><%=Server.HTMLEncode(serialNumVal)%></p>
|
<p class="mb-2"><%=Server.HTMLEncode(serialNumVal)%></p>
|
||||||
<p class="mb-2"><%=Server.HTMLEncode(hostnameVal)%></p>
|
<p class="mb-2"><%=Server.HTMLEncode(hostnameVal)%></p>
|
||||||
@@ -479,7 +484,18 @@ End If
|
|||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="relationships">
|
<div class="tab-pane" id="relationships">
|
||||||
<h5 class="mb-3">Machine Relationships</h5>
|
<h5 class="mb-3">Machine Relationships</h5>
|
||||||
|
<%
|
||||||
|
' Show notification for PC types that can have equipment relationships
|
||||||
|
' CMM=5, Wax/Trace=6, Keyence=7, Genspect=8, Heat Treat=9, Part Marker=10
|
||||||
|
If pctypeidVal >= 5 And pctypeidVal <= 10 Then
|
||||||
|
%>
|
||||||
|
<div class="alert alert-info mb-3">
|
||||||
|
<i class="zmdi zmdi-info-outline"></i>
|
||||||
|
This PC type can be assigned to control equipment. Use <a href="editmachine.asp?machineid=<%=machineid%>">Edit Machine</a> to set up relationships.
|
||||||
|
</div>
|
||||||
|
<%
|
||||||
|
End If
|
||||||
|
%>
|
||||||
<!-- Machines Controlled by This PC -->
|
<!-- Machines Controlled by This PC -->
|
||||||
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-settings"></i> Machines Controlled by This PC</h6>
|
<h6 class="mt-3 mb-2"><i class="zmdi zmdi-settings"></i> Machines Controlled by This PC</h6>
|
||||||
<div class="table-responsive mb-4">
|
<div class="table-responsive mb-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user