1、新增设备创建刀位时自动创建对应刀位的机床换刀申请记录;2、机床换刀申请模型的设备、刀位字段修改为只读,搜索视图新增按设备搜索;
This commit is contained in:
@@ -88,19 +88,19 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_run_out_accuracy_min = fields.Float('端跳精度min', digits=(6, 1))
|
||||
cutting_tool_blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20)
|
||||
fit_blade_shape_id = fields.Many2one('maintenance.equipment.image',
|
||||
'适配刀片形状', domain=[('type', '=', '刀片形状')])
|
||||
'适配刀片形状', domain=[('type', '=', '刀片形状')])
|
||||
suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image',
|
||||
'rel_machining_product_template', '适合加工方式',
|
||||
domain=[('type', '=', '加工能力')])
|
||||
blade_tip_characteristics_id = fields.Many2one('maintenance.equipment.image', '刀尖特征',
|
||||
domain=[('type', '=', '刀尖特征')])
|
||||
handle_type_id = fields.Many2one('maintenance.equipment.image', '柄部类型',domain=[('type', '=', '柄部类型')])
|
||||
domain=[('type', '=', '刀尖特征')])
|
||||
handle_type_id = fields.Many2one('maintenance.equipment.image', '柄部类型', domain=[('type', '=', '柄部类型')])
|
||||
cutting_direction_ids = fields.Many2many('maintenance.equipment.image', 'rel_cutting_product_template',
|
||||
'走刀方向', domain=[('type', '=', '走刀方向')])
|
||||
suitable_coolant_ids = fields.Many2many('maintenance.equipment.image', 'rel_coolant_product_template',
|
||||
'适合冷却液', domain=[('type', '=', '冷却液')])
|
||||
compaction_way_id = fields.Many2one('maintenance.equipment.image',
|
||||
'压紧方式', domain=[('type', '=', '压紧方式')])
|
||||
'压紧方式', domain=[('type', '=', '压紧方式')])
|
||||
|
||||
@api.onchange('cutting_tool_material_id')
|
||||
def _onchange_cutting_tool_material_id(self):
|
||||
@@ -873,3 +873,13 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
for record in self:
|
||||
if record.code:
|
||||
record.name = record.code
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
tools = super().create(vals_list)
|
||||
for tool in tools:
|
||||
self.env['sf.machine.table.tool.changing.apply'].sudo().create({
|
||||
'maintenance_equipment_id': tool.equipment_id.id,
|
||||
'cutter_spacing_code_id': tool.id
|
||||
})
|
||||
return tools
|
||||
|
||||
@@ -42,10 +42,12 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
# 计算库存位置数量
|
||||
# """
|
||||
# for obj in self:
|
||||
# if obj.current_location_id.name in ('组装后', '刀具房'):
|
||||
# obj.tool_room_num = 1
|
||||
# obj.line_edge_knife_library_num = 0
|
||||
# obj.machine_knife_library_num = 0
|
||||
# if obj.current_location_id:
|
||||
# if obj.current_location_id.name in ('组装后', '刀具房'):
|
||||
# obj.tool_room_num = 1
|
||||
# obj.line_edge_knife_library_num = 0
|
||||
# obj.machine_knife_library_num = 0
|
||||
#
|
||||
|
||||
@api.model
|
||||
def _read_group_mrs_cutting_tool_type_id(self, categories, domain, order):
|
||||
@@ -258,14 +260,14 @@ class MachineTableToolChangingApply(models.Model):
|
||||
|
||||
name = fields.Char('名称', related='maintenance_equipment_id.name', store=True)
|
||||
# 设备信息
|
||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', required=True, readonly=False,
|
||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', readonly=True,
|
||||
domain=[('category_id.equipment_type', '=', '机床')])
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=True,
|
||||
group_expand='_read_group_names')
|
||||
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型', readonly=True,
|
||||
compute='_compute_machine_table_type_id')
|
||||
machine_tool_code = fields.Char(string='机台号', store=True, invisible=True, readonly=True)
|
||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=False,
|
||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=True,
|
||||
required=True, domain="[('equipment_id', '=', maintenance_equipment_id)]")
|
||||
# 功能刀具信息
|
||||
functional_tool_name = fields.Char(string='刀具名称', related='functional_tool_name_id.name', store=True)
|
||||
@@ -279,7 +281,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
tool_position_interface_type = fields.Selection(
|
||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
||||
('直装固定式', '直装固定式')], string='刀位接口型号', required=True)
|
||||
('直装固定式', '直装固定式')], string='刀位接口型号')
|
||||
diameter = fields.Integer(string='刀具直径(mm)', )
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
||||
max_lifetime_value = fields.Integer(string='最大寿命值(min)')
|
||||
@@ -305,7 +307,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
@api.depends('alarm_value', 'used_value')
|
||||
def _compute_functional_tool_status(self):
|
||||
for record in self:
|
||||
if record.alarm_value <= record.used_value:
|
||||
if record.alarm_value < record.used_value:
|
||||
record.functional_tool_status = '报警'
|
||||
else:
|
||||
record.functional_tool_status = '正常'
|
||||
|
||||
@@ -634,15 +634,15 @@
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="maintenance_equipment_id" readonly="0" placeholder="请选择"/>
|
||||
<field name="maintenance_equipment_id" readonly="1" placeholder="请选择"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="production_line_id"/>
|
||||
<field name="machine_table_type_id"/>
|
||||
<field name="cutter_spacing_code_id"/>
|
||||
<field name="tool_position_interface_type" placeholder="请选择"/>
|
||||
<field name="cutter_spacing_code_id" options="{'no_create': True}"/>
|
||||
<field name="tool_position_interface_type" placeholder="请选择" required="1"/>
|
||||
<field name="sf_functional_tool_assembly_id" string="组装单"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -698,6 +698,7 @@
|
||||
<field name="applicant" optional="hide"/>
|
||||
<searchpanel>
|
||||
<field name="production_line_id" enable_counters="1" icon="fa-building"/>
|
||||
<field name="maintenance_equipment_id" enable_counters="1" icon="fa-building"/>
|
||||
<field name="functional_tool_status" enable_counters="1" icon="fa-building"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
|
||||
Reference in New Issue
Block a user