修改字段名称,为一键下发增加异常捕获
This commit is contained in:
@@ -185,7 +185,7 @@ class Machine_ftp(models.Model):
|
||||
y_compensation_node = fields.Char('y补偿值节点')
|
||||
# 数采配置相关
|
||||
machine_ip = fields.Char('机床IP')
|
||||
machine_signed = fields.Char('刷新间隔')
|
||||
machine_signed = fields.Char('机床刷新间隔')
|
||||
machine_status = fields.Char('机床在线状态')
|
||||
machine_time_on = fields.Char('机床总在线时长')
|
||||
machine_tool_num = fields.Char('机床当前刀具')
|
||||
@@ -318,29 +318,30 @@ class WorkCenterBarcode(models.Model):
|
||||
print(host, port, username, pwd, remote_path)
|
||||
ftp = ftp_operate.FtpController(host, port, username, pwd)
|
||||
# ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
||||
for item in self.cnc_ids:
|
||||
a = item.cnc_id
|
||||
print(a.display_name)
|
||||
_logger.info(a.public)
|
||||
_logger.info(a.display_name)
|
||||
datas = base64.standard_b64decode(a.datas)
|
||||
try:
|
||||
for item in self.cnc_ids:
|
||||
a = item.cnc_id
|
||||
print(a.display_name)
|
||||
_logger.info(a.public)
|
||||
_logger.info(a.display_name)
|
||||
datas = base64.standard_b64decode(a.datas)
|
||||
|
||||
# file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
||||
file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
||||
# 本地测试一键下发
|
||||
# file_path_local = '{}/{}'.format('D:\\jikimo', a.display_name)
|
||||
# file_path_remote = '{}\{}'.format('//M80(192,168,2,142)//DS', a.display_name)
|
||||
file_path_remote = '{}\{}'.format(remote_path, a.display_name)
|
||||
# file_path = '{}\{}\{}'.format(a._filestore(), a.store_fname.split('/'[0]), a.display_name)
|
||||
file_path_local = '{}/{}'.format('/nc2machine', a.display_name)
|
||||
# 本地测试一键下发
|
||||
# file_path_local = '{}/{}'.format('D:\\jikimo', a.display_name)
|
||||
# file_path_remote = '{}\{}'.format('//M80(192,168,2,142)//DS', a.display_name)
|
||||
file_path_remote = '{}\{}'.format(remote_path, a.display_name)
|
||||
|
||||
with open(file_path_local, mode='wb+') as file:
|
||||
file.write(datas)
|
||||
# 存在本地的文件下发到机床
|
||||
_logger.info("=====================11================")
|
||||
ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
||||
with open(file_path_local, mode='wb+') as file:
|
||||
file.write(datas)
|
||||
# 存在本地的文件下发到机床
|
||||
_logger.info("=====================11================")
|
||||
ftp.upload_file(remotepath=file_path_remote, localpath=file_path_local)
|
||||
# _logger.info("=====================22================")
|
||||
# except Exception as e:
|
||||
# _logger.info("=====================================", e)
|
||||
# raise UserError('NC下发执行超时, 请检查下发状态')
|
||||
except Exception as e:
|
||||
_logger.info("=====================================", e)
|
||||
raise UserError('NC下发执行超时, 请检查下发状态')
|
||||
# 下发都执行完毕后,按钮标志位变为true
|
||||
self.button_up_all_state = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user