|
|
|
|
@@ -60,11 +60,11 @@ class FtpButton(models.Model):
|
|
|
|
|
raise UserError("补偿值写入执行超时,请检查机床状态或者写入状态")
|
|
|
|
|
|
|
|
|
|
# host="192.168.2.158", port=8080, username="MITSUBISHI", password="CNC"
|
|
|
|
|
host = self.workorder_id.workcenter_id.machine_tool_id.ftp_host
|
|
|
|
|
port = self.workorder_id.workcenter_id.machine_tool_id.ftp_port
|
|
|
|
|
username = self.workorder_id.workcenter_id.machine_tool_id.ftp_num
|
|
|
|
|
pwd = self.workorder_id.workcenter_id.machine_tool_id.ftp_pwd
|
|
|
|
|
remote_path = self.workorder_id.workcenter_id.machine_tool_id.ftp_remote_path
|
|
|
|
|
host = self.workorder_id.equipment_id.ftp_host
|
|
|
|
|
port = self.workorder_id.equipment_id.ftp_port
|
|
|
|
|
username = self.workorder_id.equipment_id.ftp_num
|
|
|
|
|
pwd = self.workorder_id.equipment_id.ftp_pwd
|
|
|
|
|
remote_path = self.workorder_id.equipment_id.ftp_remote_path
|
|
|
|
|
print(host, port, username, pwd, remote_path)
|
|
|
|
|
ftp = ftp_operate.FtpController(host, port, username, pwd)
|
|
|
|
|
# ftp.delAllfile('C://Users//马广威//Desktop//ftp')
|
|
|
|
|
@@ -107,8 +107,8 @@ class FtpButton(models.Model):
|
|
|
|
|
下发NC代码前自动补偿三元检测偏差值
|
|
|
|
|
:return:
|
|
|
|
|
"""
|
|
|
|
|
hongbianliang550 = self.workorder_id.workcenter_id.machine_tool_id.x_compensation_node
|
|
|
|
|
hongbianliang551 = self.workorder_id.workcenter_id.machine_tool_id.y_compensation_node
|
|
|
|
|
hongbianliang550 = self.workorder_id.equipment_id.x_compensation_node
|
|
|
|
|
hongbianliang551 = self.workorder_id.equipment_id.y_compensation_node
|
|
|
|
|
try:
|
|
|
|
|
temp_dict = {}
|
|
|
|
|
temp_dict[hongbianliang550] = self.workorder_id.compensation_value_x
|
|
|
|
|
@@ -124,9 +124,9 @@ class Machine_ftp(models.Model):
|
|
|
|
|
"""
|
|
|
|
|
数据采集类
|
|
|
|
|
"""
|
|
|
|
|
_inherit = 'sf.machine_tool'
|
|
|
|
|
_inherit = 'maintenance.equipment'
|
|
|
|
|
|
|
|
|
|
workorder_ids = fields.One2many('mrp.workorder', 'machine_tool_id', string='工单')
|
|
|
|
|
# workorder_ids = fields.One2many('mrp.workorder', 'machine_tool_id', string='工单')
|
|
|
|
|
|
|
|
|
|
# 机床配置项目
|
|
|
|
|
# ftp相关
|
|
|
|
|
@@ -263,7 +263,7 @@ class WorkCenterBarcode(models.Model):
|
|
|
|
|
compensation_value_y = fields.Float(string='Y轴补偿值')
|
|
|
|
|
button_compensation_state = fields.Boolean(string='是否已经补偿', readonly=True)
|
|
|
|
|
button_up_all_state = fields.Boolean(string='是否已经全部下发', readonly=True)
|
|
|
|
|
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
|
|
|
|
|
machine_tool_id = fields.Many2one('sf.machine_tool.type', string='机床')
|
|
|
|
|
machine_tool_name = fields.Char(string='机床名称', default='未知机床', compute='_run_info', readonly=True)
|
|
|
|
|
machine_tool_type_id = fields.Char(string='机床型号', default='未知型号', compute='_run_info', readonly=True)
|
|
|
|
|
machine_tool_status = fields.Boolean(string='在线状态', compute='_run_info', readonly=True)
|
|
|
|
|
@@ -281,27 +281,27 @@ class WorkCenterBarcode(models.Model):
|
|
|
|
|
machine_tool_compensation_value_y = fields.Char('y补偿值', compute='_run_info', readonly=True)
|
|
|
|
|
delivery_records = fields.One2many('delivery.record', 'workorder_id', string="下发记录")
|
|
|
|
|
|
|
|
|
|
@api.depends('workcenter_id.machine_tool_id.timestamp')
|
|
|
|
|
@api.depends('equipment_id.timestamp')
|
|
|
|
|
def _run_info(self):
|
|
|
|
|
# self.machine_tool_name = '1号机床'
|
|
|
|
|
self.machine_tool_name = self.workcenter_id.machine_tool_id.name
|
|
|
|
|
self.machine_tool_type_id = self.workcenter_id.machine_tool_id.type_id.name
|
|
|
|
|
self.machine_tool_status = self.workcenter_id.machine_tool_id.status
|
|
|
|
|
self.machine_tool_run_status = self.workcenter_id.machine_tool_id.run_status
|
|
|
|
|
self.machine_tool_timestamp = self.workcenter_id.machine_tool_id.timestamp
|
|
|
|
|
self.machine_tool_time_on = self.workcenter_id.machine_tool_id.time_on
|
|
|
|
|
self.machine_tool_time_on_now = self.workcenter_id.machine_tool_id.time_on_now
|
|
|
|
|
self.machine_tool_tool_num = self.workcenter_id.machine_tool_id.tool_num
|
|
|
|
|
self.machine_tool_program = self.workcenter_id.machine_tool_id.program
|
|
|
|
|
self.machine_tool_machine_ip = self.workcenter_id.machine_tool_id.machine_ip
|
|
|
|
|
self.machine_tool_cut_status = self.workcenter_id.machine_tool_id.cut_status
|
|
|
|
|
self.machine_tool_name = self.equipment_id.name
|
|
|
|
|
self.machine_tool_type_id = self.equipment_id.type_id.name
|
|
|
|
|
self.machine_tool_status = self.equipment_id.status
|
|
|
|
|
self.machine_tool_run_status = self.equipment_id.run_status
|
|
|
|
|
self.machine_tool_timestamp = self.equipment_id.timestamp
|
|
|
|
|
self.machine_tool_time_on = self.equipment_id.time_on
|
|
|
|
|
self.machine_tool_time_on_now = self.equipment_id.time_on_now
|
|
|
|
|
self.machine_tool_tool_num = self.equipment_id.tool_num
|
|
|
|
|
self.machine_tool_program = self.equipment_id.program
|
|
|
|
|
self.machine_tool_machine_ip = self.equipment_id.machine_ip
|
|
|
|
|
self.machine_tool_cut_status = self.equipment_id.cut_status
|
|
|
|
|
self.machine_tool_compensation_value_x = self.compensation_value_x
|
|
|
|
|
self.machine_tool_compensation_value_y = self.compensation_value_y
|
|
|
|
|
|
|
|
|
|
def compensation(self):
|
|
|
|
|
|
|
|
|
|
hongbianliang550 = self.workcenter_id.machine_tool_id.x_compensation_node
|
|
|
|
|
hongbianliang551 = self.workcenter_id.machine_tool_id.y_compensation_node
|
|
|
|
|
hongbianliang550 = self.equipment_id.x_compensation_node
|
|
|
|
|
hongbianliang551 = self.equipment_id.y_compensation_node
|
|
|
|
|
try:
|
|
|
|
|
temp_dict = {}
|
|
|
|
|
temp_dict[hongbianliang550] = self.compensation_value_x
|
|
|
|
|
@@ -339,11 +339,11 @@ class WorkCenterBarcode(models.Model):
|
|
|
|
|
except Exception:
|
|
|
|
|
raise UserError("补偿值写入执行超时,请检查机床状态或者写入状态")
|
|
|
|
|
sequence_collect = []
|
|
|
|
|
host = self.workcenter_id.machine_tool_id.ftp_host
|
|
|
|
|
port = self.workcenter_id.machine_tool_id.ftp_port
|
|
|
|
|
username = self.workcenter_id.machine_tool_id.ftp_num
|
|
|
|
|
pwd = self.workcenter_id.machine_tool_id.ftp_pwd
|
|
|
|
|
remote_path = self.workcenter_id.machine_tool_id.ftp_remote_path
|
|
|
|
|
host = self.equipment_id.ftp_host
|
|
|
|
|
port = self.equipment_id.ftp_port
|
|
|
|
|
username = self.equipment_id.ftp_num
|
|
|
|
|
pwd = self.equipment_id.ftp_pwd
|
|
|
|
|
remote_path = self.equipment_id.ftp_remote_path
|
|
|
|
|
_logger.info("=====================1666666661111================%s,%s,%s,%s" % (host, port, username, pwd))
|
|
|
|
|
ftp = ftp_operate.FtpController(host, port, username, pwd)
|
|
|
|
|
_logger.info("=====================1777777777111================")
|
|
|
|
|
@@ -403,11 +403,11 @@ class WorkCenterBarcode(models.Model):
|
|
|
|
|
except Exception:
|
|
|
|
|
raise UserError("补偿值写入执行超时,请检查机床状态或者写入状态")
|
|
|
|
|
sequence_collect = []
|
|
|
|
|
host = self.workcenter_id.machine_tool_id.ftp_host
|
|
|
|
|
port = self.workcenter_id.machine_tool_id.ftp_port
|
|
|
|
|
username = self.workcenter_id.machine_tool_id.ftp_num
|
|
|
|
|
pwd = self.workcenter_id.machine_tool_id.ftp_pwd
|
|
|
|
|
remote_path = self.workcenter_id.machine_tool_id.ftp_remote_path
|
|
|
|
|
host = self.equipment_id.ftp_host
|
|
|
|
|
port = self.equipment_id.ftp_port
|
|
|
|
|
username = self.equipment_id.ftp_num
|
|
|
|
|
pwd = self.equipment_id.ftp_pwd
|
|
|
|
|
remote_path = self.equipment_id.ftp_remote_path
|
|
|
|
|
_logger.info("=====================1666666661111================%s,%s,%s,%s" % (host, port, username, pwd))
|
|
|
|
|
ftp = ftp_operate.FtpController(host, port, username, pwd)
|
|
|
|
|
_logger.info("=====================1777777777111================")
|
|
|
|
|
|