1,思路:扫描标签条码,得到相应的数据
2,遇到的问题:可能部分标签会存在2个条码,1个是69商品条码一般是13位的,另1个是数据条码一般是19位的(有时也有13位的但是开头一般不是69,这个暂时不去管它),我需要扫描19位的条码,但是又担心扫到69商品条码,又担心扫错其他小于19位的条码。
3,现在想要实现的是,我扫码等于19位的才可以,大于19位或者小于19位都会弹出窗口提示错误,下面代码如何去改
Dim smq As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim kh As WinForm.Label = e.Form.Controls("Label1")
Dim ys As WinForm.Label = e.Form.Controls("Label2")
Dim gg As WinForm.Label = e.Form.Controls("Label3")
Dim wm As WinForm.Label = e.Form.Controls("Label4")
Dim tm As WinForm.Label = e.Form.Controls("Label5")
If smq IsNot Nothing
If smq.text.Length = 19 Then
With Tables("装箱数据")
Dim r As Integer
r = .Find(smq.text, .RowSel + 1, "条码数据", False, False, True)
If r > - 1 Then '如果找到符合条件的行
smq .ForeColor = Color.Red
kh.text = smq.text.SubString(0,9)
kh.ForeColor = Color.Red
ys.text = smq.text.SubString(9,3)
ys.ForeColor = Color.Red
gg.text = smq.text.SubString(12,2)
gg.ForeColor = Color.Red
wm.text = smq.text.SubString(14,5)
wm.ForeColor = Color.Red
Dim Result As DialogResult
Result = MessageBox.Show("扫码重复请检查是否存在装箱错误" & vblf & smq.text, "提示", MessageBoxButtons.ok, MessageBoxIcon.Question)
If Result = DialogResult.ok Then
smq.Value = ""
End If
Else
tm.text = smq.text
kh.text = smq.text.SubString(0,9)
ys.text = smq.text.SubString(9,3)
gg.text = smq.text.SubString(12,2)
wm.text = smq.text.SubString(14,5)
Dim zxtb As Row = Tables("装箱数据").AddNew
zxtb("条码数据") = smq.text
zxtb("款号") = kh.text
zxtb("颜色") = ys.text
zxtb("规格") = gg.text
zxtb("唯一码") = wm.text
smq.Value = ""
End If
End With
Else
Dim Result As DialogResult
Result = MessageBox.Show("扫码位数错误" , "提示", MessageBoxButtons.ok, MessageBoxIcon.Question)
If Result = DialogResult.ok Then
smq.Value = ""
End If
End If
End If