求纠正如下代码::
实现同一物品名称的数据 只统计最后一行的库存记录 种类为一种
Dim cnt As Integer = DataTables("入库出库").Select("库存 <= 300").Count
If cnt > 0 Then
Tables("入库出库").filter = "库存 <= 300"
messagebox.show("总共有" & cnt & "件物品急需采购!","提 示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Dim ls As List(Of String) = DataTables("入库出库").GetValues("物品名称", "库存 <= 300 and 物品名称 is not null")
Dim idxs As String = "-1,"
Dim info As String = ""
For Each s As String In ls
Dim fdr As DataRow = DataTables("入库出库").Find("物品名称 = '" & s & "'", "入库时间 desc, 出库时间 desc")
If fdr IsNot Nothing Then
idxs &= fdr("_Identify") & ","
Info &= "【" & s & "】" & "{库存:" & fdr("库存") & ";需购:" & 300- fdr("库存") & "}" & vbcrlf
End If
Next
Tables("入库出库").Filter = "_Identify in (" & idxs.TrimEnd(",") & ")"