From c01dfddfb4d2237e1e642d977ca095abfb77ce94 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Tue, 30 Jul 2024 17:45:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=94=E5=B7=A5-=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index cb3c9ebb..b6622419 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -910,7 +910,16 @@ class ResMrpWorkOrder(models.Model): # if workorder.state not in ['cancel', 'rework']: # workorder.state = 'rework' if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']: - if workorder.production_id.programming_state == '已编程': + workorder_ids = workorder.production_id.workorder_ids + work_bo = True + for wo in workorder_ids.filtered(lambda a: a.routing_type == '装夹预调' and a.state == 'rework'): + if not workorder_ids.filtered( + lambda a: (a.routing_type == '装夹预调' and a.state not in ['rework', 'cancel'] + and a.processing_panel == wo.processing_panel)): + work_bo = False + break + if (workorder.production_id.programming_state == '已编程' and work_bo + and not workorder_ids.filtered(lambda a: a.sequence == 0)): # 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】 if workorder.production_id.tool_state in ['1', '2']: if workorder.state in ['ready']: @@ -927,8 +936,8 @@ class ResMrpWorkOrder(models.Model): workorder.state = 'waiting' continue elif workorder.production_id.tool_state in ['0']: - if workorder.production_id.workorder_ids.filtered(lambda a: a.state == 'rework'): - if not workorder.production_id.workorder_ids.filtered( + if workorder_ids.filtered(lambda a: a.state == 'rework'): + if not workorder_ids.filtered( lambda a: (a.routing_type not in ['装夹预调'] and a.state not in ['pending', 'done', 'rework', 'cancel'])): # 查询工序最小的非完工、非返工的装夹预调工单