Foxtable(狐表)用户栏目专家坐堂 → 项目卡机


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

主题:项目卡机

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/2 11:37:00 [显示全部帖子]

日期的问题,设置一下其计算机

 

http://jingyan.baidu.com/article/647f0115925aee7f2148a8b5.html


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/2 12:03:00 [显示全部帖子]

    Dim hyzh As String = vars("账号") '用一个变量在登陆的时候记录账号信息啊
    dr = DataTables("账户管理").Find("[用户账号] = '" & hyzh & "' ")

    If dr is Nothing Then

msgbox("没找到用户")

    Else

'其它操作

    End If


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/2 16:20:00 [显示全部帖子]

 卡死,试试按下alt+F4。不行,就只能结束进程。

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/2 17:31:00 [显示全部帖子]

上传例子测试。


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/2 17:42:00 [显示全部帖子]

Dim dlg As new OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
    Dim App As New MSExcel.Application
    try
        Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(dlg.FileName)
        Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("计划表")
        Dim Rg As MSExcel.Range = Ws.UsedRange
        Dim ary = rg.value
       
        Tables("配载订单").ResumeRedraw()
        Tables("配载订单").StopRedraw()
        Dim nms() As  String = {"项目","下单日期","MK号","DO号","城市","客户","送货地址","物料代码","数量","体积","重量","承运商","司机","车牌","车数","车型","出车日期"}
        Dim count As Integer = 0
        Dim ls As new List(of Integer)
        Dim dic As new Dictionary (Of DataRow, Integer)
       
        For n As Integer = 2 To ws.UsedRange.Rows.Count -1
           
            Dim filter As String = "1=1"
            For m As Integer = 0 To nms.length-1
                Dim vl As object = ary(n,m+1)
                Dim dc As String = nms(m)
                If vl = Nothing Then
                    filter &= " and " & dc & " is null"
                Else
                    Dim c As Col = Tables("配载订单").Cols(dc)
                    If c.IsNumeric Then
                        filter &= " and " & dc & " = " & vl
                    ElseIf c.IsBoolean Then
                        If vl = True Then
                            filter &= " and " & dc & " = true"
                        Else
                            filter &= " and " & dc & " = false"
                        End If
                    ElseIf c.IsDate Then
                        filter &= " and " & dc & " = #" & vl & "#"
                    Else
                        filter &= " and " & dc & " = '" & vl & "'"
                    End If
                End If
            Next
            Dim dr As DataRow = DataTables("配载订单").find(filter)
            If dr Is Nothing Then
                ls.Add(n)
                count += 1
            Else
                dic.add(dr, n)
            End If
        Next
        For Each n As Integer In ls
           
            Dim r As  Row = Tables("配载订单").AddNew()
            For  m As  Integer = 0 To nms.Length - 1
                If Tables("配载订单").Cols(nms(m)).IsDate Then
                    Dim d As Date
                    If Date.TryParse(ary(n,m+1), d)
                        r(nms(m)) = d
                    End If
                Else
                    r(nms(m)) = ary(n,m+1)
                End If
            Next
           
        Next
        Tables("配载订单").ResumeRedraw()
        msgbox("共有 "& count &" 条数据导入" )
       
    catch ex As exception
        msgbox(ex.message)
        app.quit
    End try
End If

Tables("配载订单").save
e.Form.Controls("提示").Text = "正在导入,请稍后..."
Application.DoEvents()
e.Form.Controls("提示").Text = "已经导入完成."
e.Form.TimerInterval = 5000
e.Form.TimerEnabled = True

 


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/2 18:59:00 [显示全部帖子]

Dim dlg As new OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
    Dim App As New MSExcel.Application
    try
        Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(dlg.FileName)
        Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("计划表")
        Dim Rg As MSExcel.Range = Ws.UsedRange
        Dim ary = rg.value
       
        Tables("配载订单").ResumeRedraw()
        Tables("配载订单").StopRedraw()
        Dim nms() As  String = {"项目","下单日期","MK号","DO号","城市","客户","送货地址","物料代码","数量","体积","重量","承运商","司机","车牌","车数","车型","出车日期"}
        Dim count As Integer = 0
        Dim ls As new List(of Integer)
        Dim dic As new Dictionary (Of DataRow, Integer)
       
        For n As Integer = 2 To ws.UsedRange.Rows.Count -1
           
            Dim filter As String = "1=1"
            For m As Integer = 0 To nms.length-1
                Dim vl As object = ary(n,m+1)
                Dim dc As String = nms(m)
                Dim c As Col = Tables("配载订单").Cols(dc)
                If vl = Nothing Then
                    filter &= " and " & dc & " is null"
                Else
                    If c.IsNumeric Then
                       
                        filter &= " and " & dc & " >= " & vl - 0.0001 & " and " & dc & " <= " & vl + 0.0001
                       
                    ElseIf c.IsBoolean Then
                        If vl = True Then
                            filter &= " And " & dc & " = true"
                        Else
                            filter &= " and " & dc & " = false"
                        End If
                    ElseIf c.IsDate Then
                       
                        Dim d As Date
                        If Date.TryParse(vl, d)
                            filter &= " and " & dc & " = #" & d.Date & "#"
                        End If
                       
                    Else
                       
                        filter &= " and " & dc & " = '" & vl & "'"
                       
                    End If
                End If
            Next
            Dim dr As DataRow = DataTables("配载订单").find(filter)
            If dr Is Nothing Then
                output.show(filter)
                ls.Add(n)
                count += 1
            Else
                dic.add(dr, n)
            End If
        Next
        For Each n As Integer In ls
           
            Dim r As  Row = Tables("配载订单").AddNew()
            For  m As  Integer = 0 To nms.Length - 1
                If ary(n,m+1) = Nothing Then
                    r(nms(m)) = Nothing
                Else
                    If Tables("配载订单").Cols(nms(m)).IsDate Then
                        Dim d As Date
                        If Date.TryParse(ary(n,m+1), d)
                            r(nms(m)) = d
                        End If
                    Else
                        r(nms(m)) = ary(n,m+1)
                    End If
                End If
               
            Next
           
        Next
        Tables("配载订单").ResumeRedraw()
        msgbox("共有 "& count &" 条数据导入" )
       
    catch ex As exception
        msgbox(ex.message)
    finally
        app.quit
    End try
End If

Tables("配载订单").save
e.Form.Controls("提示").Text = "正在导入,请稍后..."
Application.DoEvents()
e.Form.Controls("提示").Text = "已经导入完成."
e.Form.TimerInterval = 5000
e.Form.TimerEnabled = True


 回到顶部