From d1c10f56d1bea67dd82c69c3651efcc7e7de344b Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Fri, 5 Jan 2024 17:33:06 +0800
Subject: [PATCH 1/4] =?UTF-8?q?1=E3=80=81sf=5Fbase=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E5=88=80=E5=85=B7=E7=BB=84=E6=A8=A1=E5=9E=8B=EF=BC=9B2?=
=?UTF-8?q?=E3=80=81=E6=89=80=E4=BB=A5=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=A8=A1=E5=9E=8B=E6=B7=BB=E5=8A=A0=E5=88=80?=
=?UTF-8?q?=E5=85=B7=E7=BB=84=E5=AF=B9=E8=B1=A1=E5=AD=97=E6=AE=B5=EF=BC=88?=
=?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=EF=BC=89=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_base/models/tool_base_new.py | 9 +++++++++
sf_base/security/ir.model.access.csv | 1 +
sf_base/views/tool_menu.xml | 7 +++++++
sf_base/views/tool_views.xml | 22 ++++++++++++++++++++++
sf_tool_management/models/base.py | 10 +++++++++-
5 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py
index 4dc6b619..3d6504ab 100644
--- a/sf_base/models/tool_base_new.py
+++ b/sf_base/models/tool_base_new.py
@@ -238,3 +238,12 @@ class MaintenanceStandardImage(models.Model):
else:
record['image'] = ""
return records
+
+
+class ToolGroups(models.Model):
+ _name = 'sf.tool.groups'
+ _description = '刀具组'
+
+ name = fields.Char('名称')
+ equipment_ids = fields.Many2many('maintenance.equipment', 'ref_maintenance_equipment', string='机台号')
+ remark = fields.Char('备注', size=50)
diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv
index 77c3e810..1490b9ef 100644
--- a/sf_base/security/ir.model.access.csv
+++ b/sf_base/security/ir.model.access.csv
@@ -28,6 +28,7 @@ access_sf_sync_common,sf_sync_common,model_sf_sync_common,base.group_user,1,1,1,
access_sf_international_standards,sf_international_standards,model_sf_international_standards,base.group_user,1,1,1,1
access_material_apply,material_apply,model_material_apply,base.group_user,1,1,1,1
access_sf_cutting_tool_standard_library,sf_cutting_tool_standard_library,model_sf_cutting_tool_standard_library,base.group_user,1,1,1,1
+access_sf_tool_groups,sf_tool_groups,model_sf_tool_groups,base.group_user,1,1,1,1
access_sf_tool_materials_basic_parameters,sf_tool_materials_basic_parameters,model_sf_tool_materials_basic_parameters,base.group_user,1,1,1,1
access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,1,1,1,1
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,1
diff --git a/sf_base/views/tool_menu.xml b/sf_base/views/tool_menu.xml
index cddb7d90..82ecca18 100644
--- a/sf_base/views/tool_menu.xml
+++ b/sf_base/views/tool_menu.xml
@@ -92,5 +92,12 @@
action="action_maintenance_equipment_image"
sequence="5"/>
+
+
diff --git a/sf_base/views/tool_views.xml b/sf_base/views/tool_views.xml
index f189017d..d300f845 100644
--- a/sf_base/views/tool_views.xml
+++ b/sf_base/views/tool_views.xml
@@ -493,6 +493,28 @@
[]
+
+
+ 刀具组
+ sf.tool.groups
+
+
+
+
+
+
+
+
+
+
+
+
+ 刀具组
+ ir.actions.act_window
+ sf.tool.groups
+ tree,form,search
+
+
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index 80ac3811..d64b8ee1 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -10,7 +10,8 @@ class FunctionalCuttingToolEntity(models.Model):
_name = 'sf.functional.cutting.tool.entity'
_description = '功能刀具列表'
- # code = fields.Char('序列号')
+ code = fields.Char('编码', related='functional_tool_name_id.code')
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
name = fields.Char(related='functional_tool_name_id.name')
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称', readonly=True)
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
@@ -175,6 +176,8 @@ class FunctionalToolWarning(models.Model):
_name = 'sf.functional.tool.warning'
_description = '功能刀具预警'
+ code = fields.Char('编码', related='functional_tool_name_id.code')
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
name = fields.Char('名称', invisible=True, readonly=True, related='functional_tool_name_id.name')
# 机床信息
production_line_id = fields.Many2one('sf.production.line', string='生产线',
@@ -243,6 +246,8 @@ class StockMoveLine(models.Model):
diameter = fields.Integer(string='刀具直径(mm)', related='functional_tool_name_id.functional_tool_diameter')
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', related='functional_tool_name_id.knife_tip_r_angle')
install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time')
+ code = fields.Char('编码', related='functional_tool_name_id.code')
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
@api.model
def _read_group_functional_tool_type_id(self, categories, domain, order):
@@ -255,6 +260,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
_description = '功能刀具安全库存'
name = fields.Char('功能刀具名称', readonly=False)
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组')
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False,
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
@@ -421,6 +427,8 @@ class MachineTableToolChangingApply(models.Model):
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=True,
required=True, domain="[('equipment_id', '=', maintenance_equipment_id)]")
# 功能刀具信息
+ code = fields.Char('编码', related='functional_tool_name_id.code')
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
functional_tool_name = fields.Char(string='刀具名称', related='functional_tool_name_id.name', store=True)
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', store=True,
domain=[('product_id.name', '=', '功能刀具')],
From 498e1c12afb6e03ffaec9f6a30d50fc0aaf8a0a0 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Mon, 8 Jan 2024 17:42:34 +0800
Subject: [PATCH 2/4] =?UTF-8?q?1=E3=80=81=E6=89=80=E6=9C=89=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E7=9B=B8=E5=85=B3=E6=A8=A1=E5=9E=8B?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=80=E5=85=B7=E7=BB=84=E5=AD=97=E6=AE=B5?=
=?UTF-8?q?=E5=AF=B9=E8=B1=A1=EF=BC=8C=E5=B9=B6=E4=B8=94=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=88=80=E5=85=B7=E5=90=8D=E7=A7=B0=E6=A0=B9=E6=8D=AE=E8=A7=84?=
=?UTF-8?q?=E5=88=99=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=EF=BC=9B2?=
=?UTF-8?q?=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E7=BB=84=E8=A3=85?=
=?UTF-8?q?=E6=97=B6=E6=8C=89=E8=A7=84=E5=88=99=E8=87=AA=E5=8A=A8=E7=94=9F?=
=?UTF-8?q?=E6=88=90=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E7=BC=96=E7=A0=81?=
=?UTF-8?q?=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/product_template.py | 79 +++++++++++++-------
sf_tool_management/models/base.py | 19 ++++-
sf_tool_management/views/tool_base_views.xml | 38 ++++++++--
sf_tool_management/wizard/wizard.py | 78 ++++++++++++++++++-
sf_tool_management/wizard/wizard_view.xml | 8 +-
5 files changed, 179 insertions(+), 43 deletions(-)
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 333da9aa..b974dba4 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -486,6 +486,8 @@ class ResProductMo(models.Model):
string='适用刀柄型号'
)
+
+
# 注册状态
register_state = fields.Selection([('未注册', '未注册'), ('已注册', '已注册'), ('注册失败', '注册失败')],
string='注册状态', default='未注册')
@@ -598,35 +600,35 @@ class ResProductMo(models.Model):
if item.fixture_material_id.id != item.fixture_model_id.fixture_material_id.id:
item.fixture_model_id = False
- @api.onchange('fixture_model_id')
- def _onchange_fixture_model_id(self):
- 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
- item.tool_height = item.fixture_model_id.height
- item.tool_weight = item.fixture_model_id.weight
- item.materials_type_id = item.fixture_model_id.materials_model_id.id
- item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
- item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
- if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
- item.fixture_clamping_way = item.fixture_model_id.clamping_way
- item.fixture_port_type = item.fixture_model_id.port_type
- if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
- item.fixture_driving_way = item.fixture_model_id.driving_way
- if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
- item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
- item.fixture_screw_size = item.fixture_model_id.screw_size
- if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
- item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
- item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
- item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
- item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
- item.fixture_apply_machine_tool_type_ids = self._get_ids(
- item.fixture_model_id.apply_machine_tool_type_ids)
+ # @api.onchange('fixture_model_id')
+ # def _onchange_fixture_model_id(self):
+ # 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
+ # item.tool_height = item.fixture_model_id.height
+ # item.tool_weight = item.fixture_model_id.weight
+ # item.materials_type_id = item.fixture_model_id.materials_model_id.id
+ # item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
+ # item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
+ # if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
+ # item.fixture_clamping_way = item.fixture_model_id.clamping_way
+ # item.fixture_port_type = item.fixture_model_id.port_type
+ # if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
+ # item.fixture_driving_way = item.fixture_model_id.driving_way
+ # if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
+ # item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
+ # item.fixture_screw_size = item.fixture_model_id.screw_size
+ # if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
+ # item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
+ # item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
+ # item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
+ # item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
+ # item.fixture_apply_machine_tool_type_ids = self._get_ids(
+ # item.fixture_model_id.apply_machine_tool_type_ids)
def _get_volume_uom_id_from_ir_config_parameter(self):
product_length_in_feet_param = self.env['ir.config_parameter'].sudo().get_param('product.volume_in_cubic_feet')
@@ -877,6 +879,25 @@ class ResProductFixture(models.Model):
mounting_hole_depth = fields.Float('安装孔深度(mm)', digits=(16, 2))
centering_diameter = fields.Float('定心直径(mm)', digits=(16, 2))
+ # (待删除字段)
+ fixture_multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
+ fixture_clamping_way = fields.Char(string="装夹方式")
+ fixture_port_type = fields.Char(string="接口类型")
+ fixture_model_file = fields.Binary(string="3D模型图")
+
+ fixture_clamp_workpiece_length_max = fields.Integer(string="夹持工件长度max(mm)")
+ fixture_clamp_workpiece_width_max = fields.Integer(string="夹持工件宽度max(mm)")
+ fixture_clamp_workpiece_height_max = fields.Integer(string="夹持工件高度max(mm)")
+ fixture_clamp_workpiece_diameter_max = fields.Float(string="夹持工件直径max(mm)", digits=(16, 6))
+
+ fixture_maximum_carrying_weight = fields.Float(string="最大承载重量(kg)", digits=(16, 4))
+ fixture_maximum_clamping_force = fields.Integer(string="最大夹持力(n)")
+ fixture_driving_way = fields.Char(string="驱动方式")
+ fixture_apply_machine_tool_type_ids = fields.Many2many('sf.machine_tool.type', 'rel_product_machine_tool_type',
+ string="适用机床型号")
+ fixture_through_hole_size = fields.Integer(string="过孔大小(mm)")
+ fixture_screw_size = fields.Integer(string="螺牙大小(mm)")
+
@api.onchange('specification_fixture_id')
def _onchange_specification_fixture_id(self):
if self.specification_fixture_id:
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index d64b8ee1..01f46343 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -10,8 +10,8 @@ class FunctionalCuttingToolEntity(models.Model):
_name = 'sf.functional.cutting.tool.entity'
_description = '功能刀具列表'
- code = fields.Char('编码', related='functional_tool_name_id.code')
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', related='functional_tool_name_id.tool_groups_id')
+ code = fields.Char('编码', related='functional_tool_name_id.code')
name = fields.Char(related='functional_tool_name_id.name')
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称', readonly=True)
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
@@ -259,8 +259,8 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
_name = 'sf.real.time.distribution.of.functional.tools'
_description = '功能刀具安全库存'
- name = fields.Char('功能刀具名称', readonly=False)
- tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组')
+ name = fields.Char('功能刀具名称', readonly=True, compute='_compute_name')
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=False, required=True)
sf_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False,
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
@@ -303,6 +303,14 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
sf_functional_tool_assembly_ids = fields.Many2many('sf.functional.tool.assembly', 'sf_functional_tool_assembly_ref',
'功能刀具组装单', readonly=True)
+ @api.depends('tool_groups_id', 'diameter', 'knife_tip_r_angle')
+ def _compute_name(self):
+ for obj in self:
+ if obj.tool_groups_id:
+ obj.name = '%s-D%sR%s' % (obj.tool_groups_id.name, obj.diameter, obj.knife_tip_r_angle)
+ else:
+ obj.name = None
+
@api.constrains('min_stock_num', 'max_stock_num')
def _check_stock_num(self):
for obj in self:
@@ -347,6 +355,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
functional_tool_assembly = tool.env['sf.functional.tool.assembly'].sudo().create({
'functional_tool_name': tool.name,
'functional_tool_type_id': tool.sf_cutting_tool_type_id.id,
+ 'tool_groups_id': tool.tool_groups_id.id,
'functional_tool_diameter': tool.diameter,
'knife_tip_r_angle': tool.knife_tip_r_angle,
'coarse_middle_thin': tool.coarse_middle_thin,
@@ -685,8 +694,10 @@ class FunctionalToolAssembly(models.Model):
for obj in self:
obj.name = obj.after_assembly_functional_tool_name
+ code = fields.Char('功能刀具编码', readonly=True)
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=True)
name = fields.Char(string='名称', readonly=True, compute='_compute_name')
- assembly_order_code = fields.Char(string='编码', readonly=True)
+ assembly_order_code = fields.Char(string='组装单编码', readonly=True)
functional_tool_name_id = fields.Many2one('product.product', string='功能刀具', readonly=True)
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml
index 62c0f0eb..f357168d 100644
--- a/sf_tool_management/views/tool_base_views.xml
+++ b/sf_tool_management/views/tool_base_views.xml
@@ -10,6 +10,7 @@
+
@@ -80,9 +81,11 @@
+
+
+
@@ -310,7 +314,7 @@
-
+
@@ -318,6 +322,8 @@
+
+
+
@@ -513,6 +521,8 @@
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
type="action"
context="{ 'default_name':name,
+ 'default_code':code,
+ 'default_tool_groups_id':tool_groups_id,
'default_production_line_id': production_line_id,
'default_maintenance_equipment_id': maintenance_equipment_id,
'default_machine_table_type_id': machine_table_type_id,
@@ -548,6 +558,8 @@
name="%(sf_tool_management.sf_tool_transfer_request_information_act)d"
type="action"
context="{ 'default_name':name,
+ 'default_code':code,
+ 'default_tool_groups_id':tool_groups_id,
'default_production_line_id': production_line_id,
'default_maintenance_equipment_id': maintenance_equipment_id,
'default_machine_table_type_id': machine_table_type_id,
@@ -587,6 +599,8 @@
name="%(sf_tool_management.sf_tool_change_requirement_information_act)d"
type="action"
context="{ 'default_name':name,
+ 'default_code':code,
+ 'default_tool_groups_id':tool_groups_id,
'default_production_line_id': production_line_id,
'default_maintenance_equipment_id': maintenance_equipment_id,
'default_machine_table_type_id': machine_table_type_id,
@@ -673,9 +687,11 @@
+
+
@@ -856,7 +872,9 @@
+
+
@@ -878,7 +896,7 @@
-
+
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index a8b10fd1..a9699480 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -8,6 +8,8 @@ class ToolChangeRequirementInformation(models.TransientModel):
_name = 'sf.tool.change.requirement.information'
_description = '换刀需求信息'
+ code = fields.Char('编码', readonly=True)
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=True)
name = fields.Char('名称', related='maintenance_equipment_id.name', store=True, readonly=True)
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', readonly=True)
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=True)
@@ -32,7 +34,7 @@ class ToolChangeRequirementInformation(models.TransientModel):
effective_length = fields.Float(string='有效长(mm)', readonly=True)
# 待换功能刀具信息
- replacement_tool_name = fields.Char(string='待换功能刀具名称', required=True)
+ replacement_tool_name = fields.Char(string='待换功能刀具名称', compute='_compute_name')
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型')
replacement_diameter = fields.Integer(string='待换刀具直径(mm)')
replacement_knife_tip_r_angle = fields.Float(string='待换刀具刀尖R角(mm)', requride=True)
@@ -52,6 +54,16 @@ class ToolChangeRequirementInformation(models.TransientModel):
applicant = fields.Char(string='申请人', default=lambda self: self.env.user.name, readonly=True)
reason_for_applying = fields.Char(string='申请原因')
+ @api.depends('replacement_diameter', 'replacement_knife_tip_r_angle', 'tool_groups_id')
+ def _compute_name(self):
+ for obj in self:
+ if obj.tool_groups_id:
+ obj.replacement_tool_name = '%s-D%sR%s' % (
+ obj.tool_groups_id.name, obj.replacement_diameter,
+ obj.replacement_knife_tip_r_angle)
+ else:
+ obj.replacement_tool_name = None
+
@api.constrains('replacement_knife_tip_r_angle', 'replacement_diameter', 'replacement_tool_coarse_middle_thin',
'new_former')
def _check_length_or_diamenter(self):
@@ -90,6 +102,7 @@ class ToolChangeRequirementInformation(models.TransientModel):
# 功能刀具组装创建新任务(new_assembly_task)
sf_functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().create({
'functional_tool_name': self.replacement_tool_name,
+ 'tool_groups_id': self.tool_groups_id.id,
'functional_tool_type_id': self.replacement_tool_type_id.id,
'functional_tool_diameter': self.replacement_diameter,
'knife_tip_r_angle': self.replacement_knife_tip_r_angle,
@@ -175,7 +188,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
_inherit = ["barcodes.barcode_events_mixin"]
_description = '功能刀具组装单'
- assembly_order_code = fields.Char(string='编码', readonly=True)
+ assembly_order_code = fields.Char(string='组装单编码', readonly=True)
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', readonly=True)
functional_tool_name_id = fields.Many2one('product.product', string='功能刀具', readonly=True)
functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
@@ -307,7 +321,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 组装功能刀具参数信息
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
- after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', required=True)
+ tool_code = fields.Char(string='功能刀具编码', readonly=True, compute='_compute_tool_code')
+ after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', compute='_compute_name')
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
string='组装后功能刀具类型',
compute='_compute_after_assembly_functional_tool_type_id')
@@ -331,6 +346,59 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
hiding_length = fields.Float(string='避空长(mm)')
# functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False)
+ # res_partner_id = fields.Many2one('res.partner', '智能工厂', domain="[('is_factory', '=', True)]")
+
+ @api.depends('after_assembly_functional_tool_type_id', 'integral_specification_id', 'bar_specification_id',
+ 'pad_specification_id', 'handle_specification_id', 'res_partner_id',
+ 'after_assembly_tool_loading_length')
+ def _compute_tool_code(self):
+ for obj in self:
+ str_1 = 'GNDJ-%s' % obj.after_assembly_functional_tool_type_id.code
+ str_2 = ''
+ num = None
+ if obj.handle_specification_id:
+ if obj.integral_specification_id:
+ str_2 = '%s-D%sL%sB%sH%s-' % (
+ str_1, obj.integral_specification_id.blade_diameter, obj.after_assembly_tool_loading_length,
+ obj.integral_specification_id.blade_length, obj.handle_specification_id.total_length)
+ num = self._get_code(str_2)
+ elif obj.bar_specification_id:
+ str_2 = '%s-D%sL%sB%sH%s-' % (
+ str_1, obj.bar_specification_id.cutter_arbor_diameter, obj.after_assembly_tool_loading_length,
+ obj.bar_specification_id.blade_length, obj.handle_specification_id.total_length)
+ num = self._get_code(str_2)
+ elif obj.pad_specification_id:
+ str_2 = '%s-D%sL%sB%sH%s-' % (
+ str_1, obj.pad_specification_id.cutter_head_diameter, obj.after_assembly_tool_loading_length,
+ obj.pad_specification_id.cut_depth_max, obj.handle_specification_id.total_length,
+ )
+ num = self._get_code(str_2)
+ obj.tool_code = str_2 + str(num)
+ else:
+ obj.tool_code = None
+
+ def _get_code(self, str_2):
+ functional_tool_assembly = self.env['sf.functional.tool.assembly'].sudo().search(
+ [('code', 'like', str_2)],
+ limit=1,
+ order="id desc"
+ )
+ if not functional_tool_assembly:
+ num = "%03d" % 1
+ else:
+ m = int(functional_tool_assembly.code[-3:]) + 1
+ num = "%03d" % m
+ return num
+
+ @api.depends('after_assembly_functional_tool_diameter', 'after_assembly_knife_tip_r_angle', 'tool_groups_id')
+ def _compute_name(self):
+ for obj in self:
+ if obj.tool_groups_id:
+ obj.after_assembly_functional_tool_name = '%s-D%sR%s' % (
+ obj.tool_groups_id.name, obj.after_assembly_functional_tool_diameter,
+ obj.after_assembly_knife_tip_r_angle)
+ else:
+ obj.after_assembly_functional_tool_name = None
@api.onchange('integral_code_id')
def _onchange_after_assembly_functional_tool_diameter(self):
@@ -453,6 +521,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
def get_desc_1(self, stock_lot):
return {
'barcode_id': stock_lot.id,
+ 'code': self.tool_code,
+ 'tool_groups_id': self.tool_groups_id.id,
'integral_code_id': self.integral_code_id.id,
'blade_code_id': self.blade_code_id.id,
'bar_code_id': self.bar_code_id.id,
@@ -487,6 +557,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
def get_desc_2(self, stock_lot, functional_tool_assembly_id):
return {
'barcode_id': stock_lot.id,
+ 'code': self.tool_code,
+ 'tool_groups_id': self.tool_groups_id.id,
'functional_tool_name_id': functional_tool_assembly_id.id,
'sf_cutting_tool_type_id': self.after_assembly_functional_tool_type_id.id,
'cutting_tool_integral_model_id': self.integral_code_id.product_id.id,
diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml
index 7586a513..5c007bdc 100644
--- a/sf_tool_management/wizard/wizard_view.xml
+++ b/sf_tool_management/wizard/wizard_view.xml
@@ -25,8 +25,10 @@
+
+
@@ -38,6 +40,7 @@
+
@@ -178,6 +181,7 @@
+
@@ -328,10 +332,12 @@
-
+
+
+
From 4e6a66c68185f5bb3ea934e4aab03812df835993 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Tue, 9 Jan 2024 10:30:18 +0800
Subject: [PATCH 3/4] =?UTF-8?q?1=E3=80=81=E5=88=A0=E9=99=A4=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E7=BB=84=E8=A3=85=E5=8D=95=E7=9A=84?=
=?UTF-8?q?=E5=8A=A0=E5=B7=A5=E5=B7=A5=E5=8E=82=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/wizard/wizard.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index a9699480..ec20797a 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -349,8 +349,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# res_partner_id = fields.Many2one('res.partner', '智能工厂', domain="[('is_factory', '=', True)]")
@api.depends('after_assembly_functional_tool_type_id', 'integral_specification_id', 'bar_specification_id',
- 'pad_specification_id', 'handle_specification_id', 'res_partner_id',
- 'after_assembly_tool_loading_length')
+ 'pad_specification_id', 'handle_specification_id', 'after_assembly_tool_loading_length')
def _compute_tool_code(self):
for obj in self:
str_1 = 'GNDJ-%s' % obj.after_assembly_functional_tool_type_id.code
From 8332c5d1411f8aee568d8ee6e82a0c6123c9f489 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Tue, 9 Jan 2024 11:15:48 +0800
Subject: [PATCH 4/4] =?UTF-8?q?1=E3=80=81=E5=88=A0=E9=99=A4=E4=BA=A7?=
=?UTF-8?q?=E5=93=81=E4=B8=AD=E5=92=8C=E5=A4=B9=E5=85=B7=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E7=9A=84=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81=EF=BC=9B2?=
=?UTF-8?q?=E3=80=81=E6=B7=BB=E5=8A=A0=E5=A4=B9=E5=85=B7=E5=9E=8B=E5=8F=B7?=
=?UTF-8?q?=E5=92=8C=E8=81=94=E8=A3=85=E7=B1=BB=E5=9E=8B=E5=BF=85=E5=A1=AB?=
=?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=A1=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../product_template_management_view.xml | 7 +-
sf_manufacturing/models/product_template.py | 103 +-----------------
2 files changed, 6 insertions(+), 104 deletions(-)
diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml
index 94cb4b7f..7b42320e 100644
--- a/sf_dlm_management/views/product_template_management_view.xml
+++ b/sf_dlm_management/views/product_template_management_view.xml
@@ -39,7 +39,7 @@
-
-
+
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 1361a821..eeb9bd0d 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -515,36 +515,6 @@ class ResProductMo(models.Model):
if self.tool_thickness > 1000000:
raise ValidationError("厚度不能超过1000000")
- @api.constrains('fixture_clamp_workpiece_length_max')
- def _check_fixture_clamp_workpiece_length_max_size(self):
- if self.fixture_clamp_workpiece_length_max > 1000000:
- raise ValidationError("夹持工件长度MAX不能超过1000000")
-
- @api.constrains('fixture_clamp_workpiece_width_max')
- def _check_fixture_clamp_workpiece_width_max_size(self):
- if self.fixture_clamp_workpiece_width_max > 1000000:
- raise ValidationError("夹持工件宽度MAX不能超过1000000")
-
- @api.constrains('fixture_clamp_workpiece_height_max')
- def _check_fixture_clamp_workpiece_height_max_size(self):
- if self.fixture_clamp_workpiece_height_max > 1000000:
- raise ValidationError("夹持工件高度MAX不能超过1000000")
-
- @api.constrains('fixture_maximum_clamping_force')
- def _check_fixture_maximum_clamping_force_size(self):
- if self.fixture_maximum_clamping_force > 100000000:
- raise ValidationError("最大夹持力不能超过100000000")
-
- @api.constrains('fixture_through_hole_size')
- def _check_fixture_through_hole_size_size(self):
- if self.fixture_through_hole_size > 1000000:
- raise ValidationError("过孔大小不能超过1000000")
-
- @api.constrains('fixture_screw_size')
- def _check_fixture_through_hole_size_size(self):
- if self.fixture_screw_size > 1000000:
- raise ValidationError("螺牙大小不能超过1000000")
-
def _json_apply_machine_tool_type_item_code(self, item):
code_arr = []
for i in item.product_id.fixture_apply_machine_tool_type_ids:
@@ -584,72 +554,6 @@ class ResProductMo(models.Model):
self.detailed_type = 'product'
self.sale_ok = False
- @api.onchange('fixture_material_id')
- def _onchange_fixture_material_id(self):
- for item in self:
- if item.fixture_material_id.id != item.fixture_model_id.fixture_material_id.id:
- item.fixture_model_id = False
-
- #
- # @api.onchange('fixture_model_id')
- # def _onchange_fixture_model_id(self):
- # for item in self:
- # if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
- # item.brand_id = item.fixture_model_id.brand_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
- # item.tool_height = item.fixture_model_id.height
- # item.tool_weight = item.fixture_model_id.weight
- # item.materials_type_id = item.fixture_model_id.materials_model_id.id
- # item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
- # item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
- # if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
- # item.fixture_clamping_way = item.fixture_model_id.clamping_way
- # item.fixture_port_type = item.fixture_model_id.port_type
- # if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
- # item.fixture_driving_way = item.fixture_model_id.driving_way
- # if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
- # item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
- # item.fixture_screw_size = item.fixture_model_id.screw_size
- # if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
- # item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
- # item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
- # item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
- # item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
- # item.fixture_apply_machine_tool_type_ids = self._get_ids(
- # item.fixture_model_id.apply_machine_tool_type_ids)
-
- # @api.onchange('fixture_model_id')
- # def _onchange_fixture_model_id(self):
- # 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
- # item.tool_height = item.fixture_model_id.height
- # item.tool_weight = item.fixture_model_id.weight
- # item.materials_type_id = item.fixture_model_id.materials_model_id.id
- # item.fixture_maximum_carrying_weight = item.fixture_model_id.maximum_carrying_weight
- # item.fixture_maximum_clamping_force = item.fixture_model_id.maximum_clamping_force
- # if self.fixture_material_type in ['零点卡盘', '转接板(锁板)夹具']:
- # item.fixture_clamping_way = item.fixture_model_id.clamping_way
- # item.fixture_port_type = item.fixture_model_id.port_type
- # if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具']:
- # item.fixture_driving_way = item.fixture_model_id.driving_way
- # if self.fixture_material_type in ['气动夹具', '磁吸夹具', '虎钳夹具', '零点卡盘']:
- # item.fixture_through_hole_size = item.fixture_model_id.through_hole_size
- # item.fixture_screw_size = item.fixture_model_id.screw_size
- # if self.fixture_material_type in ['气动夹具', '转接板(锁板)夹具', '磁吸夹具', '虎钳夹具']:
- # item.fixture_clamp_workpiece_length_max = item.fixture_model_id.clamp_workpiece_length_max
- # item.fixture_clamp_workpiece_width_max = item.fixture_model_id.clamp_workpiece_width_max
- # item.fixture_clamp_workpiece_height_max = item.fixture_model_id.clamp_workpiece_height_max
- # item.fixture_clamp_workpiece_diameter_max = item.fixture_model_id.clamp_workpiece_diameter_max
- # item.fixture_apply_machine_tool_type_ids = self._get_ids(
- # item.fixture_model_id.apply_machine_tool_type_ids)
-
def _get_volume_uom_id_from_ir_config_parameter(self):
product_length_in_feet_param = self.env['ir.config_parameter'].sudo().get_param('product.volume_in_cubic_feet')
if product_length_in_feet_param == '1':
@@ -833,15 +737,12 @@ class ResProductFixture(models.Model):
fixture_model_id = fields.Many2one('sf.fixture.model', '夹具型号')
specification_fixture_id = fields.Many2one('sf.fixture.materials.basic.parameters', '夹具规格')
- fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料", required=True)
+ fixture_material_id = fields.Many2one('sf.fixture.material', string="夹具物料")
fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name')
- multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型", required=True)
+ multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
model_file = fields.Binary(string="3D模型图")
# 夹具物料基本参数
- # length = fields.Float('长度(mm)', digits=(16, 2))
- # width = fields.Float('宽度(mm)', digits=(16, 2))
- # height = fields.Float('高度(mm)', digits=(16, 2))
diameter = fields.Float('直径(mm)', digits=(16, 2))
# '零点卡盘' 字段