1, ServiceController 中dbHost和ftpHost写入注册并步骤前置到lic验证之后

2,Testplan隐藏行改为对高度设置来实现
This commit is contained in:
2025-07-03 22:55:57 +08:00
parent 6d3dc10b0d
commit 3d56954029
5 changed files with 68 additions and 31 deletions

View File

@@ -2,6 +2,7 @@
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Imports FluentFTP
Imports UTS_Core.Database
Imports UTS_Core.Security
Imports UTS_Core.UTSModule
@@ -370,14 +371,15 @@ Public Class FrmUpdateConfig
''' 获取更新服务的最新信息
''' </summary>
Private Function GetUpdateServiceInfo(serviceName As String) As UpdatePackageInfo
MsgBox("DbConnector.CanConnectToRemote = " & DbConnector.CanConnectToRemote)
If DbConnector.CanConnectToRemote = False Then '判断网络连接状态
Throw New Exception($"无法连接到数据库!")
End If
Using db As New DbExecutor(UtsDb.RemoteDbType, UtsDb.RemoteConnString)
MsgBox("DBOpen = " & UtsDb.RemoteDbType & " , " & UtsDb.RemoteConnString)
db.Open()
MsgBox("DBOpened")
Dim tableName As String = $"{SwUpdateTable.TableName}"
Dim colNames As New List(Of String) From {
$"{SwUpdateTable.ColNamesEnum.LastVersion}",
@@ -386,16 +388,18 @@ Public Class FrmUpdateConfig
}
Dim condition As String = $"`{SwUpdateTable.ColNamesEnum.SoftwareName}` = '{serviceName}'"
MsgBox("dtServiceInfo = " & condition)
Dim dtServiceInfo As DataTable = db.ExecuteDataTable(db.CmdHelper.DbSearch(UtsDb.RemotePublicDb, colNames, tableName, condition))
If dtServiceInfo.Rows.Count <= 0 Then
Throw New Exception($"从数据库获取不到{serviceName}的信息!")
End If
MsgBox("Step369")
Dim packetInfo As New UpdatePackageInfo
packetInfo.BinPackageMd5 = CStr(dtServiceInfo(0)($"{SwUpdateTable.ColNamesEnum.BinPackageMd5}"))
packetInfo.LastVersion = CStr(dtServiceInfo(0)($"{SwUpdateTable.ColNamesEnum.LastVersion}"))
packetInfo.PackageName = CStr(dtServiceInfo(0)($"{SwUpdateTable.ColNamesEnum.PackageName}"))
MsgBox("Step401")
db.Close()
Return packetInfo
End Using
@@ -517,7 +521,6 @@ Public Class FrmUpdateConfig
'If GetUtsHost() = False Then Return '根据License信息,获取服务器地址
'校验License
UpdateInstallTip(20, "Begin CheckLicense...")
_license = New License(_destLicenseFilePath)
@@ -526,12 +529,17 @@ Public Class FrmUpdateConfig
UpdateInstallTip(25, "CheckLicense Success!")
_ftpClient = New FtpService(UtsRegistry.FtpHost, CInt(_license.FtpPort), _license.FtpUser, _license.FtpPwd)
UtsRegistry.FtpHost = _license.FtpHost '写入注册表
UtsRegistry.DbHost = _license.MysqlServer '写入注册表
_ftpClient = New FtpService(_license.FtpHost, CInt(_license.FtpPort), _license.FtpUser, _license.FtpPwd)
'获取远程数据库内容
Dim packetInfo As UpdatePackageInfo = GetUpdateServiceInfo(UpdateServiceName)
'检测服务存在
If WinService.ServicesExists(UpdateServiceName) Then
'Dim updateSerVer As String = UtsRegistry.UpdateServiceVersion
'If NeedToUpdateService(updateSerVer, packetInfo.LastVersion) = False Then

View File

@@ -131,7 +131,12 @@
</None>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\UTS_Core\UTS_Core.vbproj">
<Project>{33c6456c-f00d-41ac-a6fb-db0601495c6a}</Project>
<Name>UTS_Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Document\Version.txt" />
<Content Include="MeIcon.ico" />

View File

@@ -419,6 +419,7 @@ Namespace UTSModule.Station
'SplPlanDesign
'
Me.SplPlanDesign.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplPlanDesign.FixedPanel = System.Windows.Forms.FixedPanel.Panel2
Me.SplPlanDesign.Location = New System.Drawing.Point(0, 0)
Me.SplPlanDesign.Margin = New System.Windows.Forms.Padding(4)
Me.SplPlanDesign.Name = "SplPlanDesign"
@@ -691,7 +692,7 @@ Namespace UTSModule.Station
'
Me.SplitContainer1.Panel2.Controls.Add(Me.RtxColTip)
Me.SplitContainer1.Size = New System.Drawing.Size(446, 497)
Me.SplitContainer1.SplitterDistance = 409
Me.SplitContainer1.SplitterDistance = 407
Me.SplitContainer1.SplitterWidth = 6
Me.SplitContainer1.TabIndex = 1
'
@@ -706,7 +707,7 @@ Namespace UTSModule.Station
Me.GrdRowNode.Margin = New System.Windows.Forms.Padding(4)
Me.GrdRowNode.MouseWheelSpeed = CType(3, Short)
Me.GrdRowNode.Name = "GrdRowNode"
Me.GrdRowNode.Size = New System.Drawing.Size(446, 409)
Me.GrdRowNode.Size = New System.Drawing.Size(446, 407)
Me.GrdRowNode.TabIndex = 0
'
'RtxColTip
@@ -717,7 +718,7 @@ Namespace UTSModule.Station
Me.RtxColTip.Location = New System.Drawing.Point(0, 0)
Me.RtxColTip.Margin = New System.Windows.Forms.Padding(4)
Me.RtxColTip.Name = "RtxColTip"
Me.RtxColTip.Size = New System.Drawing.Size(446, 82)
Me.RtxColTip.Size = New System.Drawing.Size(446, 84)
Me.RtxColTip.TabIndex = 0
Me.RtxColTip.Text = ""
'
@@ -782,7 +783,7 @@ Namespace UTSModule.Station
Me.Text = "Form1"
Me.ToolStrip1.ResumeLayout(False)
Me.ToolStrip1.PerformLayout()
Me.StuMain.ResumeLayout(false)
Me.StuMain.ResumeLayout(False)
Me.StuMain.PerformLayout
Me.SplStationPlan.Panel1.ResumeLayout(false)
Me.SplStationPlan.Panel2.ResumeLayout(false)

