1
나는 태그와 저장소에서 TID를 읽는 ZPL을 보내기 위해 Python을 사용하여 TCP/IP를 통해 Zebra R600 (최신 펌웨어) 프린터와 통신합니다. ZPL^HV를 사용하는 파일에서.Zebra 프린터가 TCP/IP를 통해 전체 24 개가 아닌 짧은 TID를 반환합니다.
내 문제는 모든 80 개 태그 정도 (임의) 메신저 프린터에서 나는 프린터 캐시를 변경하는 것을 시도했다
(아래 예) 짧은 TID를 받고 있지만 어떤 영향을 미칠 것 같지 않은 것입니다 문제는 아주 무작위이며 짧은 출력은 일반 태그에서 나온 것입니다. 제안 사항이 있으십니까?
내 코드 :
#!/usr/bin/env python
import socket
import os.path
from os import rename
global data
global count
count = 0
def writeTID(tid):
f = open("UID_list.txt",'a')
f.write(str(tid) + "\n")
f.close()
def Read_TID(quantity):
global count
f = open("UID_list.txt",'a')
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
for x in range(0,int(quantity)):
zpl = """
^XA
^RSB,B30,236,3,N
^RR10
^XZ
^XA
^SZ2^JMA
^MCY^PMN
^PW1215^MTT
^MNW
~JSN
~SD18^MD0
^PR8,8,8
^JZY
^LH0,0^LRN
^FN4^FS
^FN4^RFR,H,0,12,2^FS
^FH_^HV4,24,,,L^FS
^PQ1,0,1,Y^XZ
"""
print "Tag number:"+str(x+1)
s.send(str(zpl))
data = s.recv(BUFFER_SIZE)
print "Received data:", data
f.write(str(data) + "\n")
if (len(data)<24):
count+=1
print "\nnumber of errors: "+str(count)
s.close()
f.close()
#printer settings
TCP_IP = '192.168.7.220'
TCP_PORT = 9100
BUFFER_SIZE = 1024
print ("\t\t\t ##############################################################")
print ("\t\t\t ##############################################################")
print ("\t\t\t ####### #########")
print ("\t\t\t ####### TID file maker v1.0.0 #########")
print ("\t\t\t ####### #########")
print ("\t\t\t ##############################################################")
print ("\t\t\t ##############################################################")
print ("\t\t\t\nM A I N M E N U")
print ("\t\t\t\n------------------\n")
while True :
if os.path.isfile("UID_list.txt"):
num_lines = sum(1 for line in open("UID_list.txt"))
print("\nYou have "+str(num_lines)+" labels in corrent roll")
print("\n1:Start or continue roll\n2:Finish roll\n")
selected = raw_input("\tPlease select an option: ")
if selected =="1":
add_number = raw_input("How many labels to manufacture?\n ")
Read_TID(add_number)
elif selected =="2":
roll_number = raw_input("What is the roll number?\n ")
rename("UID_list.txt","UID_list_Roll_"+str(roll_number)+".txt")
출력 파일 :
E280116020006537E1EA08F1
E280116020007527E1EA08F1
E280116020007517E1EA08F1
E280116020006507E1EA08F1
E280116020006357E1E608F1
E280116020007347E1E608F1
E280116020006337E1E608F1
E280116020007327E1E608F1
E280116020007317E1E608F1
E280116
E2801160200061F7E1E408F1
E2801160200071E7E1E408F1
E280116020006157E1E408F1
E280116020007147E1E408F1
E2801160200071F7E1D608F1
E2801160200061E7E1D608F1
E2801160200061D7E1D608F1
E2801160200071C7E1D608F1
E2801160200061B7E1D608F1
E2801160200071A7E1D608F1
E280116020007197E1D608F1
E
E280116020007167E1D608F1
E280116020007157E1D608F1
E280116020006147E1D608F1
E280116020007137E1D608F1
E280116020006127E1D608F1
E280116020006117E1D608F1
E280116020006507E1EA08F1
E2801160200063F7E1E608F1
BR, Idan.