1、功能刀具列表模型新增大量字段,新增计算库存数量方法,新增查看当前功能刀具的预警记录按键;2、重构功能刀具预警模型(已完成);3、功能刀具组装模型name字段展示内容改为功能刀具名称;
This commit is contained in:
@@ -1 +1 @@
|
||||
from . import wizard
|
||||
from . import wizard
|
||||
|
||||
@@ -154,6 +154,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
_inherit = ["barcodes.barcode_events_mixin"]
|
||||
_description = '功能刀具组装单'
|
||||
|
||||
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)
|
||||
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True,
|
||||
@@ -320,7 +321,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
cut_number = fields.Integer(string='已切削次数')
|
||||
|
||||
after_assembly_whether_standard_knife = fields.Boolean(string='组装后是否标准刀', default=True)
|
||||
after_assembly_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='组装后粗/中/精')
|
||||
after_assembly_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
|
||||
string='组装后粗/中/精')
|
||||
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)')
|
||||
@@ -348,6 +350,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
# 封装功能刀具数据
|
||||
desc_1 = self.get_desc_1(stock_lot)
|
||||
functional_tool_assembly = self.env['sf.functional.tool.assembly'].search([
|
||||
('assembly_order_code', '=', self.assembly_order_code),
|
||||
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
|
||||
('cutter_spacing_code_id', '=', self.cutter_spacing_code_id.id),
|
||||
('assemble_status', '=', '0'),
|
||||
@@ -355,9 +358,9 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
|
||||
# 创建功能刀具列表记录
|
||||
# 封装功能刀具数据
|
||||
# desc_2 = self.get_desc_2(stock_lot)
|
||||
# # 创建功能刀具列表、功能刀具预警、功能刀具实时分布、功能刀具出入库记录
|
||||
# record_1 = self.env['sf.functional.cutting.tool.entity'].create(desc_2)
|
||||
desc_2 = self.get_desc_2(stock_lot, functional_tool_assembly)
|
||||
# 创建功能刀具列表、功能刀具预警、功能刀具实时分布、功能刀具出入库记录
|
||||
record_1 = self.env['sf.functional.cutting.tool.entity'].create(desc_2)
|
||||
# self.env['sf.functional.tool.warning'].create({
|
||||
# 'functional_cutting_tool_id': record_1.id,
|
||||
# 'functional_tool_assembly_id': functional_tool_assembly.id,
|
||||
@@ -512,26 +515,34 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
'tool_loading_time': fields.Datetime.now()
|
||||
}
|
||||
|
||||
def get_desc_2(self, stock_lot):
|
||||
def get_desc_2(self, stock_lot, functional_tool_assembly_id):
|
||||
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,
|
||||
'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,
|
||||
'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,
|
||||
|
||||
'functional_tool_diameter': self.after_assembly_functional_tool_diameter,
|
||||
'knife_tip_r_angle': self.after_assembly_knife_tip_r_angle,
|
||||
'coarse_middle_thin': self.after_assembly_coarse_middle_thin,
|
||||
'new_former': self.after_assembly_new_former,
|
||||
'tool_loading_length': self.after_assembly_tool_loading_length,
|
||||
'functional_tool_length': self.after_assembly_functional_tool_length,
|
||||
'effective_length': self.after_assembly_effective_length,
|
||||
|
||||
'max_lifetime_value': self.after_assembly_max_lifetime_value,
|
||||
'alarm_value': self.after_assembly_alarm_value,
|
||||
'used_value': self.after_assembly_used_value,
|
||||
'whether_standard_knife': self.after_assembly_whether_standard_knife,
|
||||
'L_D_number': self.L_D_number,
|
||||
'hiding_length': self.hiding_length,
|
||||
'cut_time': self.cut_time,
|
||||
'cut_length': self.cut_length,
|
||||
'cut_number': self.cut_number,
|
||||
'current_location_id': stock_lot.quant_ids.location_id.ids[-1],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user