合并代码
This commit is contained in:
@@ -147,6 +147,32 @@ class Machine_ftp(models.Model):
|
||||
machine_cut_status = fields.Char('机床切削状态')
|
||||
machine_emg_status = fields.Char('机床急停状态')
|
||||
machine_mode = fields.Char('机床操作模式')
|
||||
machine_spindle_speed = fields.Char('机床主轴转速')
|
||||
# 刀位配置
|
||||
tool_num1 = fields.Char('刀位1')
|
||||
tool_num2 = fields.Char('刀位2')
|
||||
tool_num3 = fields.Char('刀位3')
|
||||
tool_num4 = fields.Char('刀位4')
|
||||
tool_num5 = fields.Char('刀位5')
|
||||
tool_num6 = fields.Char('刀位6')
|
||||
tool_num7 = fields.Char('刀位7')
|
||||
tool_num8 = fields.Char('刀位8')
|
||||
tool_num9 = fields.Char('刀位9')
|
||||
tool_num10 = fields.Char('刀位10')
|
||||
tool_num11 = fields.Char('刀位11')
|
||||
tool_num12 = fields.Char('刀位12')
|
||||
tool_num13 = fields.Char('刀位13')
|
||||
tool_num14 = fields.Char('刀位14')
|
||||
tool_num15 = fields.Char('刀位15')
|
||||
tool_num16 = fields.Char('刀位16')
|
||||
tool_num17 = fields.Char('刀位17')
|
||||
tool_num18 = fields.Char('刀位18')
|
||||
tool_num19 = fields.Char('刀位19')
|
||||
tool_num20 = fields.Char('刀位20')
|
||||
tool_num21 = fields.Char('刀位21')
|
||||
tool_num22 = fields.Char('刀位22')
|
||||
tool_num23 = fields.Char('刀位23')
|
||||
tool_num24 = fields.Char('刀位24')
|
||||
|
||||
# 机床采集项目
|
||||
timestamp = fields.Datetime('时间戳', readonly=True)
|
||||
@@ -156,12 +182,13 @@ class Machine_ftp(models.Model):
|
||||
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='运行状态',
|
||||
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')
|
||||
spindle_speed = fields.Char('主轴转速', readonly=True)
|
||||
|
||||
tool_num_process_time1 = fields.Char('刀位1', readonly=True, default='0')
|
||||
tool_num_process_time2 = fields.Char('刀位2', readonly=True, default='0')
|
||||
@@ -258,17 +285,17 @@ class WorkCenterBarcode(models.Model):
|
||||
:return:
|
||||
"""
|
||||
# 一键下发前删除机床上的全部程序
|
||||
# try:
|
||||
# filepath = '/nc2machine'
|
||||
# del_list = os.listdir(filepath)
|
||||
# _logger.info("=====================================", del_list)
|
||||
# for f in del_list:
|
||||
# file_path = os.path.join(filepath, f)
|
||||
# if os.path.isfile(file_path):
|
||||
# os.remove(file_path)
|
||||
# except Exception as e:
|
||||
# _logger.info("=====================================", e)
|
||||
# raise UserError('程序删除失败,请重试')
|
||||
try:
|
||||
filepath = '/nc2machine'
|
||||
del_list = os.listdir(filepath)
|
||||
_logger.info("=====================================%s" % del_list)
|
||||
for f in del_list:
|
||||
file_path = os.path.join(filepath, f)
|
||||
if os.path.isfile(file_path):
|
||||
os.remove(file_path)
|
||||
except Exception as e:
|
||||
_logger.info("=====================================", e)
|
||||
raise UserError('程序删除失败,请重试')
|
||||
# host="192.168.2.158", port=8080, username="MITSUBISHI", password="CNC"
|
||||
try:
|
||||
self.compensation()
|
||||
@@ -280,8 +307,10 @@ class WorkCenterBarcode(models.Model):
|
||||
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
|
||||
print(host, port, username, pwd, remote_path)
|
||||
_logger.info("=====================1666666661111================%s,%s,%s,%s" % (host, port, username, pwd))
|
||||
ftp = ftp_operate.FtpController(host, port, username, pwd)
|
||||
_logger.info("=====================1777777777111================")
|
||||
|
||||
try:
|
||||
for item in self.cnc_ids:
|
||||
a = item.cnc_id
|
||||
@@ -331,6 +360,22 @@ class WorkCenterBarcode(models.Model):
|
||||
requests.post(url, json=json, data=None)
|
||||
|
||||
|
||||
class CuttingTimeToolType(models.Model):
|
||||
_inherit = 'sf.cutting_tool.type'
|
||||
total_cut_time = fields.Char(string='总切削时长')
|
||||
predict_life_time = fields.Char(string='预估寿命')
|
||||
# 只能看到未被占用的刀位,或者有提示说占没占用
|
||||
tool_position = fields.Char(string='选择刀位')
|
||||
# cnc_ids = fields.One2many(string='选择机床')
|
||||
is_connect_tool_position = fields.Boolean(string='是否已绑定刀位', default=False)
|
||||
|
||||
def tool_connect_machine(self):
|
||||
pass
|
||||
|
||||
def tool_unconnect_machine(self):
|
||||
pass
|
||||
|
||||
|
||||
class DeliveryRecord(models.Model):
|
||||
"""
|
||||
扫码托盘码可查到制造订单,由制造订单查工单
|
||||
|
||||
Reference in New Issue
Block a user