From de04d452b39de56e14812d9d532e81d609cf1407 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Tue, 28 Nov 2023 16:28:48 +0800 Subject: [PATCH] =?UTF-8?q?1=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E8=A3=85=E5=8D=95=E7=9A=84=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=89=A9=E6=96=99=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/models/base.py | 24 ++++++++++++------------ sf_tool_management/wizard/wizard.py | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 99a7f3d9..c14aa16f 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -25,7 +25,7 @@ class FunctionalCuttingToolEntity(models.Model): 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) - tool_room_num = fields.Integer(string='刀具房数量', readonly=True, compute='_compute_location_num') + tool_room_num = fields.Integer(string='刀具房数量', readonly=True) line_edge_knife_library_num = fields.Integer(string='线边刀库数量', readonly=True) machine_knife_library_num = fields.Integer(string='机内刀库数量', readonly=True) max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True) @@ -36,16 +36,16 @@ class FunctionalCuttingToolEntity(models.Model): current_location_id = fields.Many2one('stock.location', string='当前位置', readonly=True) image = fields.Binary('图片', readonly=True) - @api.depends('current_location_id') - def _compute_location_num(self): - """ - 计算库存位置数量 - """ - for obj in self: - if obj.current_location_id.name in ('组装后', '刀具房'): - obj.tool_room_num = 1 - obj.line_edge_knife_library_num = 0 - obj.machine_knife_library_num = 0 + # @api.depends('current_location_id') + # def _compute_location_num(self): + # """ + # 计算库存位置数量 + # """ + # for obj in self: + # if obj.current_location_id.name in ('组装后', '刀具房'): + # obj.tool_room_num = 1 + # obj.line_edge_knife_library_num = 0 + # obj.machine_knife_library_num = 0 @api.model def _read_group_mrs_cutting_tool_type_id(self, categories, domain, order): @@ -491,7 +491,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model): class FunctionalToolAssembly(models.Model): _name = 'sf.functional.tool.assembly' - _description = '功能刀具组装单' + _description = '功能刀具组装' _order = 'use_tool_time asc' @api.depends('functional_tool_name') diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py index 649d6b86..2c81cb31 100644 --- a/sf_tool_management/wizard/wizard.py +++ b/sf_tool_management/wizard/wizard.py @@ -183,7 +183,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 整体式刀具型号 integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '整体式刀具'), - ('quant_ids.location_id.name', 'in', ['刀具房'])]) + ('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) @@ -192,7 +193,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 刀片型号 blade_code_id = fields.Many2one('stock.lot', '刀片序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '刀片'), - ('quant_ids.location_id.name', 'in', ['刀具房'])]) + ('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) @@ -200,7 +202,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 刀杆型号 bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '刀杆'), - ('quant_ids.location_id.name', 'in', ['刀具房'])]) + ('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) @@ -209,7 +212,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 刀盘型号 pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', domain=[('product_id.cutting_tool_material_id.name', '=', '刀盘'), - ('quant_ids.location_id.name', 'in', ['刀具房'])]) + ('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) @@ -218,7 +222,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 刀柄型号 handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', required=True, domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄'), - ('quant_ids.location_id.name', 'in', ['刀具房'])]) + ('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) @@ -227,7 +232,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel): # 夹头型号 chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', required=True, domain=[('product_id.cutting_tool_material_id.name', '=', '夹头'), - ('quant_ids.location_id.name', 'in', ['刀具房'])]) + ('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')