合并sf代码
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Models for Simulation
|
||||
# ----------------------------------------------------------
|
||||
class Simulation(models.Model):
|
||||
_name = 'simulation'
|
||||
_description = 'SIMULATION'
|
||||
|
||||
name = fields.Char('Name', size=50, readonly=True)
|
||||
place_value = fields.Boolean(String="位值")
|
||||
place_value_random = fields.Boolean(String="位值随机")
|
||||
place_value_ai = fields.Boolean(String="位值自增")
|
||||
place_value_list = fields.Boolean(String="位值列表")
|
||||
|
||||
unsigned_integer_8_DO = fields.Integer(Sting="无符号8位整数D0")
|
||||
unsigned_integer_8_D1 = fields.Integer(Sting="无符号8位整数D1")
|
||||
unsigned_integer_8_random = fields.Integer(Sting="无符号8位整数随机")
|
||||
unsigned_integer_8_ai = fields.Integer(Sting="无符号8位整数自增")
|
||||
unsigned_integer_8_list = fields.Integer(Sting="无符号8位整数列表")
|
||||
|
||||
integer_8 = fields.Integer(String="有符号8位整数")
|
||||
integer_8_random = fields.Integer(String="有符号8位整数随机")
|
||||
integer_8_ai = fields.Integer(String="有符号8位整数自增")
|
||||
integer_8_ad = fields.Integer(String="有符号8位整数自减")
|
||||
integer_16 = fields.Integer(String="有符号16位整数")
|
||||
integer_16_random = fields.Integer(String="有符号16位整数随机")
|
||||
integer_16_list = fields.Integer(String="有符号16位整数列表")
|
||||
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Models for Mitsubishi
|
||||
# ----------------------------------------------------------
|
||||
class MitsuCnc(models.Model):
|
||||
_name = 'mitsu.cnc'
|
||||
_description = 'Mitsubishi CNC'
|
||||
|
||||
name = fields.Char('Name', size=50, readonly=True)
|
||||
status = fields.Boolean(string="状态")
|
||||
@@ -1,22 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
import base64
|
||||
|
||||
import psycopg2
|
||||
import os
|
||||
import logging
|
||||
from zeep.exceptions import ValidationError
|
||||
|
||||
from odoo import http
|
||||
from ftplib import FTP
|
||||
from odoo.http import request
|
||||
from odoo import api, fields, models
|
||||
import json
|
||||
import hashlib
|
||||
import time
|
||||
import requests
|
||||
from datetime import datetime
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
|
||||
# from .ftp_operate import FtpController
|
||||
# from .py2opcua import Py2opcua
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Models for client
|
||||
# ----------------------------------------------------------
|
||||
@@ -24,8 +23,13 @@ _logger = logging.getLogger(__name__)
|
||||
class FtpButton(models.Model):
|
||||
_inherit = 'sf.cnc.processing'
|
||||
|
||||
button_state = fields.Boolean(string='是否已经下发')
|
||||
|
||||
def pri(self):
|
||||
print('11111111111111111')
|
||||
"""
|
||||
一个测试函数,用于检测能否从”获取cnc程序“处获得NC代码文件
|
||||
:return:
|
||||
"""
|
||||
s = self.cnc_id
|
||||
s1 = self.cnc_id._filestore()
|
||||
print(s1)
|
||||
@@ -36,72 +40,115 @@ class FtpButton(models.Model):
|
||||
ftp_operate.FtpController.prin(self)
|
||||
|
||||
def up(self):
|
||||
# self.env['mrp.workorder'].check_compensation_before_up()
|
||||
ftp = ftp_operate.FtpController()
|
||||
# ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
||||
a = self.cnc_id
|
||||
print(a.display_name)
|
||||
_logger.info(a.display_name)
|
||||
datas = base64.standard_b64decode(a.datas)
|
||||
# file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
||||
"""
|
||||
此函数用于将NC代码下发到机床
|
||||
:return:
|
||||
"""
|
||||
# 点击下发按钮自动补偿三元检测偏差值
|
||||
|
||||
# 此方法不走ftp,直接文件写入,暂不确定能否写入ftp服务器,但可以转成ftp方法,只是要把文件暂存到本地,再上传
|
||||
# file_path_local = '{}\{}'.format('C://Users//马广威//Desktop//ftp', a.display_name)
|
||||
file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
||||
file_path_remote = '{}\{}'.format('//(192,168,2,141)//DS', a.display_name)
|
||||
try:
|
||||
try:
|
||||
if self.sequence_number == '1':
|
||||
self.check_compensation_before_up()
|
||||
except Exception:
|
||||
raise UserError("补偿值写入执行超时,请检查机床状态或者写入状态")
|
||||
|
||||
ftp = ftp_operate.FtpController()
|
||||
# ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
||||
a = self.cnc_id
|
||||
_logger.info(a.public)
|
||||
_logger.info(a.display_name)
|
||||
datas = base64.standard_b64decode(a.datas)
|
||||
|
||||
with open(file_path_local, mode='wb+') as file:
|
||||
file.write(datas)
|
||||
# file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
||||
file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
||||
file_path_remote = '{}\{}'.format('//(192,168,2,141)//DS', a.display_name)
|
||||
|
||||
# file = open(file_path_local, 'wb+')
|
||||
# file.write(datas)
|
||||
# file.close()
|
||||
with open(file_path_local, mode='wb+') as file:
|
||||
file.write(datas)
|
||||
# 存在本地的文件下发到机床
|
||||
ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
||||
except Exception as e:
|
||||
_logger.info("=====================================", e)
|
||||
raise UserError('NC下发执行超时, 请检查下发状态')
|
||||
|
||||
# 存在本地的文件下发到机床
|
||||
ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
||||
# 补偿下发都执行完毕后,按钮标志位变为true
|
||||
self.button_state = True
|
||||
|
||||
# 新增,下发完成返回当前工单位置
|
||||
# return {
|
||||
# 'name': _("工单"),
|
||||
# 'view_mode': 'form',
|
||||
# 'res_model': 'mrp.workorder',
|
||||
# 'res_id': self.workorder_id,
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'target': 'new'
|
||||
# }
|
||||
|
||||
class FtpClient(models.Model):
|
||||
_name = "ftp.client"
|
||||
_description = 'Ftp Client'
|
||||
|
||||
name = fields.Char('Name', size=50, readonly=True)
|
||||
description = fields.Char(size=50)
|
||||
mobile = fields.Char(size=50)
|
||||
|
||||
def up(self):
|
||||
ftp = ftp_operate.FtpController()
|
||||
# FtpController.__init__(self, host="127.0.0.1", port=2121, username="admin", password="123456")
|
||||
ftp.upload_file(remotepath='/(192,168,199,2)/DS/02-222.NC', localpath='D:/ftp/up/02-222.NC')
|
||||
|
||||
# def delete(self):
|
||||
# ftp = FtpController()
|
||||
# ftp.del_file()
|
||||
|
||||
#
|
||||
# def _compute_ip_url(self):
|
||||
# for box in self:
|
||||
# if not box.ip:
|
||||
# box.ip_url = False
|
||||
# else:
|
||||
# url = 'https://%s' if box.get_base_url()[:5] == 'https' else 'http://%s:8069'
|
||||
# box.ip_url = url % box.ip
|
||||
#
|
||||
# def _compute_device_count(self):
|
||||
# for box in self:
|
||||
# box.device_count = len(box.device_ids)
|
||||
def check_compensation_before_up(self):
|
||||
"""
|
||||
下发NC代码前自动补偿三元检测偏差值
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
temp_dict = {}
|
||||
temp_dict[
|
||||
'ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang550'] = self.workorder_id.compensation_value_x
|
||||
temp_dict[
|
||||
'ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang551'] = self.workorder_id.compensation_value_y
|
||||
temp = py2opcua.Py2opcua()
|
||||
# temp.connect()
|
||||
temp.write(temp_dict)
|
||||
# temp.disconnect()
|
||||
except Exception as e:
|
||||
_logger.info("=====================================", e)
|
||||
raise UserError('补偿值获取失败,或机床未连接,请检查')
|
||||
|
||||
|
||||
class Machine_ftp(models.Model):
|
||||
# _name = 'data.collection'
|
||||
"""
|
||||
数据采集类
|
||||
"""
|
||||
_inherit = 'sf.machine_tool'
|
||||
|
||||
timestamp = fields.Datetime('时间戳', readonly=True)
|
||||
signed = fields.Integer('刷新间隔', readonly=True)
|
||||
status = fields.Boolean('在线状态', readonly=True)
|
||||
time_on = fields.Char('总在线时长', readonly=True)
|
||||
time_on_now = fields.Char('本次在线时长', readonly=True)
|
||||
tool_num = fields.Integer('当前刀具', readonly=True)
|
||||
program = fields.Char('当前程序', readonly=True)
|
||||
run_status = fields.Selection([('0', '空闲中'), ('1', '加工中'), ('2', '加工中'), ('3', '等待中')], string='运行状态',
|
||||
readonly=True, default='0')
|
||||
run_time = fields.Char('总运行时长', readonly=True)
|
||||
cut_time = fields.Char('总切削时长', readonly=True)
|
||||
cut_status = fields.Selection([('0', '未切削'), ('1', '切削中'), ('2', '切削中'), ('3', '切削中')], string='切削状态',
|
||||
readonly=True, default='0')
|
||||
|
||||
tool_num_process_time1 = fields.Char('刀位1', readonly=True, default='0')
|
||||
tool_num_process_time2 = fields.Char('刀位2', readonly=True, default='0')
|
||||
tool_num_process_time3 = fields.Char('刀位3', readonly=True, default='0')
|
||||
tool_num_process_time4 = fields.Char('刀位4', readonly=True, default='0')
|
||||
tool_num_process_time5 = fields.Char('刀位5', readonly=True, default='0')
|
||||
tool_num_process_time6 = fields.Char('刀位6', readonly=True, default='0')
|
||||
tool_num_process_time7 = fields.Char('刀位7', readonly=True, default='0')
|
||||
tool_num_process_time8 = fields.Char('刀位8', readonly=True, default='0')
|
||||
tool_num_process_time9 = fields.Char('刀位9', readonly=True, default='0')
|
||||
tool_num_process_time10 = fields.Char('刀位10', readonly=True, default='0')
|
||||
tool_num_process_time11 = fields.Char('刀位11', readonly=True, default='0')
|
||||
tool_num_process_time12 = fields.Char('刀位12', readonly=True, default='0')
|
||||
tool_num_process_time13 = fields.Char('刀位13', readonly=True, default='0')
|
||||
tool_num_process_time14 = fields.Char('刀位14', readonly=True, default='0')
|
||||
tool_num_process_time15 = fields.Char('刀位15', readonly=True, default='0')
|
||||
tool_num_process_time16 = fields.Char('刀位16', readonly=True, default='0')
|
||||
tool_num_process_time17 = fields.Char('刀位17', readonly=True, default='0')
|
||||
tool_num_process_time18 = fields.Char('刀位18', readonly=True, default='0')
|
||||
tool_num_process_time19 = fields.Char('刀位19', readonly=True, default='0')
|
||||
tool_num_process_time20 = fields.Char('刀位20', readonly=True, default='0')
|
||||
tool_num_process_time21 = fields.Char('刀位21', readonly=True, default='0')
|
||||
tool_num_process_time22 = fields.Char('刀位22', readonly=True, default='0')
|
||||
tool_num_process_time23 = fields.Char('刀位23', readonly=True, default='0')
|
||||
tool_num_process_time24 = fields.Char('刀位24', readonly=True, default='0')
|
||||
|
||||
|
||||
class WorkCenterBarcode(models.Model):
|
||||
@@ -109,45 +156,56 @@ class WorkCenterBarcode(models.Model):
|
||||
扫码托盘码可查到制造订单,由制造订单查工单
|
||||
"""
|
||||
_inherit = "mrp.workorder"
|
||||
|
||||
compensation_value_x = fields.Float(string='X轴补偿值')
|
||||
compensation_value_y = fields.Float(string='Y轴补偿值')
|
||||
button_compensation_state = fields.Boolean(string='是否已经补偿')
|
||||
|
||||
def compensation(self):
|
||||
'''
|
||||
"""
|
||||
将节点与其值放入字典,字典作为参数传入
|
||||
:return:
|
||||
'''
|
||||
temp_dict = {}
|
||||
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang520'] = self.compensation_value_x
|
||||
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang521'] = self.compensation_value_y
|
||||
print("测试补偿能够执行")
|
||||
temp = py2opcua.Py2opcua()
|
||||
_logger.info(temp)
|
||||
temp.connect()
|
||||
temp.write(temp_dict)
|
||||
temp.disconnect()
|
||||
|
||||
def check_compensation_before_up(self):
|
||||
temp_value = self.env['mrp.workorder'].getcenter()
|
||||
_logger.info("====================================================================================")
|
||||
_logger.info(temp_value)
|
||||
if temp_value[0] == 0 or temp_value[1] != 0:
|
||||
"""
|
||||
try:
|
||||
temp_dict = {}
|
||||
# temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang520'] = temp_value[0]
|
||||
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang520'] = 111
|
||||
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang521'] = 111
|
||||
# temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC.hongbianliang521'] = temp_value[1]
|
||||
print("测试补偿能够执行")
|
||||
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang550'] = self.compensation_value_x
|
||||
temp_dict['ns=1;s=Project_Default.Group1.Mitsubishi_NC2.hongbianliang551'] = self.compensation_value_y
|
||||
temp = py2opcua.Py2opcua()
|
||||
_logger.info(temp)
|
||||
temp.connect()
|
||||
# temp.connect()
|
||||
temp.write(temp_dict)
|
||||
temp.disconnect()
|
||||
self.button_compensation_state = True
|
||||
# temp.disconnect()
|
||||
except Exception as e:
|
||||
_logger.info("=====================================", e)
|
||||
raise UserError('补偿值获取失败,或机床未连接,请检查')
|
||||
|
||||
def get__state(self):
|
||||
pay_time = str(datetime.now())
|
||||
json = {
|
||||
'params': {
|
||||
'model_name': 'jikimo.process.order',
|
||||
'field_name': 'name',
|
||||
'default_code': 'PO-2022-1207-0020',
|
||||
'state': '待付款',
|
||||
# 'pay_time': pay_time,
|
||||
# 'get_order_sf': 21,
|
||||
|
||||
},
|
||||
}
|
||||
# res_str = json.dumps(vals)
|
||||
url = 'https://bfm.cs.jikimo.com/api/get/state'
|
||||
requests.post(url, json=json, data=None)
|
||||
|
||||
def process_control(self):
|
||||
|
||||
def test(self, barcode):
|
||||
# 托盘对象
|
||||
tray = self.env('sf.tray').search("code", "=", barcode)
|
||||
product = tray.product_id
|
||||
if self.routing_type == '获取CNC加工程序' and self.state == '进行中':
|
||||
json = {
|
||||
'params': {
|
||||
'model_name': 'jikimo.process.order',
|
||||
'field_name': 'name',
|
||||
'default_code': 'PO-2022-1123-0014',
|
||||
'state': '加工中',
|
||||
},
|
||||
}
|
||||
url = 'https://bfm.cs.jikimo.com/api/get/state'
|
||||
requests.post(url, json=json, data=None)
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
import os
|
||||
from ftplib import FTP
|
||||
|
||||
|
||||
class FTP_P(FTP):
|
||||
"""
|
||||
重写FTP类,重写dirs方法
|
||||
"""
|
||||
|
||||
def dirs(self, *args):
|
||||
'''List a directory in long form.
|
||||
"""List a directory in long form.
|
||||
By default list current directory to stdout.
|
||||
Optional last argument is callback function; all
|
||||
non-empty arguments before it are concatenated to the
|
||||
LIST command. (This *should* only be used for a pathname.)'''
|
||||
LIST command. (This *should* only be used for a pathname.)"""
|
||||
cmd = 'LIST'
|
||||
templist = []
|
||||
tempdic = {}
|
||||
@@ -19,7 +24,6 @@ class FTP_P(FTP):
|
||||
if arg:
|
||||
cmd = cmd + (' ' + arg)
|
||||
self.retrlines(cmd, templist.append)
|
||||
# print(templist)
|
||||
# 处理返回结果,只需要目录名称
|
||||
r_files = [file.split(" ")[-1] for file in templist]
|
||||
tempdic['name'] = [file for file in r_files if file != "." and file != ".."]
|
||||
@@ -27,13 +31,14 @@ class FTP_P(FTP):
|
||||
return tempdic
|
||||
# return [file for file in r_files if file != "." and file != ".."]
|
||||
|
||||
# FTP接口类
|
||||
class FtpController():
|
||||
|
||||
'''
|
||||
# FTP接口类
|
||||
class FtpController:
|
||||
"""
|
||||
这是ftp接口类,在类初始化的时候就连接了ftp服务器,能否成功连接有反馈。
|
||||
类中定义了两个接口:上传接口和删除接口
|
||||
'''
|
||||
"""
|
||||
|
||||
# 三菱机床连接
|
||||
def __init__(self, host="192.168.2.158", port=8080, username="MITSUBISHI", password="CNC"):
|
||||
self.host = host
|
||||
@@ -42,47 +47,41 @@ class FtpController():
|
||||
self.password = password
|
||||
ftp = FTP_P()
|
||||
# self.ftp.set_debuglevel(2) #打开调试级别2,显示详细信息
|
||||
ftp.set_pasv(0) #0主动模式 1 #被动模式
|
||||
ftp.set_pasv(0) # 0主动模式 1 #被动模式
|
||||
try:
|
||||
ftp.connect(self.host, self.port)
|
||||
ftp.login(self.username, self.password)
|
||||
print("连接成功")
|
||||
self.ftp = ftp
|
||||
except:
|
||||
print("连接失败")
|
||||
except Exception as e:
|
||||
print("连接失败" + str(e))
|
||||
|
||||
# 试验接口
|
||||
def prin(self):
|
||||
print("这是试验接口")
|
||||
|
||||
# 试验ftp服务器连接
|
||||
# def connect(self, host="127.0.0.1", port=2121, username="admin", password="123456"):
|
||||
# ftp = FTP_P()
|
||||
# try:
|
||||
# ftp.connect(host, port)
|
||||
# ftp.login(username, password)
|
||||
# print("连接成功")
|
||||
# ftp1 = ftp
|
||||
# return ftp1
|
||||
# except:
|
||||
# print("连接失败")
|
||||
|
||||
|
||||
# 三菱代码下发
|
||||
def upload_file(self, remotepath='/(192,168,199,2)/DS/Z4.5.NC', localpath='D:/ftp/up/Z4.5.NC'):
|
||||
'''
|
||||
"""
|
||||
第一个是要上传到ftp服务器路径下的文件,第二个是本地要上传的的路径文件
|
||||
:param remotepath: 上传和下载都需要设置工作目录,注意只能使用文件名,不能有路径中的冒号
|
||||
:param localpath:
|
||||
:return:
|
||||
'''
|
||||
"""
|
||||
bufsize = 1024
|
||||
fp = open(localpath, 'rb')
|
||||
self.ftp.storbinary('STOR ' + remotepath, fp, bufsize)
|
||||
fp.close()
|
||||
# return "上传成功"
|
||||
# fp = open(localpath, 'rb')
|
||||
# self.ftp.storbinary('STOR ' + remotepath, fp, bufsize)
|
||||
# fp.close()
|
||||
with open(localpath, mode='rb') as file:
|
||||
self.ftp.storbinary('STOR ' + remotepath, file, bufsize)
|
||||
|
||||
|
||||
def delAllfile(self, ftppath):
|
||||
"""
|
||||
删除ftp服务器端全部文件
|
||||
:param ftppath:
|
||||
:return:
|
||||
"""
|
||||
dir_res = []
|
||||
try:
|
||||
print(ftppath)
|
||||
@@ -106,13 +105,13 @@ class FtpController():
|
||||
# print("删除FTP目录:" + ftppath + "下存在文件:" + f)
|
||||
# ftp.delete(f)
|
||||
except Exception as e:
|
||||
raise e
|
||||
print("删除失败" + str(e))
|
||||
|
||||
# 删除远端ftp文件
|
||||
# 出现550 not found file是路径不对
|
||||
# def del_file(self, delpath='./YIN.NC'):
|
||||
def del_file(self, delpath='/(192,168,199,2)/DS/Z4.5.NC'):
|
||||
self.ftp.delete(delpath) # 删除远程文件
|
||||
|
||||
|
||||
|
||||
"""
|
||||
删除ftp服务器端指定文件
|
||||
:param delpath:
|
||||
:return:
|
||||
"""
|
||||
self.ftp.delete(delpath)
|
||||
|
||||
@@ -2,22 +2,35 @@ from opcua import ua, Client
|
||||
|
||||
|
||||
class Py2opcua:
|
||||
"""
|
||||
将三元检测补偿值写入opcua服务器
|
||||
"""
|
||||
|
||||
def __init__(self, url='opc.tcp://192.168.2.99:4840'):
|
||||
self.client = Client(url)
|
||||
|
||||
def connect(self):
|
||||
|
||||
try:
|
||||
# 连接客户端
|
||||
self.client.connect()
|
||||
print("opcua服务器连接成功,可以写入")
|
||||
return self.client
|
||||
except:
|
||||
print("opcua服务器连接失败,请检查")
|
||||
# 连接客户端
|
||||
# def connect(self):
|
||||
# try:
|
||||
# self.client.connect()
|
||||
# print("opcua服务器连接成功,可以写入")
|
||||
# return self.client
|
||||
# except Exception as e:
|
||||
# print("opcua服务器连接失败,请检查" + str(e))
|
||||
|
||||
def write(self, temp_dict):
|
||||
temp_dict = temp_dict
|
||||
"""
|
||||
补偿值写入方法,参数是一个字典,键是节点名,值是补偿值
|
||||
:param temp_dict:
|
||||
:return:
|
||||
"""
|
||||
# try:
|
||||
self.client.connect()
|
||||
# print("opcua服务器连接成功,可以写入")
|
||||
# return self.client
|
||||
# except Exception as e:
|
||||
# print("opcua服务器连接失败,请检查" + str(e))
|
||||
# temp_dict = temp_dict
|
||||
temp_list = list(temp_dict.items())
|
||||
for i in range(len(temp_list)):
|
||||
# 寻找节点上的变量
|
||||
@@ -25,8 +38,9 @@ class Py2opcua:
|
||||
# var.set_value(ua.Variant(1.234, ua.VariantType.Float))
|
||||
# 通过set_value写值
|
||||
var.set_value(ua.Variant(temp_list[i][1], ua.VariantType.Double))
|
||||
print("%s 已写入" % var.get_value())
|
||||
|
||||
def disconnect(self):
|
||||
# 断开连接
|
||||
# print("%s 已写入" % var.get_value())
|
||||
self.client.disconnect()
|
||||
|
||||
# 断开连接
|
||||
# def disconnect(self):
|
||||
# self.client.disconnect()
|
||||
|
||||
Reference in New Issue
Block a user