From b731ffba331fc57959578190d78fca7096f1cd66 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Fri, 26 Jul 2024 14:51:23 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 5 +++++ sf_tool_management/models/mrp_workorder.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 27baa7be..0bbda373 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -50,6 +50,7 @@ class MrpProduction(models.Model): def _compute_tool_state(self): for item in self: if item.workorder_ids: + tool_state = item.tool_state workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) if workorder_ids.filtered(lambda a: a.tool_state == '2'): item.tool_state = '2' @@ -57,6 +58,10 @@ class MrpProduction(models.Model): item.tool_state = '1' else: item.tool_state = '0' + if tool_state == '2' and item.tool_state != '2': + item.detection_result_ids.filtered( + lambda a: a.detailed_reason == '无效功能刀具' and a.handle_result == '待处理').write( + {'handle_result': '已处理'}) # state = fields.Selection(selection_add=[ # ('pending_scheduling', '待排程'), diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py index 352162b7..f3fc3484 100644 --- a/sf_tool_management/models/mrp_workorder.py +++ b/sf_tool_management/models/mrp_workorder.py @@ -105,6 +105,12 @@ class CNCprocessing(models.Model): 'test_results': '返工', 'handle_result': '待处理' }) + if not production_id.is_rework: + production_id.write({ + 'is_rework': True + }) + production_id.workorder_ids.filtered( + lambda a: a.processing_panel == key and not a.is_rework).write({'is_rework': True}) # 对缺刀信息进行处理 for key in data2: if data2.get(key):