对产品的整体式刀具能力参数进行补充,对参数字段进行优化;对刀具物料查询的字段类型进行调整。

This commit is contained in:
yuxianghui
2023-09-05 17:21:39 +08:00
parent dbeb975cf6
commit a6ddfa22a1
4 changed files with 171 additions and 80 deletions

View File

@@ -74,12 +74,108 @@ class ResProductMo(models.Model):
tool_weight = fields.Float('重量(kg)')
coating_material = fields.Char('涂层材质')
# 整体式刀具参数
cutting_tool_total_length = fields.Float('总长度(mm)')
cutting_tool_shank_length = fields.Float('柄部长度(mm)')
cutting_tool_blade_length = fields.Float('刃部长度(mm)')
# 整体式刀具特有字段
cutting_tool_total_length = fields.Float('总长度(mm)', digits=(6, 1))
cutting_tool_shank_length = fields.Float('柄部长度(mm)', digits=(6, 1))
cutting_tool_blade_length = fields.Float('刃部长度(mm)', digits=(6, 1))
cutting_tool_blade_number = fields.Integer('刃数(个)')
# 整体式刀具新增字段
integral_code = fields.Char('整体式刀具编码', readonly=True)
integral_neck_length = fields.Float('整体式刀具颈部长度(mm)', digits=(6, 1))
integral_shank_diameter = fields.Float('整体式刀具柄部直径(mm)', digits=(6, 1))
integral_blade_diameter = fields.Float('整体式刀具刃部直径(mm)', digits=(6, 1))
integral_neck_diameter = fields.Float('整体式刀具颈部直径(mm)', digits=(6, 1))
integral_blade_tip_diameter = fields.Float('整体式刀具刀尖直径(mm)', digits=(6, 1))
integral_blade_tip_taper = fields.Float('整体式刀具刀尖锥度(°)', digits=(6, 1))
integral_blade_helix_angle = fields.Float('整体式刀具刃部螺旋角(°)', digits=(6, 1))
integral_blade_type = fields.Char('整体式刀具刃部类型')
integral_coarse_medium_fine = fields.Selection([('', ''), ('', ''), ('', '')], '整体式刀具粗/中/精')
integral_hardness = fields.Integer('整体式刀具硬度(HRC)')
integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6, 1))
integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1))
suitable_machining_method_ids = fields.Many2many('sf.suitable.machining.method',
'rel_suitable_machining_method_product_template', '适合加工方式')
blade_tip_characteristics_ids = fields.Many2many('sf.blade.tip.characteristics',
'rel_blade_tip_characteristics_product_template', '刀尖特征')
handle_type_ids = fields.Many2many('sf.handle.type', 'rel_handle_type_product_template', '柄部类型')
cutting_direction_ids = fields.Many2many('sf.cutting.direction', 'rel_cutting_direction_product_template', '走刀方向')
suitable_coolant_ids = fields.Many2many('sf.suitable.coolant', 'rel_suitable_coolant_product_template', '适合冷却液')
@api.constrains('suitable_machining_method_ids')
def _check_suitable_machining_method_ids(self):
for record in self:
if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("适合加工方式不能为空!")
@api.constrains('blade_tip_characteristics_ids')
def _check_blade_tip_characteristics_ids(self):
for record in self:
if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("刀尖特征不能为空!")
if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("刀尖特征只能单选!")
@api.constrains('handle_type_ids')
def _check_handle_type_ids(self):
for record in self:
if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("柄部类型不能为空!")
if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("柄部类型只能单选!")
@api.constrains('cutting_direction_ids')
def _check_cutting_direction_ids(self):
for record in self:
if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("走刀方向不能为空!")
@api.constrains('suitable_coolant_ids')
def _check_suitable_coolant_ids(self):
for record in self:
if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具':
raise ValidationError("适合冷却液不能为空!")
@api.constrains('integral_total_length')
def _check_integral_total_length(self):
if self.cutting_tool_total_length <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("总长度不能为0")
@api.constrains('integral_shank_length')
def _check_integral_shank_length(self):
if self.cutting_tool_shank_length <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("柄部长度不能为0")
@api.constrains('integral_blade_length')
def _check_integral_blade_length(self):
if self.cutting_tool_blade_length <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("刃部长度不能为0")
@api.constrains('integral_blade_number')
def _check_integral_blade_number(self):
if self.cutting_tool_blade_number <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("刃数不能为0")
@api.constrains('integral_shank_diameter')
def _check_integral_shank_diameter(self):
if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("柄部直径不能为0")
@api.constrains('integral_blade_diameter')
def _check_integral_blade_diameter(self):
if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("刃部直径不能为0")
@api.constrains('integral_run_out_accuracy_min')
def _check_integral_blade_diameter(self):
if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("端跳精度最小(min)不能为0")
@api.constrains('integral_run_out_accuracy_max')
def _check_integral_run_out_accuracy_max(self):
if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具':
raise ValidationError("端跳精度最大(max)不能为0")
cutting_tool_diameter = fields.Float('直径(mm)')
cutting_tool_blade_number = fields.Integer('刃数')
cutting_tool_front_angle = fields.Float('前角(°)')
cutting_tool_rear_angle = fields.Float('后角(°)')
cutting_tool_main_included_angle = fields.Float('主偏角(°)')