以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- 不知道错哪了? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133769)
|
-- 作者:hongye
-- 发布时间: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编辑过]
|
-- 作者:有点蓝
-- 发布时间:2019/4/19 21:56:00
--
Tables(t).Filter = "类别 =\'" & ns & "\' And 合同号 =\'" & ht & "\' And 款号 =\'" & kh & "\'"
|
-- 作者:hongye
-- 发布时间: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
-- 发布时间: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
可以分组了,但是这样显示不正确
|
-- 作者:hongyefor
-- 发布时间:2019/4/19 22:42:00
--
此主题相关图片如下:无法显示.jpg
此主题相关图片如下:无法显示2.jpg
|
-- 作者:有点蓝
-- 发布时间:2019/4/20 9:44:00
--
分成几次处理,先遍历上海仓的数据添加到listview,然后再同样的方法遍历其它仓的数据添加到listview
Dim drs = dt.Select("款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\' and 分仓信息=\'上海仓\'", "_sortkey")
|
-- 作者:hongyefor
-- 发布时间:2019/4/20 15:53: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 drs = dt.Select("款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\'", "_sortkey") \'Dim ggs = dt.GetValues("规格", "款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\'", "_sortkey") Dim gfc2 As List(Of String) = dt.GetValues("分仓信息", "款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\'") Dim gfc3 As new List(Of String) For Each fc As String In dt.GetValues("分仓信息") If gfc2.Contains(fc) Then gfc3.Add(fc) Next 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.Groups.Clear() \'清除原来的分组 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("分仓信息", "款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\'") \'增加分组 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.Group = dr("分仓信息") \'------------------------------------------------------------ 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
不知道怎么写了
|
-- 作者:hongyefor
-- 发布时间:2019/4/20 17:12: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 drs = dt.Select("款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\'", "_sortkey") \'Dim ggs = dt.GetValues("规格", "款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\'", "_sortkey") Dim gfc2 As List(Of String) = dt.GetValues("分仓信息", "款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\'") Dim gfc3 As new List(Of String) Dim Products As New List(Of String) Products = DataTables("箱单数据").GetValues("分仓信息","","_sortkey") For ie As Integer = 0 To Products.Count -1 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 & "%\'and 分仓信息 = \'" & Products(ie) & "\'") 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.Groups.Clear() \'清除原来的分组 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 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 \'-------------------------------------------------------------------- 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.Group = dr("分仓信息") \'------------------------------------------------------------ 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
搞了老半天还是没搞出来
|
-- 作者:有点蓝
-- 发布时间:2019/4/20 17:28:00
--
…… \'--------------------------分组-------------------------------------- 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 fc as string in Products 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 dt.Select("款号 = \'" & dm.Text & "\'and 合同号 like \'%" & cj.Text & "%\' and 分仓信息 = ‘" & fc & "’", "_sortkey") 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.Group = fc \'------------------------------------------------------------ r("颜色") = dr("颜色") xhs = dr("箱号") xs = 1
|
-- 作者:hongyefor
-- 发布时间:2019/4/20 17:36:00
--
此主题相关图片如下:wt12.jpg
问题是没有了,但是箱号出问题了,4-6应该是单独显示4和6而不是显示4-6
|