Fix dualpath propagation, getShopfloorPCs filtering, USB management, and printer features
- Fix dualpath PC propagation direction (Equipment->PC) in api.asp and db_helpers.asp - Fix early exit in CreatePCMachineRelationship preventing propagation - Fix getShopfloorPCs to filter machinetypeid IN (33,34,35) instead of >= 33 - Fix getShopfloorPCs to show equipment numbers via GROUP_CONCAT subquery - Add detailed PropagateDP logging for dualpath debugging - Default "Show on Shopfloor Dashboard" checkbox to checked in addnotification.asp - Add USB label batch printing, single USB labels, and USB history pages - Add printer supplies tracking and toner report enhancements - Add uptime map visualization page - Add dashboard/lobby display SQL migration - Update CLAUDE.md with IIS 401 workaround documentation - Update TODO.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -302,19 +302,20 @@ Function PropagateControllerToDualpathMachines(conn, equipmentMachineid, pcMachi
|
||||
dualpathMachineId = CLng(rsDP("related_machineid"))
|
||||
|
||||
' Check if this dualpath machine already has a Controls relationship with this PC
|
||||
' Pattern: Equipment -> Controls -> PC (machineid=equipment, related_machineid=PC)
|
||||
Set rsDPCheck = conn.Execute("SELECT relationshipid FROM machinerelationships " & _
|
||||
"WHERE machineid = " & CLng(pcMachineid) & " " & _
|
||||
"AND related_machineid = " & dualpathMachineId & " " & _
|
||||
"WHERE machineid = " & dualpathMachineId & " " & _
|
||||
"AND related_machineid = " & CLng(pcMachineid) & " " & _
|
||||
"AND relationshiptypeid = " & controlsTypeID & " AND isactive = 1")
|
||||
|
||||
If rsDPCheck.EOF Then
|
||||
' Create Controls relationship: PC -> Dualpath Machine
|
||||
' Create Controls relationship: Dualpath Equipment -> PC (matches existing data pattern)
|
||||
Dim cmdDP
|
||||
Set cmdDP = Server.CreateObject("ADODB.Command")
|
||||
cmdDP.ActiveConnection = conn
|
||||
cmdDP.CommandText = "INSERT INTO machinerelationships (machineid, related_machineid, relationshiptypeid, isactive) VALUES (?, ?, ?, 1)"
|
||||
cmdDP.Parameters.Append cmdDP.CreateParameter("@pcid", 3, 1, , CLng(pcMachineid))
|
||||
cmdDP.Parameters.Append cmdDP.CreateParameter("@equipid", 3, 1, , dualpathMachineId)
|
||||
cmdDP.Parameters.Append cmdDP.CreateParameter("@pcid", 3, 1, , CLng(pcMachineid))
|
||||
cmdDP.Parameters.Append cmdDP.CreateParameter("@reltypeid", 3, 1, , controlsTypeID)
|
||||
cmdDP.Execute
|
||||
Set cmdDP = Nothing
|
||||
@@ -360,28 +361,29 @@ Function PropagateControllerFromDualpathMachine(conn, machineId1, machineId2)
|
||||
Set rsCtrl = Nothing
|
||||
|
||||
' Check if machine1 has a controller, copy to machine2 if machine2 doesn't have one
|
||||
Set rsCtrl = conn.Execute("SELECT machineid FROM machinerelationships " & _
|
||||
"WHERE related_machineid = " & CLng(machineId1) & " " & _
|
||||
' Pattern: Equipment -> Controls -> PC (machineid=equipment, related_machineid=PC)
|
||||
Set rsCtrl = conn.Execute("SELECT related_machineid FROM machinerelationships " & _
|
||||
"WHERE machineid = " & CLng(machineId1) & " " & _
|
||||
"AND relationshiptypeid = " & controlsTypeID & " AND isactive = 1")
|
||||
|
||||
If Not rsCtrl.EOF Then
|
||||
pcMachineid = CLng(rsCtrl("machineid"))
|
||||
pcMachineid = CLng(rsCtrl("related_machineid"))
|
||||
rsCtrl.Close
|
||||
Set rsCtrl = Nothing
|
||||
|
||||
' Check if machine2 already has this controller
|
||||
Set rsCheck = conn.Execute("SELECT relationshipid FROM machinerelationships " & _
|
||||
"WHERE machineid = " & pcMachineid & " AND related_machineid = " & CLng(machineId2) & " " & _
|
||||
"WHERE machineid = " & CLng(machineId2) & " AND related_machineid = " & pcMachineid & " " & _
|
||||
"AND relationshiptypeid = " & controlsTypeID & " AND isactive = 1")
|
||||
|
||||
If rsCheck.EOF Then
|
||||
' Create: PC -> Controls -> machine2
|
||||
' Create: Equipment -> Controls -> PC
|
||||
Dim cmdCtrl
|
||||
Set cmdCtrl = Server.CreateObject("ADODB.Command")
|
||||
cmdCtrl.ActiveConnection = conn
|
||||
cmdCtrl.CommandText = "INSERT INTO machinerelationships (machineid, related_machineid, relationshiptypeid, isactive) VALUES (?, ?, ?, 1)"
|
||||
cmdCtrl.Parameters.Append cmdCtrl.CreateParameter("@pcid", 3, 1, , pcMachineid)
|
||||
cmdCtrl.Parameters.Append cmdCtrl.CreateParameter("@equipid", 3, 1, , CLng(machineId2))
|
||||
cmdCtrl.Parameters.Append cmdCtrl.CreateParameter("@pcid", 3, 1, , pcMachineid)
|
||||
cmdCtrl.Parameters.Append cmdCtrl.CreateParameter("@reltypeid", 3, 1, , controlsTypeID)
|
||||
cmdCtrl.Execute
|
||||
Set cmdCtrl = Nothing
|
||||
@@ -395,28 +397,28 @@ Function PropagateControllerFromDualpathMachine(conn, machineId1, machineId2)
|
||||
End If
|
||||
|
||||
' Now check if machine2 has a controller, copy to machine1 if machine1 doesn't have one
|
||||
Set rsCtrl = conn.Execute("SELECT machineid FROM machinerelationships " & _
|
||||
"WHERE related_machineid = " & CLng(machineId2) & " " & _
|
||||
Set rsCtrl = conn.Execute("SELECT related_machineid FROM machinerelationships " & _
|
||||
"WHERE machineid = " & CLng(machineId2) & " " & _
|
||||
"AND relationshiptypeid = " & controlsTypeID & " AND isactive = 1")
|
||||
|
||||
If Not rsCtrl.EOF Then
|
||||
pcMachineid = CLng(rsCtrl("machineid"))
|
||||
pcMachineid = CLng(rsCtrl("related_machineid"))
|
||||
rsCtrl.Close
|
||||
Set rsCtrl = Nothing
|
||||
|
||||
' Check if machine1 already has this controller
|
||||
Set rsCheck = conn.Execute("SELECT relationshipid FROM machinerelationships " & _
|
||||
"WHERE machineid = " & pcMachineid & " AND related_machineid = " & CLng(machineId1) & " " & _
|
||||
"WHERE machineid = " & CLng(machineId1) & " AND related_machineid = " & pcMachineid & " " & _
|
||||
"AND relationshiptypeid = " & controlsTypeID & " AND isactive = 1")
|
||||
|
||||
If rsCheck.EOF Then
|
||||
' Create: PC -> Controls -> machine1
|
||||
' Create: Equipment -> Controls -> PC
|
||||
Dim cmdCtrl2
|
||||
Set cmdCtrl2 = Server.CreateObject("ADODB.Command")
|
||||
cmdCtrl2.ActiveConnection = conn
|
||||
cmdCtrl2.CommandText = "INSERT INTO machinerelationships (machineid, related_machineid, relationshiptypeid, isactive) VALUES (?, ?, ?, 1)"
|
||||
cmdCtrl2.Parameters.Append cmdCtrl2.CreateParameter("@pcid", 3, 1, , pcMachineid)
|
||||
cmdCtrl2.Parameters.Append cmdCtrl2.CreateParameter("@equipid", 3, 1, , CLng(machineId1))
|
||||
cmdCtrl2.Parameters.Append cmdCtrl2.CreateParameter("@pcid", 3, 1, , pcMachineid)
|
||||
cmdCtrl2.Parameters.Append cmdCtrl2.CreateParameter("@reltypeid", 3, 1, , controlsTypeID)
|
||||
cmdCtrl2.Execute
|
||||
Set cmdCtrl2 = Nothing
|
||||
|
||||
Reference in New Issue
Block a user