第一次提交至Git

This commit is contained in:
2024-03-11 16:32:52 +08:00
commit 3f6c4d62b9
2865 changed files with 2172317 additions and 0 deletions

61
AUTS_AOI/CheckRecorder.vb Normal file
View File

@@ -0,0 +1,61 @@
Imports UTS_Core.Database
Imports UTS_Core.UTSModule
Imports UTS_Core.UTSModule.DbTableModel.Customer
Public Class CheckRecorder
Private ReadOnly _failTipDictionary As Dictionary(Of String, Integer)
Sub New()
_failTipDictionary = New Dictionary(Of String, Integer)()
End Sub
Public Property TestLogTableName As String
Public Sub Commit(failTip As String)
If _failTipDictionary.ContainsKey(failTip) Then
_failTipDictionary(failTip) += 1
Else
_failTipDictionary.Add(failTip, 1)
End If
End Sub
''' <summary>
''' 获取当前倒叙排序的结果信息
''' </summary>
''' <returns></returns>
Public Function UpdateFailStrings() As String()
Dim result As New List(Of String)
'排序
For Each valuePair As KeyValuePair(Of String, Integer) In _failTipDictionary.OrderByDescending(Function(x) x.Value)
result.Add(valuePair.Key)
Next
Return result.ToArray()
End Function
Public Sub ReloadFailString()
If String.IsNullOrWhiteSpace(TestLogTableName) Then Return
'以本地库为准
Using db As New DbExecutor(UtsDb.LocalDbType, UtsDb.LocalConnString)
db.Open()
Dim cmdText As String
'统计日志表分组信息
cmdText = $"select `{TestLogTable.ColNamesEnum.QA_CheckResult}`,count(*) as count from `{TestLogTableName}` where `TestResult` = '0' group by `{TestLogTable.ColNamesEnum.QA_CheckResult}` order by count"
Dim dtTable As DataTable = db.ExecuteDataTable(cmdText)
For Each row As DataRow In dtTable.Rows
_failTipDictionary.Add(row($"{TestLogTable.ColNamesEnum.QA_CheckResult}").ToString(), CInt(row("count")))
Next
db.Close()
End Using
End Sub
End Class