From e84842d0a3a046dd54ff5822446a5f83ff39d24a Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Sun, 28 Jul 2024 16:23:17 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=A4=87=E6=B3=A8=E5=80=BC=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E6=B3=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 7 +++++-- sf_manufacturing/models/mrp_workorder.py | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 6eff353d..e6668ecf 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -38,10 +38,13 @@ class MrpProduction(models.Model): if item.workorder_ids: workorder_ids = item.workorder_ids.filtered(lambda a: a.state not in ('rework', '返工')) if workorder_ids.filtered(lambda a: a.tool_state_remark): - work_ids = workorder_ids.filtered(lambda a: a.tool_state_remark) + work_ids = workorder_ids.filtered(lambda a: a.tool_state == '1' and a.state not in ['rework']) tool_state_remark = '' for work_id in work_ids: - tool_state_remark = f"{work_id.tool_state_remark}\n" + if tool_state_remark == '': + tool_state_remark = f"{work_id.tool_state_remark}" + else: + tool_state_remark = f"{tool_state_remark}\n{work_id.tool_state_remark}" item.tool_state_remark = tool_state_remark else: item.tool_state_remark = False diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 76664a35..925fcc8f 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -189,11 +189,12 @@ class ResMrpWorkOrder(models.Model): if item.cnc_ids.filtered(lambda a: a.tool_state == '2'): item.tool_state_remark = None elif item.cnc_ids.filtered(lambda a: a.tool_state == '1'): - tool_state_remark = f'{item.processing_panel}缺刀:[' + tool_state_remark = [] cnc_ids = item.cnc_ids.filtered(lambda a: a.tool_state == '1') for cnc_id in cnc_ids: - tool_state_remark = f"{tool_state_remark}'{cnc_id.cutting_tool_name}'" - item.tool_state_remark = f"{tool_state_remark}]" + if cnc_id.cutting_tool_name not in tool_state_remark: + tool_state_remark.append(cnc_id.cutting_tool_name) + item.tool_state_remark = f"{item.processing_panel}缺刀:{tool_state_remark}]" else: item.tool_state_remark = None