If e.KeyCode = Keys.Enter Then
Dim str() As String = txt.text.split("|") \'字符串转数组
If str.Length = 7 Then \'必须增加条码判断
Dim cj As String = IIf(str(5) = "null" , Nothing , str(5)) \'生产车间(班组)不为空才赋值
If cj > "" Then
Dim dr As DataRow = DataTables(tbl.Name).Find("生产车间 = \'" & cj & "\'")
If dr IsNot Nothing Then
Dim bh As String = dr("单据编号")
Dim r As Row = Tables(e.form.name & "_明细").AddNew
r("产品编码") = str(0)
r("生产单号") = str(1)
r("姓名") = IIf(str(4) = "null" , Nothing , str(4)) \'姓名不为空才赋值
r("师傅") = IIf(str(6) = "null" , Nothing , str(6)) \'姓名不为空才赋值
r("单据编号") = bh \'重新给关联列赋值
End If
End If
txt.text = Nothing \'清空扫码值
e.Sender.Select()
End If
e.Cancel = true \'如果用这句,有时扫码后不操作
End If