diff --git a/api.asp b/api.asp index 071c776..d3fb087 100644 --- a/api.asp +++ b/api.asp @@ -246,24 +246,14 @@ Sub UpdateCompleteAsset() End If debugMsg = debugMsg & "6-modelId=" & modelId & "," - ' Get machine type ID - Select Case LCase(pcType) - Case "standard" - machineTypeId = 33 - Case "engineer", "engineering" - machineTypeId = 34 - Case "shopfloor", "shop floor" - machineTypeId = 35 - Case "cmm" - machineTypeId = 41 - 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 & "," + ' Get machine type ID (all PCs use 33) + machineTypeId = 33 + debugMsg = debugMsg & "7-machineTypeId=" & machineTypeId & "," + + ' Get PC type ID from pcType string + Dim pctypeId + pctypeId = GetPCTypeIdFromPCType(pcType) + debugMsg = debugMsg & "7b-pctypeId=" & pctypeId & "," ' Check if PC exists Dim strSQL, rsResult, safeHostname, safeSerial @@ -308,7 +298,7 @@ Sub UpdateCompleteAsset() Else lastBootPart = "" 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 If Err.Number <> 0 Then SendError debugMsg & "10-UPDATE failed: " & Err.Description @@ -348,7 +338,7 @@ Sub UpdateCompleteAsset() lastBootColInsert = "" lastBootValInsert = "" 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 If Err.Number <> 0 Then SendError debugMsg & "10-INSERT failed: " & Err.Description @@ -2041,7 +2031,7 @@ Function GetPCTypeIdFromPCType(pcTypeString) GetPCTypeIdFromPCType = 7 Case "GENSPECT", "EAS1000" GetPCTypeIdFromPCType = 8 ' Genspect / EAS1000 - Case "HEAT TREAT", "HEATTTREAT" + Case "HEAT TREAT", "HEATTTREAT", "HEATTEAT", "HEAT_TREAT", "HEATTREAT" GetPCTypeIdFromPCType = 9 Case "PART MARKER", "PARTMARKER" GetPCTypeIdFromPCType = 10 diff --git a/displaypc.asp b/displaypc.asp index 71f9e7a..764ad19 100644 --- a/displaypc.asp +++ b/displaypc.asp @@ -253,6 +253,11 @@ If machineTypeVal = "" Then machineTypeVal = "N/A" buVal = rs("businessunit") & "" 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")) %>
<%=Server.HTMLEncode(serialNumVal)%>
<%=Server.HTMLEncode(hostnameVal)%>
@@ -479,7 +484,18 @@ End If