优化刀具模版和刀具标准库
This commit is contained in:
@@ -6,10 +6,8 @@ import os
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.modules import get_resource_path
|
||||
|
||||
|
||||
# from OCC.Extend.DataExchange import read_step_file
|
||||
# from OCC.Extend.DataExchange import write_stl_file
|
||||
from OCC.Extend.DataExchange import read_step_file
|
||||
from OCC.Extend.DataExchange import write_stl_file
|
||||
|
||||
|
||||
class ResProductMo(models.Model):
|
||||
@@ -204,7 +202,6 @@ class ResProductMo(models.Model):
|
||||
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
||||
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
|
||||
elif self.cutting_tool_type == '夹头':
|
||||
self.cutting_tool_clamping_length = self.specification_id.clamping_length
|
||||
self.cutting_tool_clamping_tolerance = self.specification_id.clamping_tolerance
|
||||
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
|
||||
self.cutting_tool_clamping_diameter_min = self.specification_id.max_clamping_diameter
|
||||
@@ -236,8 +233,6 @@ class ResProductMo(models.Model):
|
||||
self.cutting_tool_rear_angle = self.specification_id.relief_angle
|
||||
self.cutting_tool_main_included_angle = self.specification_id.main_included_angle
|
||||
self.cutting_tool_top_angle = self.specification_id.top_angle
|
||||
self.cutting_tool_blade_tip_dip_angle = self.specification_id.blade_tip_dip_angle
|
||||
self.cutting_tool_side_cutting_edge_angle = self.specification_id.side_cutting_edge_angle
|
||||
self.cutting_tool_pitch = self.specification_id.pitch
|
||||
self.cutting_tool_bladed_teeth_model = self.specification_id.blade_teeth_model
|
||||
self.cutting_tool_thickness_tolerance = self.specification_id.thickness_tolerance
|
||||
@@ -265,7 +260,14 @@ class ResProductMo(models.Model):
|
||||
self.cutting_tool_rear_angle = self.specification_id.relief_angle
|
||||
self.cutting_tool_main_included_angle = self.specification_id.main_included_angle
|
||||
self.cutting_tool_top_angle = self.specification_id.top_angle
|
||||
self.cutting_tool_blade_tip_dip_angle = self.specification_id.blade_tip_dip_angle
|
||||
self.cutting_tool_screw = self.specification_id.screw
|
||||
self.cutting_tool_wrench = self.specification_id.wrench
|
||||
self.cutting_tool_blade_id = self.specification_id.blade_id
|
||||
self.cutting_tool_is_cooling_hole = self.specification_id.is_cooling_hole
|
||||
self.cutting_tool_locating_slot_code = self.specification_id.locating_slot_code
|
||||
self.cutting_tool_install_blade_tip_num = self.specification_id.install_blade_tip_num
|
||||
self.cutting_tool_installing_structure = self.specification_id.installing_structure
|
||||
self.cutting_tool_cut_depth_max = self.specification_id.cut_depth_max
|
||||
if self.cutting_tool_type == '刀盘':
|
||||
self.cutting_tool_blade_length = self.specification_id.blade_length
|
||||
self.cutting_tool_cutter_head_diameter = self.specification_id.cutter_head_diameter
|
||||
@@ -274,6 +276,9 @@ class ResProductMo(models.Model):
|
||||
self.cutting_tool_knife_head_height = self.specification_id.knife_head_height
|
||||
self.cutting_tool_knife_head_width = self.specification_id.knife_head_width
|
||||
self.cutting_tool_knife_head_length = self.specification_id.knife_head_length
|
||||
self.cutting_tool_tool_shim = self.specification_id.tool_shim
|
||||
self.cutting_tool_cotter_pin = self.specification_id.cotter_pin
|
||||
self.cutting_tool_pressing_plate = self.specification_id.pressing_plate
|
||||
elif self.cutting_tool_type == '刀柄':
|
||||
self.cutting_tool_total_length = self.specification_id.total_length
|
||||
self.cutting_tool_speed_max = self.specification_id.max_rotate_speed
|
||||
@@ -285,6 +290,13 @@ class ResProductMo(models.Model):
|
||||
self.cutting_tool_flange_diameter = self.specification_id.flange_diameter
|
||||
self.cutting_tool_fit_chuck_size = self.specification_id.fit_chuck_size
|
||||
self.cutting_tool_dynamic_balance_class = self.specification_id.dynamic_balance_class
|
||||
self.cutting_tool_is_high_speed_cutting = self.specification_id.is_quick_cutting
|
||||
self.cutting_tool_is_safety_lock = self.specification_id.is_safe_lock
|
||||
self.cutting_tool_fit_nut_model = self.specification_id.nut
|
||||
self.cutting_tool_wrench = self.specification_id.spanner
|
||||
self.cutting_tool_chuck_id = self.specification_id.chuck_id.id
|
||||
self.cutting_tool_jump_accuracy = self.specification_id.diameter_slip_accuracy
|
||||
self.cutting_tool_taper_shank_model = self.specification_id.taper_shank_model
|
||||
self.suitable_machining_method_ids = [(6, 0, [])] if not \
|
||||
self.cutting_tool_model_id.suitable_machining_method_ids \
|
||||
else [(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)]
|
||||
@@ -352,12 +364,12 @@ class ResProductMo(models.Model):
|
||||
raise ValidationError("请选择压紧方式")
|
||||
if self.cutting_tool_type == '刀片':
|
||||
if not self.suitable_coolant_ids:
|
||||
raise ValidationError("请选择适合冷却液")
|
||||
raise ValidationError("请选择适合冷却方式")
|
||||
elif self.cutting_tool_type == '整体式刀具':
|
||||
if not self.handle_type_id:
|
||||
raise ValidationError("请选择柄部类型")
|
||||
if not self.suitable_coolant_ids:
|
||||
raise ValidationError("请选择适合冷却液")
|
||||
raise ValidationError("请选择适合冷却方式")
|
||||
if not self.suitable_machining_method_ids:
|
||||
raise ValidationError("请选择适合加工方式")
|
||||
if not self.blade_tip_characteristics_id:
|
||||
@@ -371,11 +383,8 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_rear_angle = fields.Integer('后角(°)')
|
||||
cutting_tool_main_included_angle = fields.Integer('主偏角(°)')
|
||||
# 适用夹头型号可以多选
|
||||
cutting_tool_chuck_ids = fields.Many2many(
|
||||
cutting_tool_chuck_id = fields.Many2one(
|
||||
'sf.cutting_tool.standard.library',
|
||||
relation='product_cutting_tool_library_handle_chuck_rel',
|
||||
column1='model_id_1',
|
||||
column2='model_id_2',
|
||||
domain="[('cutting_tool_type', '=', '夹头')]",
|
||||
string='适用夹头型号')
|
||||
# 刀片参数
|
||||
@@ -432,11 +441,8 @@ class ResProductMo(models.Model):
|
||||
cutting_tool_min_machining_aperture = fields.Integer('最小加工孔径(mm)')
|
||||
cutting_tool_install_blade_tip_num = fields.Integer('可装刀片数/齿数(个)', size=20)
|
||||
cutting_tool_installing_structure = fields.Char('安装结构', size=20)
|
||||
cutting_tool_blade_ids = fields.Many2many(
|
||||
cutting_tool_blade_id = fields.Many2one(
|
||||
'sf.cutting_tool.standard.library',
|
||||
relation='product_cutting_tool_library_pad_blade_rel',
|
||||
column1='model_id_1',
|
||||
column2='model_id_2',
|
||||
domain="[('cutting_tool_type', '=', '刀片')]",
|
||||
string='适用刀片型号' # 使用空列表作为默认值
|
||||
)
|
||||
@@ -547,12 +553,6 @@ class ResProductMo(models.Model):
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_chuck_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.product_id.cutting_tool_chuck_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_cutter_bar_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.product_id.cutting_tool_cutter_bar_ids:
|
||||
@@ -565,12 +565,6 @@ class ResProductMo(models.Model):
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_blade_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.product_id.cutting_tool_blade_ids:
|
||||
code_arr.append(i.code)
|
||||
return code_arr
|
||||
|
||||
def _json_handle_item_code(self, item):
|
||||
code_arr = []
|
||||
for i in item.product_id.cutting_tool_handle_ids:
|
||||
@@ -603,7 +597,6 @@ class ResProductMo(models.Model):
|
||||
for item in self:
|
||||
if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
|
||||
item.brand_id = item.fixture_model_id.brand_id.id
|
||||
item.fixture_multi_mounting_type_id = item.fixture_model_id.multi_mounting_type_id.id
|
||||
item.fixture_model_file = item.fixture_model_id.model_file
|
||||
item.tool_length = item.fixture_model_id.length
|
||||
item.tool_width = item.fixture_model_id.width
|
||||
|
||||
@@ -386,8 +386,6 @@ class ReStockMove(models.Model):
|
||||
'brand_code': self.env['sf.machine.brand'].search([('id', '=', item.product_id.brand_id.id)]).code,
|
||||
'fixture_material_code': self.env['sf.fixture.material'].search(
|
||||
[('id', '=', item.product_id.fixture_material_id.id)]).code,
|
||||
'fixture_multi_mounting_type_code': self.env['sf.multi_mounting.type'].search(
|
||||
[('id', '=', item.product_id.fixture_multi_mounting_type_id.id)]).code,
|
||||
'fixture_materials_type_code': self.env['sf.materials.model'].search(
|
||||
[('id', '=', item.product_id.materials_type_id.id)]).materials_no,
|
||||
'fixture_clamping_way': item.product_id.fixture_clamping_way,
|
||||
|
||||
Reference in New Issue
Block a user