# -*- 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("错误警告")



