更新规则:
用 <1111.xlsx > 中的
"工单号或受理人"的内容查询项目中是否存在,
如果存在,则更新 "受理时间" "外呼时间" "录入时间"
如果不存在,则整行新增到项目内
点击按钮1弹出选择要更新有文件 选择好后确认 提示确认导入
更新完成提示更新了多少条数据
完成后提示新增多少条数据
以下是现有的代码,但是不能弹出选择文件,导入时间只显示日期,时间都是00,麻烦大神帮忙修改一下
Dim Book As New XLS.Book("C:\1111.xlsx")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("商机单跟进表").StopRedraw()
Dim nms() As String = {"受理时间","外呼时间","录入时间"}
Dim s1 As new List(of String)
s1.AddRange(nms)
Dim dict As new Dictionary(of String,Integer)
Dim dict2 As new Dictionary(of String,Integer)
For m As Integer = 0 To sheet.Cols.count -1
If s1.Contains(sheet(0,m).value) Then
dict.add(sheet(0,m).value,m)
End If
If DataTables("商机单跟进表").DataCols.Contains(sheet(0,m).value) Then
dict2.add(sheet(0,m).value,m)
End If
Next
For n As Integer = 1 To Sheet.Rows.Count -1
Dim bh As String = sheet(n,3).Text
Dim dr As DataRow = DataTables("商机单跟进表").Find("工单号或受理人 = '" & bh & "'")
If dr Is Nothing Then '如果不存在同编号的订单
dr = DataTables("商机单跟进表").AddNew()
For Each key As String In dict2.Keys
dr(key) = Sheet(n,dict2(key)).Value
Next
Else
For Each mm As String In nms
dr(mm) = Sheet(n,dict(mm)).Value
Next
End If
Next
Tables("商机单跟进表").ResumeRedraw()