以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]按钮代码执行  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=127971)

--  作者:工匠
--  发布时间:2018/11/26 13:13:00
--  [求助]按钮代码执行
老师好:原来有个需求是从表事件实现的,但是随着需求变化,有些需求集在一起就矛盾了。有些功能要移植出来:比如自动根据规则进行一键自动计划排单,请帮2段代码合并在一个按钮代码,谢谢!
\'原按钮重置列代码
Dim dc As DataCol = DataTables("表A").DataCols("合并文本")

dc.RaiseDataColChanged()

\'原表A   DataColChanged事件代码
Select Case e.DataCol.name      
    Case "合并文本"
        If e.DataRow.Isnull("合并文本") = False Then
            Dim dr As DataRow = DataTables("规则").find("合并文本 = \'" & e.DataRow("合并文本") & "\'")
            If dr IsNot Nothing Then
                e.DataRow("产线") = dr("产线")
            End If
        Else
            e.DataRow("产线") = Nothing
        End If
End Select


--  作者:有点甜
--  发布时间:2018/11/26 14:45:00
--  
For Each dr As DataRow In DataTables("表A").DataRows
    If dr.Isnull("合并文本") = False Then
        Dim fdr As DataRow = DataTables("规则").find("合并文本 = \'" & dr("合并文本") & "\'")
        If fdr IsNot Nothing Then
            dr("产线") = fdr("产线")
        End If
    Else
        dr("产线") = Nothing
    End If
Next