产品优化

This commit is contained in:
jinling.yang
2023-11-16 17:35:04 +08:00
parent 77535fa70e
commit f36c2ac096
5 changed files with 87 additions and 45 deletions

View File

@@ -340,7 +340,7 @@ class FeedPerTooth(models.Model):
cutting_speed = fields.Char('径向切宽 ae(mm)')
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
blade_diameter = fields.Char('刃部直径(mm)', readonly=True)
blade_diameter = fields.Integer('刃部直径(mm)', readonly=True)
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
def _json_feed_per_tooth(self, obj):

View File

@@ -95,7 +95,6 @@ class ResMrpBomMo(models.Model):
limit=1,
order='volume desc'
)
logging.info('get_bom-vals:%s' % embryo_has)
if embryo_has:
rate_of_waste = ((embryo_has.volume - product.model_volume) % embryo_has.volume) * 100
if rate_of_waste <= 20:

View File

@@ -262,7 +262,7 @@
<span>(mm)&amp;nbsp;</span>
</div>
<field name="cutting_tool_clamping_way"
attrs="{'required': [('cutting_tool_type','in',('整体式刀具','刀片','刀杆','刀盘'))]}"/>
attrs="{'invisible': [('cutting_tool_type','not in',('刀柄','夹头'))]}"/>
<field name="cutting_tool_top_diameter" class="diameter"
attrs='{"invisible": [("cutting_tool_type","!=","夹头")]}'/>
<field name="cutting_tool_outer_diameter" class="diameter"

View File