View File

@@ -1412,19 +1412,22 @@ Namespace UTSModule.Station
For i As Integer = 0 To _headNode.RowList.Count - 1
If _headNode.RowList(i).RowType = RowNode.RowTypeEnum.FixedModule Then
_grd.Row(i).Visible = True
'_grd.Row(i).Visible = True
SetRowVisible(i, True)
ElseIf _headNode.RowList(i).RowType = RowNode.RowTypeEnum.Module Then
If action = False Then
_grd.Row(i).Visible = True
'_grd.Row(i).Visible = True
SetRowVisible(i, True)
Else
If _headNode.RowList(i).Action Then
_grd.Row(i).Visible = True
' _grd.Row(i).Visible = True
SetRowVisible(i, True)
Else
_grd.Row(i).Visible = False
' _grd.Row(i).Visible = False
SetRowVisible(i, False)
For j As Integer = 1 To _headNode.RowList(i).AllChildCount
_grd.Row(i + j).Visible = False
'_grd.Row(i + j).Visible = False
SetRowVisible(i + j, False)
Next
i += _headNode.RowList(i).AllChildCount
@@ -1433,12 +1436,15 @@ Namespace UTSModule.Station
Else
If action Then
If _headNode.RowList(i).Action Then
_grd.Row(i).Visible = True
'_grd.Row(i).Visible = True
SetRowVisible(i, True)
Else
_grd.Row(i).Visible = False
'_grd.Row(i).Visible = False
SetRowVisible(i, False)
End If
Else
_grd.Row(i).Visible = True
'_grd.Row(i).Visible = True
SetRowVisible(i, True)
End If
End If
Next
@@ -1446,6 +1452,14 @@ Namespace UTSModule.Station
UnLockGridAutoRedraw()
End Sub
Public Sub SetRowVisible(row As Integer, visible As Boolean)
If visible Then
_grd.Row(row).Height = _grd.Row(0).Height
Else
_grd.Row(row).Height = 0
End If
End Sub
Public Sub SetNodeRecordShowMode(recode As Boolean)
If _headNode Is Nothing Then Return
@@ -1454,18 +1468,23 @@ Namespace UTSModule.Station
For i As Integer = 0 To _headNode.RowList.Count - 1
If _headNode.RowList(i).RowType = RowNode.RowTypeEnum.FixedModule Then
_grd.Row(i).Visible = True
' _grd.Row(i).Visible = True
SetRowVisible(i, True)
ElseIf _headNode.RowList(i).RowType = RowNode.RowTypeEnum.Module Then
_grd.Row(i).Visible = Not recode
'_grd.Row(i).Visible = Not recode
SetRowVisible(i, Not recode)
Else
If recode Then
If _headNode.RowList(i).SaveToDb Then
_grd.Row(i).Visible = True
'_grd.Row(i).Visible = True
SetRowVisible(i, True)
Else
_grd.Row(i).Visible = False
'_grd.Row(i).Visible = False
SetRowVisible(i, False)
End If
Else
_grd.Row(i).Visible = True
'_grd.Row(i).Visible = True
SetRowVisible(i, True)
End If
End If
Next
@@ -1481,20 +1500,24 @@ Namespace UTSModule.Station
For i As Integer = 1 To _headNode.RowList.Count - 1
If _headNode.RowList(i).RowType = RowNode.RowTypeEnum.FixedModule Then
_grd.Row(i).Visible = True
' _grd.Row(i).Visible = True
SetRowVisible(i, True)
ElseIf _headNode.RowList(i).RowType = RowNode.RowTypeEnum.Module Then
_headNode.RowList(i).Expanded = expand
For Each node As RowNode In _headNode.RowList(i).Children
_grd.Row(node.RowListIndex).Visible = expand
'_grd.Row(node.RowListIndex).Visible = expand
SetRowVisible(node.RowListIndex, expand)
Next
Else
If expand Then
_grd.Row(i).Visible = True
'_grd.Row(i).Visible = True
SetRowVisible(i, True)
Else
If String.IsNullOrEmpty(_headNode.RowList(i).Description) Then
_grd.Row(i).Visible = expand
'_grd.Row(i).Visible = expand
SetRowVisible(i, expand)
End If
End If
End If

View File

@@ -10,7 +10,7 @@ Namespace UTSModule
Public Shared Sub InitConnectParams(license As License.License)
RemoteDbType = DbExecutor.DbTypeEnum.Mysql
_remoteConn.Add("Server", UtsRegistry.DbHost) '从注册表中获取
_remoteConn.Add("Server", license.MysqlServer) '从注册表中获取
_remoteConn.Add("Port", license.MysqlPort)
_remoteConn.Add("User id", license.MysqlUserID)
_remoteConn.Add("Password", license.MysqlPassword)