194 lines
10 KiB
Python
194 lines
10 KiB
Python
from odoo import fields, models, api
|
|
|
|
|
|
class ToolMaterialsBasicParameters(models.Model):
|
|
_name = 'sf.tool.materials.basic.parameters'
|
|
_description = '刀具物料基本参数'
|
|
|
|
name = fields.Char('物料号', size=50)
|
|
code = fields.Char('编码', size=50)
|
|
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库')
|
|
cutting_tool_type = fields.Char(related='standard_library_id.cutting_tool_type', string='刀具物料类型',
|
|
store=True)
|
|
is_cloud = fields.Boolean(related='standard_library_id.is_cloud', string='云端数据')
|
|
|
|
# 整体式刀具参数
|
|
total_length = fields.Float('总长度(mm)')
|
|
blade_number = fields.Selection(
|
|
[('0', '0'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8')],
|
|
string='刃数(个)', default='0')
|
|
neck_diameter = fields.Float('颈部直径(mm)')
|
|
neck_length = fields.Float('颈部长度(mm)')
|
|
handle_diameter = fields.Float('柄部直径(mm)')
|
|
handle_length = fields.Float('柄部长度(mm)')
|
|
blade_tip_diameter = fields.Integer('刀尖直径(mm)')
|
|
blade_tip_working_size = fields.Char('刀尖处理尺寸(R半径mm/倒角)', size=20)
|
|
blade_tip_taper = fields.Integer('刀尖锥度(°)')
|
|
blade_diameter = fields.Float('刃部直径(mm)')
|
|
blade_length = fields.Float('刃部长度(mm)')
|
|
blade_helix_angle = fields.Integer('刃部螺旋角(°)')
|
|
blade_width = fields.Float('刃部宽度(mm)')
|
|
blade_depth = fields.Float('刃部深度(mm)')
|
|
pitch = fields.Float('牙距(mm)')
|
|
cutting_depth = fields.Float('切削深度(mm)')
|
|
# 刀片参数
|
|
length = fields.Float('长度(mm)')
|
|
thickness = fields.Float('厚度(mm)')
|
|
width = fields.Float('宽度(mm)')
|
|
cutting_blade_length = fields.Float('切削刃长(mm)')
|
|
relief_angle = fields.Integer('后角(°)')
|
|
blade_tip_circular_arc_radius = fields.Char('刀尖圆弧半径(mm)', size=20)
|
|
inscribed_circle_diameter = fields.Float('内接圆直径(mm)')
|
|
install_aperture_diameter = fields.Float('安装孔直径(mm)')
|
|
chip_breaker_groove = fields.Selection([('无', '无'), ('单面', '单面'), ('双面', '双面')],
|
|
string='有无断屑槽')
|
|
chip_breaker_type_code = fields.Char('断屑槽型代号')
|
|
blade_teeth_model = fields.Selection(
|
|
[('无', '无'), ('V牙型', 'V牙型'), ('米制全牙型', '米制全牙型'), ('美制全牙型', '美制全牙型'),
|
|
('惠氏全牙型', '惠氏全牙型'), ('BSPT全牙型', 'BSPT全牙型'), ('NPT全牙型', 'NPT全牙型'),
|
|
('UNJ全牙型', 'UNJ全牙型'), ('DIN405圆牙型', 'DIN405圆牙型'), ('ACME梯形', 'ACME梯形'),
|
|
('石油管螺纹刀片', '石油管螺纹刀片'), ('矮牙ACME梯形', '矮牙ACME梯形'),
|
|
('Trapeze30° 103', 'Trapeze30° 103')], string='刀片牙型', default='无')
|
|
blade_blade_number = fields.Selection(
|
|
[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'),
|
|
('9', '9'), ('10', '10')],
|
|
string='刀片的刃数(个)', default='0')
|
|
main_included_angle = fields.Integer('主偏角(°)')
|
|
top_angle = fields.Integer('顶角(°)')
|
|
thread_model = fields.Selection([('无', '无'), ('外螺纹', '外螺纹'), ('内螺纹', '内螺纹')], string='螺纹类型',
|
|
default='无')
|
|
thread_num = fields.Float('每英寸螺纹数(tpi)')
|
|
blade_tip_height_tolerance = fields.Char('刀尖高度公差(mm)', size=20)
|
|
inscribed_circle_tolerance = fields.Char('内接圆公差(mm)', size=20)
|
|
thickness_tolerance = fields.Char('厚度公差(mm)', size=20)
|
|
# 刀杆参数
|
|
height = fields.Float('高度(mm)')
|
|
blade_height = fields.Float('刃部高度(mm)')
|
|
knife_head_height = fields.Float('刀头高度(mm)')
|
|
knife_head_width = fields.Float('刀头宽度(mm)')
|
|
knife_head_length = fields.Float('刀头长度(mm)')
|
|
cut_depth_max = fields.Float('最大切削深度(mm)')
|
|
cutter_arbor_diameter = fields.Float('刀杆直径(mm)')
|
|
min_machining_aperture = fields.Integer('最小加工孔径(mm)')
|
|
install_blade_tip_num = fields.Integer('可装刀片数/齿数(个)')
|
|
cutting_blade_model = fields.Char('切削类型', size=20)
|
|
is_cooling_hole = fields.Boolean('有无冷却孔')
|
|
locating_slot_code = fields.Char('定位槽代号', size=20)
|
|
installing_structure = fields.Char('安装结构', size=20)
|
|
blade_id = fields.Many2one(
|
|
'sf.cutting_tool.standard.library',
|
|
domain="[('cutting_tool_material_id.name', '=', '刀片')]",
|
|
string='适配刀片型号' # 使用空列表作为默认值
|
|
)
|
|
tool_shim = fields.Char('适配刀垫型号', size=50)
|
|
cotter_pin = fields.Char('适配销钉型号', size=50)
|
|
pressing_plate = fields.Char('适配压板型号', size=50)
|
|
screw = fields.Char('适配螺钉型号', size=50)
|
|
spanner = fields.Char('适配扳手型号', size=50)
|
|
# 刀盘参数
|
|
cutter_head_diameter = fields.Float('刀盘直径(mm)')
|
|
interface_diameter = fields.Float('接口直径(mm)')
|
|
# 刀柄参数
|
|
flange_shank_length = fields.Float('法兰长(mm)')
|
|
flange_diameter = fields.Float('法兰直径(mm)')
|
|
fit_chuck_size = fields.Char('适配夹头尺寸')
|
|
handle_external_diameter = fields.Float('柄部外径(mm)')
|
|
handle_inside_diameter = fields.Float('柄部内径(mm)')
|
|
dynamic_balance_class = fields.Char('动平衡等级')
|
|
min_clamping_diameter = fields.Float('最小夹持直径(mm)')
|
|
max_clamping_diameter = fields.Float('最大夹持直径(mm)')
|
|
clamping_mode = fields.Char('夹持方式', size=20)
|
|
max_load_capacity = fields.Float('最大负载能力(kg)')
|
|
taper = fields.Integer('锥度(°)')
|
|
shank_length = fields.Float('刀柄长度(mm)', digits=(3, 2))
|
|
shank_diameter = fields.Float('刀柄直径(mm)')
|
|
tool_changing_time = fields.Integer('换刀时间(s)')
|
|
standard_rotate_speed = fields.Integer('标准转速(n/min)')
|
|
max_rotate_speed = fields.Integer('最大转速(n/min)')
|
|
diameter_slip_accuracy = fields.Char('径跳精度(mm)', size=20)
|
|
cooling_model = fields.Char('冷却类型', size=20)
|
|
taper_shank_model = fields.Char('锥柄型号')
|
|
is_quick_cutting = fields.Boolean('可高速切削', default=False)
|
|
is_safe_lock = fields.Boolean('有无安全锁', default=False)
|
|
chuck_id = fields.Many2one(
|
|
'sf.cutting_tool.standard.library',
|
|
domain="[('cutting_tool_material_id.name', '=', '夹头')]",
|
|
string='适配夹头型号' # 使用空列表作为默认值
|
|
)
|
|
nut = fields.Char('适配锁紧螺母型号')
|
|
|
|
# 夹头参数
|
|
er_size_model = fields.Char('ER尺寸型号', size=20)
|
|
outer_diameter = fields.Float('外径(mm)')
|
|
inner_diameter = fields.Float('内径(mm)')
|
|
run_out_accuracy = fields.Char('跳动精度(mm)', size=20)
|
|
top_diameter = fields.Float('顶部直径(mm)')
|
|
weight = fields.Float('重量(kg)')
|
|
clamping_length = fields.Float('夹持长度(mm)')
|
|
clamping_tolerance = fields.Char('夹持公差(mm)', size=20)
|
|
cooling_jacket = fields.Char('适用冷却套型号', size=50)
|
|
active = fields.Boolean(string='有效', default=True)
|
|
|
|
|
|
class CuttingSpeed(models.Model):
|
|
_name = 'sf.cutting.speed'
|
|
_description = '切削速度Vc'
|
|
|
|
name = fields.Char('名称')
|
|
product_template_id = fields.Many2one('product.template')
|
|
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
|
|
|
execution_standard_id = fields.Many2one('sf.international.standards', string='执行标准', store=True)
|
|
material_code = fields.Char('材料代号')
|
|
material_name_id = fields.Many2one('sf.materials.model', '材料名称',
|
|
domain="[('standards_id', '=', execution_standard_id)]")
|
|
material_grade = fields.Char('材料牌号')
|
|
tensile_strength = fields.Char('拉伸强度 (N/mm²)')
|
|
hardness = fields.Integer('硬度(hrc)')
|
|
ability_feature_library = fields.Many2one('maintenance.equipment.image', '加工方式',
|
|
domain="[('type', '=', '加工能力')]")
|
|
cutting_width_depth_id = fields.Many2one('sf.cutting.width.depth', '切削宽度和深度')
|
|
process_capability = fields.Selection([('粗加工', '粗加工'), ('精加工', '精加工')], string='粗/精加工')
|
|
cutting_speed = fields.Char('切削速度', required=True)
|
|
cutting_speed_max = fields.Float('最大值')
|
|
cutting_speed_min = fields.Float('最小值')
|
|
|
|
application = fields.Selection([('主应用', '主应用'), ('次应用', '次应用')], '主/次应用')
|
|
active = fields.Boolean(string='有效', default=True)
|
|
|
|
|
|
class FeedPerTooth(models.Model):
|
|
_name = 'sf.feed.per.tooth'
|
|
_description = '每齿走刀量fz'
|
|
_order = 'blade_diameter,cutting_width_depth_id,materials_type_id'
|
|
|
|
name = fields.Char('名称')
|
|
product_template_id = fields.Many2one('product.template')
|
|
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='标准库')
|
|
blade_diameter = fields.Integer('刃部直径(mm)', readonly=True)
|
|
materials_type_id = fields.Many2one('sf.materials.model', string='材料名称', readonly=True)
|
|
cutting_width_depth_id = fields.Many2one('sf.cutting.width.depth', '切削宽度和深度', readonly=True)
|
|
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)', size=20)
|
|
active = fields.Boolean(string='有效', default=True)
|
|
|
|
# @api.depends('product_template_id')
|
|
# def _compute_product_template_id(self):
|
|
# if self.product_template_id is not None:
|
|
# self.blade_diameter = self.product_template_id.cutting_tool_blade_diameter
|
|
|
|
|
|
class CuttingWidthDepth(models.Model):
|
|
_name = 'sf.cutting.width.depth'
|
|
_description = '切削宽度和深度'
|
|
|
|
name = fields.Char('名称')
|
|
|
|
|
|
class RampingAngle(models.Model):
|
|
_name = 'sf.ramping.angle'
|
|
_description = '坡铣角度'
|
|
|
|
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', '刀具标准库')
|
|
|
|
name = fields.Char('坡铣角度')
|