Files
test/zpl_print/models/common.py
2023-11-27 17:08:11 +08:00

22 lines
683 B
Python

# -*- coding: utf-8 -*-
import ctypes
from odoo import models
class Common(models.Model):
_name = 'sf.sync.common'
_description = u'公用类'
def print_zpl(self, zpl_str):
WinDll_path = "D://桌面//pythonZPL//tsc_python_sdk_example//TSC_Python_SDK_Example//tsc_sample//libs//TSCLIB.dll"
try:
tsclibrary = ctypes.WinDLL(WinDll_path)
tsclibrary.openportW("USB")
print(zpl_str)
tsclibrary.sendcommandW(zpl_str)
print('111222')
tsclibrary.printlabelW("0", "1");
tsclibrary.closeport();
except Exception as e:
raise UserWarning("错误警告:%s" % e)