From a0ed14aed19956d8f550866e8d40dd89c87e1219 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Tue, 30 Jul 2024 09:21:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20=20=E5=88=B6=E9=80=A0?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8F=90=E4=BA=A4=E8=BF=94=E5=B7=A5-?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E9=87=8D=E6=96=B0=E7=BC=96=E7=A8=8B-?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E5=BC=A0=E5=B7=A5=E5=8D=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 59 ++++++++++++------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 65f85048..cb3c9ebb 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -910,39 +910,40 @@ 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.tool_state in ['1', '2']: - if workorder.state in ['ready']: - workorder.state = 'waiting' - continue - elif workorder.state in ['waiting']: - continue - elif workorder.state == 'pending' and workorder == self.search( - [('production_id', '=', workorder.production_id.id), - ('routing_type', '=', '装夹预调'), - ('state', 'not in', ['rework', 'done', 'cancel'])], - limit=1, - order="sequence"): - 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( - lambda a: (a.routing_type not in ['装夹预调'] and - a.state not in ['pending', 'done', 'rework', 'cancel'])): - # 查询工序最小的非完工、非返工的装夹预调工单 - work_id = self.search( + if workorder.production_id.programming_state == '已编程': + # 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】 + if workorder.production_id.tool_state in ['1', '2']: + if workorder.state in ['ready']: + workorder.state = 'waiting' + continue + elif workorder.state in ['waiting']: + continue + elif workorder.state == 'pending' and workorder == self.search( [('production_id', '=', workorder.production_id.id), ('routing_type', '=', '装夹预调'), ('state', 'not in', ['rework', 'done', 'cancel'])], limit=1, - order="sequence") - if workorder == work_id: - if workorder.production_id.reservation_state == 'assigned': - workorder.state = 'ready' - elif workorder.production_id.reservation_state != 'assigned': - workorder.state = 'waiting' - continue + order="sequence"): + 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( + lambda a: (a.routing_type not in ['装夹预调'] and + a.state not in ['pending', 'done', 'rework', 'cancel'])): + # 查询工序最小的非完工、非返工的装夹预调工单 + work_id = self.search( + [('production_id', '=', workorder.production_id.id), + ('routing_type', '=', '装夹预调'), + ('state', 'not in', ['rework', 'done', 'cancel'])], + limit=1, + order="sequence") + if workorder == work_id: + if workorder.production_id.reservation_state == 'assigned': + workorder.state = 'ready' + elif workorder.production_id.reservation_state != 'assigned': + workorder.state = 'waiting' + continue logging.info('工序:%s' % workorder.sequence) logging.info('工单最终状态:%s' % workorder.state)