Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/刀具产品调取Cloud刀具标准库(10.11)
# Conflicts: # sf_base/models/tool_base.py # sf_base/models/tool_base_new.py # sf_maintenance/views/maintenance_views.xml # sf_mrs_connect/models/res_config_setting.py
This commit is contained in:
@@ -97,7 +97,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
control_system_id = fields.Many2one('sf.machine.control_system',
|
||||
string="控制系统")
|
||||
# 多个机床型号对应一个机床
|
||||
brand_id = fields.Many2one('sf.machine.brand', string='品牌')
|
||||
brand_id = fields.Many2one('sf.machine.brand', string='品牌', domain="[('tag_ids.name', 'ilike', equipment_type)]")
|
||||
type_id = fields.Many2one('sf.machine_tool.type', '型号')
|
||||
|
||||
state = fields.Selection(
|
||||
@@ -154,48 +154,48 @@ class SfMaintenanceEquipment(models.Model):
|
||||
result.append((parameter.id, name))
|
||||
return result
|
||||
|
||||
@api.constrains('rotate_speed')
|
||||
def _check_rotate_speed(self):
|
||||
if self.rotate_speed <= 0:
|
||||
raise UserError("转速不能为0")
|
||||
|
||||
@api.constrains('precision')
|
||||
def _check_precision(self):
|
||||
if self.precision <= 0.00:
|
||||
raise UserError("加工精度不能为0")
|
||||
|
||||
@api.constrains('number_of_knife_library')
|
||||
def _check_number_of_knife_library(self):
|
||||
if self.number_of_knife_library <= 0:
|
||||
raise UserError("刀库数量不能为0")
|
||||
|
||||
@api.constrains('x_axis')
|
||||
def _check_x_axis(self):
|
||||
if self.x_axis <= 0:
|
||||
raise UserError("加工行程里x轴不能为0")
|
||||
|
||||
@api.constrains('y_axis')
|
||||
def _check_y_axis(self):
|
||||
if self.y_axis <= 0:
|
||||
raise UserError("加工行程里y轴不能为0")
|
||||
|
||||
@api.constrains('z_axis')
|
||||
def _check_z_axis(self):
|
||||
if self.z_axis <= 0:
|
||||
raise UserError("加工行程里z轴不能为0")
|
||||
|
||||
@api.constrains('b_axis')
|
||||
def _check_b_axis(self):
|
||||
if self.number_of_axles == '四轴':
|
||||
print(self.number_of_axles)
|
||||
if self.b_axis <= 0:
|
||||
raise UserError("加工行程里b轴不能为0")
|
||||
|
||||
@api.constrains('c_axis')
|
||||
def _check_c_axis(self):
|
||||
if self.number_of_axles == '五轴':
|
||||
if self.c_axis <= 0:
|
||||
raise UserError("加工行程里c轴不能为0")
|
||||
# @api.constrains('rotate_speed')
|
||||
# def _check_rotate_speed(self):
|
||||
# if self.rotate_speed <= 0:
|
||||
# raise UserError("转速不能为0")
|
||||
#
|
||||
# @api.constrains('precision')
|
||||
# def _check_precision(self):
|
||||
# if self.equipment_type == '机床' and self.precision <= 0.00:
|
||||
# raise UserError("加工精度不能为0")
|
||||
#
|
||||
# @api.constrains('number_of_knife_library')
|
||||
# def _check_number_of_knife_library(self):
|
||||
# if self.equipment_type == '机床' and self.number_of_knife_library <= 0:
|
||||
# raise UserError("刀库数量不能为0")
|
||||
#
|
||||
# @api.constrains('x_axis')
|
||||
# def _check_x_axis(self):
|
||||
# if self.equipment_type == '机床' and self.x_axis <= 0:
|
||||
# raise UserError("加工行程里x轴不能为0")
|
||||
#
|
||||
# @api.constrains('y_axis')
|
||||
# def _check_y_axis(self):
|
||||
# if self.equipment_type == '机床' and self.y_axis <= 0:
|
||||
# raise UserError("加工行程里y轴不能为0")
|
||||
#
|
||||
# @api.constrains('z_axis')
|
||||
# def _check_z_axis(self):
|
||||
# if self.equipment_type == '机床' and self.z_axis <= 0:
|
||||
# raise UserError("加工行程里z轴不能为0")
|
||||
#
|
||||
# @api.constrains('b_axis')
|
||||
# def _check_b_axis(self):
|
||||
# if self.equipment_type == '机床' and self.number_of_axles == '四轴':
|
||||
# print(self.number_of_axles)
|
||||
# if self.b_axis <= 0:
|
||||
# raise UserError("加工行程里b轴不能为0")
|
||||
#
|
||||
# @api.constrains('c_axis')
|
||||
# def _check_c_axis(self):
|
||||
# if self.equipment_type == '机床' and self.number_of_axles == '五轴':
|
||||
# if self.c_axis <= 0:
|
||||
# raise UserError("加工行程里c轴不能为0")
|
||||
|
||||
@api.onchange('type_id')
|
||||
def get_type_info(self):
|
||||
@@ -316,6 +316,14 @@ class SfMaintenanceEquipment(models.Model):
|
||||
robot_operating_temperature = fields.Char('环境温度')
|
||||
robot_operating_humidity = fields.Char('环境湿度')
|
||||
|
||||
# 其他参数(所有设备)
|
||||
date_of_purchase = fields.Date('采购日期')
|
||||
date_of_manufacture = fields.Date('出厂日期')
|
||||
date_of_warranty = fields.Date('质保截至日期')
|
||||
original_value = fields.Char('原值')
|
||||
incomplete_value = fields.Char('残值')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -338,25 +346,28 @@ class SfMaintenanceEquipment(models.Model):
|
||||
machine_tool_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
images_ids_names = []
|
||||
for a in self.env['maintenance.equipment.image'].search([('id', 'in', item.image_id.ids)]):
|
||||
images_ids_names.append(a.name)
|
||||
if item.machine_tool_picture != False:
|
||||
image = base64.b64encode(item.machine_tool_picture).decode('utf-8')
|
||||
else:
|
||||
image = False
|
||||
control_system_id = self.env['sf.machine.control_system'].sudo().browse(item.control_system_id.id).code
|
||||
|
||||
val = {
|
||||
'MTcode': item.MTcode,
|
||||
'factory_token': token,
|
||||
'id': item.id,
|
||||
'name': item.name,
|
||||
'code': item.code,
|
||||
'precision': item.precision,
|
||||
'knife_type': item.knife_type,
|
||||
'number_of_knife_library': item.number_of_knife_library,
|
||||
'rotate_speed': item.rotate_speed,
|
||||
'number_of_axles': item.number_of_axles,
|
||||
'control_system_id': self.env['sf.machine.control_system'].search(
|
||||
[('id', '=', item.control_system_id.id)]).code,
|
||||
'type_id': self.env['sf.machine_tool.type'].search([('id', '=', item.type_id.id)]).code,
|
||||
'brand_id': self.env['sf.machine.brand'].search([('id', '=', item.brand_id.id)]).code,
|
||||
'control_system_id': control_system_id,
|
||||
'type_id': self.env['sf.machine_tool.type'].sudo().browse(item.type_id.id).code,
|
||||
'brand_id': self.env['sf.machine.brand'].sudo().browse(item.brand_id.id).code,
|
||||
'supplier_id': item.supplier_id.id,
|
||||
'x_axis': item.x_axis,
|
||||
'y_axis': item.y_axis,
|
||||
@@ -377,15 +388,19 @@ class SfMaintenanceEquipment(models.Model):
|
||||
'machine_tool_H': item.machine_tool_H,
|
||||
'feed_speed': item.feed_speed,
|
||||
'tool_speed': item.tool_speed,
|
||||
'distance': item.distance,
|
||||
'taper': item.taper,
|
||||
'torque': item.torque,
|
||||
'motor_power': item.motor_power,
|
||||
'tool_quality_max': item.tool_quality_max,
|
||||
'tool_long_max': item.tool_long_max,
|
||||
'tool_diameter_max': item.tool_diameter_max,
|
||||
'precision_min': item.precision_min,
|
||||
'precision_max': item.precision_max,
|
||||
'distance_min': item.distance_min,
|
||||
'distance_max': item.distance_max,
|
||||
'tool_diameter_min': item.tool_diameter_min,
|
||||
'machine_tool_category': item.machine_tool_category.code,
|
||||
|
||||
'image_id': images_ids_names
|
||||
}
|
||||
machine_tool_list.append(val)
|
||||
# kw = machine_tool_list
|
||||
@@ -564,7 +579,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
if not next_requests:
|
||||
equipment._create_new_request1(equipment.overhaul_date)
|
||||
|
||||
image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='设备图文')
|
||||
image_id = fields.Many2many('maintenance.equipment.image', 'equipment_id', string='加工能力', domain="[('type', '=', '加工能力')]")
|
||||
|
||||
|
||||
class SfRobotAxisNum(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user