根据GS1标准(http://www.databar-barcode.info/application-identifiers/),条形码中的可变长度字段在结束时应该有一个中断标志来发出信号。
测试中的.zpl打印机代码如下:
^200,200,FT250,860^BXN,12,200,0,0,6,~ ^FH\^FD\7E10012345678912345678910123\7E1151606013712\7E1^FS
这是根据(http://www.servopack.de/support/zebra/ZPLbasics.pdf)编写的,当我将其扫描到Notepad++中时,我发现在代码中应用了断点,如下图所示。
但是,当我试图在我的VB6应用程序中扫描它时,它似乎没有捕捉到中断标志,并将从10 (批号)开始的所有内容写入批号,而不是在15 (到期日期)之前中断。
我的代码如下所示:
ElseIf Left(Data, 2) = AI_BATCH Or Left(Data, 6) = "<GS>10" Or Left(Data, 3) = "~10" Then
If Left(Data, 2) = AI_BATCH Then
Data = Mid(Data, 3)
ElseIf Left(Data, 6) = "<GS>10" Then
Data = Mid(Data, 7)
ElseIf Left(Data, 3) = "~10" Then
Data = Mid(Data, 4)
End If
' Calculate length
While Mid(Data, AI_BATCH_LEN + 1, 1) <> "" And Mid(Data, AI_BATCH_LEN + 1, 1) <> "~" And Mid(Data, AI_BATCH_LEN + 1, 1) <> "<"
AI_BATCH_LEN = AI_BATCH_LEN + 1
Wend
gs1.batch = Trim(Left(Data, AI_BATCH_LEN))
Data = Mid(Data, 1 + AI_BATCH_LEN)
提前谢谢。
发布于 2016-03-24 10:47:11
您似乎在寻找两个ASCII字符'G'
和'S'
,但您应该寻找单个'GS'
字符- GS
是ASCII控制字符29 (组分隔符)。
这个字符不能作为字母打印,所以Notepad++ (及其使用的字体)代替了您看到的图形字形。
使用chrw$(29)
定位此字符:
x = "Hello" & chrw$(29) & "World"
?x
HelloWorld
?left$(x, instr(x, chrw$(29)) - 1)
Hello
https://stackoverflow.com/questions/36195617
复制相似问题