Accept Merge Request #724: (feature/功能刀具组装流程bug优化 -> develop)
Merge Request: 功能刀具组装流程bug优化 Created By: @禹翔辉 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @禹翔辉 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/724
This commit is contained in:
@@ -77,32 +77,32 @@ class CuttingToolModel(models.Model):
|
||||
integral_run_out_accuracy_min = fields.Char('整体式刀具端跳精度min')
|
||||
|
||||
fit_blade_shape_id = fields.Many2one('maintenance.equipment.image',
|
||||
'适配刀片形状', domain=[('type', '=', '刀片形状')])
|
||||
'适配刀片形状', domain=[('type', '=', '刀片形状')])
|
||||
suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image',
|
||||
'suitable_machining_method_library_rel',
|
||||
'适合加工方式', domain=[('type', '=', '加工能力')])
|
||||
blade_tip_characteristics_id = fields.Many2one('maintenance.equipment.image',
|
||||
'刀尖特征', domain=[('type', '=', '刀尖特征')])
|
||||
'刀尖特征', domain=[('type', '=', '刀尖特征')])
|
||||
handle_type_id = fields.Many2one('maintenance.equipment.image',
|
||||
'柄部类型', domain=[('type', '=', '柄部类型')])
|
||||
'柄部类型', domain=[('type', '=', '柄部类型')])
|
||||
cutting_direction_ids = fields.Many2many('maintenance.equipment.image', 'cutting_direction_library_rel',
|
||||
'走刀方向', domain=[('type', '=', '走刀方向')])
|
||||
suitable_coolant_ids = fields.Many2many('maintenance.equipment.image', 'suitable_coolant_library_rel',
|
||||
'适合冷却液', domain=[('type', '=', '冷却液')])
|
||||
compaction_way_id = fields.Many2one('maintenance.equipment.image',
|
||||
'压紧方式', domain=[('type', '=', '压紧方式')])
|
||||
'压紧方式', domain=[('type', '=', '压紧方式')])
|
||||
integral_tool_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'standard_library_id', string='整体式刀具基本参数')
|
||||
'standard_library_id', string='整体式刀具基本参数')
|
||||
blade_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'standard_library_id', string='刀片基本参数')
|
||||
'standard_library_id', string='刀片基本参数')
|
||||
cutter_bar_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'standard_library_id', string='刀杆基本参数')
|
||||
'standard_library_id', string='刀杆基本参数')
|
||||
cutter_head_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'standard_library_id', string='刀盘基本参数')
|
||||
'standard_library_id', string='刀盘基本参数')
|
||||
knife_handle_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'standard_library_id', string='刀柄基本参数')
|
||||
'standard_library_id', string='刀柄基本参数')
|
||||
chuck_basic_parameters_ids = fields.One2many('sf.tool.materials.basic.parameters',
|
||||
'standard_library_id', string='夹头基本参数')
|
||||
'standard_library_id', string='夹头基本参数')
|
||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'standard_library_id', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz',
|
||||
domain=[('cutting_speed', '!=', False)])
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing'],
|
||||
'data': [
|
||||
'data/stock_data.xml',
|
||||
'views/product_template_management_view.xml',
|
||||
],
|
||||
'demo': [
|
||||
|
||||
29
sf_dlm_management/data/stock_data.xml
Normal file
29
sf_dlm_management/data/stock_data.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="stock_location_tool_room" model="stock.location">
|
||||
<field name="name">刀具房</field>
|
||||
<field name="usage">internal</field>
|
||||
<field name="location_type">库区</field>
|
||||
<field name="area_type">存货区</field>
|
||||
<field name="barcode">DJF</field>
|
||||
<field name="active">true</field>
|
||||
<field name="product_type"
|
||||
eval="[ref('sf_dlm.product_category_cutting_tool_sf'),
|
||||
ref('sf_dlm.product_category_functional_tool_sf')]"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="after_assembly_picking_in" model="stock.picking.type">
|
||||
<field name="name">刀具组装入库</field>
|
||||
<field name="code">internal</field>
|
||||
<field name="sequence_id" ref="sf_manufacturing.tool_assembly_in"/>
|
||||
<field name="active">true</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="sequence_code">ZR</field>
|
||||
<field name="default_location_src_id" ref="sf_manufacturing.stock_location_locations_virtual_after_assembly"/>
|
||||
<field name="default_location_dest_id" ref="stock_location_tool_room"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -13,6 +13,12 @@
|
||||
<field name="padding">5</field>
|
||||
</record>
|
||||
|
||||
<record id="tool_assembly_in" model="ir.sequence">
|
||||
<field name="name">My Company 刀具组装入库</field>
|
||||
<field name="prefix">ZR/</field>
|
||||
<field name="padding">5</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_location_locations_virtual_outcontract" model="stock.location">
|
||||
<field name="name">外协</field>
|
||||
<field name="location_id" ref="stock.stock_location_locations_virtual"/>
|
||||
@@ -31,15 +37,6 @@
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
<!-- <record id="stock_location_locations_WH_tool_stock_area" model="stock.location">-->
|
||||
<!-- <field name="name">刀具存货区</field>-->
|
||||
<!-- <field name="location_id" ref="stock.stock_location_locations_virtual"/>-->
|
||||
<!-- <field name="usage">internal</field>-->
|
||||
<!-- <field name="barcode">WH-DJCHQ</field>-->
|
||||
<!-- <field name="active">true</field>-->
|
||||
<!-- <field name="company_id" ref="base.main_company"/>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record id="outcontract_picking_in" model="stock.picking.type">
|
||||
<field name="name">外协入库</field>
|
||||
<field name="code">internal</field>
|
||||
@@ -63,17 +60,5 @@
|
||||
search="[('barcode','=','WH-PREPRODUCTION')]"/>
|
||||
<field name="default_location_dest_id" ref="stock_location_locations_virtual_outcontract"/>
|
||||
</record>
|
||||
|
||||
<record id="after_assembly_picking_in" model="stock.picking.type">
|
||||
<field name="name">刀具组装入库</field>
|
||||
<field name="code">internal</field>
|
||||
<field name="active">true</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="sequence_code">ZR</field>
|
||||
<field name="default_location_src_id" ref="stock_location_locations_virtual_after_assembly"/>
|
||||
<field name="default_location_dest_id"
|
||||
search="[('barcode','=','WH-PREPRODUCTION')]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -22,7 +22,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=True)
|
||||
tool_loading_length = fields.Float(strin='总长度(mm)', readonly=True)
|
||||
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True)
|
||||
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
||||
tool_room_num = fields.Integer(string='刀具房数量', readonly=True)
|
||||
@@ -107,19 +107,41 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
|
||||
suitable_machining_method_ids = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_machining_product_template_tool_entity', '适合加工方式',
|
||||
domain=[('type', '=', '加工能力')], related='cutting_tool_integral_model_id.suitable_machining_method_ids')
|
||||
domain=[('type', '=', '加工能力')])
|
||||
blade_tip_characteristics_id = fields.Many2one(
|
||||
'maintenance.equipment.image', '刀尖特征',
|
||||
domain=[('type', '=', '刀尖特征')], related='cutting_tool_integral_model_id.blade_tip_characteristics_id')
|
||||
domain=[('type', '=', '刀尖特征')])
|
||||
handle_type_id = fields.Many2one(
|
||||
'maintenance.equipment.image', '柄部类型',
|
||||
domain=[('type', '=', '柄部类型')], related='cutting_tool_integral_model_id.handle_type_id')
|
||||
domain=[('type', '=', '柄部类型')])
|
||||
cutting_direction_ids = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_cutting_product_template_tool_entity', '走刀方向',
|
||||
domain=[('type', '=', '走刀方向')], related='cutting_tool_integral_model_id.cutting_direction_ids')
|
||||
domain=[('type', '=', '走刀方向')])
|
||||
suitable_coolant_ids = fields.Many2many(
|
||||
'maintenance.equipment.image', 'rel_coolant_product_template_tool_entity', '适合冷却液',
|
||||
domain=[('type', '=', '冷却液')], related='cutting_tool_integral_model_id.suitable_coolant_ids')
|
||||
domain=[('type', '=', '冷却液')])
|
||||
|
||||
@api.depends('cutting_tool_integral_model_id', 'cutting_tool_blade_model_id')
|
||||
def _compute_maintenance_equipment_image(self):
|
||||
for record in self:
|
||||
if record.cutting_tool_integral_model_id:
|
||||
record.suitable_machining_method_ids = record.cutting_tool_integral_model_id.suitable_machining_method_ids.ids
|
||||
record.blade_tip_characteristics_id = record.cutting_tool_integral_model_id.blade_tip_characteristics_id.ids
|
||||
record.handle_type_id = record.cutting_tool_integral_model_id.handle_type_id.ids
|
||||
record.cutting_direction_ids = record.cutting_tool_integral_model_id.cutting_direction_ids.ids
|
||||
record.suitable_coolant_ids = record.cutting_tool_integral_model_id.suitable_coolant_ids.ids
|
||||
elif record.cutting_tool_blade_model_id:
|
||||
record.suitable_machining_method_ids = record.cutting_tool_blade_model_id.suitable_machining_method_ids.ids
|
||||
record.blade_tip_characteristics_id = record.cutting_tool_blade_model_id.blade_tip_characteristics_id.ids
|
||||
record.handle_type_id = record.cutting_tool_blade_model_id.handle_type_id.ids
|
||||
record.cutting_direction_ids = record.cutting_tool_blade_model_id.cutting_direction_ids.ids
|
||||
record.suitable_coolant_ids = record.cutting_tool_blade_model_id.suitable_coolant_ids.ids
|
||||
else:
|
||||
record.suitable_machining_method_ids = []
|
||||
record.blade_tip_characteristics_id = []
|
||||
record.handle_type_id = []
|
||||
record.cutting_direction_ids = []
|
||||
record.suitable_coolant_ids = []
|
||||
|
||||
def _get_functional_tool_model_ids(self, functional_tool_model_code):
|
||||
functional_tool_model_ids = []
|
||||
@@ -332,8 +354,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
# 设备信息
|
||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床', readonly=True,
|
||||
domain=[('category_id.equipment_type', '=', '机床')])
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=True,
|
||||
group_expand='_read_group_names')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', readonly=True)
|
||||
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型', readonly=True,
|
||||
compute='_compute_machine_table_type_id')
|
||||
machine_tool_code = fields.Char(string='机台号', related='maintenance_equipment_id.name')
|
||||
@@ -344,9 +365,10 @@ class MachineTableToolChangingApply(models.Model):
|
||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', store=True,
|
||||
domain=[('product_id.name', '=', '功能刀具')],
|
||||
related='functional_tool_name_id.barcode_id')
|
||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', string='功能刀具名称')
|
||||
functional_tool_name_id = fields.Many2one('sf.functional.tool.assembly', domain=[('assemble_status', '=', '1')],
|
||||
string='功能刀具名称')
|
||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', store=True,
|
||||
related='functional_tool_name_id.functional_tool_type_id')
|
||||
related='functional_tool_name_id.after_assembly_functional_tool_type_id')
|
||||
|
||||
tool_position_interface_type = fields.Selection(
|
||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||
@@ -403,11 +425,6 @@ class MachineTableToolChangingApply(models.Model):
|
||||
if len(records) > 1:
|
||||
raise ValidationError('该刀位号已存在,请重新选择!!!')
|
||||
|
||||
@api.model
|
||||
def _read_group_names(self, categories, domain, order):
|
||||
names = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
||||
return categories.browse(names)
|
||||
|
||||
@api.constrains('functional_tool_status')
|
||||
def automation_apply_for_tool_change(self):
|
||||
"""
|
||||
@@ -520,7 +537,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
|
||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False)
|
||||
diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
|
||||
tool_included_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
|
||||
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=False)
|
||||
tool_loading_length = fields.Float(strin='总长度(mm)', readonly=False)
|
||||
extension_length = fields.Float(string='伸出长(mm)')
|
||||
effective_length = fields.Float(string='有效长(mm)')
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=False, default='0')
|
||||
@@ -608,7 +625,7 @@ class FunctionalToolAssembly(models.Model):
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=True)
|
||||
tool_loading_length = fields.Float(strin='总长度(mm)', readonly=True)
|
||||
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True)
|
||||
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
||||
loading_task_source = fields.Selection([('0', 'CAM装刀'), ('1', '机台换刀'), ('2', '按库存组装')],
|
||||
@@ -640,91 +657,52 @@ class FunctionalToolAssembly(models.Model):
|
||||
# 整体式刀具型号
|
||||
integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', readonly=True)
|
||||
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
|
||||
readonly=True)
|
||||
integral_name = fields.Char('整体式刀具名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
|
||||
related='integral_code_id.product_id.cutting_tool_model_id')
|
||||
integral_name = fields.Char('整体式刀具名称', related='integral_code_id.product_id.name')
|
||||
integral_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='整体式刀具规格',
|
||||
related='integral_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
|
||||
related='integral_code_id.product_id.brand_id')
|
||||
# 刀片型号
|
||||
blade_code_id = fields.Many2one('stock.lot', '刀片序列号', readonly=True)
|
||||
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True)
|
||||
blade_name = fields.Char('刀片名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
|
||||
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号',
|
||||
related='blade_code_id.product_id.cutting_tool_model_id')
|
||||
blade_name = fields.Char('刀片名称', related='blade_code_id.product_id.name')
|
||||
blade_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀片规格',
|
||||
related='blade_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_code_id.product_id.brand_id')
|
||||
# 刀杆型号
|
||||
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', readonly=True)
|
||||
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
|
||||
readonly=True)
|
||||
bar_name = fields.Char('刀杆名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
|
||||
related='bar_code_id.product_id.cutting_tool_model_id')
|
||||
bar_name = fields.Char('刀杆名称', related='bar_code_id.product_id.name')
|
||||
bar_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀杆规格',
|
||||
related='bar_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_code_id.product_id.brand_id')
|
||||
# 刀盘型号
|
||||
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', readonly=True)
|
||||
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
|
||||
readonly=True)
|
||||
pad_name = fields.Char('刀盘名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
|
||||
related='pad_code_id.product_id.cutting_tool_model_id')
|
||||
pad_name = fields.Char('刀盘名称', related='pad_code_id.product_id.name')
|
||||
pad_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀盘规格',
|
||||
related='pad_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_code_id.product_id.brand_id')
|
||||
# 刀柄型号
|
||||
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', readonly=True)
|
||||
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号',
|
||||
readonly=True)
|
||||
handle_name = fields.Char('刀柄名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
|
||||
related='handle_code_id.product_id.cutting_tool_model_id')
|
||||
handle_name = fields.Char('刀柄名称', related='handle_code_id.product_id.name')
|
||||
handle_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀柄规格',
|
||||
related='handle_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', related='handle_code_id.product_id.brand_id')
|
||||
# 夹头型号
|
||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', readonly=True)
|
||||
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
|
||||
readonly=True)
|
||||
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
|
||||
|
||||
@api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id')
|
||||
def _compute_auto_fill(self):
|
||||
for record in self:
|
||||
if record.integral_code_id:
|
||||
print(record.integral_code_id.product_id)
|
||||
record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_id.id
|
||||
record.integral_name = record.integral_code_id.product_id.name
|
||||
record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_integral_model_id = None
|
||||
record.integral_name = None
|
||||
record.sf_tool_brand_id_1 = None
|
||||
if record.blade_code_id:
|
||||
record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_model_id.id
|
||||
record.blade_name = record.blade_code_id.product_id.name
|
||||
record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_blade_model_id = None
|
||||
record.blade_name = None
|
||||
record.sf_tool_brand_id_2 = None
|
||||
if record.bar_code_id:
|
||||
record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_model_id.id
|
||||
record.bar_name = record.bar_code_id.product_id.name
|
||||
record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterbar_model_id = None
|
||||
record.bar_name = None
|
||||
record.sf_tool_brand_id_3 = None
|
||||
if record.pad_code_id:
|
||||
record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_model_id.id
|
||||
record.pad_name = record.pad_code_id.product_id.name
|
||||
record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterpad_model_id = None
|
||||
record.pad_name = None
|
||||
record.sf_tool_brand_id_4 = None
|
||||
if record.handle_code_id:
|
||||
record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_model_id.id
|
||||
record.handle_name = record.handle_code_id.product_id.name
|
||||
record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterhandle_model_id = None
|
||||
record.handle_name = None
|
||||
record.sf_tool_brand_id_5 = None
|
||||
if record.chuck_code_id:
|
||||
record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_model_id.id
|
||||
record.chuck_name = record.chuck_code_id.product_id.name
|
||||
record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterhead_model_id = None
|
||||
record.chuck_name = None
|
||||
record.sf_tool_brand_id_6 = None
|
||||
related='chuck_code_id.product_id.cutting_tool_model_id')
|
||||
chuck_name = fields.Char('夹头名称', related='chuck_code_id.product_id.name')
|
||||
chuck_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='夹头规格',
|
||||
related='chuck_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_code_id.product_id.brand_id')
|
||||
|
||||
# 组装功能刀具参数信息
|
||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号', readonly=True)
|
||||
@@ -744,7 +722,7 @@ class FunctionalToolAssembly(models.Model):
|
||||
after_assembly_max_lifetime_value = fields.Integer(string='组装后最大寿命值(min)', readonly=True)
|
||||
after_assembly_alarm_value = fields.Integer(string='组装后报警值(min)', readonly=True)
|
||||
after_assembly_used_value = fields.Integer(string='组装后已使用值(min)', readonly=True)
|
||||
after_assembly_tool_loading_length = fields.Float(string='组装后装刀长(mm)', readonly=True)
|
||||
after_assembly_tool_loading_length = fields.Float(string='组装后总长度(mm)', readonly=True)
|
||||
after_assembly_functional_tool_length = fields.Float(string='组装后伸出长(mm)', readonly=True)
|
||||
after_assembly_effective_length = fields.Float(string='组装后有效长(mm)', readonly=True)
|
||||
L_D_number = fields.Float(string='L/D值(mm)', readonly=True)
|
||||
|
||||
@@ -156,9 +156,10 @@
|
||||
<field name="effective_length"/>
|
||||
<field name="L_D_number"/>
|
||||
<field name="hiding_length"/>
|
||||
<field name="cut_time"/>
|
||||
<field name="cut_length"/>
|
||||
<field name="cut_number"/>
|
||||
<field name="new_former"/>
|
||||
<field name="cut_time" attrs="{'invisible': [('new_former','=','0')]}"/>
|
||||
<field name="cut_length" attrs="{'invisible': [('new_former','=','0')]}"/>
|
||||
<field name="cut_number" attrs="{'invisible': [('new_former','=','0')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
@@ -990,7 +991,7 @@
|
||||
string="最大寿命值(min)"/>
|
||||
<field name="after_assembly_alarm_value" string="报警值(min)"/>
|
||||
<field name="after_assembly_used_value" string="已使用值(min)"/>
|
||||
<field name="after_assembly_tool_loading_length" string="装刀长(mm)"/>
|
||||
<field name="after_assembly_tool_loading_length" string="总长度(mm)"/>
|
||||
<field name="after_assembly_functional_tool_length"
|
||||
string="伸出长(mm)"/>
|
||||
<field name="after_assembly_effective_length" string="有效长(mm)"/>
|
||||
@@ -1011,6 +1012,7 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="handle_name" string="名称"/>
|
||||
<field name="cutting_tool_cutterhandle_model_id" string="型号"/>
|
||||
<field name="handle_specification_id" string="规格"/>
|
||||
<field name="sf_tool_brand_id_5" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -1023,6 +1025,7 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="integral_name" string="名称"/>
|
||||
<field name="cutting_tool_integral_model_id" string="型号"/>
|
||||
<field name="integral_specification_id" string="规格"/>
|
||||
<field name="sf_tool_brand_id_1" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -1035,6 +1038,7 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="blade_name" string="名称"/>
|
||||
<field name="cutting_tool_blade_model_id" string="型号"/>
|
||||
<field name="blade_specification_id" string="规格"/>
|
||||
<field name="sf_tool_brand_id_2" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -1050,6 +1054,7 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="chuck_name" string="名称"/>
|
||||
<field name="cutting_tool_cutterhead_model_id" string="型号"/>
|
||||
<field name="chuck_specification_id" string="规格"/>
|
||||
<field name="sf_tool_brand_id_6" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -1064,6 +1069,7 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="bar_name" string="名称"/>
|
||||
<field name="cutting_tool_cutterbar_model_id" string="型号"/>
|
||||
<field name="bar_specification_id" string="规格"/>
|
||||
<field name="sf_tool_brand_id_3" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -1078,6 +1084,7 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="pad_name" string="名称"/>
|
||||
<field name="cutting_tool_cutterpad_model_id" string="型号"/>
|
||||
<field name="pad_specification_id" string="规格"/>
|
||||
<field name="sf_tool_brand_id_4" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from datetime import timedelta, datetime
|
||||
|
||||
from odoo import fields, models, api
|
||||
from odoo.exceptions import ValidationError
|
||||
@@ -35,23 +35,34 @@ class ToolChangeRequirementInformation(models.TransientModel):
|
||||
replacement_tool_name = fields.Char(string='待换功能刀具名称', required=True)
|
||||
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)')
|
||||
replacement_tool_setting_length = fields.Float(string='待换刀具装刀长(mm)')
|
||||
replacement_knife_tip_r_angle = fields.Float(string='待换刀具刀尖R角(mm)', requride=True)
|
||||
replacement_tool_setting_length = fields.Float(string='待换刀具总长度(mm)', requride=True)
|
||||
replacement_extension_length = fields.Float(string='待换刀具伸出长(mm)')
|
||||
replacement_effective_length = fields.Float(string='待换刀具有效长(mm)')
|
||||
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
|
||||
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], requride=True,
|
||||
string='待换刀具粗/中/精', default='3')
|
||||
|
||||
replacement_max_lifetime_value = fields.Integer(string='待换刀具最大寿命值(min)')
|
||||
replacement_alarm_value = fields.Integer(string='待换刀具报警值(min)')
|
||||
replacement_used_value = fields.Integer(string='待换刀具已使用值(min)')
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', default='0')
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', default='0', requride=True)
|
||||
replacement_whether_standard_knife = fields.Boolean(string='待换刀具是否标准刀', default=True)
|
||||
used_tool_time = fields.Datetime(string='用刀时间',
|
||||
default=lambda self: fields.Datetime.now() + timedelta(hours=4))
|
||||
applicant = fields.Char(string='申请人', default=lambda self: self.env.user.name, readonly=True)
|
||||
reason_for_applying = fields.Char(string='申请原因')
|
||||
|
||||
@api.constrains('replacement_knife_tip_r_angle', 'replacement_diameter', 'replacement_tool_coarse_middle_thin',
|
||||
'new_former')
|
||||
def _check_length_or_diamenter(self):
|
||||
for obj in self:
|
||||
if obj.replacement_diameter == 0 and obj.replacement_knife_tip_r_angle == 0:
|
||||
raise ValidationError('待换功能刀具信息【刀具直径】和【刀尖R角】不能同时为0!!!')
|
||||
if not obj.new_former:
|
||||
raise ValidationError('待换功能刀具信息【新/旧】不能位空!!!')
|
||||
if not obj.replacement_tool_coarse_middle_thin:
|
||||
raise ValidationError('待换功能刀具信息【粗/中/精】不能位空!!!')
|
||||
|
||||
def tool_changing_apply(self):
|
||||
"""
|
||||
确认换刀申请(按键)
|
||||
@@ -173,7 +184,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=True)
|
||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=True)
|
||||
tool_loading_length = fields.Float(string='总长度(mm)', readonly=True)
|
||||
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True)
|
||||
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
||||
loading_task_source = fields.Selection([('0', 'CAM装刀'), ('1', '机台换刀'), ('2', '按库存组装')],
|
||||
@@ -202,18 +213,24 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||
('quant_ids.quantity', '>', 0)])
|
||||
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
|
||||
readonly=True)
|
||||
integral_name = fields.Char('整体式刀具名称', readonly=True)
|
||||
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
|
||||
related='integral_code_id.product_id.cutting_tool_model_id')
|
||||
integral_name = fields.Char('整体式刀具名称', related='integral_code_id.product_id.name')
|
||||
integral_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='整体式刀具规格',
|
||||
related='integral_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
|
||||
related='integral_code_id.product_id.brand_id')
|
||||
|
||||
# 刀片型号
|
||||
blade_code_id = fields.Many2one('stock.lot', '刀片序列号',
|
||||
domain=[('product_id.cutting_tool_material_id.name', '=', '刀片'),
|
||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||
('quant_ids.quantity', '>', 0)])
|
||||
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True)
|
||||
blade_name = fields.Char('刀片名称', readonly=True)
|
||||
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
|
||||
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号',
|
||||
related='blade_code_id.product_id.cutting_tool_model_id')
|
||||
blade_name = fields.Char('刀片名称', related='blade_code_id.product_id.name')
|
||||
blade_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀片规格',
|
||||
related='blade_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_code_id.product_id.brand_id')
|
||||
|
||||
# 刀杆型号
|
||||
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号',
|
||||
@@ -221,9 +238,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||
('quant_ids.quantity', '>', 0)])
|
||||
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
|
||||
readonly=True)
|
||||
bar_name = fields.Char('刀杆名称', readonly=True)
|
||||
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
|
||||
related='bar_code_id.product_id.cutting_tool_model_id')
|
||||
bar_name = fields.Char('刀杆名称', related='bar_code_id.product_id.name')
|
||||
bar_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀杆规格',
|
||||
related='bar_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_code_id.product_id.brand_id')
|
||||
|
||||
# 刀盘型号
|
||||
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号',
|
||||
@@ -231,9 +250,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||
('quant_ids.quantity', '>', 0)])
|
||||
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
|
||||
readonly=True)
|
||||
pad_name = fields.Char('刀盘名称', readonly=True)
|
||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
|
||||
related='pad_code_id.product_id.cutting_tool_model_id')
|
||||
pad_name = fields.Char('刀盘名称', related='pad_code_id.product_id.name')
|
||||
pad_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀盘规格',
|
||||
related='pad_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_code_id.product_id.brand_id')
|
||||
|
||||
# 刀柄型号
|
||||
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', required=True,
|
||||
@@ -241,9 +262,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||
('quant_ids.quantity', '>', 0)])
|
||||
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号',
|
||||
readonly=True)
|
||||
handle_name = fields.Char('刀柄名称', readonly=True)
|
||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
|
||||
related='handle_code_id.product_id.cutting_tool_model_id')
|
||||
handle_name = fields.Char('刀柄名称', related='handle_code_id.product_id.name')
|
||||
handle_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='刀柄规格',
|
||||
related='handle_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', related='handle_code_id.product_id.brand_id')
|
||||
|
||||
# 夹头型号
|
||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', required=True,
|
||||
@@ -251,9 +274,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
('quant_ids.location_id.name', 'in', ['刀具房']),
|
||||
('quant_ids.quantity', '>', 0)])
|
||||
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
|
||||
readonly=True)
|
||||
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
|
||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
|
||||
related='chuck_code_id.product_id.cutting_tool_model_id')
|
||||
chuck_name = fields.Char('夹头名称', related='chuck_code_id.product_id.name')
|
||||
chuck_specification_id = fields.Many2one('sf.tool.materials.basic.parameters', string='夹头规格',
|
||||
related='chuck_code_id.product_id.specification_id')
|
||||
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_code_id.product_id.brand_id')
|
||||
|
||||
def on_barcode_scanned(self, barcode):
|
||||
"""
|
||||
@@ -280,63 +305,12 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
else:
|
||||
raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
|
||||
|
||||
@api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id')
|
||||
def _compute_auto_fill(self):
|
||||
for record in self:
|
||||
if record.integral_code_id:
|
||||
record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_id.id
|
||||
record.integral_name = record.integral_code_id.product_id.name
|
||||
record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_integral_model_id = None
|
||||
record.integral_name = None
|
||||
record.sf_tool_brand_id_1 = None
|
||||
if record.blade_code_id:
|
||||
record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_model_id.id
|
||||
record.blade_name = record.blade_code_id.product_id.name
|
||||
record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_blade_model_id = None
|
||||
record.blade_name = None
|
||||
record.sf_tool_brand_id_2 = None
|
||||
if record.bar_code_id:
|
||||
record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_model_id.id
|
||||
record.bar_name = record.bar_code_id.product_id.name
|
||||
record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterbar_model_id = None
|
||||
record.bar_name = None
|
||||
record.sf_tool_brand_id_3 = None
|
||||
if record.pad_code_id:
|
||||
record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_model_id.id
|
||||
record.pad_name = record.pad_code_id.product_id.name
|
||||
record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterpad_model_id = None
|
||||
record.pad_name = None
|
||||
record.sf_tool_brand_id_4 = None
|
||||
if record.handle_code_id:
|
||||
record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_model_id.id
|
||||
record.handle_name = record.handle_code_id.product_id.name
|
||||
record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterhandle_model_id = None
|
||||
record.handle_name = None
|
||||
record.sf_tool_brand_id_5 = None
|
||||
if record.chuck_code_id:
|
||||
record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_model_id.id
|
||||
record.chuck_name = record.chuck_code_id.product_id.name
|
||||
record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id
|
||||
else:
|
||||
record.cutting_tool_cutterhead_model_id = None
|
||||
record.chuck_name = None
|
||||
record.sf_tool_brand_id_6 = None
|
||||
|
||||
# 组装功能刀具参数信息
|
||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
|
||||
after_assembly_functional_tool_name = fields.Char(string='组装后功能刀具名称', required=True)
|
||||
after_assembly_functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model',
|
||||
string='组装后功能刀具类型')
|
||||
string='组装后功能刀具类型',
|
||||
compute='_compute_after_assembly_functional_tool_type_id')
|
||||
after_assembly_functional_tool_diameter = fields.Integer(string='组装后功能刀具直径(mm)')
|
||||
after_assembly_knife_tip_r_angle = fields.Float(string='组装后刀尖R角(mm)')
|
||||
after_assembly_new_former = fields.Selection([('0', '新'), ('1', '旧')], string='组装后新/旧', default='0')
|
||||
@@ -350,14 +324,54 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
after_assembly_max_lifetime_value = fields.Integer(string='组装后最大寿命值(min)')
|
||||
after_assembly_alarm_value = fields.Integer(string='组装后报警值(min)')
|
||||
after_assembly_used_value = fields.Integer(string='组装后已使用值(min)')
|
||||
after_assembly_tool_loading_length = fields.Float(string='组装后装刀长(mm)')
|
||||
after_assembly_functional_tool_length = fields.Float(string='组装后伸出长(mm)')
|
||||
after_assembly_tool_loading_length = fields.Float(string='组装后总长度(mm)')
|
||||
after_assembly_functional_tool_length = fields.Float(string='组装后伸出长(mm)', required=True)
|
||||
after_assembly_effective_length = fields.Float(string='组装后有效长(mm)')
|
||||
L_D_number = fields.Float(string='L/D值(mm)')
|
||||
L_D_number = fields.Float(string='L/D值(mm)', compute='_compute_l_d_number')
|
||||
hiding_length = fields.Float(string='避空长(mm)')
|
||||
|
||||
functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False)
|
||||
|
||||
@api.onchange('integral_code_id')
|
||||
def _onchange_after_assembly_functional_tool_diameter(self):
|
||||
for obj in self:
|
||||
if obj.integral_code_id:
|
||||
obj.after_assembly_functional_tool_diameter = obj.integral_code_id.product_id.cutting_tool_blade_diameter
|
||||
else:
|
||||
obj.after_assembly_functional_tool_diameter = 0
|
||||
|
||||
@api.onchange('blade_code_id')
|
||||
def _onchange_after_assembly_knife_tip_r_angle(self):
|
||||
for obj in self:
|
||||
if obj.blade_code_id:
|
||||
obj.after_assembly_knife_tip_r_angle = obj.blade_code_id.product_id.cutting_tool_blade_tip_circular_arc_radius
|
||||
else:
|
||||
obj.after_assembly_knife_tip_r_angle = 0
|
||||
|
||||
@api.depends('functional_tool_type_id')
|
||||
def _compute_after_assembly_functional_tool_type_id(self):
|
||||
for obj in self:
|
||||
if obj.functional_tool_type_id:
|
||||
obj.after_assembly_functional_tool_type_id = obj.functional_tool_type_id
|
||||
else:
|
||||
obj.after_assembly_functional_tool_type_id = None
|
||||
|
||||
@api.depends('hiding_length', 'after_assembly_functional_tool_diameter')
|
||||
def _compute_l_d_number(self):
|
||||
for record in self:
|
||||
if record.hiding_length != 0 and record.after_assembly_functional_tool_diameter != 0:
|
||||
record.L_D_number = record.hiding_length / record.after_assembly_functional_tool_diameter
|
||||
else:
|
||||
record.L_D_number = 0
|
||||
|
||||
@api.constrains('after_assembly_tool_loading_length', 'after_assembly_functional_tool_length')
|
||||
def _check_length_control(self):
|
||||
for obj in self:
|
||||
if obj.after_assembly_tool_loading_length == 0:
|
||||
raise ValidationError('组装参数信息【总长度】不能为0!!!')
|
||||
if obj.after_assembly_functional_tool_length == 0:
|
||||
raise ValidationError('组装参数信息【伸出长】不能为0!!!')
|
||||
|
||||
def functional_tool_assembly(self):
|
||||
"""
|
||||
功能刀具组装
|
||||
@@ -378,7 +392,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
# 创建功能刀具批次/序列号记录
|
||||
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly)
|
||||
# 创建刀具组装入库单
|
||||
self.create_stocking_picking(stock_lot, functional_tool_assembly)
|
||||
self.env['stock.picking'].create_stocking_picking(stock_lot, functional_tool_assembly)
|
||||
# 刀具物料出库
|
||||
if self.integral_code_id:
|
||||
product_id.tool_material_stock_moves(self.integral_code_id)
|
||||
@@ -436,26 +450,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
if not self.bar_code_id and not self.pad_code_id:
|
||||
raise ValidationError('【刀盘】和【刀杆】必须填写一个!')
|
||||
|
||||
def create_stocking_picking(self, stock_lot, functional_tool_assembly):
|
||||
"""
|
||||
创建刀具组装入库单
|
||||
"""
|
||||
# 获取名称为刀具组装入库的作业类型
|
||||
picking_type_id = self.env['stock.picking.type'].sudo().search([('name', '=', '刀具组装入库')])
|
||||
# 创建刀具组装入库单
|
||||
picking_id = self.env['stock.picking'].create({
|
||||
'picking_type_id': picking_type_id.id
|
||||
})
|
||||
# 创建作业详情对象记录,并绑定到刀具组装入库单
|
||||
self.env['stock.move.line'].create({
|
||||
'picking_id': picking_id.id,
|
||||
'product_id': stock_lot.product_id.id,
|
||||
'lot_id': stock_lot.id,
|
||||
'functional_tool_name_id': functional_tool_assembly.id
|
||||
})
|
||||
# 将刀具组装入库单的状态更改为就绪
|
||||
picking_id.action_confirm()
|
||||
|
||||
def get_desc_1(self, stock_lot):
|
||||
return {
|
||||
'barcode_id': stock_lot.id,
|
||||
@@ -523,6 +517,50 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
}
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def create_stocking_picking(self, stock_lot, functional_tool_assembly):
|
||||
"""
|
||||
创建刀具组装入库单
|
||||
"""
|
||||
# 获取名称为刀具组装入库的作业类型
|
||||
picking_type_id = self.env['stock.picking.type'].sudo().search([('name', '=', '刀具组装入库')])
|
||||
# 创建刀具组装入库单
|
||||
picking_id = self.env['stock.picking'].create({
|
||||
'name': self._get_name_stock(picking_type_id),
|
||||
'picking_type_id': picking_type_id.id,
|
||||
'location_id': picking_type_id.default_location_src_id.id,
|
||||
'location_dest_id': picking_type_id.default_location_dest_id.id,
|
||||
})
|
||||
# 创建作业详情对象记录,并绑定到刀具组装入库单
|
||||
self.env['stock.move.line'].create({
|
||||
'picking_id': picking_id.id,
|
||||
'product_id': stock_lot.product_id.id,
|
||||
'lot_id': stock_lot.id,
|
||||
'qty_done': 1,
|
||||
'functional_tool_name_id': functional_tool_assembly.id
|
||||
})
|
||||
# 将刀具组装入库单的状态更改为就绪
|
||||
picking_id.action_confirm()
|
||||
picking_id.button_validate()
|
||||
|
||||
def _get_name_stock(self, picking_type_id):
|
||||
name = picking_type_id.sequence_id.prefix + str(
|
||||
datetime.strptime(str(fields.Date.today()), "%Y-%m-%d").strftime("%Y%m%d"))
|
||||
stock_id = self.env['stock.picking'].sudo().search(
|
||||
[('name', 'like', name), ('picking_type_id', '=', picking_type_id.id)],
|
||||
limit=1,
|
||||
order="id desc"
|
||||
)
|
||||
if not stock_id:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(stock_id.name[-3:]) + 1
|
||||
num = "%03d" % m
|
||||
return name + str(num)
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
@@ -553,7 +591,7 @@ class ProductProduct(models.Model):
|
||||
[('id', '=', tool_assembly_order_id)])
|
||||
code = 'JKM-T-' + str(tool_assembly_order.after_assembly_functional_tool_type_id.code) + '-' + str(
|
||||
tool_assembly_order.after_assembly_functional_tool_diameter) + '-'
|
||||
new_time = fields.Date.today()
|
||||
new_time = datetime.strptime(str(fields.Date.today()), "%Y-%m-%d").strftime("%Y%m%d")
|
||||
code += str(new_time) + '-'
|
||||
stock_lot_id = self.env['stock.lot'].sudo().search(
|
||||
[('name', 'like', new_time), ('product_id.name', '=', '功能刀具')],
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
<field name="replacement_diameter" string="刀具直径(mm)"/>
|
||||
<field name="replacement_knife_tip_r_angle" string="刀尖R角(mm)"/>
|
||||
<field name="replacement_tool_setting_length" string="装刀长(mm)"/>
|
||||
<field name="replacement_tool_setting_length" string="总长度(mm)"/>
|
||||
<field name="replacement_extension_length" string="伸出长(mm)"/>
|
||||
<field name="replacement_effective_length" string="有效长(mm)"/>
|
||||
<field name="replacement_tool_coarse_middle_thin" string="粗/中/精"/>
|
||||
@@ -206,14 +206,13 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="integral_name" string="名称"/>
|
||||
<field name="integral_specification_id" string="规格"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="cutting_tool_integral_model_id" string="型号"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="sf_tool_brand_id_1" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -228,14 +227,13 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="blade_name" string="名称"/>
|
||||
<field name="blade_specification_id" string="规格"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="cutting_tool_blade_model_id" string="型号"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="sf_tool_brand_id_2" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -251,14 +249,13 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="bar_name" string="名称"/>
|
||||
<field name="bar_specification_id" string="规格"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="cutting_tool_cutterbar_model_id" string="型号"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="sf_tool_brand_id_3" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -274,14 +271,13 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="pad_name" string="名称"/>
|
||||
<field name="pad_specification_id" string="规格"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="cutting_tool_cutterpad_model_id" string="型号"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="sf_tool_brand_id_4" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -296,14 +292,13 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="handle_name" string="名称"/>
|
||||
<field name="handle_specification_id" string="规格"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="cutting_tool_cutterhandle_model_id" string="型号"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="sf_tool_brand_id_5" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -318,14 +313,13 @@
|
||||
options="{'no_create': True, 'no_quick_create': True}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group col="3">
|
||||
<group col="2">
|
||||
<group>
|
||||
<field name="chuck_name" string="名称"/>
|
||||
<field name="chuck_specification_id" string="规格"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="cutting_tool_cutterhead_model_id" string="型号"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="sf_tool_brand_id_6" string="品牌"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -341,9 +335,9 @@
|
||||
<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" string="是否标准刀"/>
|
||||
@@ -351,11 +345,11 @@
|
||||
<field name="after_assembly_max_lifetime_value" string="最大寿命值(min)"/>
|
||||
<field name="after_assembly_alarm_value" string="报警值(min)"/>
|
||||
<field name="after_assembly_used_value" string="已使用值(min)"/>
|
||||
<field name="after_assembly_tool_loading_length" string="装刀长(mm)"/>
|
||||
<field name="after_assembly_tool_loading_length" string="总长度(mm)"/>
|
||||
<field name="after_assembly_functional_tool_length" string="伸出长(mm)"/>
|
||||
<field name="after_assembly_effective_length" string="有效长(mm)"/>
|
||||
<field name="L_D_number"/>
|
||||
<field name="hiding_length"/>
|
||||
<field name="L_D_number"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
|
||||
Reference in New Issue
Block a user