条码生成Function EAN13(BM As String )
Private BM
Dimension EAN_code[10,3]
EAN_code[1,1]='00000011110011'
EAN_code[1,2]='00110000111111'
EAN_code[1,3]='11111100001100'
EAN_code[2,1]='00001111000011'
EAN_code[2,2]='00111100001111'
EAN_code[2,3]='11110000111100'
EAN_code[3,1]='00001100001111'
EAN_code[3,2]='00001111001111'
EAN_code[3,3]='11110011110000'
EAN_code[4,1]='00111111001100'
EAN_code[4,2]='00001111110011'
EAN_code[4,3]='11000000001100'
EAN_code[5,1]='00110000001111'
EAN_code[5,2]='00001111110011'
EAN_code[5,3]='11001111110000'
EAN_code[6,1]='00111100000011'
EAN_code[6,2]='00111111000011'
EAN_code[6,3]='11000011111100'
EAN_code[7,1]='00110011111111'
EAN_code[7,2]='00000011001111'
EAN_code[7,3]='11001100000000'
EAN_code[8,1]='00111111001111'
EAN_code[8,2]='00001100000011'
EAN_code[8,3]='11000000110000'
EAN_code[9,1]='00111100111111'
EAN_code[9,2]='00000011000011'
EAN_code[9,3]='11000011000000'
EAN_code[10,1]='00000011001111'
EAN_code[10,2]='00001100111111'
EAN_code[10,3]='11111100110000'
Dimension EAN_left[10]
EAN_left[1]='111111'
EAN_left[2]='112122'
EAN_left[3]='112212'
EAN_left[4]='112221'
EAN_left[5]='121122'
EAN_left[6]='122112'
EAN_left[7]='122211'
EAN_left[8]='121212'
EAN_left[9]='121221'
EAN_left[10]='122121'
Dimension EAN_mode[8]
Store '' To EAN_mode
If Len(Alltrim(BM))12 .And. Val(BM)>0
Messagebox('EAN-13编码长度不规范',268,'信息提示')
Return ''
Else
EAN_mode[1]='000000000000000000'
EAN_mode[2]='110011'
For i=0 To 9
If Val(Substr(BM,1,1))=i
For ii=1 To 6
BMZ=Val(Substr(BM,ii+1,1))
MODE=Val(Substr(EAN_left[i+1],ii,1))
EAN_mode[3]=EAN_mode[3]+EAN_code[BMZ+1,MODE]
Endf
Endi
Endf
2021-12-24 17:30:10
6KB
tmsc
1