……
'--------------------------分组--------------------------------------
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