4.7更改打印标签代码,去掉序列号以及批号
This commit is contained in:
@ -133,7 +133,7 @@ class LabelPrintService:
|
||||
| [QR Code] (15mm) | 名: XXXXXX |
|
||||
| | 规: XXXXXX |
|
||||
| SKU: XXXXX(大/粗)| 属: XXXXXX |
|
||||
| 库: XXXXX (中/粗)| SN: XXXXXX |
|
||||
| 库: XXXXX (中/粗)| |
|
||||
---------------------------------------
|
||||
"""
|
||||
# 1. 创建画布
|
||||
@ -157,24 +157,6 @@ class LabelPrintService:
|
||||
typ = str(data.get('material_type', '') or '')
|
||||
attr = f"{cat}/{typ}" if (cat or typ) else "-"
|
||||
|
||||
# 底部编号逻辑
|
||||
bottom_val = ""
|
||||
bottom_label = "NO"
|
||||
if data.get('print_no'):
|
||||
bottom_val = str(data.get('print_no'))
|
||||
l_type = data.get('print_label', '')
|
||||
bottom_label = 'SN' if l_type == '序' else 'BN' if l_type == '批' else 'NO'
|
||||
elif data.get('serial_number'):
|
||||
bottom_label = "SN"
|
||||
bottom_val = str(data.get('serial_number'))
|
||||
elif data.get('batch_number'):
|
||||
bottom_label = "BN"
|
||||
bottom_val = str(data.get('batch_number'))
|
||||
else:
|
||||
bottom_val = sku_code
|
||||
|
||||
bottom_text_full = f"{bottom_label}:{bottom_val}"
|
||||
|
||||
# ==================== 绘制区域划分 ====================
|
||||
|
||||
# --- A. 左侧区域 (二维码 + SKU + 库位) ---
|
||||
@ -223,7 +205,7 @@ class LabelPrintService:
|
||||
stroke_fill='black'
|
||||
)
|
||||
|
||||
# --- B. 右侧区域 (名称、规格、属性、编号) ---
|
||||
# --- B. 右侧区域 (名称、规格、属性) ---
|
||||
|
||||
# 右侧起始 X
|
||||
right_start_x = LabelPrintService.MARGIN_LEFT + LabelPrintService.QR_SIZE_PX + LabelPrintService.GAP_COLUMNS
|
||||
@ -251,12 +233,6 @@ class LabelPrintService:
|
||||
current_right_y = LabelPrintService.draw_text_wrap(
|
||||
d, f"属:{attr}", right_start_x, current_right_y, font_text, right_max_width, line_spacing=LINE_SPACING
|
||||
)
|
||||
current_right_y += LINE_SPACING
|
||||
|
||||
# 4. 序列号/批号
|
||||
LabelPrintService.draw_text_wrap(
|
||||
d, bottom_text_full, right_start_x, current_right_y, font_text, right_max_width, line_spacing=LINE_SPACING
|
||||
)
|
||||
|
||||
return img
|
||||
|
||||
@ -321,4 +297,4 @@ class LabelPrintService:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
pass
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"label_printer": {
|
||||
"ip": "192.168.9.14",
|
||||
"ip": "192.168.9.78",
|
||||
"port": 9100
|
||||
},
|
||||
"network_printer": {
|
||||
|
||||
Reference in New Issue
Block a user