1、机台换刀申请tree视图隐藏机床字段,机台号字段内容自动同步位机床名称;功能刀具出入库记录模型机台号字段内容自动同步位机床名称;2、解决功能刀具有的出入库记录机床字段没有内容的问题;3、新增继承机床刀位模型,将新建机床刀位时创建机台换刀申请记录从原机床刀位模型移动到继承后的机床刀位模型中;
This commit is contained in:
@@ -873,13 +873,3 @@ class SfMaintenanceEquipmentTool(models.Model):
|
||||
for record in self:
|
||||
if record.code:
|
||||
record.name = record.code
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
tools = super().create(vals_list)
|
||||
for tool in tools:
|
||||
self.env['sf.machine.table.tool.changing.apply'].sudo().create({
|
||||
'maintenance_equipment_id': tool.equipment_id.id,
|
||||
'cutter_spacing_code_id': tool.id
|
||||
})
|
||||
return tools
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
from . import base
|
||||
from . import tool_material_search
|
||||
from . import maintenance_equipment
|
||||
|
||||
@@ -41,13 +41,10 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
def _compute_current_location_id(self):
|
||||
for record in self:
|
||||
if record.barcode_id.quant_ids:
|
||||
print(record.barcode_id.quant_ids)
|
||||
for quant_id in record.barcode_id.quant_ids:
|
||||
if quant_id.inventory_quantity_auto_apply > 0:
|
||||
print(quant_id)
|
||||
record.current_location_id = quant_id.location_id
|
||||
record.current_location = quant_id.location_id.name
|
||||
print(record.current_location_id)
|
||||
if record.current_location_id:
|
||||
record.get_location_num()
|
||||
else:
|
||||
@@ -161,7 +158,7 @@ class FunctionalToolWarning(models.Model):
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线',
|
||||
group_expand='_read_group_machine_table_name_ids')
|
||||
maintenance_equipment_id = fields.Many2one('maintenance.equipment', string='CNC机床')
|
||||
machine_tool_code = fields.Char(string='机台号')
|
||||
machine_tool_code = fields.Char(string='机台号', related='maintenance_equipment_id.name')
|
||||
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型')
|
||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号',
|
||||
domain="[('equipment_id', '=', maintenance_equipment_id)]")
|
||||
@@ -222,7 +219,7 @@ class StockMoveLine(models.Model):
|
||||
related='functional_tool_name_id.functional_tool_type_id')
|
||||
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("刀具组装时间")
|
||||
install_tool_time = fields.Datetime("刀具组装时间", related='functional_tool_name_id.tool_loading_time')
|
||||
|
||||
@api.model
|
||||
def _read_group_functional_tool_type_id(self, categories, domain, order):
|
||||
@@ -339,7 +336,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
group_expand='_read_group_names')
|
||||
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型', readonly=True,
|
||||
compute='_compute_machine_table_type_id')
|
||||
machine_tool_code = fields.Char(string='机台号', store=True, invisible=True, readonly=True)
|
||||
machine_tool_code = fields.Char(string='机台号', related='maintenance_equipment_id.name')
|
||||
cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', readonly=True,
|
||||
required=True, domain="[('equipment_id', '=', maintenance_equipment_id)]")
|
||||
# 功能刀具信息
|
||||
@@ -355,7 +352,7 @@ class MachineTableToolChangingApply(models.Model):
|
||||
[('BT刀柄式', 'BT刀柄式'), ('SK刀柄式', 'SK刀柄式'), ('HSK刀柄式', 'HSK刀柄式'),
|
||||
('CAT刀柄式', 'CAT刀柄式'), ('ISO刀盘式', 'ISO刀盘式'), ('DIN刀盘式', 'DIN刀盘式'),
|
||||
('直装固定式', '直装固定式')], string='刀位接口型号')
|
||||
diameter = fields.Integer(string='刀具直径(mm)', )
|
||||
diameter = fields.Integer(string='刀具直径(mm)')
|
||||
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
|
||||
max_lifetime_value = fields.Integer(string='最大寿命值(min)')
|
||||
alarm_value = fields.Integer(string='报警值(min)')
|
||||
|
||||
15
sf_tool_management/models/maintenance_equipment.py
Normal file
15
sf_tool_management/models/maintenance_equipment.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from odoo import models, api
|
||||
|
||||
|
||||
class SfMaintenanceEquipmentTool(models.Model):
|
||||
_inherit = 'maintenance.equipment.tool'
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
tools = super().create(vals_list)
|
||||
for tool in tools:
|
||||
self.env['sf.machine.table.tool.changing.apply'].sudo().create({
|
||||
'maintenance_equipment_id': tool.equipment_id.id,
|
||||
'cutter_spacing_code_id': tool.id
|
||||
})
|
||||
return tools
|
||||
@@ -478,7 +478,7 @@
|
||||
<tree create="0" delete="0">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="production_line_id" invisible="1"/>
|
||||
<field name="maintenance_equipment_id"/>
|
||||
<field name="maintenance_equipment_id" invisible="1"/>
|
||||
<field name="machine_tool_code"/>
|
||||
<field name="cutter_spacing_code_id"/>
|
||||
<field name="functional_tool_name_id"/>
|
||||
|
||||
@@ -378,7 +378,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
# 创建功能刀具批次/序列号记录
|
||||
stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly)
|
||||
# 创建刀具组装入库单
|
||||
self.create_stocking_picking(stock_lot)
|
||||
self.create_stocking_picking(stock_lot, functional_tool_assembly)
|
||||
# 刀具物料出库
|
||||
if self.integral_code_id:
|
||||
product_id.tool_material_stock_moves(self.integral_code_id)
|
||||
@@ -436,7 +436,7 @@ 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):
|
||||
def create_stocking_picking(self, stock_lot, functional_tool_assembly):
|
||||
"""
|
||||
创建刀具组装入库单
|
||||
"""
|
||||
@@ -450,7 +450,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
self.env['stock.move.line'].create({
|
||||
'picking_id': picking_id.id,
|
||||
'product_id': stock_lot.product_id.id,
|
||||
'lot_id': stock_lot.id
|
||||
'lot_id': stock_lot.id,
|
||||
'functional_tool_name_id': functional_tool_assembly.id
|
||||
})
|
||||
# 将刀具组装入库单的状态更改为就绪
|
||||
picking_id.action_confirm()
|
||||
@@ -572,7 +573,6 @@ class ProductProduct(models.Model):
|
||||
"""
|
||||
# 获取位置对象
|
||||
location_inventory_id = tool_material.quant_ids.location_id[-1]
|
||||
print(location_inventory_id)
|
||||
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None)
|
||||
|
||||
Reference in New Issue
Block a user