diff --git a/AUTS_DataService/Service1.vb b/AUTS_DataService/Service1.vb
index a5ce65b..1bd9339 100644
--- a/AUTS_DataService/Service1.vb
+++ b/AUTS_DataService/Service1.vb
@@ -1439,8 +1439,6 @@ Public Class Service1
_license = New License(licensePath)
_license.CheckLicense()
- UTS_Core.DebugLog.ApplicationLog.WriteInfoLog($"License Info:{JsonConvert.SerializeObject(_license, Formatting.Indented)}.")
-
UTS_Core.DebugLog.ApplicationLog.WriteInfoLog($"CheckLicense Success.")
Catch ex As Exception
UTS_Core.DebugLog.ApplicationLog.WriteErrorLog($"CheckLicense Error:{ex.Message}.")
@@ -1460,8 +1458,6 @@ Public Class Service1
Dim packet() As Byte = _webPacker.FillPacket(CByte(UtsWebPacket.Commands.UploadTaskStatus), param.ToArray)
SendDataToWeb(_webUdpClient.Client, _webRemoteIP, packet)
-
- ServiceLog.WriteDebugLog($"UploadAddTask :{JsonConvert.SerializeObject(task)}")
End Sub
'''
diff --git a/AUTS_DataService/ServiceTask/DbSynchronizer.vb b/AUTS_DataService/ServiceTask/DbSynchronizer.vb
index 7b54b55..49e22df 100644
--- a/AUTS_DataService/ServiceTask/DbSynchronizer.vb
+++ b/AUTS_DataService/ServiceTask/DbSynchronizer.vb
@@ -61,8 +61,6 @@ Public Class DbSynchronizer
''' 同步数据库,开始同步
'''
Public Sub SyncDatabase()
- ServiceLog.WriteDebugLog($"RemoteConnString:{Parameters.RemoteConnString} LocalConnString:{Parameters.LocalConnString}")
-
Using remoteDb As New DbExecutor(Parameters.RemoteType, Parameters.RemoteConnString)
remoteDb.Open()
diff --git a/AUTS_Win/bin/Debug/AUTS_Win.exe b/AUTS_Win/bin/Debug/AUTS_Win.exe
index 3858cf1..a4fddb9 100644
Binary files a/AUTS_Win/bin/Debug/AUTS_Win.exe and b/AUTS_Win/bin/Debug/AUTS_Win.exe differ
diff --git a/AUTS_Win/bin/Debug/AUTS_Win.pdb b/AUTS_Win/bin/Debug/AUTS_Win.pdb
index fd4e33d..fe01cf3 100644
Binary files a/AUTS_Win/bin/Debug/AUTS_Win.pdb and b/AUTS_Win/bin/Debug/AUTS_Win.pdb differ
diff --git a/AUTS_Win/bin/Debug/UTS_Core.dll b/AUTS_Win/bin/Debug/UTS_Core.dll
index bd9ec5d..fbb2880 100644
Binary files a/AUTS_Win/bin/Debug/UTS_Core.dll and b/AUTS_Win/bin/Debug/UTS_Core.dll differ
diff --git a/AUTS_Win/bin/Debug/UTS_Core.pdb b/AUTS_Win/bin/Debug/UTS_Core.pdb
index ac7d2d0..46955da 100644
Binary files a/AUTS_Win/bin/Debug/UTS_Core.pdb and b/AUTS_Win/bin/Debug/UTS_Core.pdb differ
diff --git a/AUTS_Win/obj/Debug/AUTS_Win.exe b/AUTS_Win/obj/Debug/AUTS_Win.exe
index 3858cf1..a4fddb9 100644
Binary files a/AUTS_Win/obj/Debug/AUTS_Win.exe and b/AUTS_Win/obj/Debug/AUTS_Win.exe differ
diff --git a/AUTS_Win/obj/Debug/AUTS_Win.pdb b/AUTS_Win/obj/Debug/AUTS_Win.pdb
index fd4e33d..fe01cf3 100644
Binary files a/AUTS_Win/obj/Debug/AUTS_Win.pdb and b/AUTS_Win/obj/Debug/AUTS_Win.pdb differ
diff --git a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.AssemblyReference.cache b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.AssemblyReference.cache
index e58674b..6a63128 100644
Binary files a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.AssemblyReference.cache and b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.AssemblyReference.cache differ
diff --git a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.CoreCompileInputs.cache b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.CoreCompileInputs.cache
index b62e9bf..7fa10d5 100644
--- a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.CoreCompileInputs.cache
+++ b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.CoreCompileInputs.cache
@@ -1 +1 @@
-c3886199ae22c3f880bce6f672a51ae51def76056da39af819cd26fad1c0b813
+f016d1be56f6fedc61741e9fdbb1f0d49638d13457a53b051aea0362c5491bcc
diff --git a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.FileListAbsolute.txt b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.FileListAbsolute.txt
index d3b9556..2d64232 100644
--- a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.FileListAbsolute.txt
+++ b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.FileListAbsolute.txt
@@ -249,3 +249,4 @@ C:\Project\AUTS_Win\bin\Debug\System.Threading.Tasks.Extensions.xml
C:\Project\AUTS_Win\bin\Debug\K4os.Compression.LZ4.xml
C:\Project\AUTS_Win\bin\Debug\K4os.Hash.xxHash.xml
C:\Project\AUTS_Win\obj\Debug\AUTS_Win.exe.config
+G:\Git\AUTS\AUTS_Win\obj\Debug\AUTS_Win.exe.config
diff --git a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.GenerateResource.cache b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.GenerateResource.cache
index 22540aa..8e2d30b 100644
Binary files a/AUTS_Win/obj/Debug/AUTS_Win.vbproj.GenerateResource.cache and b/AUTS_Win/obj/Debug/AUTS_Win.vbproj.GenerateResource.cache differ
diff --git a/UTS_Core/UTSModule/DbConnect/DbConnector.vb b/UTS_Core/UTSModule/DbConnect/DbConnector.vb
index 13dff08..0083b60 100644
--- a/UTS_Core/UTSModule/DbConnect/DbConnector.vb
+++ b/UTS_Core/UTSModule/DbConnect/DbConnector.vb
@@ -805,34 +805,34 @@ Namespace UTSModule.DbConnect
'''
'''
Public Shared Sub UpdateSnListTableToLocal(db As DbExecutor, dbName As String, filedNames As List(Of String), filedValues As List(Of String), Optional saveCache As Boolean = True)
- Dim timeString As String = $"{result.StartTime:yyyy-MM-dd HH:mm:ss}"
- Dim logResult As Integer = CInt(IIf(result.TestResult = TestResult.TestResultEnum.Pass, 1, 0))
- Dim a1String As String = ""
+ 'Dim timeString As String = $"{result.StartTime:yyyy-MM-dd HH:mm:ss}"
+ 'Dim logResult As Integer = CInt(IIf(result.TestResult = TestResult.TestResultEnum.Pass, 1, 0))
+ 'Dim a1String As String = ""
- Dim localDbName As String = UtsFilterDbName(db.DatabaseType, dbName) '过滤库名
- Dim updateString As String = $"`S{Station.SnListOrder}` = '{timeString}',`Result{Station.SnListOrder}` = {logResult}"
- Dim MoId As String = "-1"
- 'A类型站额外更新组装字段
- If Station.StationType = ProcessStation.StationTypeEnum.Assem Then
- 'a1String = result.CustomRecord("AssemblySn")
- updateString &= $",`{SnListTable.ColNames.AssemblySn}` = '{a1String}',`{SnListTable.ColNames.AssemblyTime}` = '{timeString}'"
- End If
+ 'Dim localDbName As String = UtsFilterDbName(db.DatabaseType, dbName) '过滤库名
+ 'Dim updateString As String = $"`S{Station.SnListOrder}` = '{timeString}',`Result{Station.SnListOrder}` = {logResult}"
+ 'Dim MoId As String = "-1"
+ ''A类型站额外更新组装字段
+ 'If Station.StationType = ProcessStation.StationTypeEnum.Assem Then
+ ' 'a1String = result.CustomRecord("AssemblySn")
+ ' updateString &= $",`{SnListTable.ColNames.AssemblySn}` = '{a1String}',`{SnListTable.ColNames.AssemblyTime}` = '{timeString}'"
+ 'End If
- Dim condition As String = $"`{SnListTable.ColNames.ProductID}` = '{Station.ParentProject.Index}' and `{SnListTable.ColNames.BarCode}` = '{result.DUT_SN}'"
- Dim cmdText As String = db.CmdHelper.DbUpdate(localDbName, SnListTable.TableName, updateString, condition)
- db.ExecuteNonQuery(cmdText)
+ 'Dim condition As String = $"`{SnListTable.ColNames.ProductID}` = '{Station.ParentProject.Index}' and `{SnListTable.ColNames.BarCode}` = '{result.DUT_SN}'"
+ 'Dim cmdText As String = db.CmdHelper.DbUpdate(localDbName, SnListTable.TableName, updateString, condition)
+ 'db.ExecuteNonQuery(cmdText)
- If saveCache Then
- cmdText = $"Call `{UtsDb.RemotePrivateDb}`.`UpdateSnListBarcode`('{result.DUT_SN}',{Station.SnListOrder},'{timeString}',{logResult},'{a1String}');"
- 'CZH 2023 06 07 增加SN_list MoId
- If result.CustomRecord.ContainsKey("OrderID") Then
- MoId = result.CustomRecord("OrderID")
- cmdText = $"Call `{dbName}`.`UpdateSnListBarcode_MO`('{result.DUT_SN}',{Station.SnListOrder},'{timeString}',{logResult},'{a1String}',{MoId});"
- End If
- ''''''''''''''''''
+ 'If saveCache Then
+ ' cmdText = $"Call `{UtsDb.RemotePrivateDb}`.`UpdateSnListBarcode`('{result.DUT_SN}',{Station.SnListOrder},'{timeString}',{logResult},'{a1String}');"
+ ' 'CZH 2023 06 07 增加SN_list MoId
+ ' If result.CustomRecord.ContainsKey("OrderID") Then
+ ' MoId = result.CustomRecord("OrderID")
+ ' cmdText = $"Call `{dbName}`.`UpdateSnListBarcode_MO`('{result.DUT_SN}',{Station.SnListOrder},'{timeString}',{logResult},'{a1String}',{MoId});"
+ ' End If
+ ' ''''''''''''''''''
- SaveCmdStringToCacheTable(db, cmdText)
- End If
+ ' SaveCmdStringToCacheTable(db, cmdText)
+ 'End If
End Sub
diff --git a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/CombindRecordCommand.vb b/UTS_Core/UTSModule/Test/Command/DatabaseCommand/CombindRecordCommand.vb
deleted file mode 100644
index feb1f3e..0000000
--- a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/CombindRecordCommand.vb
+++ /dev/null
@@ -1,84 +0,0 @@
-Imports UTS_Core.Database
-Imports UTS_Core.UTSModule
-Imports UTS_Core.UTSModule.DbConnect
-Imports UTS_Core.UTSModule.DbTableModel.Customer
-Imports UTS_Core.UTSModule.Test.Command
-
-Public Class CombindRecordCommand
- Inherits TestCommandExecutor
-
- Private _filedNames As New List(Of String)
- Private _dutSn As String
- Private _dutSn2 As String
-
- Sub New(command As TestCommand)
- MyBase.New(command)
-
- _dutSn = command.Parameter(0)
- _dutSn2 = command.Parameter(1)
-
- _filedNames.Add(command.Parameter(0))
- End Sub
-
- Public Overrides Function Execute() As TestCommandReturn
- CommandReturn.ExecuteResult = True
- CommandReturn.RecordValue = "True"
-
- Dim filedName As String = _filedNames(0)
- Dim updateString As String = $"t1.`{filedName}` = t2.`{filedName}`"
- For i As Integer = 1 To _filedNames.Count - 1
- updateString += $",t1.`{filedName}` = t2.`{filedName}` "
- Next
-
-
- Dim saveDbCmdText As String = String.Empty
- Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
- Dim cmdText As String = $"UPDATE `{UtsDb.RemotePrivateDb}`.`{SnListTable.TableName}` t1 JOIN `{UtsDb.RemotePrivateDb}`.`{SnListTable.TableName}` t2 ON t2.`{SnListTable.ColNames.BarCode}` = '{_dutSn2}' SET {updateString} WHERE t1.`{SnListTable.ColNames.BarCode}` = '{_dutSn}';"
-
- Try
- db.Open()
- db.ExecuteNonQuery(cmdText)
- db.Close()
- Catch ex As Exception
- saveDbCmdText = cmdText '云端执行,使用本地执行
- End Try
- End Using
-
- '本地存储
- Using db As New DbExecutor(UtsDb.LocalDbType, UtsDb.LocalConnString)
- Try
- db.Open()
- Catch ex As Exception
- CommandReturn.ExecuteResult = False
- CommandReturn.RecordValue = "False"
- CommandReturn.ExecuteResultTipString = $"本地数据库连接失败,{ex.Message}"
- End Try
-
- Try
- Dim cmdText As String = $"UPDATE `{SnListTable.TableName}` t1 JOIN `{UtsDb.RemotePrivateDb}`.`{SnListTable.TableName}` t2 ON t2.`{SnListTable.ColNames.BarCode}` = '{_dutSn2}' SET {updateString} WHERE t1.`{SnListTable.ColNames.BarCode}` = '{_dutSn}';"
- db.ExecuteNonQuery(cmdText)
- Catch ex As Exception
- CommandReturn.ExecuteResult = False
- CommandReturn.RecordValue = "False"
- CommandReturn.ExecuteResultTipString = $"本地数据库保存失败,{ex.Message}"
- End Try
-
-
- '本地缓存
- Try
- If String.IsNullOrEmpty(saveDbCmdText) Then
- DbConnector.SaveCmdStringToCacheTable(db, saveDbCmdText)
- CommandReturn.ExecuteResultTipString = "本地缓存成功"
- End If
- Catch ex As Exception
- CommandReturn.ExecuteResult = False
- CommandReturn.RecordValue = "False"
- CommandReturn.ExecuteResultTipString = $"本地数据库缓存失败,{ex.Message}"
- End Try
-
-
- db.Close()
- End Using
-
- End Function
-End Class
diff --git a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/DatabaseCommandManager.vb b/UTS_Core/UTSModule/Test/Command/DatabaseCommand/DatabaseCommandManager.vb
deleted file mode 100644
index 173fa18..0000000
--- a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/DatabaseCommandManager.vb
+++ /dev/null
@@ -1,18 +0,0 @@
-Namespace UTSModule.Test.Command.DatabaseCommand
- Public Class DatabaseCommandManager
- Public Shared Function CreateExecutor(command As TestCommand) As TestCommandExecutor
- Dim executor As TestCommandExecutor
- Select Case command.Name
- Case "GetRecord"
- Return New GetRecordCommand(command)
- Case "SetRecord"
- Return New SetRecordCommand(command)
- Case "CombindRecord"
- Return New CombindRecordCommand(command)
- Case Else
- Throw New Exception($"Database集,未知命令 :{command.Name}")
- End Select
- Return executor
- End Function
- End Class
-End Namespace
diff --git a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/GetRecordCommand.vb b/UTS_Core/UTSModule/Test/Command/DatabaseCommand/GetRecordCommand.vb
deleted file mode 100644
index 96fcc9f..0000000
--- a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/GetRecordCommand.vb
+++ /dev/null
@@ -1,70 +0,0 @@
-Imports UTS_Core.Database
-Imports UTS_Core.UTSModule
-Imports UTS_Core.UTSModule.DbConnect
-Imports UTS_Core.UTSModule.DbTableModel.Customer
-Imports UTS_Core.UTSModule.Test.Command
-
-Public Class GetRecordCommand
- Inherits TestCommandExecutor
-
- Private _filedName As String
- Private _dutSn As String
-
- Sub New(command As TestCommand)
- MyBase.New(command)
-
- _dutSn = command.Parameter(0)
- _filedName = command.Parameter(1)
- End Sub
-
- Public Overrides Function Execute() As TestCommandReturn
- '优先查询云端
- Dim useLocalSearch As Boolean = False
- Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
- Dim condition As String = $"`{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
- Dim cmdText As String = db.CmdHelper.DbSearch(UtsDb.RemotePrivateDb, _filedName, SnListTable.TableName, condition)
-
- Try
- db.Open()
- CommandReturn.RecordValue = db.ExecuteScalar(cmdText).ToString()
- CommandReturn.ExecuteResult = True
- db.Close()
- Catch ex As Exception
- useLocalSearch = True '云端查询失败,使用本地查询
- End Try
- End Using
-
-
- '本地存储
- If useLocalSearch Then
- Using db As New DbExecutor(UtsDb.LocalDbType, UtsDb.LocalConnString)
- Try
- db.Open()
- Catch ex As Exception
- CommandReturn.ExecuteResult = False
- CommandReturn.RecordValue = ""
- CommandReturn.ExecuteResultTipString = $"本地数据库连接失败,{ex.Message}"
- End Try
-
- Try
- ' Dim condition As String = $"`{SnListTable.ColNames.ProductID}` = '{Station.ParentProject.Index}' and `{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
- Dim condition As String = $"`{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
- Dim cmdText As String = db.CmdHelper.Search(_filedName, SnListTable.TableName, condition)
- CommandReturn.RecordValue = db.ExecuteScalar(cmdText).ToString()
- CommandReturn.ExecuteResult = True
- CommandReturn.ExecuteResultTipString = $"本地数据库查询成功"
- Catch ex As Exception
- CommandReturn.ExecuteResult = False
- CommandReturn.RecordValue = ""
- CommandReturn.ExecuteResultTipString = $"本地数据库查询失败,{ex.Message}"
- End Try
-
- db.Close()
- End Using
- End If
-
- Return CommandReturn
-
-
- End Function
-End Class
diff --git a/UTS_Core/UTSModule/Test/Command/SystemCommand/CombindRecordCommand.vb b/UTS_Core/UTSModule/Test/Command/SystemCommand/CombindRecordCommand.vb
new file mode 100644
index 0000000..b3831f5
--- /dev/null
+++ b/UTS_Core/UTSModule/Test/Command/SystemCommand/CombindRecordCommand.vb
@@ -0,0 +1,97 @@
+Imports UTS_Core.Database
+Imports UTS_Core.UTSModule
+Imports UTS_Core.UTSModule.DbConnect
+Imports UTS_Core.UTSModule.DbTableModel.Customer
+Imports UTS_Core.UTSModule.Test.Command
+Imports System.Linq
+
+Public Class CombindRecordCommand
+ Inherits TestCommandExecutor
+
+ Private _filedNames As New List(Of String)
+ Private _dutSn As String
+ Private _dutSn2 As String
+
+ Sub New(command As TestCommand)
+ MyBase.New(command)
+ '合并逻辑:将源SN指定字段的值复制到目标SN,如果目标SN已经有值,则进行覆盖操作
+ '如果合并字段名为 S1~S12,则对应的Result1~Result12 也进行合并,即Sx与Resultx配对进行操作
+ '覆盖方向:源SN -》 目标SN’
+ _dutSn = command.Parameter(0) '目标SN’
+ _dutSn2 = command.Parameter(1) '源SN’
+
+ '_filedNames.Add(command.Parameter(2)) '字段名,多个字段名之间用“:”分割,大小写不敏感,去掉前后空格
+
+ 'Dim upperArr = arr.Select(Function(x) x.ToUpper()).ToArray()
+ ' upperArr = {"A", "B", "C"}
+
+ _filedNames.AddRange(command.Parameter(2).Split(":"c).Select(Function(x) x.Trim()))
+ End Sub
+
+ Public Overrides Function Execute() As TestCommandReturn
+ CommandReturn.ExecuteResult = True
+ CommandReturn.RecordValue = "True"
+
+ Dim filedName As String = _filedNames(0)
+ Dim updateString As String = $"t1.`{filedName}` = t2.`{filedName}`"
+ For i As Integer = 1 To _filedNames.Count - 1
+ filedName = _filedNames(i)
+ updateString += $",t1.`{filedName}` = t2.`{filedName}` "
+ Next
+
+
+ Dim saveDbCmdText As String = String.Empty
+ Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
+ Dim cmdText As String = $"UPDATE `{UtsDb.RemotePrivateDb}`.`{SnListTable.TableName}` t1 JOIN `{UtsDb.RemotePrivateDb}`.`{SnListTable.TableName}` t2 On t2.`{SnListTable.ColNames.BarCode}` = '{_dutSn2}' SET {updateString} WHERE t1.`{SnListTable.ColNames.BarCode}` = '{_dutSn}';"
+
+ Try
+ db.Open()
+ db.ExecuteNonQuery(cmdText)
+ db.Close()
+ Catch ex As Exception
+
+ CommandReturn.ExecuteResult = False
+ CommandReturn.RecordValue = "False"
+ CommandReturn.ExecuteResultTipString = $"数据库更新失败,{ex.Message}"
+ End Try
+ End Using
+
+ ''本地存储
+ 'Using db As New DbExecutor(UtsDb.LocalDbType, UtsDb.LocalConnString)
+ ' Try
+ ' db.Open()
+ ' Catch ex As Exception
+ ' CommandReturn.ExecuteResult = False
+ ' CommandReturn.RecordValue = "False"
+ ' CommandReturn.ExecuteResultTipString = $"本地数据库连接失败,{ex.Message}"
+ ' End Try
+
+ ' Try
+ ' Dim cmdText As String = $"UPDATE `{SnListTable.TableName}` t1 JOIN `{UtsDb.RemotePrivateDb}`.`{SnListTable.TableName}` t2 ON t2.`{SnListTable.ColNames.BarCode}` = '{_dutSn2}' SET {updateString} WHERE t1.`{SnListTable.ColNames.BarCode}` = '{_dutSn}';"
+ ' db.ExecuteNonQuery(cmdText)
+ ' Catch ex As Exception
+ ' CommandReturn.ExecuteResult = False
+ ' CommandReturn.RecordValue = "False"
+ ' CommandReturn.ExecuteResultTipString = $"本地数据库保存失败,{ex.Message}"
+ ' End Try
+
+
+ ' '本地缓存
+ ' Try
+ ' If Not String.IsNullOrEmpty(saveDbCmdText) Then
+ ' DbConnector.SaveCmdStringToCacheTable(db, saveDbCmdText)
+ ' CommandReturn.ExecuteResultTipString = "本地缓存成功"
+ ' End If
+ ' Catch ex As Exception
+ ' CommandReturn.ExecuteResult = False
+ ' CommandReturn.RecordValue = "False"
+ ' CommandReturn.ExecuteResultTipString = $"本地数据库缓存失败,{ex.Message}"
+ ' End Try
+
+
+ ' db.Close()
+ 'End Using
+
+ Return CommandReturn
+ End Function
+End Class
diff --git a/UTS_Core/UTSModule/Test/Command/SystemCommand/GetRecordCommand.vb b/UTS_Core/UTSModule/Test/Command/SystemCommand/GetRecordCommand.vb
new file mode 100644
index 0000000..594cdad
--- /dev/null
+++ b/UTS_Core/UTSModule/Test/Command/SystemCommand/GetRecordCommand.vb
@@ -0,0 +1,145 @@
+Imports UTS_Core.Database
+Imports UTS_Core.UTSModule
+Imports UTS_Core.UTSModule.DbTableModel.Customer
+Imports UTS_Core.UTSModule.Test.Command
+
+Public Class GetRecordCommand
+ Inherits TestCommandExecutor
+
+ Private _filedName As String
+ Private _dutSn As String
+ Private _mode As String
+
+ Private _LowerLimit As String = ""
+ Private _UpperLimit As String = ""
+ Private _stringLen_LowwerLimit As String = ""
+ Private _stringLen_UpperLimit As String = ""
+ Private _Char_VerfiyMode As String = ""
+
+ Sub New(command As TestCommand)
+ MyBase.New(command)
+
+ _dutSn = command.Parameter(0)
+ _filedName = command.Parameter(1)
+ _mode = command.Parameter(2) 'Local:只查询本地 Remote:只查询云端 Both:查询本地和云端(云端优先)
+
+
+ End Sub
+
+ Private Sub GetByLocal()
+ Using db As New DbExecutor(UtsDb.LocalDbType, UtsDb.LocalConnString)
+ Try
+ db.Open()
+ Catch ex As Exception
+ CommandReturn.ExecuteResult = False
+ CommandReturn.RecordValue = ""
+ CommandReturn.ExecuteResultTipString = $"本地数据库连接失败,{ex.Message}"
+ End Try
+
+ Try
+ ' Dim condition As String = $"`{SnListTable.ColNames.ProductID}` = '{Station.ParentProject.Index}' and `{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
+ Dim condition As String = $"`{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
+ Dim cmdText As String = db.CmdHelper.Search(_filedName, SnListTable.TableName, condition)
+ CommandReturn.RecordValue = db.ExecuteScalar(cmdText).ToString()
+ CommandReturn.ExecuteResult = True
+ CommandReturn.ExecuteResultTipString = $"本地数据库查询成功"
+ Catch ex As Exception
+ CommandReturn.ExecuteResult = False
+ CommandReturn.RecordValue = ""
+ CommandReturn.ExecuteResultTipString = $"本地数据库查询失败,{ex.Message}"
+ End Try
+
+ db.Close()
+ End Using
+
+ End Sub
+
+
+ Private Function GetByRemote() As Boolean
+ Dim useLocalSearch As Boolean = False
+
+
+ Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
+ Dim condition As String = $"`{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
+ Dim cmdText As String = db.CmdHelper.DbSearch(UtsDb.RemotePrivateDb, _filedName, SnListTable.TableName, condition)
+
+ Try
+ db.Open()
+ CommandReturn.RecordValue = db.ExecuteScalar(cmdText).ToString()
+ CommandReturn.ExecuteResult = True
+ db.Close()
+ Catch ex As Exception
+ useLocalSearch = True '云端查询失败,使用本地查询
+ End Try
+ End Using
+
+ Return useLocalSearch
+ End Function
+
+
+ Public Overrides Function Execute() As TestCommandReturn
+ Select Case _mode
+ Case "Local", "0"
+ GetByLocal()
+ Case "Both", "2"
+ If GetByRemote() = False Then GetByLocal()
+
+ Case "Remote", "1"
+ GetByRemote()
+ Case Else
+ GetByRemote()
+ End Select
+
+ 'todo:数据验证
+
+
+
+
+ ''优先查询云端
+ 'Dim useLocalSearch As Boolean = False
+ 'Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
+ ' Dim condition As String = $"`{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
+ ' Dim cmdText As String = db.CmdHelper.DbSearch(UtsDb.RemotePrivateDb, _filedName, SnListTable.TableName, condition)
+
+ ' Try
+ ' db.Open()
+ ' CommandReturn.RecordValue = db.ExecuteScalar(cmdText).ToString()
+ ' CommandReturn.ExecuteResult = True
+ ' db.Close()
+ ' Catch ex As Exception
+ ' useLocalSearch = True '云端查询失败,使用本地查询
+ ' End Try
+ 'End Using
+
+
+ ''本地存储
+ 'If useLocalSearch Then
+ ' Using db As New DbExecutor(UtsDb.LocalDbType, UtsDb.LocalConnString)
+ ' Try
+ ' db.Open()
+ ' Catch ex As Exception
+ ' CommandReturn.ExecuteResult = False
+ ' CommandReturn.RecordValue = ""
+ ' CommandReturn.ExecuteResultTipString = $"本地数据库连接失败,{ex.Message}"
+ ' End Try
+
+ ' Try
+ ' ' Dim condition As String = $"`{SnListTable.ColNames.ProductID}` = '{Station.ParentProject.Index}' and `{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
+ ' Dim condition As String = $"`{SnListTable.ColNames.BarCode}` = '{_dutSn}'"
+ ' Dim cmdText As String = db.CmdHelper.Search(_filedName, SnListTable.TableName, condition)
+ ' CommandReturn.RecordValue = db.ExecuteScalar(cmdText).ToString()
+ ' CommandReturn.ExecuteResult = True
+ ' CommandReturn.ExecuteResultTipString = $"本地数据库查询成功"
+ ' Catch ex As Exception
+ ' CommandReturn.ExecuteResult = False
+ ' CommandReturn.RecordValue = ""
+ ' CommandReturn.ExecuteResultTipString = $"本地数据库查询失败,{ex.Message}"
+ ' End Try
+
+ ' db.Close()
+ ' End Using
+ 'End If
+
+ Return CommandReturn
+ End Function
+End Class
diff --git a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/SetRecordCommand.vb b/UTS_Core/UTSModule/Test/Command/SystemCommand/SetRecordCommand.vb
similarity index 95%
rename from UTS_Core/UTSModule/Test/Command/DatabaseCommand/SetRecordCommand.vb
rename to UTS_Core/UTSModule/Test/Command/SystemCommand/SetRecordCommand.vb
index 1ee0c09..729c0d2 100644
--- a/UTS_Core/UTSModule/Test/Command/DatabaseCommand/SetRecordCommand.vb
+++ b/UTS_Core/UTSModule/Test/Command/SystemCommand/SetRecordCommand.vb
@@ -19,7 +19,7 @@ Public Class SetRecordCommand
_filedName = command.Parameter(1)
_filedValue = command.Parameter(2)
-
+ 'todo:SetRecord 只能对自定义字段进行写入,保护字段不执行’
End Sub
Public Overrides Function Execute() As TestCommandReturn
@@ -67,7 +67,7 @@ Public Class SetRecordCommand
'本地缓存
Try
- If String.IsNullOrEmpty(saveDbCmdText) Then
+ If Not String.IsNullOrEmpty(saveDbCmdText) Then
DbConnector.SaveCmdStringToCacheTable(db, saveDbCmdText)
CommandReturn.ExecuteResultTipString = "本地缓存成功"
End If
diff --git a/UTS_Core/UTSModule/Test/Command/SystemCommand/SystemCommandManger.vb b/UTS_Core/UTSModule/Test/Command/SystemCommand/SystemCommandManger.vb
index 3208bfc..fc6c05d 100644
--- a/UTS_Core/UTSModule/Test/Command/SystemCommand/SystemCommandManger.vb
+++ b/UTS_Core/UTSModule/Test/Command/SystemCommand/SystemCommandManger.vb
@@ -21,6 +21,12 @@
executor = New GetDBDataExecutor(command)
Case "Call"
executor = New CallExecutor(command)
+ Case "GetRecord"
+ Return New GetRecordCommand(command)
+ Case "SetRecord"
+ Return New SetRecordCommand(command)
+ Case "CombindRecord"
+ Return New CombindRecordCommand(command)
Case Else
Throw New Exception($"System集,未知命令 :{command.Name}")
End Select
diff --git a/UTS_Core/UTSModule/Test/Command/TestCommandManger.vb b/UTS_Core/UTSModule/Test/Command/TestCommandManger.vb
index ddd579b..d91363e 100644
--- a/UTS_Core/UTSModule/Test/Command/TestCommandManger.vb
+++ b/UTS_Core/UTSModule/Test/Command/TestCommandManger.vb
@@ -1,8 +1,8 @@
Imports UTS_Core.UTSModule.Test.Command.ComPortCommand
+Imports UTS_Core.UTSModule.Test.Command.ConverterCommand
Imports UTS_Core.UTSModule.Test.Command.ProcessCommand
Imports UTS_Core.UTSModule.Test.Command.SystemCommand
Imports UTS_Core.UTSModule.Test.Command.UtsComPortCommand
-Imports UTS_Core.UTSModule.Test.Command.ConverterCommand
Namespace UTSModule.Test.Command
Public Class TestCommandManger
diff --git a/UTS_Core/UTS_Core.vbproj b/UTS_Core/UTS_Core.vbproj
index af722fe..661d672 100644
--- a/UTS_Core/UTS_Core.vbproj
+++ b/UTS_Core/UTS_Core.vbproj
@@ -342,10 +342,9 @@
-
-
-
-
+
+
+
diff --git a/UTS_Core/bin/Debug/UTS_Core.dll b/UTS_Core/bin/Debug/UTS_Core.dll
index bd9ec5d..fbb2880 100644
Binary files a/UTS_Core/bin/Debug/UTS_Core.dll and b/UTS_Core/bin/Debug/UTS_Core.dll differ
diff --git a/UTS_Core/bin/Debug/UTS_Core.pdb b/UTS_Core/bin/Debug/UTS_Core.pdb
index ac7d2d0..46955da 100644
Binary files a/UTS_Core/bin/Debug/UTS_Core.pdb and b/UTS_Core/bin/Debug/UTS_Core.pdb differ
diff --git a/UTS_Core/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/UTS_Core/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
index 1b03451..bf4fa5a 100644
Binary files a/UTS_Core/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/UTS_Core/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/UTS_Core/obj/Debug/UTS_Core.dll b/UTS_Core/obj/Debug/UTS_Core.dll
index bd9ec5d..fbb2880 100644
Binary files a/UTS_Core/obj/Debug/UTS_Core.dll and b/UTS_Core/obj/Debug/UTS_Core.dll differ
diff --git a/UTS_Core/obj/Debug/UTS_Core.pdb b/UTS_Core/obj/Debug/UTS_Core.pdb
index ac7d2d0..46955da 100644
Binary files a/UTS_Core/obj/Debug/UTS_Core.pdb and b/UTS_Core/obj/Debug/UTS_Core.pdb differ
diff --git a/UTS_Core/obj/Debug/UTS_Core.vbproj.AssemblyReference.cache b/UTS_Core/obj/Debug/UTS_Core.vbproj.AssemblyReference.cache
index 6709639..97b4e38 100644
Binary files a/UTS_Core/obj/Debug/UTS_Core.vbproj.AssemblyReference.cache and b/UTS_Core/obj/Debug/UTS_Core.vbproj.AssemblyReference.cache differ
diff --git a/UTS_Core/obj/Debug/UTS_Core.vbproj.CoreCompileInputs.cache b/UTS_Core/obj/Debug/UTS_Core.vbproj.CoreCompileInputs.cache
index 267543b..f9cfb99 100644
--- a/UTS_Core/obj/Debug/UTS_Core.vbproj.CoreCompileInputs.cache
+++ b/UTS_Core/obj/Debug/UTS_Core.vbproj.CoreCompileInputs.cache
@@ -1 +1 @@
-34de90036f057f2c0b29d8bef1e24cf1ba7a80e898f2f80e37d38e472d36018d
+bc36b2673dd91a86b3284d3625ed2d97a7b0a0f3bbce3b71f7327a4440c08219
diff --git a/UTS_Core/obj/Debug/UTS_Core.vbproj.GenerateResource.cache b/UTS_Core/obj/Debug/UTS_Core.vbproj.GenerateResource.cache
index 37e041e..7de1f9e 100644
Binary files a/UTS_Core/obj/Debug/UTS_Core.vbproj.GenerateResource.cache and b/UTS_Core/obj/Debug/UTS_Core.vbproj.GenerateResource.cache differ