1、机床换刀申请界面新增搜索面板和设备字段根据设备的设备类型等于机床的过滤条件;2、隐藏功能刀具出入库记录菜单;3、功能刀具列表form视图新增预警跳转按键(跳转功能未完成);
This commit is contained in:
@@ -166,14 +166,14 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
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', '=', '刀柄')])
|
||||
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)
|
||||
|
||||
# 夹头型号
|
||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号',
|
||||
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', required=True,
|
||||
domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')])
|
||||
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')
|
||||
@@ -269,58 +269,25 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
功能刀具组装
|
||||
:return:
|
||||
"""
|
||||
# 对物料做必填判断
|
||||
self.materials_must_be_judged()
|
||||
|
||||
# 创建组装入库单
|
||||
# 创建功能刀具批次/序列号记录
|
||||
stock_lot = self.create_assemble_warehouse_receipt()
|
||||
# 创建刀具组装入库单
|
||||
self.create_stocking_picking(stock_lot)
|
||||
desc_1 = {
|
||||
'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()
|
||||
}
|
||||
# 封装功能刀具数据
|
||||
desc_1 = self.get_desc_1(stock_lot)
|
||||
functional_tool_assembly = self.env['sf.functional.tool.assembly'].search([
|
||||
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
|
||||
('cutter_spacing_code', '=', self.cutter_spacing_code),
|
||||
('assemble_status', '=', '0'),
|
||||
])
|
||||
|
||||
# 创建功能刀具列表记录
|
||||
# 封装功能刀具数据
|
||||
desc_2 = {
|
||||
'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,
|
||||
}
|
||||
desc_2 = self.get_desc_2(stock_lot)
|
||||
# 创建功能刀具列表、功能刀具预警、功能刀具实时分布、功能刀具出入库记录
|
||||
record_1 = self.env['sf.functional.cutting.tool.entity'].create(desc_2)
|
||||
self.env['sf.functional.tool.warning'].create({
|
||||
@@ -335,7 +302,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
'functional_cutting_tool_id': record_1.id
|
||||
})
|
||||
|
||||
# 修改功能刀具组装信息
|
||||
# 修改功能刀具组装单信息
|
||||
functional_tool_assembly.write(desc_1)
|
||||
|
||||
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'}
|
||||
|
||||
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):
|
||||
"""
|
||||
创建刀具组装入库单
|
||||
@@ -413,7 +390,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
'qty_done': 1.0,
|
||||
'state': 'done'
|
||||
})
|
||||
|
||||
return stock_move_id, stock_move_line_id
|
||||
|
||||
def get_stock_lot_name(self):
|
||||
@@ -433,4 +409,49 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
else:
|
||||
m = int(stock_lot_id.name[-3:]) + 1
|
||||
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