一键打印功能
This commit is contained in:
2
zpl_print/models/__init__.py
Normal file
2
zpl_print/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*-coding:utf-8-*-
|
||||
from .import common
|
||||
24
zpl_print/models/common.py
Normal file
24
zpl_print/models/common.py
Normal 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("错误警告")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user