AAA=AAA_1 or AAA_BBB=AAA_BBB_1
这二个规律,我理解为,右边字符串包含左边的字符串,并且位置从1开始。
AAA_1_AAA<>AAA_1 or AAA_1_AAA<>AAA_2_AAA
反之不成立。
不知是不是这样的。
s1 左,s2 右
if s1=left(s2,len(s1)) then 成立
Private Sub AAA() ..... ..... For i = 0 To UBound(PowerPin) Status = False If i < UBound(PowerPin) Then If GetDPS(CH_Data_Count).SameCount > 0 Then CH_Data_Count = CH_Data_Count + 1 ReDim Preserve GetDPS(CH_Data_Count) GetDPS(CH_Data_Count).SameCount = 0 ReDim GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) ReDim GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) End If For j = i + 1 To UBound(PowerPin) If PowerPin(i) <> "" Then If PowerPin(j) <> "" Then If GetName(0, PowerPin(i)) = GetName(0, PowerPin(j)) Then If GetDPS(CH_Data_Count).DPin(0) = "" Then GetDPS(CH_Data_Count).DPin(0) = GetName(1, PowerPin(i)) GetDPS(CH_Data_Count).Channel(0) = GetName(2, PowerPin(i)) GetDPS(CH_Data_Count).SameCount = GetDPS(CH_Data_Count).SameCount + 1 ReDim Preserve GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) = GetName(1, PowerPin(j)) ReDim Preserve GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) = GetName(2, PowerPin(j)) Else GetDPS(CH_Data_Count).SameCount = GetDPS(CH_Data_Count).SameCount + 1 ReDim Preserve GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) = GetName(1, PowerPin(j)) ReDim Preserve GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) = GetName(2, PowerPin(j)) End If Status = True: PowerPin(j) = "" End If End If Else Exit For End If Next j End If If Status = True Then PowerPin(i) = "" End If Next i Erase PowerPin If GetDPS(CH_Data_Count).SameCount = 0 And GetDPS(CH_Data_Count).DPin(0) = "" And GetDPS(CH_Data_Count).Channel(0) = 0 Then ReDim Preserve GetDPS(CH_Data_Count - 1) End If ....... ....... end Sub Private Function GetName(Mode As Integer, PowerPin As String) As String Dim Temp() As String, Temp1() As String GetName = "" Temp = Split(PowerPin, "=") If Mode = 0 Then If InStr(Temp(0), "_") <> 0 Then Temp1 = Split(Temp(0), "_") If IsNumeric(Temp1(UBound(Temp1))) = True Then For k = 0 To (UBound(Temp1) - 1) GetName = GetName & Temp1(k) & "_" Next k Else For k = 0 To UBound(Temp1) GetName = GetName & Temp1(k) & "_" Next k End If GetName = Mid$(GetName, 1, Len(GetName) - 1) Erase Temp1 Else GetName = Temp(0) End If ElseIf Mode = 1 Then GetName = Trim$(Temp(0)) ElseIf Mode = 2 Then GetName = Trim$(Temp(1)) End If Erase Temp End Function
Private Type CH_Data Channel() As Integer DPin() As String SameCount As Integer End Type Private Type DPS_Data PinChannel() As Integer V_Scale() As enDPS_V_SCALE I_Scale() As enDPS_I_SCALE I_ClampH() As Double I_Clamp_L() As Double Diff As Boolean DPS_Set_Name As String End Type Private Function Section2(FileName As String, NowStatus As String, MachineCat As String, Fab As String, Custom As String, Prod As String, KTPFileName As String, FullPath As String) As String Dim GetDPS() As CH_Data, CH_Data_Count As Integer, CompareDPS() As DPS_Data, DPS_Data_Count() As Integer Dim i As Integer, j As Integer, k As Integer, m As Integer, n As Integer Dim DPSChnnel As Integer, DpsPinName As String, IScale As Double, IClamp As Double, IClampLow As Double Dim TempStr As String, PowerPin() As String, Status As Boolean, DPSChannel As Integer, DPSSetName As String, Result As String Dim No_Diff As Boolean On Error GoTo aa i = 0: j = 0: k = 0: Status = False: TempStr = vbCrLf & vbCrLf & vbCrLf & KTPFileName & vbCrLf ReDim PowerPin(0): CH_Data_Count = 0: ReDim GetDPS(CH_Data_Count) GetDPS(CH_Data_Count).SameCount = 0: No_Diff = False ReDim GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) ReDim GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) With CompareProjectData(0) For i = 0 To .Device.PinNum - 1 If .Device.PinData(i).TYPE = P_POWER Then ReDim Preserve PowerPin(j) PowerPin(j) = .Device.PinData(i).Name & "=" & .Device.PinData(i).DutChannel(0) j = j + 1 End If Next i For i = 0 To UBound(PowerPin) Status = False If i < UBound(PowerPin) Then If GetDPS(CH_Data_Count).SameCount > 0 Then CH_Data_Count = CH_Data_Count + 1 ReDim Preserve GetDPS(CH_Data_Count) GetDPS(CH_Data_Count).SameCount = 0 ReDim GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) ReDim GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) End If For j = i + 1 To UBound(PowerPin) If PowerPin(i) <> "" Then If PowerPin(j) <> "" Then If GetName(0, PowerPin(i)) = GetName(0, PowerPin(j)) Then If GetDPS(CH_Data_Count).DPin(0) = "" Then GetDPS(CH_Data_Count).DPin(0) = GetName(1, PowerPin(i)) GetDPS(CH_Data_Count).Channel(0) = GetName(2, PowerPin(i)) GetDPS(CH_Data_Count).SameCount = GetDPS(CH_Data_Count).SameCount + 1 ReDim Preserve GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) = GetName(1, PowerPin(j)) ReDim Preserve GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) = GetName(2, PowerPin(j)) Else GetDPS(CH_Data_Count).SameCount = GetDPS(CH_Data_Count).SameCount + 1 ReDim Preserve GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).DPin(GetDPS(CH_Data_Count).SameCount) = GetName(1, PowerPin(j)) ReDim Preserve GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) GetDPS(CH_Data_Count).Channel(GetDPS(CH_Data_Count).SameCount) = GetName(2, PowerPin(j)) End If Status = True: PowerPin(j) = "" End If End If Else Exit For End If Next j End If If Status = True Then PowerPin(i) = "" End If Next i Erase PowerPin If GetDPS(CH_Data_Count).SameCount = 0 And GetDPS(CH_Data_Count).DPin(0) = "" And GetDPS(CH_Data_Count).Channel(0) = 0 And CH_Data_Count <> 0 Then ReDim Preserve GetDPS(CH_Data_Count - 1) End If If GetDPS(0).SameCount = 0 And GetDPS(0).DPin(0) = "" And GetDPS(0).Channel(0) = 0 Then Exit Function End If For i = 0 To .DPSNum - 1 ReDim DPS_Data_Count(UBound(GetDPS)): ReDim CompareDPS(0) DPSSetName = .DPS(i).Name For j = 0 To .DPS(i).StepNum - 1 For k = 0 To .DPS(i).DPSStepCtrl(j).ChannelNum - 1 DPSChannel = .DPS(i).DPSStepCtrl(j).ChannelData(k).DPSChannel For m = 0 To UBound(GetDPS) For n = 0 To GetDPS(m).SameCount If GetDPS(m).Channel(n) = DPSChannel Then ReDim Preserve CompareDPS(m) ReDim Preserve CompareDPS(m).PinChannel(DPS_Data_Count(m)) CompareDPS(m).PinChannel(DPS_Data_Count(m)) = DPSChannel ReDim Preserve CompareDPS(m).V_Scale(DPS_Data_Count(m)) CompareDPS(m).V_Scale(DPS_Data_Count(m)) = .DPS(i).DPSStepCtrl(j).ChannelData(k).VScale ReDim Preserve CompareDPS(m).I_Scale(DPS_Data_Count(m)) CompareDPS(m).I_Scale(DPS_Data_Count(m)) = .DPS(i).DPSStepCtrl(j).ChannelData(k).IScale ReDim Preserve CompareDPS(m).I_ClampH(DPS_Data_Count(m)) CompareDPS(m).I_ClampH(DPS_Data_Count(m)) = .DPS(i).DPSStepCtrl(j).ChannelData(k).IClamp ReDim Preserve CompareDPS(m).I_Clamp_L(DPS_Data_Count(m)) CompareDPS(m).I_Clamp_L(DPS_Data_Count(m)) = .DPS(i).DPSStepCtrl(j).ChannelData(k).IClampLow DPS_Data_Count(m) = DPS_Data_Count(m) + 1 CompareDPS(m).Diff = True CompareDPS(m).DPS_Set_Name = DPSSetName End If Next n Next m Next k Next j For j = 0 To UBound(CompareDPS) If CompareDPS(j).Diff = True Then If UBound(CompareDPS(j).PinChannel) > 0 Then For k = 0 To UBound(CompareDPS(j).PinChannel) For m = k + 1 To UBound(CompareDPS(j).PinChannel) If CompareDPS(j).V_Scale(k) <> CompareDPS(j).V_Scale(m) Or _ CompareDPS(j).I_Scale(k) <> CompareDPS(j).I_Scale(m) Or _ CompareDPS(j).I_ClampH(k) <> CompareDPS(j).I_ClampH(m) Or _ CompareDPS(j).I_Clamp_L(k) <> CompareDPS(j).I_Clamp_L(m) Then Result = "" If CompareDPS(j).V_Scale(k) <> CompareDPS(j).V_Scale(m) Then Result = "V_Scale is Different" End If If CompareDPS(j).I_Scale(k) <> CompareDPS(j).I_Scale(m) Then If Result <> "" Then Result = Result & " & I_Scale is Different" Else Result = "I_Scale is Different" End If End If If CompareDPS(j).I_ClampH(k) <> CompareDPS(j).I_ClampH(m) Then If Result <> "" Then Result = Result & " & I_ClampH is Different" Else Result = "I_ClampH is Different" End If End If If CompareDPS(j).I_Clamp_L(k) <> CompareDPS(j).I_Clamp_L(m) Then If Result <> "" Then Result = Result & " & I_Clamp_L is Different" Else Result = "I_Clamp_L is Different" End If End If TempStr = TempStr & _ CompareDPS(j).DPS_Set_Name & "," & _ GetDPSPinName(CompareDPS(j).PinChannel(k)) & "," & _ CompareDPS(j).V_Scale(k) & "," & _ CompareDPS(j).I_Scale(k) & "," & _ CompareDPS(j).I_ClampH(k) & "," & _ CompareDPS(j).I_Clamp_L(k) & ",<>," & _ GetDPSPinName(CompareDPS(j).PinChannel(m)) & "," & _ CompareDPS(j).V_Scale(m) & "," & _ CompareDPS(j).I_Scale(m) & "," & _ CompareDPS(j).I_ClampH(m) & "," & _ CompareDPS(j).I_Clamp_L(m) & "," & _ Result & "," & FullPath & vbCrLf & vbCrLf No_Diff = True ' Debug.Print TempStr End If Next m Next k End If End If Next j Next i End With If No_Diff = False Then TempStr = "" Else Call WriteInfo(TempStr) End If Exit Function aa: Resume Next End Function Private Function GetName(Mode As Integer, PowerPin As String) As String Dim temp() As String, Temp1() As String GetName = "" temp = Split(PowerPin, "=") If Mode = 0 Then If InStr(temp(0), "_") <> 0 Then Temp1 = Split(temp(0), "_") If IsNumeric(Temp1(UBound(Temp1))) = True Then For k = 0 To (UBound(Temp1) - 1) GetName = GetName & Temp1(k) & "_" Next k Else For k = 0 To UBound(Temp1) GetName = GetName & Temp1(k) & "_" Next k End If GetName = Mid$(GetName, 1, Len(GetName) - 1) Erase Temp1 Else GetName = temp(0) End If ElseIf Mode = 1 Then GetName = Trim$(temp(0)) ElseIf Mode = 2 Then GetName = Trim$(temp(1)) End If Erase temp End Function Private Sub WriteInfo(temp As String) Open "C:\DPS_Compare.csv" For Append As #1 Print #1, temp Close #1 End Sub