Foxtable(狐表)用户栏目专家坐堂 → 不知道错哪了?


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

主题:不知道错哪了?

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


加好友 发短信
等级:一尾狐 帖子:437 积分:2949 威望:0 精华:0 注册:2011/3/15 12:49:00
不知道错哪了?  发帖心情 Post By:2019/4/19 21:53:00 [显示全部帖子]

Dim ht As WinForm.TextBox = e.Form.Controls("TextBox1").Value
Dim kh As WinForm.TextBox = e.Form.Controls("TextBox2").Value
Dim pg As WinForm.TabControl = e.Form.Controls("TabControl1")
Dim n As String = pg.SelectedPage.Text     '定义n为当前页签的名称
Dim ns As String =  n.SubString(0,2)
Dim t As String = "订单装箱配置_" & n
Dim s As String = "装箱配置_" & n
Select Case  e.Sender.SelectedIndex
    Case 0,1
Tables(t).Filter = "类别 ='" & ns  & "' And 合同号 ='" & ht  & '" And 款号 ='" & kh  & "'"
End Select
[此贴子已经被作者于2019/4/19 21:53:45编辑过]

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


加好友 发短信
等级:一尾狐 帖子:437 积分:2949 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2019/4/19 22:22:00 [显示全部帖子]

Dim cj As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dm As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
If cj.text <> Nothing AndAlso dm.text <> Nothing Then
    Dim dt As DataTable = DataTables("箱单数据")
    Dim drs = dt.Select("款号 = '" & dm.Text & "'and 合同号 like '%" & cj.Text & "%'", "_sortkey")
    'Dim ggs = dt.GetValues("规格", "款号 = '" & dm.Text & "'and 合同号 like '%" & cj.Text & "%'", "_sortkey")
    Dim ggs() As String ={"XXXS","XXS","XS","S","M","L","XL","XXL","XXXL","F","60","65","70","75","80","85","90","95","100","105","110","115","120","125","130","135","140","145","150","155","160","165","170","175","180","185","190","195","200"}
    Dim ggs2  As List(Of String) = dt.GetValues("规格", "款号 = '" & dm.Text & "'and 合同号 like '%" & cj.Text & "%'")
    Dim ggs3  As new List(Of String)
    For Each gg As String In ggs
        If ggs2.Contains(gg) Then ggs3.Add(gg)
    Next
    lvw.StopRedraw() '暂停绘制
    lvw.Columns.Clear() '清除原来的列
    lvw.Rows.Clear() '清除原来的行
    lvw.View = ViewMode.Details '显示模式为详细信息
    lvw.GridLines = True '显示网格线
    Dim cls() As String = {"颜色","箱号"} '定义列名
    Dim wds() As String = {80,50} '定义列宽
    For i As Integer = 0 To  cls.Length - 1  '增加列
        Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
        c.Text = cls(i) '指定列标题
        c.Name = cls(i) '指定列名
        c.Width = wds(i) '指定列宽
    Next
    For Each gg As String In ggs3
        Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
        c.Text = gg
        c.Name = gg
        c.Width = 30
    Next
    cls = new String() {"箱数","数量"} '定义列名
    wds = new String()  {40,40} '定义列宽
    For i As Integer = 0 To  cls.Length - 1  '增加列
        Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
        c.Text = cls(i) '指定列标题
        c.Name = cls(i) '指定列名
        c.Width = wds(i) '指定列宽
    Next
    For Each zh As String In dt.GetValues("颜色") '增加分组
        Dim grp As WinForm.ListViewGroup = lvw.Groups.Add()
        grp.Name = zh
        grp.Text = zh
    Next

    Dim pdr As DataRow = Nothing
    Dim xs As Double = 0
    Dim xhs As String = ""
    Dim sl As Double = 0
    Dim pr As object = Nothing
    For Each dr As DataRow In drs
        If pdr Is Nothing OrElse pdr("规格") <> dr("规格") OrElse pdr("颜色") <> dr("颜色") OrElse pdr("数量") <> dr("数量")Then
            If pr IsNot Nothing Then
                pr("箱号") = xhs.trim("-")
                pr(pdr("规格")) = pdr("数量")
                pr("箱数") = xs
                pr("数量") = sl
                Dim arr() As String = pr("箱号").split("-")
                If arr.length > 2
                    pr("箱号") = arr(0) & "-" & arr(arr.length - 1)
                End If
            End If
            Dim r As  WinForm.ListViewRow =  lvw.Rows.Add() '增加一行
            r("颜色") = dr("颜色")
            xhs = dr("箱号")
            xs = 1
            sl = dr("数量")
            pr = r
        Else
            xhs &= "-" & dr("箱号")
            xs += 1
            sl += dr("数量")
        End If
        pdr = dr
    Next
    If drs.count > 0
        Dim dr = drs(drs.count - 1)
        If pr IsNot Nothing Then
            pr("箱号") = xhs.trim("-")
            pr(pdr("规格")) = dr("数量")
            pr("箱数") = xs
            pr("数量") = sl
        End If
    End If
    lvw.ResumeRedraw
    Dim sll As WinForm.Label = e.Form.Controls("Label1")
    sll.Visible = True
    Dim Sum As Integer
    Dim Sum1 As Integer
    Dim Sum2 As Integer
    For Each dr As DataRow In drs
        Sum = Sum + dr("数量")
        sum1 = lvw.Columns.Count - 4
        sum2 = lvw.Rows.Count
    Next
    sll.text ="合计件数: "  & Sum &  " 件, 共 " & sum1 & " 列 " & sum2 & " 行"
