'导入TXT文件,其文件格式必须为"条码号,数量",在导入的时候,相同条码的数量可以累加
Dim strs As String = FileSys.ReadAllText(e.Form.Controls("ComboBox1").Text,Encoding.Default)
strs = strs.Replace(vblf,"")
Dim rs() As String = strs.Split(vbcr)
Tables("订单.订单明细").StopRedraw()
For i As Integer = 0 To rs.Length - 1
Dim cs() As String = rs(i).Split(",") '以","为记号将每行的内容拆分为两部分
If cs.Length = 2 Then
Dim tm As String = cs(0)
Dim sl As Integer = cs(1)
Dim er As Row
Dim idx As Integer = Tables("订单.订单明细").Find(tm,0,"条码号",False,True,False)
If idx > -1 Then
Tables("订单.订单明细").Rows(idx)("数量") += sl
Else
er = Tables("订单.订单明细").AddNew
er("条码号")= tm
er("数量")= sl
End If
End If
Next
Tables("订单.订单明细").ResumeRedraw
e.Form.Close() '关闭本窗口