Foxtable(狐表)用户栏目专家坐堂 → 代码整合问题


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

主题:代码整合问题

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


加好友 发短信
等级:二尾狐 帖子:573 积分:2961 威望:0 精华:0 注册:2016/10/27 14:33:00
  发帖心情 Post By:2016/11/22 14:26:00 [显示全部帖子]

Dim ddh As WinForm.TextBox = e.Form.Controls("合同号")
Dim shk As WinForm.TextBox = e.Form.Controls("款号")
Dim dtr5 As String = e.Form.Controls("Ts_8_8").text
If shk.text > "" And ddh.text > "" Then
    Dim filter As String = "合同号 = '" & ddh.Text & "'And 款号 = '" & shk.Text & "' "
    Dim drZ As  List(Of DataRow) = DataTables("订单主表").Select(filter)
    For Each r As DataRow In drZ
        Dim Parts() As String = dtr5.Split("+")
        r("数量") = Parts(0)
    Next
   
    For k As Integer = 1 To 7
        For l As Integer = 1 To 7
            Dim dr As String = e.Form.Controls("Ts_" & l & "_" & k).text
            Dim dr2 As String = e.Form.Controls("Tg_"  & k).text
            Dim dr3 As String = e.Form.Controls("Tsy_" & l).text
            If dr > "" And dr2 > "" And dr3 > ""  Then
                Dim temp As String = filter & " and 颜色 = '" & dr3 & "' and 规格 = '" & dr2 & "'"
                Dim fdr As DataRow = DataTables("订单数量明细").find(temp)
                msgbox(temp)
                If fdr IsNot Nothing Then
                    fdr("数量") = dr
                Else
                    Dim Tea() As String ={"合同号","款号"}
                    Dim r As Row = Tables("订单数量明细").AddNew
                    For Each TTL As String In Tea
                        r(TTL) = e.Form.Controls(TTL).text
                    Next
                    r("颜色") = dr3
                    r("规格") = dr2
                    r("数量") = dr
                End If
            End If
        Next
    Next
    If DataTables("订单主表").HasChanges Or DataTables("订单数量明细").HasChanges  Then
        If MessageBox.Show("款号为" & shk.text & "的订单已经被修改,是否保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
            DataTables("订单数量明细").Save()
            DataTables("订单主表").Save()
            MessageBox.Show("订单更新完成,请打印!")
        End If
    End If
End If

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


加好友 发短信
等级:二尾狐 帖子:573 积分:2961 威望:0 精华:0 注册:2016/10/27 14:33:00
  发帖心情 Post By:2016/11/24 12:57:00 [显示全部帖子]

Dim ddh As WinForm.TextBox = e.Form.Controls("合同号")
Dim shk As WinForm.TextBox = e.Form.Controls("款号")
Dim filter As String = "合同号 = '" & ddh.Text & "'And 款号 = '" & shk.Text & "' "
For i1 As Integer = 1 To 9
    Dim drm1 As String = e.Form.Controls("Tml_"  & i1 & "_1" ).text
    Dim drm2 As String = e.Form.Controls("Tml_"  & i1 & "_2" ).text
    Dim drm7 As String = e.Form.Controls("Tml_" & i1 & "_7" ).text
    Dim drm8 As String = e.Form.Controls("Tml_" & i1 & "_8" ).text
    If drm1 <> "" And drm2 <> "" And drm7<> ""  And drm8<> ""  Then
        If shk.text > "" And ddh.text > "" Then
            Dim drs As List(Of DataRow) = DataTables("订单面料明细").Select(filter & " and 面料名称 = '" & e.Form.controls("Tml_" & i1 & "_2" ).Text & "' and 面料颜色 = '" & e.Form.controls("Tml_" & i1 & "_1" ).Text & "'")
            If drs.count = 0 Then
                Dim dr As DataRow = DataTables("订单面料明细").AddNew
                dr("合同号") = ddh.text
                dr("款号") = shk.text
                dr("面料名称") = e.Form.controls("Tml_" & i1 & "_2").Text
                dr("面料规格") = e.Form.controls("Tml_" & i1 & "_3" ).Text
                dr("面料颜色") = e.Form.controls("Tml_" & i1 & "_1" ).Text
                dr("面料成分") = e.Form.controls("Tml_" & i1 & "_4").Text
                dr("面料门幅") = e.Form.controls("Tml_" & i1 & "_6" ).Text
                dr("面料单位") = e.Form.controls("Tml_" & i1 & "_5" ).Text
                dr("面料单耗") = e.Form.controls("Tml_" & i1 & "_7").Text
                dr("面料合计") = e.Form.controls("Tml_" & i1 & "_8" ).Text
                dr("供应商") = e.Form.controls("Tml_" & i1 & "_9" ).Text
            Else
                For ir As Integer = 0 To drs.count-1
                    drs(ir)("面料名称") = e.Form.controls("Tml_" & i1 & "_2").Text
                    drs(ir)("面料规格") = e.Form.controls("Tml_" & i1 & "_3" ).Text
                    drs(ir)("面料颜色") = e.Form.controls("Tml_" & i1 & "_1" ).Text
                    drs(ir)("面料成分") = e.Form.controls("Tml_" & i1 & "_4").Text
                    drs(ir)("面料门幅") = e.Form.controls("Tml_" & i1 & "_6" ).Text
                    drs(ir)("面料单位") = e.Form.controls("Tml_" & i1 & "_5" ).Text
                    drs(ir)("面料单耗") = e.Form.controls("Tml_" & i1 & "_7").Text
                    drs(ir)("面料合计") = e.Form.controls("Tml_" & i1 & "_8" ).Text
                    drs(ir)("供应商") = e.Form.controls("Tml_" & i1 & "_9" ).Text
                Next
               
            End If
        End If
    End If
Next

 回到顶部