From 66caeee1cdf224fbcdcb8dba214b9f46ad41113e Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Fri, 26 Jul 2024 16:25:16 +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=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 20 +++++++++++++------- sf_tool_management/models/mrp_workorder.py | 12 ++++++------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 827f77df..ded46f93 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -806,8 +806,6 @@ class ResMrpWorkOrder(models.Model): if workorder.production_id.is_rework is True: if re_work or cnc_workorder: workorder.state = 'waiting' - if workorder.production_id.tool_state in ['1', '2'] and workorder.state != 'pending': - workorder.state = 'waiting' elif workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'rework', 'cancel']: pre_workorder = self.env['mrp.workorder'].search( @@ -850,11 +848,19 @@ class ResMrpWorkOrder(models.Model): # else: # if workorder.state not in ['cancel', 'rework']: # workorder.state = 'rework' - if workorder.production_id.state == 'pending_cam': - if workorder.production_id.tool_state in ['1', '2']: - work_ids = workorder.production_id.workorder_ids.filtered( - lambda a: a.routing_type == '装夹预调' and a.state in ['ready', 'waiting']) - work_ids.state = 'waiting' + # 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】 + if workorder.production_id.tool_state in ['1', '2']: + if workorder.routing_type == '装夹预调': + if workorder.state in ['ready']: + workorder.state = 'waiting' + continue + elif workorder.state == 'pending' and self.search( + [('production_id', '=', workorder.production_id.id), + ('sequence', '=', workorder.sequence - 1), + ('state', 'in', ['done', 'rework'])]): + workorder.state = 'waiting' + continue + logging.info('工序:%s' % workorder.sequence) logging.info('工单最终状态:%s' % workorder.state) diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py index f3fc3484..eb8db183 100644 --- a/sf_tool_management/models/mrp_workorder.py +++ b/sf_tool_management/models/mrp_workorder.py @@ -105,12 +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}) + # 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):