1、机床换刀申请界面新增搜索面板和设备字段根据设备的设备类型等于机床的过滤条件;2、隐藏功能刀具出入库记录菜单;3、功能刀具列表form视图新增预警跳转按键(跳转功能未完成);
This commit is contained in:
@@ -94,6 +94,9 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
functional_tool_model_ids.append(functional_tool_model.id)
|
functional_tool_model_ids.append(functional_tool_model.id)
|
||||||
return [(6, 0, functional_tool_model_ids)]
|
return [(6, 0, functional_tool_model_ids)]
|
||||||
|
|
||||||
|
def open_functional_tool_warning(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FunctionalToolWarning(models.Model):
|
class FunctionalToolWarning(models.Model):
|
||||||
_name = 'sf.functional.tool.warning'
|
_name = 'sf.functional.tool.warning'
|
||||||
@@ -438,7 +441,7 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
_description = '机床换刀申请'
|
_description = '机床换刀申请'
|
||||||
|
|
||||||
name = fields.Many2one('maintenance.equipment', string='CNC机床', required=True, readonly=False,
|
name = fields.Many2one('maintenance.equipment', string='CNC机床', required=True, readonly=False,
|
||||||
group_expand='_read_group_names')
|
group_expand='_read_group_names', domain=[('category_id.equipment_type', '=', '机床')])
|
||||||
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型', readonly=True,
|
machine_table_type_id = fields.Many2one('maintenance.equipment.category', string='机床类型', readonly=True,
|
||||||
compute='_compute_machine_table_type_id')
|
compute='_compute_machine_table_type_id')
|
||||||
machine_tool_code = fields.Char(string='机台号', store=True, invisible=True, readonly=True)
|
machine_tool_code = fields.Char(string='机台号', store=True, invisible=True, readonly=True)
|
||||||
@@ -489,7 +492,7 @@ class MachineTableToolChangingApply(models.Model):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _read_group_names(self, categories, domain, order):
|
def _read_group_names(self, categories, domain, order):
|
||||||
names = categories._search([], order=order, access_rights_uid=SUPERUSER_ID)
|
names = categories._search([('category_id.equipment_type', '=', '机床')], order=order, access_rights_uid=SUPERUSER_ID)
|
||||||
return categories.browse(names)
|
return categories.browse(names)
|
||||||
|
|
||||||
@api.onchange('functional_tool_status')
|
@api.onchange('functional_tool_status')
|
||||||
|
|||||||
@@ -32,13 +32,13 @@
|
|||||||
parent="menu_sf_tool_manage"
|
parent="menu_sf_tool_manage"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<!-- <menuitem-->
|
||||||
sequence="10"
|
<!-- sequence="10"-->
|
||||||
name="功能刀具出入库记录"
|
<!-- name="功能刀具出入库记录"-->
|
||||||
id="menu_sf_function_tool_entry_exit_records"
|
<!-- id="menu_sf_function_tool_entry_exit_records"-->
|
||||||
action="sf_inbound_and_outbound_records_of_functional_tools_view_act"
|
<!-- action="sf_inbound_and_outbound_records_of_functional_tools_view_act"-->
|
||||||
parent="menu_sf_tool_manage"
|
<!-- parent="menu_sf_tool_manage"-->
|
||||||
/>
|
<!-- />-->
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
sequence="0"
|
sequence="0"
|
||||||
|
|||||||
@@ -27,6 +27,19 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form create="0" edit="0" delete="0" >
|
<form create="0" edit="0" delete="0" >
|
||||||
<sheet>
|
<sheet>
|
||||||
|
<div class="oe_button_box" name="button_box">
|
||||||
|
<button class="oe_stat_button"
|
||||||
|
name="open_functional_tool_warning"
|
||||||
|
icon="fa-list-ul"
|
||||||
|
type="object">
|
||||||
|
<div class="o_field_widget o_stat_info">
|
||||||
|
<span>
|
||||||
|
预警
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
<button name="%(stock.action_stock_report)d" icon="fa-arrow-up" class="oe_stat_button" string="Traceability" type="action"/>
|
||||||
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<h1>
|
<h1>
|
||||||
<field name="barcode_id" readonly="1" nolabel="True"/>
|
<field name="barcode_id" readonly="1" nolabel="True"/>
|
||||||
|
|||||||
@@ -166,14 +166,14 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
|
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
|
||||||
|
|
||||||
# 刀柄型号
|
# 刀柄型号
|
||||||
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号',
|
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', required=True,
|
||||||
domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄')])
|
domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄')])
|
||||||
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号', readonly=True)
|
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号', readonly=True)
|
||||||
handle_name = fields.Char('刀柄名称', readonly=True)
|
handle_name = fields.Char('刀柄名称', readonly=True)
|
||||||
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
|
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
|
||||||
|
|
||||||
# 夹头型号
|
# 夹头型号
|
||||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号',
|
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', required=True,
|
||||||
domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')])
|
domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')])
|
||||||
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', 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')
|
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
|
||||||
@@ -269,58 +269,25 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
功能刀具组装
|
功能刀具组装
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
# 对物料做必填判断
|
||||||
|
self.materials_must_be_judged()
|
||||||
|
|
||||||
# 创建组装入库单
|
# 创建组装入库单
|
||||||
# 创建功能刀具批次/序列号记录
|
# 创建功能刀具批次/序列号记录
|
||||||
stock_lot = self.create_assemble_warehouse_receipt()
|
stock_lot = self.create_assemble_warehouse_receipt()
|
||||||
# 创建刀具组装入库单
|
# 创建刀具组装入库单
|
||||||
self.create_stocking_picking(stock_lot)
|
self.create_stocking_picking(stock_lot)
|
||||||
desc_1 = {
|
# 封装功能刀具数据
|
||||||
'barcode_id': stock_lot.id,
|
desc_1 = self.get_desc_1(stock_lot)
|
||||||
'integral_code_id': self.integral_code_id.id,
|
|
||||||
'blade_code_id': self.blade_code_id.id,
|
|
||||||
'bar_code_id': self.bar_code_id.id,
|
|
||||||
'pad_code_id': self.pad_code_id.id,
|
|
||||||
'handle_code_id': self.handle_code_id.id,
|
|
||||||
'chuck_code_id': self.chuck_code_id.id,
|
|
||||||
'coarse_middle_thin': self.coarse_middle_thin,
|
|
||||||
'tool_loading_length': self.tool_loading_length,
|
|
||||||
'new_former': self.new_former,
|
|
||||||
'reference_length': self.reference_length,
|
|
||||||
'cut_time': self.cut_time,
|
|
||||||
'cut_length': self.cut_length,
|
|
||||||
'cut_number': self.cut_number,
|
|
||||||
'assemble_status': '1',
|
|
||||||
'tool_loading_person': self.env.user.name,
|
|
||||||
'tool_loading_time': fields.Datetime.now()
|
|
||||||
}
|
|
||||||
functional_tool_assembly = self.env['sf.functional.tool.assembly'].search([
|
functional_tool_assembly = self.env['sf.functional.tool.assembly'].search([
|
||||||
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
|
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
|
||||||
('cutter_spacing_code', '=', self.cutter_spacing_code),
|
('cutter_spacing_code', '=', self.cutter_spacing_code),
|
||||||
('assemble_status', '=', '0'),
|
('assemble_status', '=', '0'),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# 创建功能刀具列表记录
|
||||||
# 封装功能刀具数据
|
# 封装功能刀具数据
|
||||||
desc_2 = {
|
desc_2 = self.get_desc_2(stock_lot)
|
||||||
'barcode_id': stock_lot.id,
|
|
||||||
'functional_tool_name_id': self.functional_tool_name_id.id,
|
|
||||||
'mrs_cutting_tool_type_id': self.functional_tool_type_id.id,
|
|
||||||
'cutting_tool_integral_model_id': self.integral_code_id.product_id.id,
|
|
||||||
'cutting_tool_blade_model_id': self.blade_code_id.product_id.id,
|
|
||||||
'cutting_tool_cutterbar_model_id': self.bar_code_id.product_id.id,
|
|
||||||
'cutting_tool_cutterpad_model_id': self.pad_code_id.product_id.id,
|
|
||||||
'cutting_tool_cutterhandle_model_id': self.handle_code_id.product_id.id,
|
|
||||||
'cutting_tool_cutterhead_model_id': self.chuck_code_id.product_id.id,
|
|
||||||
'diameter': self.functional_tool_diameter,
|
|
||||||
'tool_grade': None,
|
|
||||||
'machining_accuracy': None,
|
|
||||||
'tool_length': self.tool_loading_length,
|
|
||||||
'blade_number': None,
|
|
||||||
'integral_blade_length': None,
|
|
||||||
'effective_blade_length': self.effective_length,
|
|
||||||
'max_life': None,
|
|
||||||
'is_standard': self.whether_standard_tool,
|
|
||||||
'applicable_range': None,
|
|
||||||
'image': None,
|
|
||||||
}
|
|
||||||
# 创建功能刀具列表、功能刀具预警、功能刀具实时分布、功能刀具出入库记录
|
# 创建功能刀具列表、功能刀具预警、功能刀具实时分布、功能刀具出入库记录
|
||||||
record_1 = self.env['sf.functional.cutting.tool.entity'].create(desc_2)
|
record_1 = self.env['sf.functional.cutting.tool.entity'].create(desc_2)
|
||||||
self.env['sf.functional.tool.warning'].create({
|
self.env['sf.functional.tool.warning'].create({
|
||||||
@@ -335,7 +302,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
'functional_cutting_tool_id': record_1.id
|
'functional_cutting_tool_id': record_1.id
|
||||||
})
|
})
|
||||||
|
|
||||||
# 修改功能刀具组装信息
|
# 修改功能刀具组装单信息
|
||||||
functional_tool_assembly.write(desc_1)
|
functional_tool_assembly.write(desc_1)
|
||||||
|
|
||||||
if functional_tool_assembly.sf_machine_table_tool_changing_apply_id:
|
if functional_tool_assembly.sf_machine_table_tool_changing_apply_id:
|
||||||
@@ -352,6 +319,16 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
# 关闭弹出窗口
|
# 关闭弹出窗口
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
|
|
||||||
|
def materials_must_be_judged(self):
|
||||||
|
"""
|
||||||
|
功能刀具组装物料必填判断
|
||||||
|
"""
|
||||||
|
if not self.integral_code_id and not self.blade_code_id:
|
||||||
|
raise ValidationError('【整体式刀具】和【刀片】必须填写一个!')
|
||||||
|
if self.blade_code_id:
|
||||||
|
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):
|
||||||
"""
|
"""
|
||||||
创建刀具组装入库单
|
创建刀具组装入库单
|
||||||
@@ -413,7 +390,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
'qty_done': 1.0,
|
'qty_done': 1.0,
|
||||||
'state': 'done'
|
'state': 'done'
|
||||||
})
|
})
|
||||||
|
|
||||||
return stock_move_id, stock_move_line_id
|
return stock_move_id, stock_move_line_id
|
||||||
|
|
||||||
def get_stock_lot_name(self):
|
def get_stock_lot_name(self):
|
||||||
@@ -433,4 +409,49 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
|||||||
else:
|
else:
|
||||||
m = int(stock_lot_id.name[-3:]) + 1
|
m = int(stock_lot_id.name[-3:]) + 1
|
||||||
num = "%03d" % m
|
num = "%03d" % m
|
||||||
return code + str(num)
|
return code + str(num)
|
||||||
|
|
||||||
|
def get_desc_1(self, stock_lot):
|
||||||
|
return {
|
||||||
|
'barcode_id': stock_lot.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,
|
||||||
|
'pad_code_id': self.pad_code_id.id,
|
||||||
|
'handle_code_id': self.handle_code_id.id,
|
||||||
|
'chuck_code_id': self.chuck_code_id.id,
|
||||||
|
'coarse_middle_thin': self.coarse_middle_thin,
|
||||||
|
'tool_loading_length': self.tool_loading_length,
|
||||||
|
'new_former': self.new_former,
|
||||||
|
'reference_length': self.reference_length,
|
||||||
|
'cut_time': self.cut_time,
|
||||||
|
'cut_length': self.cut_length,
|
||||||
|
'cut_number': self.cut_number,
|
||||||
|
'assemble_status': '1',
|
||||||
|
'tool_loading_person': self.env.user.name,
|
||||||
|
'tool_loading_time': fields.Datetime.now()
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_desc_2(self, stock_lot):
|
||||||
|
return {
|
||||||
|
'barcode_id': stock_lot.id,
|
||||||
|
'functional_tool_name_id': self.functional_tool_name_id.id,
|
||||||
|
'mrs_cutting_tool_type_id': self.functional_tool_type_id.id,
|
||||||
|
'cutting_tool_integral_model_id': self.integral_code_id.product_id.id,
|
||||||
|
'cutting_tool_blade_model_id': self.blade_code_id.product_id.id,
|
||||||
|
'cutting_tool_cutterbar_model_id': self.bar_code_id.product_id.id,
|
||||||
|
'cutting_tool_cutterpad_model_id': self.pad_code_id.product_id.id,
|
||||||
|
'cutting_tool_cutterhandle_model_id': self.handle_code_id.product_id.id,
|
||||||
|
'cutting_tool_cutterhead_model_id': self.chuck_code_id.product_id.id,
|
||||||
|
'diameter': self.functional_tool_diameter,
|
||||||
|
'tool_grade': None,
|
||||||
|
'machining_accuracy': None,
|
||||||
|
'tool_length': self.tool_loading_length,
|
||||||
|
'blade_number': None,
|
||||||
|
'integral_blade_length': None,
|
||||||
|
'effective_blade_length': self.effective_length,
|
||||||
|
'max_life': None,
|
||||||
|
'is_standard': self.whether_standard_tool,
|
||||||
|
'applicable_range': None,
|
||||||
|
'image': None,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user