Foxtable(狐表)用户栏目专家坐堂 → 条件添加


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

主题:条件添加

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/5 13:17:00 [显示全部帖子]

Dim t1 As DataTable = e.Form.Controls("毛坯工序").Table.DataTable
Dim dt1 As DataTable = DataTables("毛坯工序维护_条码维护")
Dim dt2 As DataTable = DataTables("生产排产表")
Dim Cols1() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols2() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols3() As String = {"加工工序","加工内容","成品描述"}
Dim Cols4() As String = {"加工工序","加工内容","成品描述"}
For Each dr1 As DataRow In dt1.Select("")
    For Each dr3 As DataRow In dt2.Select("成品编码 = '" & dr1("成品编码")& "' and 生产批次 = '" & dr1("生产批次")& "'")
        Dim dr2 As DataRow = t1.find("成品编码 = '" & dr1("成品编码")& "' and 生产批次 = '" & dr1("生产批次")& "'")
        If dr2 Is Nothing Then
            dr2 = t1.addnew
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            For i As Integer = 0 To Cols3.Length -1
                dr2(Cols4(i)) = dr3(Cols3(i))
            Next
        end if
    Next
Next

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/5 14:19:00 [显示全部帖子]

Dim t1 As DataTable = e.Form.Controls("毛坯工序").Table.DataTable
Dim dt1 As DataTable = DataTables("毛坯工序维护_条码维护")
Dim dt2 As DataTable = DataTables("生产排产表")
Dim Cols1() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols2() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols3() As String = {"加工工序","加工内容","成品描述"}
Dim Cols4() As String = {"加工工序","加工内容","成品描述"}
For Each dr1 As DataRow In dt1.Select("")
    For Each dr3 As DataRow In dt2.Select("成品编码 = '" & dr1("成品编码")& "' and 生产批次 = '" & dr1("生产批次")& "' and 加工工序 = '" & dr1("加工工序") & "'")
        Dim dr2 As DataRow = t1.find("成品编码 = '" & dr1("成品编码")& "' and 生产批次 = '" & dr1("生产批次")& "' and 加工工序 = '" & dr1("加工工序") & "'")
        If dr2 Is Nothing Then
            dr2 = t1.addnew
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            For i As Integer = 0 To Cols3.Length -1
                dr2(Cols4(i)) = dr3(Cols3(i))
            Next
        end if
    Next
Next

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/1/5 17:11:00 [显示全部帖子]

Dim t1 As DataTable = e.Form.Controls("毛坯工序").Table.DataTable
Dim dt1 As DataTable = DataTables("毛坯工序维护_条码维护")
Dim dt2 As DataTable = DataTables("生产排产表")
Dim Cols1() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols2() As String = {"成品编码","毛坯编码","生产批次","批次序号","毛坯产地","投产日期"}
Dim Cols3() As String = {"加工工序","加工内容","成品描述"}
Dim Cols4() As String = {"加工工序","加工内容","成品描述"}
For Each dr1 As DataRow In dt1.Select("")
    For Each dr3 As DataRow In dt2.Select("成品编码 = '" & dr1("成品编码")& "' and 生产批次 = '" & dr1("生产批次")& "'")
        Dim dr2 As DataRow = t1.find("成品编码 = '" & dr3("成品编码")& "' and 生产批次 = '" & dr3("生产批次")& "' and 加工工序 = '" & dr3("加工工序") & "'")
        If dr2 Is Nothing Then
            dr2 = t1.addnew
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            For i As Integer = 0 To Cols3.Length -1
                dr2(Cols4(i)) = dr3(Cols3(i))
            Next
        end if
    Next
Next

 回到顶部