Foxtable(狐表)用户栏目专家坐堂 → 代码请教


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

主题:代码请教

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


加好友 发短信
等级:一尾狐 帖子:405 积分:3572 威望:0 精华:0 注册:2014/1/8 17:12:00
代码请教  发帖心情 Post By:2017/1/10 12:12:00 [只看该作者]

Dim Filter As String
With e.Form.Controls("DropBox1")
    If .Value IsNot Nothing Then
        Filter = "内部加工单号  in ('" & .Value.replace(",","','") & "')"
        End If
End With
With e.Form.Controls("combobox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "工段 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("DropBox3")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "产品名称 = '" & .Value & "'"
    End If
End With

If Filter > "" Then
    DataTables("工序库调用_Table1").LoadFilter = Filter '设置加载条件
    DataTables("工序库调用_Table1").Load()
End If
Dim cmd1 As New SQLCommand
Dim dt As DataTable
Dim cmd2 As New SQLCommand
Dim dr As DataRow
Dim dt2 As DataTable
Dim Val As Double
Dim val1 As Double
Dim s As Integer
cmd1.C
cmd1.CommandText = "SE LECT * From {派工明细表} " & iif(Filter>"", "Where " & filter, "")
dt = cmd1.ExecuteReader()
cmd2.C
cmd2.CommandText = "SE LECT * From {加工点清单} " & iif(Filter>"", "Where " & filter, "")
dt2 = cmd1.ExecuteReader()
For Each r As Row In Tables("工序库调用_table1").Rows
    Val = dt.SQLCompute("Sum(派工量)"," 编号= '" & r("编号") & "'")
    val1 = dt.SQLCompute("Sum(部件派工)"," 编号= '" & r("编号") & "'")
    r("可派工量") = r("工序数量") - val
    r("部件余量") = r("部件量") - val1
    dr = dt2.find("编号 =  '" & r("编号") & "'")
    If  dr IsNot Nothing Then
    r("状态") = " 已派 "
    End If
Next
Tables("工序库调用_table1").Filter = "[可派工量] > 0 "

e.Form.Controls("TreeView1").BuildTree("工序库调用_table1", "工段|工序名称|产品名称")
e.Form.Controls("TreeView2").BuildTree("工序库调用_table1", "产品名称|工段|工序名称")

使用代码筛选时,出现错误提示
              无法在system.string  和system.int32 上执行 ">" 操作。 

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


加好友 发短信
等级:一尾狐 帖子:405 积分:3572 威望:0 精华:0 注册:2014/1/8 17:12:00
  发帖心情 Post By:2017/1/10 12:22:00 [只看该作者]

找到原因了,列类型不对。

 回到顶部