第一次提交至Git
This commit is contained in:
217
SQLliteReading/AUTS_Package/ZQ/Phobos/T1-PCBA_Test/MainTest.vb
Normal file
217
SQLliteReading/AUTS_Package/ZQ/Phobos/T1-PCBA_Test/MainTest.vb
Normal file
@@ -0,0 +1,217 @@
|
||||
Public Class MainTest
|
||||
|
||||
Enum ColNames
|
||||
No
|
||||
Content
|
||||
DataSource
|
||||
SendData
|
||||
PassResult
|
||||
RetryCount
|
||||
RetryInterval
|
||||
ReadInterval
|
||||
OperatingMode
|
||||
Lower
|
||||
Upper
|
||||
TestVal
|
||||
TestResult
|
||||
IsRecord
|
||||
RecordName
|
||||
Max
|
||||
End Enum
|
||||
|
||||
Public theGrid As FlexCell.Grid
|
||||
|
||||
Public Serial As IO.Ports.SerialPort
|
||||
Public Userkeyval_ComboBox As ComboBox
|
||||
Public Userkeyval_Rictext As RichTextBox
|
||||
Public Label2 As Label
|
||||
|
||||
|
||||
Public split_Curr_1 As String
|
||||
Public split_Curr_2 As String
|
||||
Public split_Curr_3 As String
|
||||
Public split_Curr_4 As String
|
||||
Public split_Curr_Peak_1 As String
|
||||
Public split_Curr_Peak_2 As String
|
||||
Public split_Curr_peak_3 As String
|
||||
Public split_Curr_peak_4 As String
|
||||
Public split_Temp As String
|
||||
Public split_HumidityAs As String
|
||||
|
||||
|
||||
|
||||
|
||||
Sub New(grd As FlexCell.Grid)
|
||||
theGrid = grd
|
||||
UpdateStepTestRecord()
|
||||
DefaultData()
|
||||
End Sub
|
||||
#Region "初始化表格"
|
||||
Public Sub UpdateStepTestRecord()
|
||||
With theGrid
|
||||
.AutoRedraw = False
|
||||
'.AutoSize = True
|
||||
.Cols = ColNames.Max
|
||||
.Rows = 1
|
||||
.ExtendLastCol = True '最后一列自动扩充
|
||||
.DisplayRowNumber = True '首列显示数字
|
||||
|
||||
For col As Integer = 0 To ColNames.Max - 1
|
||||
.Cell(0, col).Text = [Enum].GetName(GetType(ColNames), col) '设置列名
|
||||
.Column(col).CellType = FlexCell.CellTypeEnum.TextBox '设置列型
|
||||
|
||||
.Column(col).Width = 140 '设置列宽
|
||||
|
||||
.Column(col).Alignment = FlexCell.AlignmentEnum.CenterCenter '设置对齐位置
|
||||
Next
|
||||
.ForeColorComment = Color.Blue
|
||||
|
||||
|
||||
.BackColorBkg = Color.DimGray
|
||||
.AutoRedraw = True
|
||||
.Refresh()
|
||||
.Locked = True
|
||||
End With
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
#Region "加載表格數據"
|
||||
Public Sub DefaultData()
|
||||
|
||||
Dim SendDatalist As New List(Of List(Of String))
|
||||
UartSendDataList(SendDatalist, "确认测试板连接", "uts", "*IDN?", "uts-Phobos-rev01", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
UartSendDataList(SendDatalist, "设置输出限流", "uts", "SET_PPS_CURR:400", "SET_PPS_CURR:400:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
UartSendDataList(SendDatalist, "设置输出电压", "uts", "SET_PPS_VOLT:2000", "SET_PPS_VOLT:2000:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
UartSendDataList(SendDatalist, "打开输出电压", "uts", "SET_PPS_OUTP:ON", "SET_PPS_OUTP:ON:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
UartSendDataList(SendDatalist, "清除峰值电流 - ch1", "uts", "CLR_PPS_CURR_PEAK:1", "CLR_PPS_CURR_PEAK:1:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
UartSendDataList(SendDatalist, "清除峰值电流 - ch2", "uts", "CLR_PPS_CURR_PEAK:2", "CLR_PPS_CURR_PEAK:2:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
UartSendDataList(SendDatalist, "清除峰值电流 - ch3", "uts", "CLR_PPS_CURR_PEAK:3", "CLR_PPS_CURR_PEAK:3:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
UartSendDataList(SendDatalist, "清除峰值电流 - ch4", "uts", "CLR_PPS_CURR_PEAK:4", "CLR_PPS_CURR_PEAK:4:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
|
||||
UartSendDataList(SendDatalist, "读取平均电流(轮询直到勾选的属性测试结束)", "uts", "RUN", "10", "max", "100", "300", "split", "", "", "", "", "", "")
|
||||
|
||||
UartSendDataList(SendDatalist, "发送关闭电源命令", "uts", "SET_PPS_OUTP:OFF", "SET_PPS_OUTP:OFF:TRUE", "3", "100", "300", "comparison", "", "", "", "", "", "")
|
||||
|
||||
Grid5AddRow(SendDatalist)
|
||||
|
||||
End Sub
|
||||
|
||||
Public Function UartSendDataList(ByRef SendDatalist As List(Of List(Of String)), ParamArray ptr() As String) As List(Of String)
|
||||
|
||||
Dim Datalist As New List(Of String)
|
||||
Datalist.AddRange(ptr)
|
||||
SendDatalist.Add(Datalist)
|
||||
|
||||
End Function
|
||||
|
||||
Public Sub Grid5AddRow(SendDatalist As List(Of List(Of String)))
|
||||
If SendDatalist.Count < 1 Then Return
|
||||
|
||||
For rowindex As Integer = 0 To SendDatalist.Count - 1
|
||||
|
||||
Dim Datalist As List(Of String) = SendDatalist.Item(rowindex)
|
||||
|
||||
|
||||
AddRowToTable(theGrid, Datalist)
|
||||
Next
|
||||
|
||||
End Sub
|
||||
Public Sub AddRowToTable(tablegrid As FlexCell.Grid, Datalist As List(Of String))
|
||||
tablegrid.AddItem("")
|
||||
For colid As Integer = 1 To ColNames.Max - 1
|
||||
tablegrid.Cell(tablegrid.Rows - 1, colid).Text = Datalist.Item(colid - 1)
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "读数据并解析"
|
||||
|
||||
Public Function ParsingRowRead(rowid As Integer, readStr As String) As Boolean
|
||||
If rowid = 0 OrElse Not rowid < theGrid.Rows Then Return False
|
||||
SettheGridt(theGrid, rowid, ColNames.TestVal, readStr)
|
||||
If theGrid.Cell(rowid, ColNames.OperatingMode).Text.ToLower.Contains("comparison") Then
|
||||
If theGrid.Cell(rowid, ColNames.PassResult).Text.Trim.ToLower.Equals(readStr.ToLower) Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
ElseIf theGrid.Cell(rowid, ColNames.OperatingMode).Text.ToLower.Contains("split") Then
|
||||
split_Curr_1 = ""
|
||||
split_Curr_2 = ""
|
||||
split_Curr_3 = ""
|
||||
split_Curr_4 = ""
|
||||
split_Curr_Peak_1 = ""
|
||||
split_Curr_Peak_2 = ""
|
||||
split_Curr_peak_3 = ""
|
||||
split_Curr_peak_4 = ""
|
||||
split_Temp = ""
|
||||
split_HumidityAs = ""
|
||||
Dim splitbuff() As String = readStr.Split(CType(",", Char))
|
||||
If splitbuff.Length = CType(theGrid.Cell(rowid, ColNames.PassResult).Text, Integer) Then
|
||||
split_Curr_1 = splitbuff(0)
|
||||
split_Curr_2 = splitbuff(1)
|
||||
split_Curr_3 = splitbuff(2)
|
||||
split_Curr_4 = splitbuff(3)
|
||||
split_Curr_Peak_1 = splitbuff(4)
|
||||
split_Curr_Peak_2 = splitbuff(5)
|
||||
split_Curr_peak_3 = splitbuff(6)
|
||||
split_Curr_peak_4 = splitbuff(7)
|
||||
split_Temp = splitbuff(8)
|
||||
split_HumidityAs = splitbuff(9)
|
||||
Return True
|
||||
End If
|
||||
|
||||
Return False
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
End Function
|
||||
Delegate Sub IPSetUILabeltext(tablegrid As FlexCell.Grid, trowel As Integer, tcol As Integer, txt As String)
|
||||
Public Sub SettheGridt(tablegrid As FlexCell.Grid, trowel As Integer, tcol As Integer, txt As String)
|
||||
If tablegrid.InvokeRequired Then
|
||||
tablegrid.Invoke(New IPSetUILabeltext(AddressOf SettheGridt), New Object() {tablegrid, trowel, tcol, txt})
|
||||
Else
|
||||
tablegrid.Cell(trowel, tcol).Text = txt
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Public Function GetUtsData(attri As String) As String
|
||||
If attri.ToLower.Equals("tempre") Then
|
||||
Return split_Temp
|
||||
ElseIf attri.ToLower.Equals("humiture") Then
|
||||
Return split_HumidityAs
|
||||
ElseIf attri.ToLower.Equals("run") Then
|
||||
Dim result As String = split_Curr_1 & "," & split_Curr_2 &
|
||||
"," & split_Curr_3 & "," & split_Curr_4
|
||||
|
||||
|
||||
Return result
|
||||
ElseIf attri.ToLower.Equals("current") Then
|
||||
Dim result As String = split_Curr_Peak_1 & "," & split_Curr_Peak_2 &
|
||||
"," & split_Curr_peak_3 & "," & split_Curr_peak_4
|
||||
Return result
|
||||
End If
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user