Dim ti As WinForm.TextBox = e.Form.Controls("TextBox_PDF")
Dim all As Integer =0
Dim repeat As Integer = 0
If ti.lines.Length > 0 Then
For i As Integer = 0 To ti.Lines.Length - 1
If (i Mod 3 = 0 ) Then ’我的pdf粘贴出来后,逢 1 4 7行是数据,其他行是垃圾文字
Dim s As String = ti.Lines(i)
s= s.Trim
Dim Values() As String
Values = s.split(" ")
If Values.Length > = 5 Then
Dim bar As String = Values(1)
Dim qty As Integer = Values(Values.Length -5)
Dim tg As Table = Tables("JOQuotationMain.JOQuotationDetail")
Dim pg As Integer
pg = tg.Findrow("JOItemCode ='" & bar & "'")
If pg > - 1 Then '如果找到符合条件的行
If pg > -1 Then
tg.Position = pg '则选择该行
Dim nowr As Row = tg.Current
nowr("JOQuotationQty") = nowr("JOQuotationQty") + qty
repeat =repeat +1 '对应产品数量+1
End If
Else '找不到,就新增
Dim filter As String = "JOItemCode = '" & bar & "'"
Dim dr As DataRow = DataTables("JOItemInfo").SQLFind (filter)
If dr IsNot Nothing Then
If DataTables("JOItemInfo").find(filter) Is Nothing Then '判断是否加载,没加载就加载
DataTables("JOItemInfo").AppendLoad(filter)
End If
Dim r As Row = tg.AddNew
r("JOItemID")= dr("JOItemID")
r("JOQuotationQty") = qty
tg.AutoSizeCols
all=all+1
Else
MessageBox.Show("找不到第" & (i/3) & "行条码为" & bar & "的样板,请用笔和纸记录下来,并完善样板资料")
End If
End If
Else
MessageBox.show("第" & (i/3) & "款信息有误,读取失败,请用笔和纸记录下来")
End If
End If
Next
ti.Text=""
MessageBox.show("产品识别完成," & repeat & "款重复," & all & "款新增")
Else
MessageBox.show("请先粘贴订单PDF表格明细内容")
End If