Foxtable(狐表)用户栏目专家坐堂 → 【求助】数据合并


  共有1653人关注过本帖树形打印复制链接

主题:【求助】数据合并

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2016/12/15 16:10:00 [显示全部帖子]

 

[此贴子已经被作者于2016/12/15 16:10:54编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2016/12/15 16:24:00 [显示全部帖子]

Dim dlg As new OpenFileDialog
dlg.Filter = "Excel文件|*.xls;*.xlsx"
dlg.MultiSelect = True '允许选择多个文件
If dlg.ShowDialog = DialogResult.OK Then
    For Each file As String In dlg.filenames
        Dim dt As DataTable = DataTables("临时表")
        Dim dt1 As DataTable = DataTables("销售订单管理")
        Dim book As new XLS.Book(file)
        Dim sheet As XLS.Sheet = book.Sheets("Report")
        Dim khmc As String = ""
        Dim riqi As String = ""
        For i As Integer = 3 To sheet.Rows.Count - 1
            If sheet(i, 5).Text = "" Then
                khmc = ""
            Else
                If sheet(i, 6).Text = "" Then
                    If sheet(i, 5).Text = "W12806" Then
                        khmc = ""
                    Else
                        Dim ndr1 As DataRow = dt1.AddNew
                        ndr1("ABUS香港订单号") = sheet(i, 5).text
                        ndr1("箱唛") = sheet(i+1, 11).text
                        khmc = sheet(i, 5).Text
                    End If
                ElseIf khmc > "" Then
                    If sheet(i, 10).text <> "" Then
                        If sheet(i, 10).text = "(leaving HK latest mid February 2017)" Then
                            riqi = sheet(i-1, 10).text
                        Else
                            riqi = sheet(i, 10).text
                        End If
                    End If
                    Dim ndr As DataRow = dt.AddNew
                    ndr("ABUS香港订单号") = khmc
                    ndr("德国编码") = sheet(i, 5).text
                    ndr("订单数量") = sheet(i, 8).text
                    ndr("要求交期") = riqi
                    ndr("确定交期") = riqi
                End If
            End If
        Next
    Next
End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2016/12/15 17:18:00 [显示全部帖子]

Dim str As String = "W12806,W12807,W12809"

 

'其余代码

 

If ("," & str & ",").Contains("," & sheet(i, 5).Text & ",") Then

 

'其余代码


 回到顶部