Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "(*.*)|*.*" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim Book As New XLS.Book(dlg.FileName)
Dim Sheet As XLS.Sheet = Book.Sheets("齐套信息")
Tables("齐套信息").StopRedraw()
Dim nms() As String = {"工单号","工单状态","产品料号","产品品名","产品规格","生产数量","异常_描述","异常_采购部回复","PN号","IQC在验量","预计齐套日期","备料料号","料件品名","料件规格","缺料","库存量","应发量","已发量","未发量","发货未收量"}
For n As Integer = 1 To Sheet.Rows.Count -1
Dim bh As String = sheet(n,0).Text
Dim bh1 As String = sheet(n,11).Text
Dim dr As DataRow = DataTables("齐套信息").Find("工单号 = '" & bh & "' and 备料料号 = '" & bh1 & "'")
If dr Is Nothing Then '如果不存在同编号的订单
dr = DataTables("齐套信息").AddNew()
End If
For m As Integer = 0 To nms.Length - 1
dr(nms(m)) = Sheet(n,m).Value
Next
Next
Tables("齐套信息").ResumeRedraw()
End If