一键打印功能

This commit is contained in:
gqh
2023-02-28 17:32:24 +08:00
parent 84a674e4e2
commit adaecd6e09
7 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# -*-coding:utf-8-*-
from .import common

View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from odoo import models
import ctypes
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("错误警告")