def party(party_id, rem='', type_result='svg'): '''Партионные этикетки''' return render( type_result, party_size, ZText((0, 0.5, 42.7, 5), 'party:%s' % party_id), ZText((0, 0.5, 49, 5), rem, align='right', weight=True), ZEan13((1, 8, 47, 26), party2barcode(party_id)), )
def barcode(code, party='', rem='', type_result='svg'): '''Партионные этикетки''' title = 'party' if code.startswith('8'): title = 'extra_party' return render( type_result, party_size, ZText((0, 0.5, 42.7, 5), '%s:%s' % (title, party)), ZText((0, 0.5, 49, 5), rem, align='right', weight=True), ZEan13((1, 8, 47, 26), code), )
def pallet(pallet_id, type_result='svg'): '''Этикетка на палеты''' return render( type_result, pallet_size, ZText((49, 6), 'pallet:%s' % pallet_id), ZEan13((1, 8, 47, 26), pallet2barcode(pallet_id)), )
def cell(line, row, floor, depart, type_result='svg'): '''Этикетка на ячейки''' ztext = '%02d-%02d-%1d' % (int(line), int(row), int(floor)) zbarcode = cellinfo2barcode(int(depart), int(line), int(floor), int(row)) return render( type_result, cell_size, ZRect((96, 70)), ZText((96, 26), ztext, align='center', weight=True), ZEan13((7, 30, 80, 37), zbarcode), )
def party2(party_id, num, name, type_result='svg'): '''Партионные этикетки имени Мантурова''' name = name.decode('utf-8') num = num.decode('utf-8') if len(name) > 64: name = [name[:33], name[33:66], name[66:]] fs = 2.6 elif len(name) > 32: name = [name[:32], name[32:]] fs = 3.0 else: fs = 3.5 return render( type_result, party_size, # ZRect(party_size), ZText((0, 0, 48, 9), name, font_size=fs), ZFillRect((0, 9.1, 49, 0.2)), ZText((0, 9.5, 42.7, 5), u'партия: %s' % num), ZEan13((1, 16, 45, 19), party2barcode(party_id)), )
def badge(bar_code, fio, type_result='svg'): '''Бэйджик''' return render(type_result, badge_size, ZRect(badge_size), ZEan13((7, 20, 74, 28), bar_code), ZFillRect( (1, 18, 88, 0.5)), ZText((1, 1, 88, 15), fio, align='center'))
def box_label(num, forwarder, phone, address, name, phone_to, place, item, isUp=True, isGlaz=True, isUmbrell=True, type_result='svg'): '''Транспортные этикетки''' def gn(): x = (1, 16, 32) i = 0 while True: yield x[i] i += 1 i = i % (len(x)) gx = gn() f1 = 4 f2 = 5.6 # forwarder # recipient try: if forwarder and len(forwarder) > 50: forwarder = textwrap.wrap(forwarder, 55, break_long_words=False) except: pass try: if address and len(address) > 50: address = textwrap.wrap(address, 85, break_long_words=False) except: pass data = [ ZRect(box_label_size), ZText((1, 1, 20, 6), u'Заказ:', font_size=f1), ZText((18, 1, 70, 6), num, align='right', weight=True), ZText((1, 8.5, 28, 6), u'Отправитель:', font_size=f1), ZText((4, 15, 88, 6), forwarder, font_size=f1), ZText((4, 29, 88, 6), phone, font_size=f1), ZFillRect((1, 37, 88, 0.5)), ZFillRect((1, 56.5, 88, 0.5)), ZText((1, 55, 28, 6), u'Получатель:', font_size=f1), ZText((4, 62, 88, 6), address, align="left", font_size=f1), ZText((4, 75, 88, 6), name, font_size=f1), ZText((4, 80, 88, 6), phone_to, font_size=f1), ZText((1, 85, 28, 6), u'Место:', font_size=f1), ZText((17, 85, 28, 6), place, font_size=f2), ZText((45, 85, 28, 6), u'Отправка:', font_size=f1), ZText((67, 85, 28, 6), item, font_size=f2) ] if isUp: data.append(ZImage_UP((gx.next(), 39, 15, 16))) if isGlaz: data.append(ZImage_Glaz((gx.next(), 39, 15, 16))) if isUmbrell: data.append(ZImage_Umbrel((gx.next(), 39, 15, 16))) return render(type_result, box_label_size, *data)