JH625项目条码格式更改,在编程过程中,出现了 更改任何格式,条码打印出来的格式都没有改变,源码如下:
Public Function GetBarcodeStr2DG(ByVal PrintProductCode1 As String, ByVal PrintProductType1 As String, ByVal PrintDateStr1 As String, ByVal PrintBatchStr1 As String, ByVal PrintDescribeCode1 As String) As String
Dim t As
String
Dim d As String
Dim n As String
d =
Microsoft.VisualBasic.Left(PrintProductCode1, 20) '取条码位数
t = Microsoft.VisualBasic.Right(PrintProductCode1,
11)
n = t + " " + LogSysCode
Dim str0 As String
str0 = ""
str0 +=
"<STX><ESC>C0<ETX>" & vbCrLf
str0 += "<STX><SI>l31<ETX>" &
vbCrLf
str0 +=
"<STX><ESC>P;<ETX>" & vbCrLf
str0 += "<STX>E*;F*;<ETX>" &
vbCrLf
str0 += "<STX>E2,1;A2,;<ETX>"
& vbCrLf
str0 +=
"<STX>L39;D0;<ETX>" & vbCrLf
str0 += "<STX>B0,Barcode ;o350,800;f3;c17;h8;w8;d0,50<ETX>" &
vbCrLf
'str0 += "<STX>H1,Part/Batch
;o200,50;f3;h15;w15;c26,d0,30;<ETX>" & vbCrLf
str0 += "<STX>H1,Barcode
;o350,100;f3;h20;w20;c26;d0,80;<ETX>" & vbCrLf
str0 += "<STX>H2,Date
;o250,100;f3;h20;w20;c26;d0,30;<ETX>" & vbCrLf
str0 +=
"<STX>H3,description;o150,100;f3;h20;w25;c3;d0,40;<ETX>" &
vbCrLf
str0 += "<STX>H4,Area
;o180,1000;f3;h15;w15;c26;d0,30;<ETX>" & vbCrLf
'str0 += "<STX>H5,Barcode
;o20,530;f0;h10;w8;c26;d0,30;<ETX>" & vbCrLf
str0 += "<STX>R<ETX>" & vbCrLf
str0 +=
"<STX><ESC>E1<CAN><ETX>" & vbCrLf
str0 += "<STX><ESC>k<ETX>" &
vbCrLf
str0 +=
"<STX><ESC>F0<LF>" & PrintProductCode1 & "<ETX>"
& vbCrLf
'str0 +=
"<STX><ESC>F1<LF>" & PrintProductType1 & "/" &
PrintBatchStr1 & "<ETX>" & vbCrLf
str0 += "<STX><ESC>F1<LF>" & d & "<ETX>" &
vbCrLf
str0 +=
"<STX><ESC>F2<LF>" & n & "<ETX>" & vbCrLf
str0 += "<STX><ESC>F3<LF>" &
PrintDescribeCode1 & "<ETX>" & vbCrLf
'str0 += "<STX><ESC>F4<LF>" &
LogSysCode & "<ETX>" & vbCrLf
'str0 += "<STX><ESC>F5<LF>" & PrintProductCode1 &
"<ETX>" & vbCrLf
str0 +=
"<STX><RS>1<ETX>" & vbCrLf
str0 += "<STX><SI>R1<ETX>" & vbCrLf
str0 += "<STX><SI>r100<ETX>"
& vbCrLf
str0 +=
"<STX><US>1<ETX><STX><ETB><ETX><STX><FF><ETX>"
& vbCrLf
Return str0
End Function
通过调试发现,以前编程的格式,缺少了需多命令行,缺少的命令是以下标红行,如下:
'类型为15
Public Function
GetBarcodeStr2D9(ByVal PrintProductCode1 As String, ByVal PrintProductType1 As
String, ByVal PrintDateStr1 As String, ByVal PrintBatchStr1 As String, ByVal
PrintDescribeCode1 As String) As String
Dim t As
String
Dim d As String
Dim n As String
Dim
a1 As Integer
Dim a2 As String
Dim a3 As String
Dim num As Integer
a1 =
Len(PrintDescribeCode1) '打印描述位数
num = a1 - 11
a2 = Microsoft.VisualBasic.Mid(PrintDescribeCode1,
1, num) '取描述信息
a3 = Microsoft.VisualBasic.Right(PrintDescribeCode1, 11) '取3C信息
d =
Microsoft.VisualBasic.Left(PrintProductCode1, 20) '取条码位数
t = Microsoft.VisualBasic.Right(PrintProductCode1,
11)
n = t + " " + LogSysCode
Dim str0 As String
str0 = ""
str0 +=
"<STX><ESC>C0<ETX>" & vbCrLf
str0 += "<STX><SI>l31<ETX>" &
vbCrLf
str0 +=
"<STX><ESC>P;<ETX>" & vbCrLf
str0 += "<STX>E*;F*;<ETX>" &
vbCrLf
str0 += "<STX>E2,1;A2,;<ETX>"
& vbCrLf
str0 +=
"<STX>L39;D0;<ETX>" & vbCrLf
str0 += "<STX>B0,Barcode ;o400,800;f3;c17;h8;w8;d0,50<ETX>" &
vbCrLf
'str0 += "<STX>H1,Part/Batch
;o200,50;f3;h15;w15;c26,d0,30;<ETX>" & vbCrLf
str0 += "<STX>H1,Barcode
;o400,100;f3;h20;w20;c26;d0,80;<ETX>" & vbCrLf
str0 += "<STX>H2,Date
;o300,100;f3;h20;w20;c26;d0,40;<ETX>" & vbCrLf
str0 +=
"<STX>H3,description;o100,100;f3;h20;w25;c3;d0,40;<ETX>" &
vbCrLf
'str0 += "<STX>H4,Area
;o380,1000;f3;h15;w15;c26;d0,30;<ETX>" & vbCrLf
str0 +=
"<STX>H4,description;o200,100;f3;h20;w20;c26;d0,40;<ETX>" &
vbCrLf
'str0 += "<STX>H5,Barcode
;o20,530;f0;h10;w8;c26;d0,30;<ETX>" & vbCrLf
str0 += "<STX>R<ETX>" & vbCrLf
str0 += "<STX>R<ETX>" & vbCrLf
str0 +=
"<STX><ESC>E*<CAN><ETX>" & vbCrLf
str0 += "<STX><ESC>k<ETX>" &
vbCrLf
str0 +=
"<STX><SI>g1<SI>T1<SI>R0<SI>r0<SI>D0<SI>c0<SI>t0<SI>l0<SI>F-10<SI>f0<SI>L1000<SI>i0<SI>S30<SI>d8<ETX>"
& vbCrLf
str0 +=
"<STX><ESC>E2,1<CAN><ETX>" & vbCrLf
str0 += "<STX><ESC>F0<LF>" &
PrintProductCode1 & "<ETX>" & vbCrLf
'str0 += "<STX><ESC>F1<LF>" &
PrintProductType1 & "/" & PrintBatchStr1 & "<ETX>" &
vbCrLf
str0 +=
"<STX><ESC>F1<LF>" & d & "<ETX>" & vbCrLf
str0 += "<STX><ESC>F2<LF>" &
n & "<ETX>" & vbCrLf
str0 +=
"<STX><ESC>F3<LF>" & a2 & "<ETX>" &
vbCrLf
str0 +=
"<STX><ESC>F4<LF>" & a3.Trim & "<ETX>" &
vbCrLf
'str0 +=
"<STX><ESC>F4<LF>" & LogSysCode & "<ETX>" &
vbCrLf
'str0 +=
"<STX><ESC>F5<LF>" & a3 & "<ETX>" &
vbCrLf
str0 +=
"<STX><RS>1<ETX>" & vbCrLf
str0 += "<STX><SI>R1<ETX>" & vbCrLf
str0 += "<STX><SI>r100<ETX>"
& vbCrLf
str0 +=
"<STX><US>1<ETX><STX><ETB><ETX><STX><FF><ETX>"
& vbCrLf
Return str0
End Function