Foxtable(狐表)用户栏目专家坐堂 → [求助] 狐表可以实现以下要求吗?


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

主题:[求助] 狐表可以实现以下要求吗?

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


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

Dim ary() As String = {"检查","切边","自动_切边","磁检","套弹簧","封油脂","组装","防锈_包装","称油脂","返工"}
Select Case e.DataCol.Name
    Case "型号"
        If e.NewValue = Nothing Then
            e.DataRow("作业标准") = Nothing
            e.DataRow("能力") = Nothing
        Else
            e.DataTable.DataCols("检测").RaiseDataColChanged(e.DataRow)
        End If
    Case Else
        If array.IndexOf(ary, e.DataCol.Name) > -1 Then
            Dim filter As String = "1=1"
            For Each a As String In ary
                If e.DataRow.IsNull(a) Then
                    filter &= " and " & a & " Is null"
                Else
                    filter &= " and " & a & " = '*'"
                End If
            Next
            Dim fdr As DataRow = DataTables("工序标准").Find(filter)
            If fdr IsNot Nothing Then
                e.DataRow("作业标准") = fdr("标准工序")
                If DataTables("标准能力").DataCols.Contains(fdr("标准工序")) Then
                    filter = "型号 = '" & e.DataRow("型号") & "'"
                    fdr = DataTables("标准能力").Find(filter)
                    e.DataRow("能力") = fdr(e.DataRow("作业标准"))
                Else
                    e.DataRow("能力") = Nothing
                End If
            Else
                e.DataRow("作业标准") = Nothing
                e.DataRow("能力") = Nothing
            End If
        End If
End Select

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


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

是。或者改代码

 

e.DataRow("能力") = val(fdr(e.DataRow("作业标准")))


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


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

 测试没有问题啊。

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


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

 列名要对应起来啊。

 

Dim ary() As String = {"检查1","切边1","自动切边1","磁检1","套弹簧1","封油脂1","组装1","防锈包装1","称油脂1","返工1"}
Select Case e.DataCol.Name
    Case "型号"
        If e.NewValue = Nothing Then
            e.DataRow("作业标准") = Nothing
            e.DataRow("能力") = Nothing
        Else
            e.DataTable.DataCols("检查").RaiseDataColChanged(e.DataRow)
        End If
    Case Else
        If array.IndexOf(ary, e.DataCol.Name) > -1 Then
            Dim filter As String = "1=1"
            For Each a As String In ary
                If e.DataRow.IsNull(a) OrElse e.DataRow(a) = False Then
                    filter &= " and " & a.Replace("1", "") & " Is null"
                Else
                    filter &= " and " & a.Replace("1", "") & " = '*'"
                End If
            Next
            Dim fdr As DataRow = DataTables("工序标准").Find(filter)
            If fdr IsNot Nothing Then
                e.DataRow("作业标准") = fdr("标准工序")
                If DataTables("标准能力").DataCols.Contains(fdr("标准工序")) Then
                    filter = "型号 = '" & e.DataRow("型号") & "'"
                    fdr = DataTables("标准能力").Find(filter)
                    If fdr IsNot Nothing Then
                        e.DataRow("能力") = val(fdr(e.DataRow("作业标准")))
                    Else
                        e.DataRow("能力") = Nothing
                    End If
                Else
                    e.DataRow("能力") = Nothing
                End If
            Else
                e.DataRow("作业标准") = Nothing
                e.DataRow("能力") = Nothing
            End If
        End If
End Select


 回到顶部