修复固件版本换算方式和设备上传报错
This commit is contained in:
Binary file not shown.
@@ -374,4 +374,81 @@ Public Class DbExecutor
|
|||||||
|
|
||||||
GC.Collect() '对所有缓存垃圾进行回收
|
GC.Collect() '对所有缓存垃圾进行回收
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 添加参数到命令(简化版本,自动推断参数类型)
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="parameterName">参数名称(需包含@或:前缀)</param>
|
||||||
|
''' <param name="value">参数值</param>
|
||||||
|
''' <returns>创建的DbParameter对象</returns>
|
||||||
|
Public Function AddParameter(parameterName As String, value As Object) As DbParameter
|
||||||
|
' 自动根据值类型推断DbType
|
||||||
|
Dim dbType As DbType
|
||||||
|
Dim convertedValue As Object = value
|
||||||
|
|
||||||
|
If value Is Nothing OrElse DBNull.Value.Equals(value) Then
|
||||||
|
dbType = DbType.Object
|
||||||
|
convertedValue = DBNull.Value
|
||||||
|
Else
|
||||||
|
Select Case value.GetType()
|
||||||
|
Case GetType(Integer)
|
||||||
|
dbType = DbType.Int32
|
||||||
|
Case GetType(String)
|
||||||
|
dbType = DbType.String
|
||||||
|
Case GetType(Boolean)
|
||||||
|
dbType = DbType.Boolean
|
||||||
|
Case GetType(DateTime)
|
||||||
|
dbType = DbType.DateTime
|
||||||
|
Case GetType(Decimal)
|
||||||
|
dbType = DbType.Decimal
|
||||||
|
Case GetType(Double)
|
||||||
|
dbType = DbType.Double
|
||||||
|
Case GetType(Single)
|
||||||
|
dbType = DbType.Single
|
||||||
|
Case GetType(Byte())
|
||||||
|
dbType = DbType.Binary
|
||||||
|
Case GetType(Guid)
|
||||||
|
dbType = DbType.Guid
|
||||||
|
Case Else
|
||||||
|
dbType = DbType.Object
|
||||||
|
End Select
|
||||||
|
End If
|
||||||
|
|
||||||
|
' 调用现有的AddDbParameter方法
|
||||||
|
Return AddDbParameter(dbType, parameterName, convertedValue)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 添加参数到命令(指定明确的类型)
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="parameterName">参数名称</param>
|
||||||
|
''' <param name="value">参数值</param>
|
||||||
|
''' <param name="dbType">参数的数据类型</param>
|
||||||
|
''' <returns>创建的DbParameter对象</returns>
|
||||||
|
Public Function AddParameter(parameterName As String, value As Object, dbType As DbType) As DbParameter
|
||||||
|
Dim convertedValue As Object = value
|
||||||
|
|
||||||
|
' 处理空值
|
||||||
|
If value Is Nothing OrElse DBNull.Value.Equals(value) Then
|
||||||
|
convertedValue = DBNull.Value
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return AddDbParameter(dbType, parameterName, convertedValue)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' 添加参数到命令(包含方向)
|
||||||
|
''' </summary>
|
||||||
|
''' <param name="parameterName">参数名称</param>
|
||||||
|
''' <param name="value">参数值</param>
|
||||||
|
''' <param name="dbType">参数的数据类型</param>
|
||||||
|
''' <param name="direction">参数方向(输入/输出)</param>
|
||||||
|
''' <returns>创建的DbParameter对象</returns>
|
||||||
|
Public Function AddParameter(parameterName As String, value As Object, dbType As DbType, direction As ParameterDirection) As DbParameter
|
||||||
|
Dim param = AddParameter(parameterName, value, dbType)
|
||||||
|
param.Direction = direction
|
||||||
|
Return param
|
||||||
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
21
BLV_Studio/FrmMain.Designer.vb
generated
21
BLV_Studio/FrmMain.Designer.vb
generated
@@ -265,6 +265,7 @@ Partial Class FrmMain
|
|||||||
Me.tsb_SyncConfigFiles = New System.Windows.Forms.ToolStripButton()
|
Me.tsb_SyncConfigFiles = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.ToolStripButton4 = New System.Windows.Forms.ToolStripButton()
|
Me.ToolStripButton4 = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.ToolStripButton17 = New System.Windows.Forms.ToolStripButton()
|
Me.ToolStripButton17 = New System.Windows.Forms.ToolStripButton()
|
||||||
|
Me.ToolStripButton23 = New System.Windows.Forms.ToolStripButton()
|
||||||
Me.MsMain.SuspendLayout()
|
Me.MsMain.SuspendLayout()
|
||||||
Me.StatusStrip1.SuspendLayout()
|
Me.StatusStrip1.SuspendLayout()
|
||||||
Me.CmsEvent.SuspendLayout()
|
Me.CmsEvent.SuspendLayout()
|
||||||
@@ -1140,17 +1141,15 @@ Partial Class FrmMain
|
|||||||
'
|
'
|
||||||
'ToolStripButton19
|
'ToolStripButton19
|
||||||
'
|
'
|
||||||
Me.ToolStripButton19.Enabled = False
|
|
||||||
Me.ToolStripButton19.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
Me.ToolStripButton19.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
|
||||||
Me.ToolStripButton19.ForeColor = System.Drawing.Color.Black
|
Me.ToolStripButton19.ForeColor = System.Drawing.Color.Black
|
||||||
Me.ToolStripButton19.Image = CType(resources.GetObject("ToolStripButton19.Image"), System.Drawing.Image)
|
Me.ToolStripButton19.Image = CType(resources.GetObject("ToolStripButton19.Image"), System.Drawing.Image)
|
||||||
Me.ToolStripButton19.ImageTransparentColor = System.Drawing.Color.Magenta
|
Me.ToolStripButton19.ImageTransparentColor = System.Drawing.Color.Magenta
|
||||||
Me.ToolStripButton19.Name = "ToolStripButton19"
|
Me.ToolStripButton19.Name = "ToolStripButton19"
|
||||||
Me.ToolStripButton19.Size = New System.Drawing.Size(33, 37)
|
Me.ToolStripButton19.Size = New System.Drawing.Size(81, 37)
|
||||||
Me.ToolStripButton19.Text = "导出"
|
Me.ToolStripButton19.Text = "上传设备信息"
|
||||||
Me.ToolStripButton19.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
|
Me.ToolStripButton19.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
|
||||||
Me.ToolStripButton19.ToolTipText = "将文件导出到Excel表格"
|
Me.ToolStripButton19.ToolTipText = "将文件导出到Excel表格"
|
||||||
Me.ToolStripButton19.Visible = False
|
|
||||||
'
|
'
|
||||||
'ToolStripSeparator22
|
'ToolStripSeparator22
|
||||||
'
|
'
|
||||||
@@ -1580,7 +1579,7 @@ Partial Class FrmMain
|
|||||||
'
|
'
|
||||||
'ToolStrip2
|
'ToolStrip2
|
||||||
'
|
'
|
||||||
Me.ToolStrip2.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsb_ReleaseToProjcet, Me.ToolStripSeparator7, Me.tsb_RuleCheck, Me.tsb_Compile, Me.tsb_DownLoad, Me.ToolStripSeparator4, Me.TsBtnNewFile, Me.TsBtnLoad, Me.tsb_SaveFile, Me.TsBtnSaveAs, Me.tsb_OpenFileFolder, Me.ToolStripSeparator6, Me.TsBtnAddModel, Me.TsBtnAddActions, Me.TsBtnAddDev, Me.TsBtnAddCondition, Me.TsBtnAddAction, Me.tsb_ExportToExcel, Me.ToolStripSeparator13, Me.UploadFirmware_btn, Me.ToolStripSeparator17})
|
Me.ToolStrip2.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsb_ReleaseToProjcet, Me.ToolStripSeparator7, Me.tsb_RuleCheck, Me.tsb_Compile, Me.tsb_DownLoad, Me.ToolStripSeparator4, Me.TsBtnNewFile, Me.TsBtnLoad, Me.tsb_SaveFile, Me.TsBtnSaveAs, Me.tsb_OpenFileFolder, Me.ToolStripSeparator6, Me.TsBtnAddModel, Me.TsBtnAddActions, Me.TsBtnAddDev, Me.TsBtnAddCondition, Me.TsBtnAddAction, Me.tsb_ExportToExcel, Me.ToolStripSeparator13, Me.UploadFirmware_btn, Me.ToolStripSeparator17, Me.ToolStripButton23})
|
||||||
Me.ToolStrip2.Location = New System.Drawing.Point(3, 3)
|
Me.ToolStrip2.Location = New System.Drawing.Point(3, 3)
|
||||||
Me.ToolStrip2.Name = "ToolStrip2"
|
Me.ToolStrip2.Name = "ToolStrip2"
|
||||||
Me.ToolStrip2.Size = New System.Drawing.Size(987, 40)
|
Me.ToolStrip2.Size = New System.Drawing.Size(987, 40)
|
||||||
@@ -2706,6 +2705,17 @@ Partial Class FrmMain
|
|||||||
Me.ToolStripButton17.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
|
Me.ToolStripButton17.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
|
||||||
Me.ToolStripButton17.Visible = False
|
Me.ToolStripButton17.Visible = False
|
||||||
'
|
'
|
||||||
|
'ToolStripButton23
|
||||||
|
'
|
||||||
|
Me.ToolStripButton23.ForeColor = System.Drawing.Color.Blue
|
||||||
|
Me.ToolStripButton23.Image = CType(resources.GetObject("ToolStripButton23.Image"), System.Drawing.Image)
|
||||||
|
Me.ToolStripButton23.ImageTransparentColor = System.Drawing.Color.Magenta
|
||||||
|
Me.ToolStripButton23.Name = "ToolStripButton23"
|
||||||
|
Me.ToolStripButton23.Size = New System.Drawing.Size(60, 37)
|
||||||
|
Me.ToolStripButton23.Text = "上传设备"
|
||||||
|
Me.ToolStripButton23.TextAlign = System.Drawing.ContentAlignment.MiddleRight
|
||||||
|
Me.ToolStripButton23.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
|
||||||
|
'
|
||||||
'FrmMain
|
'FrmMain
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
|
||||||
@@ -3031,4 +3041,5 @@ Partial Class FrmMain
|
|||||||
Friend WithEvents lab_RoomType As Label
|
Friend WithEvents lab_RoomType As Label
|
||||||
Friend WithEvents ToolStripButton17 As ToolStripButton
|
Friend WithEvents ToolStripButton17 As ToolStripButton
|
||||||
Friend WithEvents TvwMain As TreeViewEx
|
Friend WithEvents TvwMain As TreeViewEx
|
||||||
|
Friend WithEvents ToolStripButton23 As ToolStripButton
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@@ -4569,7 +4569,7 @@ Public Class FrmMain
|
|||||||
If Not String.IsNullOrEmpty(FirmwareVer) Then
|
If Not String.IsNullOrEmpty(FirmwareVer) Then
|
||||||
Dim Firbuf As String() = FirmwareVer.Split("_")
|
Dim Firbuf As String() = FirmwareVer.Split("_")
|
||||||
If Firbuf.Length > 3 Then
|
If Firbuf.Length > 3 Then
|
||||||
FVer = Convert.ToInt32(Firbuf(3))
|
FVer = Convert.ToInt32(Firbuf(3), 16)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If _TableInteraction.TableCompiletoByte(FVer, savePath, True) = True Then
|
If _TableInteraction.TableCompiletoByte(FVer, savePath, True) = True Then
|
||||||
@@ -4841,6 +4841,317 @@ Public Class FrmMain
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub ToolStripButton19_Click(sender As Object, e As EventArgs) Handles ToolStripButton19.Click
|
||||||
|
If Releaseflag And Not IsNothing(TvwMain.SelectedNode) Then
|
||||||
|
Else
|
||||||
|
MsgBox("Please select the publishing node.")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
Dim TrNode As TreeNode = TvwMain.SelectedNode
|
||||||
|
|
||||||
|
If TrNode.Level > 1 Then
|
||||||
|
TrNode = TrNode.Parent
|
||||||
|
End If
|
||||||
|
Dim FirmwareVer As String = TrNode.FirstNode.NextNode.NextNode.Text ' TrNode.NextVisibleNode.NextNode.Text
|
||||||
|
Dim FVer As Integer = 0
|
||||||
|
If Not String.IsNullOrEmpty(FirmwareVer) Then
|
||||||
|
Dim Firbuf As String() = FirmwareVer.Split("_")
|
||||||
|
If Firbuf.Length > 3 Then
|
||||||
|
'将Firbuf(3)十六进制字符串转换为十进制
|
||||||
|
|
||||||
|
|
||||||
|
FVer = Convert.ToInt32(Firbuf(3), 16)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
UploadDeviceList(FVer)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub UploadDeviceList(pzVer As Integer)
|
||||||
|
' 1. 参数验证
|
||||||
|
If Not Releaseflag OrElse IsNothing(TvwMain.SelectedNode) Then
|
||||||
|
MsgBox("Please select the publishing node.")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
If IsNothing(_TableInteraction) Then
|
||||||
|
MsgBox("Unselected model")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
Try
|
||||||
|
' 2. 获取数据
|
||||||
|
Dim aaa = _TableInteraction.TestReportingScenario1()
|
||||||
|
If IsNothing(aaa) Then
|
||||||
|
MsgBox("Please configure the logical table first.")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
|
||||||
|
' 3. 序列化 JSON
|
||||||
|
Dim device_list_json As String = JsonConvert.SerializeObject(aaa.TDevicemodel)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Dim hotel_id As Integer = _project.HotelIndex
|
||||||
|
Dim roomtype_id As Integer = _project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_ID
|
||||||
|
Dim createTime As String = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
|
||||||
|
|
||||||
|
' 5. 使用参数化查询
|
||||||
|
Dim insertStr As String = "INSERT INTO `blv_rcu_db`.`tbl_room_type_device` " &
|
||||||
|
"(`hotel_id`, `roomtype_id`, `device_list_json`, `version`, `create_time`) " &
|
||||||
|
"VALUES (@hotel_id, @roomtype_id, @device_list_json, @version, @create_time)"
|
||||||
|
|
||||||
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mysql, DbConnString)
|
||||||
|
db.Open()
|
||||||
|
|
||||||
|
' 清空可能存在的旧参数
|
||||||
|
db.ClearDbParameter()
|
||||||
|
|
||||||
|
'' 使用新的AddParameter方法添加参数
|
||||||
|
'db.AddParameter("@hotel_id", hotel_id)
|
||||||
|
'db.AddParameter("@roomtype_id", roomtype_id)
|
||||||
|
'db.AddParameter("@device_list_json", device_list_json)
|
||||||
|
'db.AddParameter("@version", pzVer)
|
||||||
|
'db.AddParameter("@create_time", createTime)
|
||||||
|
|
||||||
|
' 使用明确的类型
|
||||||
|
db.AddParameter("@hotel_id", hotel_id, DbType.Int32)
|
||||||
|
db.AddParameter("@roomtype_id", roomtype_id, DbType.Int32)
|
||||||
|
db.AddParameter("@device_list_json", device_list_json, DbType.String)
|
||||||
|
db.AddParameter("@version", pzVer, DbType.Int32)
|
||||||
|
db.AddParameter("@create_time", createTime, DbType.DateTime)
|
||||||
|
|
||||||
|
' 执行插入操作
|
||||||
|
Dim result As Integer = db.ExecuteNonQuery(insertStr)
|
||||||
|
|
||||||
|
db.Close()
|
||||||
|
|
||||||
|
If result > 0 Then
|
||||||
|
MsgBox("Device list upload successful")
|
||||||
|
Else
|
||||||
|
MsgBox("Upload of equipment list failed")
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox($"An error occurred while uploading the device list.: {ex.Message}")
|
||||||
|
' 记录详细错误日志
|
||||||
|
LogError($"UploadDeviceList error: {ex.Message}{Environment.NewLine}{ex.StackTrace}")
|
||||||
|
End Try
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
' JSON验证函数
|
||||||
|
|
||||||
|
|
||||||
|
' 日志记录函数
|
||||||
|
Private Sub LogError(message As String)
|
||||||
|
Dim logPath As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ErrorLog.txt")
|
||||||
|
|
||||||
|
Try
|
||||||
|
File.AppendAllText(logPath, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - {message}{Environment.NewLine}{Environment.NewLine}")
|
||||||
|
Catch
|
||||||
|
' 日志写入失败时不抛出异常
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub ToolStripButton23_Click(sender As Object, e As EventArgs) Handles ToolStripButton23.Click
|
||||||
|
If Releaseflag And Not IsNothing(TvwMain.SelectedNode) Then
|
||||||
|
Else
|
||||||
|
MsgBox("Please select the publishing node.")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
Dim TrNode As TreeNode = TvwMain.SelectedNode
|
||||||
|
|
||||||
|
If TrNode.Level > 1 Then
|
||||||
|
TrNode = TrNode.Parent
|
||||||
|
End If
|
||||||
|
Dim FirmwareVer As String = TrNode.FirstNode.NextNode.NextNode.Text ' TrNode.NextVisibleNode.NextNode.Text
|
||||||
|
Dim FVer As Integer = 0
|
||||||
|
If Not String.IsNullOrEmpty(FirmwareVer) Then
|
||||||
|
Dim Firbuf As String() = FirmwareVer.Split("_")
|
||||||
|
If Firbuf.Length > 3 Then
|
||||||
|
FVer = Convert.ToInt32(Firbuf(3), 16)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
UploadDeviceList1(FVer)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
Public Sub UploadDeviceList1(pzVer As Integer)
|
||||||
|
Dim headnode As RowNode
|
||||||
|
headnode = _grdModel._rootNode
|
||||||
|
Dim childnode, D485node, Virtualnode As RowNode
|
||||||
|
'初始化treeview控件
|
||||||
|
|
||||||
|
Console.WriteLine("初始化treeview控件")
|
||||||
|
|
||||||
|
' 1. 参数验证
|
||||||
|
If IsNothing(TvwMain.SelectedNode) Then
|
||||||
|
MsgBox("Please select the publishing node.")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
childnode = headnode.Nodes(0)
|
||||||
|
childnode = childnode.Nodes(0)
|
||||||
|
|
||||||
|
D485node = childnode.Nodes(1)
|
||||||
|
Virtualnode = childnode.Nodes(2)
|
||||||
|
|
||||||
|
If IsNothing(_grdModel) OrElse IsNothing(_grdModel._rootNode) Then
|
||||||
|
MsgBox("No model selected")
|
||||||
|
Return
|
||||||
|
End If
|
||||||
|
Dim li As List(Of UpdataDevnode) = New List(Of UpdataDevnode)
|
||||||
|
Dim hnode As UpdataDevnode = Extractnode(childnode, True)
|
||||||
|
li.Add(hnode)
|
||||||
|
For Each node In D485node.Nodes
|
||||||
|
|
||||||
|
For Each node2 In node.Nodes
|
||||||
|
li.Add(Extractnode(node2))
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
Next
|
||||||
|
For Each node In Virtualnode.Nodes
|
||||||
|
For Each node2 In node.Nodes
|
||||||
|
li.Add(Extractnode(node2))
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
|
||||||
|
Try
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
' 3. 序列化 JSON
|
||||||
|
Dim device_list_json As String = JsonConvert.SerializeObject(li)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Dim hotel_id As Integer = _project.HotelIndex
|
||||||
|
Dim roomtype_id As Integer = _project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_ID
|
||||||
|
Dim createTime As String = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
|
||||||
|
|
||||||
|
' 5. 使用参数化查询
|
||||||
|
Dim insertStr As String = "INSERT INTO `blv_rcu_db`.`tbl_room_type_device` " &
|
||||||
|
"(`hotel_id`, `roomtype_id`, `device_list_json`, `version`, `create_time`,`format`) " &
|
||||||
|
"VALUES (@hotel_id, @roomtype_id, @device_list_json, @version, @create_time,@format)"
|
||||||
|
|
||||||
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mysql, DbConnString)
|
||||||
|
db.Open()
|
||||||
|
|
||||||
|
' 清空可能存在的旧参数
|
||||||
|
db.ClearDbParameter()
|
||||||
|
|
||||||
|
'' 使用新的AddParameter方法添加参数
|
||||||
|
'db.AddParameter("@hotel_id", hotel_id)
|
||||||
|
'db.AddParameter("@roomtype_id", roomtype_id)
|
||||||
|
'db.AddParameter("@device_list_json", device_list_json)
|
||||||
|
'db.AddParameter("@version", pzVer)
|
||||||
|
'db.AddParameter("@create_time", createTime)
|
||||||
|
|
||||||
|
' 使用明确的类型
|
||||||
|
db.AddParameter("@hotel_id", hotel_id, DbType.Int32)
|
||||||
|
db.AddParameter("@roomtype_id", roomtype_id, DbType.Int32)
|
||||||
|
db.AddParameter("@device_list_json", device_list_json, DbType.String)
|
||||||
|
db.AddParameter("@version", pzVer, DbType.Int32)
|
||||||
|
db.AddParameter("@create_time", createTime, DbType.DateTime)
|
||||||
|
db.AddParameter("@format", 0, DbType.Int32)
|
||||||
|
' 执行插入操作
|
||||||
|
Dim result As Integer = db.ExecuteNonQuery(insertStr)
|
||||||
|
|
||||||
|
db.Close()
|
||||||
|
|
||||||
|
If result > 0 Then
|
||||||
|
MsgBox("The equipment list has been uploaded successfully.")
|
||||||
|
Else
|
||||||
|
MsgBox("The equipment list upload failed.")
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox($"An error occurred while uploading the device list: {ex.Message}")
|
||||||
|
' 记录详细错误日志
|
||||||
|
LogError($"UploadDeviceList error: {ex.Message}{Environment.NewLine}{ex.StackTrace}")
|
||||||
|
End Try
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
Public Function Extractnode(node As RowNode, Optional isRoot As Boolean = False) As UpdataDevnode
|
||||||
|
|
||||||
|
|
||||||
|
Dim updataDevnode As UpdataDevnode = New UpdataDevnode
|
||||||
|
updataDevnode.DevName = node.Text
|
||||||
|
|
||||||
|
updataDevnode.DevAttr = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, String)))
|
||||||
|
updataDevnode.DevFunc = New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, (String, String)))))
|
||||||
|
|
||||||
|
''遍历节点默认第一个节点为设备属性
|
||||||
|
For i As Integer = 0 To node.Nodes.Count - 1
|
||||||
|
If i = 0 Then
|
||||||
|
Dim attr As Dictionary(Of String, Dictionary(Of String, String)) = New Dictionary(Of String, Dictionary(Of String, String))
|
||||||
|
updataDevnode.DevAttr.Add(node.Nodes(i).Text, attr)
|
||||||
|
For j As Integer = 0 To node.Nodes(i).Nodes.Count - 1
|
||||||
|
Dim attr2 As Dictionary(Of String, String) = New Dictionary(Of String, String)
|
||||||
|
attr.Add(node.Nodes(i).Nodes(j).name, attr2)
|
||||||
|
'继续遍历子节点
|
||||||
|
For k As Integer = 0 To node.Nodes(i).Nodes(j).Nodes.Count - 1
|
||||||
|
attr2.Add(node.Nodes(i).Nodes(j).Nodes(k).name, node.Nodes(i).Nodes(j).Nodes(k).devicetype.ToString)
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
'判断节点名称不能为"RS485"、"VirtualObject"
|
||||||
|
If node.Nodes(i).name <> "RS485" AndAlso node.Nodes(i).name <> "VirtualObject" Then
|
||||||
|
'遍历节点的子节点
|
||||||
|
Dim devtype As String = "0"
|
||||||
|
Dim addr As String = "0"
|
||||||
|
Dim tnodename As String
|
||||||
|
If isRoot Then
|
||||||
|
'"设备存在组:DO设备组信息"
|
||||||
|
tnodename = $"{node.Nodes(i).name} device group information"
|
||||||
|
If updataDevnode.DevAttr.Values(0).ContainsKey(tnodename) Then
|
||||||
|
|
||||||
|
If updataDevnode.DevAttr.Values(0)(tnodename).ContainsKey("DeviceType") Then
|
||||||
|
devtype = updataDevnode.DevAttr.Values(0).Item(tnodename).Item("DeviceType")
|
||||||
|
End If
|
||||||
|
If updataDevnode.DevAttr.Values(0)(tnodename).ContainsKey("DeviceAddr") Then
|
||||||
|
addr = updataDevnode.DevAttr.Values(0).Item(tnodename).Item("DeviceAddr")
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
devtype = node.Nodes(i).DEV_TYPE_DATA
|
||||||
|
tnodename = "Device present"
|
||||||
|
If updataDevnode.DevAttr.Values(0)(tnodename).ContainsKey("Dialing address") Then
|
||||||
|
addr = updataDevnode.DevAttr.Values(0).Item(tnodename).Item("Dialing address")
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim func1 As New Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, (String, String))))
|
||||||
|
Dim func2 As New Dictionary(Of String, Dictionary(Of String, (String, String)))
|
||||||
|
Dim func As New Dictionary(Of String, (String, String))
|
||||||
|
' 功能块名 , 类型值 , 功能块地址 别名,序号
|
||||||
|
' Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, String)))
|
||||||
|
func2.Add(addr, func)
|
||||||
|
func1.Add(devtype, func2)
|
||||||
|
updataDevnode.DevFunc.Add(node.Nodes(i).Text, func1) ' (devtype, func))
|
||||||
|
|
||||||
|
'Dim tag As AttributeRowNodeTag = node.Tag
|
||||||
|
|
||||||
|
For j As Integer = 0 To node.Nodes(i).Nodes.Count - 1
|
||||||
|
|
||||||
|
func.Add(node.Nodes(i).Nodes(j).index + 1, (node.Nodes(i).Nodes(j).Text, node.Nodes(i).Nodes(j).deviceAlias))
|
||||||
|
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Next
|
||||||
|
Return updataDevnode
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -4931,3 +5242,15 @@ Public Class RoomType
|
|||||||
' Public Property RoomType_OldID As String
|
' Public Property RoomType_OldID As String
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
<Serializable>
|
||||||
|
Public Class UpdataDevnode
|
||||||
|
'设备名称
|
||||||
|
Public Property DevName As String
|
||||||
|
'设备属性列表
|
||||||
|
Public Property DevAttr As Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, String)))
|
||||||
|
' 功能块名 , 类型值 , 功能块地址 序号 回路名 别名
|
||||||
|
Public Property DevFunc As Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, Dictionary(Of String, (String, String)))))
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ Public Class ReportingScenario
|
|||||||
'Runing(grd, Devicemodel, ActionConfiguration)
|
'Runing(grd, Devicemodel, ActionConfiguration)
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
Sub New(grd As FlexCell.Grid, Devicemodel As Dictionary(Of String, DeviceModel))
|
||||||
|
Tgrd = grd
|
||||||
|
TDevicemodel = Devicemodel
|
||||||
|
End Sub
|
||||||
'配置名称
|
'配置名称
|
||||||
Public ConfigurationName As String
|
Public ConfigurationName As String
|
||||||
'配置版本
|
'配置版本
|
||||||
|
|||||||
@@ -7140,6 +7140,10 @@ ON DUPLICATE KEY UPDATE {updatastr};"
|
|||||||
Dim nsurl As String = "https://boonlive-rcu.com/api/UploadRoomTypeModal" '"https://pms.boonlive-rcu.com/api/UploadRoomTypeModal"
|
Dim nsurl As String = "https://boonlive-rcu.com/api/UploadRoomTypeModal" '"https://pms.boonlive-rcu.com/api/UploadRoomTypeModal"
|
||||||
GetAccountAuth(nsurl, str)
|
GetAccountAuth(nsurl, str)
|
||||||
Return aaa
|
Return aaa
|
||||||
|
End Function
|
||||||
|
Public Function TestReportingScenario1() As ReportingScenario
|
||||||
|
Dim aaa As New ReportingScenario( _grd, Dic_Devicemodel)
|
||||||
|
Return aaa
|
||||||
End Function
|
End Function
|
||||||
Private Function GetAccountAuth(url As String, data As String) As Boolean
|
Private Function GetAccountAuth(url As String, data As String) As Boolean
|
||||||
Dim jsonString As String = HttpMothod.PostData2(url, data)
|
Dim jsonString As String = HttpMothod.PostData2(url, data)
|
||||||
|
|||||||
@@ -7452,6 +7452,33 @@ BLV_Studio
|
|||||||
回收资源
|
回收资源
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:BLV_Studio.DbExecutor.AddParameter(System.String,System.Object)">
|
||||||
|
<summary>
|
||||||
|
添加参数到命令(简化版本,自动推断参数类型)
|
||||||
|
</summary>
|
||||||
|
<param name="parameterName">参数名称(需包含@或:前缀)</param>
|
||||||
|
<param name="value">参数值</param>
|
||||||
|
<returns>创建的DbParameter对象</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:BLV_Studio.DbExecutor.AddParameter(System.String,System.Object,System.Data.DbType)">
|
||||||
|
<summary>
|
||||||
|
添加参数到命令(指定明确的类型)
|
||||||
|
</summary>
|
||||||
|
<param name="parameterName">参数名称</param>
|
||||||
|
<param name="value">参数值</param>
|
||||||
|
<param name="dbType">参数的数据类型</param>
|
||||||
|
<returns>创建的DbParameter对象</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:BLV_Studio.DbExecutor.AddParameter(System.String,System.Object,System.Data.DbType,System.Data.ParameterDirection)">
|
||||||
|
<summary>
|
||||||
|
添加参数到命令(包含方向)
|
||||||
|
</summary>
|
||||||
|
<param name="parameterName">参数名称</param>
|
||||||
|
<param name="value">参数值</param>
|
||||||
|
<param name="dbType">参数的数据类型</param>
|
||||||
|
<param name="direction">参数方向(输入/输出)</param>
|
||||||
|
<returns>创建的DbParameter对象</returns>
|
||||||
|
</member>
|
||||||
<member name="M:BLV_Studio.SqliteCmdHelper.SearchTableInfo(System.String)">
|
<member name="M:BLV_Studio.SqliteCmdHelper.SearchTableInfo(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
查询指定数据表的信息
|
查询指定数据表的信息
|
||||||
|
|||||||
@@ -7452,6 +7452,33 @@ BLV_Studio
|
|||||||
回收资源
|
回收资源
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:BLV_Studio.DbExecutor.AddParameter(System.String,System.Object)">
|
||||||
|
<summary>
|
||||||
|
添加参数到命令(简化版本,自动推断参数类型)
|
||||||
|
</summary>
|
||||||
|
<param name="parameterName">参数名称(需包含@或:前缀)</param>
|
||||||
|
<param name="value">参数值</param>
|
||||||
|
<returns>创建的DbParameter对象</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:BLV_Studio.DbExecutor.AddParameter(System.String,System.Object,System.Data.DbType)">
|
||||||
|
<summary>
|
||||||
|
添加参数到命令(指定明确的类型)
|
||||||
|
</summary>
|
||||||
|
<param name="parameterName">参数名称</param>
|
||||||
|
<param name="value">参数值</param>
|
||||||
|
<param name="dbType">参数的数据类型</param>
|
||||||
|
<returns>创建的DbParameter对象</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:BLV_Studio.DbExecutor.AddParameter(System.String,System.Object,System.Data.DbType,System.Data.ParameterDirection)">
|
||||||
|
<summary>
|
||||||
|
添加参数到命令(包含方向)
|
||||||
|
</summary>
|
||||||
|
<param name="parameterName">参数名称</param>
|
||||||
|
<param name="value">参数值</param>
|
||||||
|
<param name="dbType">参数的数据类型</param>
|
||||||
|
<param name="direction">参数方向(输入/输出)</param>
|
||||||
|
<returns>创建的DbParameter对象</returns>
|
||||||
|
</member>
|
||||||
<member name="M:BLV_Studio.SqliteCmdHelper.SearchTableInfo(System.String)">
|
<member name="M:BLV_Studio.SqliteCmdHelper.SearchTableInfo(System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
查询指定数据表的信息
|
查询指定数据表的信息
|
||||||
|
|||||||
Reference in New Issue
Block a user