For i = 1 To OPCGroupItemsCls.Count
Set OPCItemToUpdate = OPCGroupItemsCls.Item(Str(i))
ItemValue = OPCItemToUpdate.GetItemValue(1)
ItemID = OPCItemToUpdate.GetItemID
Call FindRoute(ItemID, IDChannel, IDDevice, IDTag)
For j = 1 To VSGIndex
If VSG(j).Channel = IDChannel And VSG(j).Device = IDDevice Then
Select Case IDTag
Case "Mach"
VSG(j).Mach = ItemValue
Case "LampGreen"
VSG(j).Lampgreen = ItemValue
Case "LampRed"
VSG(j).LampRed = ItemValue
Case "LampAmber"
VSG(j).LampAmber = ItemValue
Case "DT1000"
VSG(j).DT1000 = ItemValue
Case "DT1001"
VSG(j).DT1001 = ItemValue
Case "DT1002"
VSG(j).DT1002 = ItemValue
Case "DT1003"
VSG(j).DT1003 = ItemValue
Case "DT1004"
VSG(j).DT1004 = ItemValue
Case "DT1005"
VSG(j).DT1005 = ItemValue
Case "BadWeld"
VSG(j).Badweld = ItemValue
Case "DropedParts"
VSG(j).DropedParts = ItemValue
Case "EpoxyLosses"
VSG(j).EpoxyLosses = ItemValue
Case "TwistedAnodes"
VSG(j).TwistedAnodes = ItemValue
Case "EmptyPockets"
VSG(j).EmptyPockets = ItemValue
Case "Case"
Select Case ItemValue
Case 1
VSG(j).Size = "D"
Case 2
VSG(j).Size = "B"
Case 4
VSG(j).Size = "A"
Case 8
VSG(j).Size = "C"
Case 16
VSG(j).Size = "X"
End Select
Case "StopBit"
If VSG(j).Lampgreen = False And VSG(j).ErrorCode = "" And ItemValue = True Then
VSG(j).ErrorCode = "R166"
VSG(j).ErrorDescription = "Stop Button Pressed"
End If
Case "BitLdframe"
If Monitor = False Then
Dim Direccion As String
Direccion = IDChannel & "." & IDDevice
If ItemValue = True And VSG(j).LdfrmFlag = 0 Then
VSG(j).Leadframe = ""
Call UpdateItem(Direccion & ".ErrLdframe", 1)
ElseIf ItemValue = True And VSG(j).LdfrmFlag = 1 Then
Call UpdateItem(Direccion & ".ErrLdframe", 0)
Call UpdateItem(Direccion & ".BitLdframe", 0)
ElseIf ItemValue = False Then
VSG(j).LdfrmFlag = 0
End If
End If
Case "Batchreset"
If ItemValue = True Then
Call UpdateItem(IDChannel & "." & IDDevice & ".Batchreset", 0)
End If
Case "BatchLoaded"
If Monitor = False Then
Dim Direccion1 As String
Direccion1 = IDChannel & "." & IDDevice & ".BatchLoaded"
If Len(VSG(j).Batch) = 0 And VSG(j).DT1002 > 0 Then
Call UpdateItem(Direccion1, 1)
Else
Call UpdateItem(Direccion1, 0)
End If
End If
Case "LdframeYield"
If ItemValue < 1001 Then
'Para no guardar un valor falso del inicio
VSG(j).LeadFrameYield = ItemValue / 10
End If
End Select