1、所有功能刀具相关模型添加刀具组字段对象,并且功能刀具名称根据规则自动生成;2、功能刀具组装时按规则自动生成功能刀具编码;
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<field name="barcode_id"/>
|
||||
<field name="functional_tool_name_id"/>
|
||||
<field name="image" widget='image'/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="functional_tool_diameter"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="coarse_middle_thin" optional="hide"/>
|
||||
@@ -80,9 +81,11 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="code" readonly="1"/>
|
||||
<field name="functional_tool_name_id" invisible="False"
|
||||
placeholder="请输入20字以内的名称"/>
|
||||
<field name="sf_cutting_tool_type_id"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="cutting_tool_integral_model_id"
|
||||
options="{'no_create': True, 'no_quick_create': True}"
|
||||
attrs="{'invisible': [('cutting_tool_blade_model_id', '!=', False)]}"
|
||||
@@ -287,6 +290,7 @@
|
||||
<tree create="1" edit="1" delete="0">
|
||||
<field name="name"/>
|
||||
<field name="sf_cutting_tool_type_id" invisible="True"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="diameter"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="coarse_middle_thin"/>
|
||||
@@ -310,7 +314,7 @@
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name" attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="name"/>
|
||||
</h1>
|
||||
</div>
|
||||
<field name="status_create" invisible="1"/>
|
||||
@@ -318,6 +322,8 @@
|
||||
<group>
|
||||
<field name="sf_cutting_tool_type_id"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="tool_groups_id"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="diameter"
|
||||
attrs="{'readonly': [('status_create', '=', False)]}"/>
|
||||
<field name="knife_tip_r_angle"
|
||||
@@ -487,11 +493,13 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree create="0" delete="0">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="code" invisible="1"/>
|
||||
<field name="production_line_id" invisible="1"/>
|
||||
<field name="maintenance_equipment_id" invisible="1"/>
|
||||
<field name="machine_tool_code"/>
|
||||
<field name="cutter_spacing_code_id"/>
|
||||
<field name="functional_tool_name_id"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="diameter"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="max_lifetime_value"/>
|
||||
@@ -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 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="barcode_id"/>
|
||||
<field name="code"/>
|
||||
<field name="functional_tool_name_id"
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="functional_tool_type_id"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="diameter"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
</group>
|
||||
@@ -856,7 +872,9 @@
|
||||
<tree create="0" delete="0">
|
||||
<field name="assembly_order_code"/>
|
||||
<field name="barcode_id" optional="hide"/>
|
||||
<field name="code" optional="hide"/>
|
||||
<field name="functional_tool_name"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="functional_tool_diameter" string="刀具直径"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="coarse_middle_thin" optional="hide"/>
|
||||
@@ -878,7 +896,7 @@
|
||||
<field name="whether_standard_knife" invisible="True"/>
|
||||
<field name="reason_for_applying" invisible="True"/>
|
||||
<field name="functional_tool_type_id" invisible="True"/>
|
||||
<!-- <field name="functional_tool_cutting_type" invisible="True"/>-->
|
||||
<!-- <field name="functional_tool_cutting_type" invisible="True"/>-->
|
||||
|
||||
<button string="组装"
|
||||
name="%(sf_tool_management.sf_functional_tool_assembly_order_act)d"
|
||||
@@ -890,6 +908,7 @@
|
||||
'default_cutter_spacing_code_id':cutter_spacing_code_id,
|
||||
'default_functional_tool_name':functional_tool_name,
|
||||
'default_functional_tool_type_id':functional_tool_type_id,
|
||||
'default_tool_groups_id': tool_groups_id,
|
||||
'default_functional_tool_diameter':functional_tool_diameter,
|
||||
'default_knife_tip_r_angle':knife_tip_r_angle,
|
||||
'default_tool_loading_length':tool_loading_length,
|
||||
@@ -926,6 +945,7 @@
|
||||
'default_cutter_spacing_code_id':cutter_spacing_code_id,
|
||||
'default_functional_tool_name':functional_tool_name,
|
||||
'default_functional_tool_type_id':functional_tool_type_id,
|
||||
'default_tool_groups_id': tool_groups_id,
|
||||
'default_functional_tool_diameter':functional_tool_diameter,
|
||||
'default_knife_tip_r_angle':knife_tip_r_angle,
|
||||
'default_tool_loading_length':tool_loading_length,
|
||||
@@ -976,17 +996,22 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="barcode_id"/>
|
||||
<field name="code"/>
|
||||
<field name="after_assembly_functional_tool_name"
|
||||
string="功能刀具名称"/>
|
||||
<field name="after_assembly_functional_tool_type_id"
|
||||
string="功能刀具类型"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="after_assembly_functional_tool_diameter"
|
||||
string="刀具直径(mm)"/>
|
||||
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
||||
<field name="after_assembly_new_former" string="新/旧"/>
|
||||
<field name="cut_time"/>
|
||||
<field name="cut_length"/>
|
||||
<field name="cut_number"/>
|
||||
<field name="cut_time"
|
||||
attrs="{'invisible': [('after_assembly_new_former', '=', '0')]}"/>
|
||||
<field name="cut_length"
|
||||
attrs="{'invisible': [('after_assembly_new_former', '=', '0')]}"/>
|
||||
<field name="cut_number"
|
||||
attrs="{'invisible': [('after_assembly_new_former', '=', '0')]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="after_assembly_whether_standard_knife"
|
||||
@@ -1102,6 +1127,7 @@
|
||||
<group>
|
||||
<field name="functional_tool_name"/>
|
||||
<field name="functional_tool_type_id"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="functional_tool_diameter" string="刀具直径(mm)"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="tool_loading_length" string="总长度(mm)"/>
|
||||
@@ -1114,7 +1140,7 @@
|
||||
<field name="new_former"/>
|
||||
<field name="use_tool_time"/>
|
||||
<field name="reason_for_applying"/>
|
||||
<!-- <field name="functional_tool_cutting_type"/>-->
|
||||
<!-- <field name="functional_tool_cutting_type"/>-->
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="barcode_id"/>
|
||||
<field name="code"/>
|
||||
<field name="functional_tool_name"/>
|
||||
<field name="functional_tool_type_id"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="diameter"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="extension_length"/>
|
||||
@@ -38,6 +40,7 @@
|
||||
<field name="replacement_tool_name" string="功能刀具名称"/>
|
||||
<field name="replacement_tool_type_id" string="功能刀具类型"
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="replacement_diameter" string="刀具直径(mm)"/>
|
||||
<field name="replacement_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
||||
<field name="replacement_tool_setting_length" string="总长度(mm)"/>
|
||||
@@ -178,6 +181,7 @@
|
||||
<group>
|
||||
<field name="functional_tool_name"/>
|
||||
<field name="functional_tool_type_id"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="functional_tool_diameter" string="刀具直径(mm)"/>
|
||||
<field name="knife_tip_r_angle"/>
|
||||
<field name="tool_loading_length"/>
|
||||
@@ -328,10 +332,12 @@
|
||||
|
||||
<group string="组装参数信息">
|
||||
<group>
|
||||
<field name="barcode_id" readonly="True"/>
|
||||
<field name="barcode_id" invisible="True"/>
|
||||
<field name="tool_code" readonly="True"/>
|
||||
<field name="after_assembly_functional_tool_name" string="功能刀具名称"/>
|
||||
<field name="after_assembly_functional_tool_type_id" string="功能刀具类型"
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="tool_groups_id"/>
|
||||
<field name="after_assembly_functional_tool_diameter" string="刀具直径(mm)"/>
|
||||
<field name="after_assembly_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
||||
<field name="after_assembly_new_former" string="新/旧"/>
|
||||
|
||||
Reference in New Issue
Block a user