@@ -151,33 +151,35 @@ class ResProductMo(models.Model):
item.cutting_speed_ids = False
item.feed_per_tooth_ids = False
def choice(self):
if self.cutting_tool_type == '整体式刀具':
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
elif self.cutting_tool_type == '刀片':
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
elif self.cutting_tool_type == '刀杆':
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
elif self.cutting_tool_type == '刀盘':
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
elif self.cutting_tool_type == '刀柄':
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
else:
tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
return {
'name': _('规格'),
'view_mode': 'list',
'view_id': tree_view.id,
'type': 'ir.actions.act_window',
'res_model': 'sf.tool.materials.basic.parameters',
'target': 'new',
'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
('standard_library_id', '=', self.cutting_tool_model_id.id)],
}
# def choice(self):
# if self.cutting_tool_type == '整体式刀具':
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_integral_tree')
# elif self.cutting_tool_type == '刀片':
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_blade_tree')
# elif self.cutting_tool_type == '刀杆':
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_cutter_bar_tree')
# elif self.cutting_tool_type == '刀盘':
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
# elif self.cutting_tool_type == '刀柄':
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
# else:
# tree_view = self.env.ref('sf_base.view_sf_tool_materials_basic_parameters_tree')
# return {
# 'name': _('规格'),
# 'view_mode': 'list',
# 'view_id': tree_view.id,
# 'type': 'ir.actions.act_window',
# 'res_model': 'sf.tool.materials.basic.parameters',
# 'target': 'new',
# 'domain': [('cutting_tool_type', '=', self.cutting_tool_type),
# ('standard_library_id', '=', self.cutting_tool_model_id.id)],
# }
@api.onchange('specification_id')
def _onchange_specification(self):
if self.specification_id:
self.cutting_speed_ids = False
self.feed_per_tooth_ids = False
self.cutting_tool_type_id = self.cutting_tool_model_id.cutting_tool_type_id.id
self.brand_id = self.cutting_tool_model_id.brand_id.id
self.tool_hardness = self.cutting_tool_model_id.tool_hardness
@@ -202,14 +204,18 @@ class ResProductMo(models.Model):
self.cutting_tool_blade_depth = self.specification_id.blade_depth
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
self.feed_per_tooth_ids = [(0, 0, {'product_template_id': product_template.id,
'cutting_speed': product_template.cutting_speed,
'machining_method': product_template.machining_method,
'blade_diameter': product_template.blade_diameter,
'materials_type_id': product_template.materials_type_id.id}) for
product_template in
self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
lambda r: r.blade_diameter == self.specification_id.blade_diameter)]
# # self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.
# for tooth in self.cutting_tool_model_id.feed_per_tooth_ids:
# print(int(tooth.blade_diameter))
# print(int(self.specification_id.blade_diameter))
# if int(tooth.blade_diameter) == int(self.specification_id.blade_diameter):
# self.feed_per_tooth_ids = [(0, 0, {
# 'cutting_speed': tooth.cutting_speed,
# 'machining_method': tooth.machining_method,
# 'blade_diameter': tooth.blade_diameter,
# 'materials_type_id': tooth.materials_type_id.id})]
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
@@ -284,8 +290,8 @@ class ResProductMo(models.Model):
elif self.cutting_tool_type == '刀柄':
self.cutting_tool_total_length = self.specification_id.total_length
self.cutting_tool_standard_speed = self.specification_id.standard_rotate_speed
self.cutting_tool_speed_max = self.specification_id.speed_max
self.cutting_tool_change_time = self.specification_id.change_time
self.cutting_tool_speed_max = self.specification_id.max_rotate_speed
self.cutting_tool_change_time = self.specification_id.tool_changing_time
self.cutting_tool_total_length = self.specification_id.total_length
self.cutting_tool_clamping_diameter_max = self.specification_id.max_clamping_diameter
self.cutting_tool_clamping_diameter_min = self.specification_id.min_clamping_diameter
@@ -313,6 +319,44 @@ class ResProductMo(models.Model):
self.compaction_way_ids = [(6, 0,
[])] if not self.cutting_tool_model_id.compaction_way_ids else [
(6, 0, self.cutting_tool_model_id.compaction_way_ids.ids)]
else:
self.cutting_tool_type_id = False
self.brand_id = False
self.tool_hardness = False
self.cutting_tool_run_out_accuracy_max = False
self.cutting_tool_run_out_accuracy_min = False
self.materials_type_id = False
self.cutting_tool_blade_type = False
self.cutting_tool_total_length = False
self.cutting_tool_clamping_way = False
self.cutting_tool_blade_diameter = False
self.cutting_tool_shank_length = False
self.cutting_tool_blade_length = False
self.cutting_tool_blade_number = False
self.cutting_tool_neck_length = False
self.cutting_tool_neck_diameter = False
self.cutting_tool_shank_diameter = False
self.cutting_tool_blade_tip_diameter = False
self.cutting_tool_blade_tip_taper = False
self.cutting_tool_blade_helix_angle = False
self.cutting_tool_blade_type = False
self.cutting_tool_pitch = False
self.cutting_tool_blade_width = False
self.cutting_tool_blade_depth = False
self.cutting_tool_cut_depth = False
self.cutting_tool_coarse_medium_fine = False
self.cutting_tool_run_out_accuracy_max = False
self.cutting_tool_run_out_accuracy_min = False
self.cutting_tool_blade_tip_working_size = False
self.fit_blade_shape_id = False
self.suitable_machining_method_ids = False
self.blade_tip_characteristics_id = False
self.handle_type_ids = False
self.cutting_direction_ids = False
self.suitable_coolant_ids = False
self.compaction_way_ids = False
self.cutting_speed_ids = False
self.feed_per_tooth_ids = False
# @api.constrains('suitable_machining_method_ids')
# def _check_suitable_machining_method_ids(self):
@@ -899,7 +943,8 @@ class SfMaintenanceEquipmentTool(models.Model):
_description = '机床刀位'
equipment_id = fields.Many2one('maintenance.equipment', string='设备')
product_template_id = fields.Many2one('product.template', string='功能刀具名称', domain="[('categ_type', '=', '刀具')]")
product_template_id = fields.Many2one('product.template', string='功能刀具名称',
domain="[('categ_type', '=', '刀具')]")
image_1920 = fields.Binary('图片', related='product_template_id.image_1920')
categ_type = fields.Char(string='功能刀具类型')
diameter = fields.Char('直径')
@@ -911,5 +956,3 @@ class SfMaintenanceEquipmentTool(models.Model):
alarm_value = fields.Char('报警值')
used_value = fields.Char('已使用值')
code = fields.Char('机床刀位号')

View File

@@ -309,12 +309,12 @@ class StockPicking(models.Model):
res = super().button_validate()
# 采购单验证(夹具)
for item in self.move_ids_without_package:
if item.quantity_done > 0:
if item.product_id.categ_type == '夹具':
item._register_fixture()
elif item.product_id.categ_type == '刀具':
item._register_cutting_tool()
# for item in self.move_ids_without_package:
# if item.quantity_done > 0:
# if item.product_id.categ_type == '夹具':
# item._register_fixture()
# elif item.product_id.categ_type == '刀具':
# item._register_cutting_tool()
return res
# 创建 外协出库入单