End If

怎么不分组,只显示 default---------

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


加好友 发短信
等级:一尾狐 帖子:437 积分:2949 威望:0 精华:0 注册:2011/3/15 12:49:00
  发帖心情 Post By:2019/4/19 22:41:00 [显示全部帖子]

Dim cj As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dm As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
If cj.text <> Nothing AndAlso dm.text <> Nothing Then
    Dim dt As DataTable = DataTables("箱单数据")
    Dim drs = dt.Select("款号 = '" & dm.Text & "'and 合同号 like '%" & cj.Text & "%'", "_sortkey")
    'Dim ggs = dt.GetValues("规格", "款号 = '" & dm.Text & "'and 合同号 like '%" & cj.Text & "%'", "_sortkey")
    Dim ggs() As String ={"XXXS","XXS","XS","S","M","L","XL","XXL","XXXL","F","60","65","70","75","80","85","90","95","100","105","110","115","120","125","130","135","140","145","150","155","160","165","170","175","180","185","190","195","200"}
    Dim ggs2  As List(Of String) = dt.GetValues("规格", "款号 = '" & dm.Text & "'and 合同号 like '%" & cj.Text & "%'")
    Dim ggs3  As new List(Of String)
    For Each gg As String In ggs
        If ggs2.Contains(gg) Then ggs3.Add(gg)
    Next
    lvw.StopRedraw() '暂停绘制
    lvw.Columns.Clear() '清除原来的列
    lvw.Rows.Clear() '清除原来的行
    lvw.View = ViewMode.Details '显示模式为详细信息
    lvw.GridLines = True '显示网格线
    Dim cls() As String = {"颜色","箱号"} '定义列名
    Dim wds() As String = {80,50} '定义列宽
    For i As Integer = 0 To  cls.Length - 1  '增加列
        Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
        c.Text = cls(i) '指定列标题
        c.Name = cls(i) '指定列名
        c.Width = wds(i) '指定列宽
    Next
    '--------------------------分组--------------------------------------
    For Each zh As String In dt.GetValues("分仓信息", "款号 = '" & dm.Text & "'and 合同号 like '%" & cj.Text & "%'") '增加分组
        Dim grp As WinForm.ListViewGroup = lvw.Groups.Add()
        grp.Name = zh
        grp.Text = zh
    Next
    '--------------------------------------------------------------------
    For Each gg As String In ggs3
        Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
        c.Text = gg
        c.Name = gg
        c.Width = 30
    Next
    cls = new String() {"箱数","数量"} '定义列名
    wds = new String()  {40,40} '定义列宽
    For i As Integer = 0 To  cls.Length - 1  '增加列
        Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
        c.Text = cls(i) '指定列标题
        c.Name = cls(i) '指定列名
        c.Width = wds(i) '指定列宽
    Next
   
    Dim pdr As DataRow = Nothing
    Dim xs As Double = 0
    Dim xhs As String = ""
    Dim sl As Double = 0
    Dim pr As object = Nothing
    For Each dr As DataRow In drs
        If pdr Is Nothing OrElse pdr("规格") <> dr("规格") OrElse pdr("颜色") <> dr("颜色") OrElse pdr("数量") <> dr("数量")Then
            If pr IsNot Nothing Then
                pr("箱号") = xhs.trim("-")
                pr(pdr("规格")) = pdr("数量")
                pr("箱数") = xs
                pr("数量") = sl
                Dim arr() As String = pr("箱号").split("-")
                If arr.length > 2
                    pr("箱号") = arr(0) & "-" & arr(arr.length - 1)
                End If
            End If
            Dim r As  WinForm.ListViewRow =  lvw.Rows.Add() '增加一行
            r("颜色") = dr("颜色")
            xhs = dr("箱号")
            xs = 1
            sl = dr("数量")
            pr = r
'----------------------分组----------------------------------
            r.Group = dr("分仓信息")
'------------------------------------------------------------
        Else
            xhs &= "-" & dr("箱号")
            xs += 1
            sl += dr("数量")
        End If
        pdr = dr
    Next
    If drs.count > 0
        Dim dr = drs(drs.count - 1)
        If pr IsNot Nothing Then
            pr("箱号") = xhs.trim("-")
            pr(pdr("规格")) = dr("数量")
            pr("箱数") = xs
            pr("数量") = sl
        End If
    End If
    lvw.ResumeRedraw
    Dim sll As WinForm.Label = e.Form.Controls("Label1")
    sll.Visible = True
    Dim Sum As Integer
    Dim Sum1 As Integer
    Dim Sum2 As Integer
    For Each dr As DataRow In drs
        Sum = Sum + dr("数量")
        sum1 = lvw.Columns.Count - 4
        sum2 = lvw.Rows.Count
    Next
    sll.text ="合计件数: "  & Sum &  " 件, 共 " & sum1 & " 列 " & sum2 & " 行"
End If

可以分组了,但是这样显示不正确

 回到顶部