From 251e289fd182222d57980cec0a996ebfa8fe579c Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Mon, 22 Jul 2024 15:08:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=94=E5=B7=A5=E5=A4=9A?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 14 +++++++------- sf_manufacturing/models/mrp_workorder.py | 1 + sf_manufacturing/wizard/rework_wizard.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index c03e2d56..b7c8fe91 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -200,12 +200,12 @@ class MrpProduction(models.Model): if result['status'] == 1: for item in result['programming_list']: if not self: - production = self.env['mrp.production'].search( - [('state', '=', 'rework'), - ('programming_no', '=', item['programming_no'], ('is_rework', '=', True))]) - if production: - production.write({'programming_state': '已编程未下发' if item[ - 'programming_state'] == '已编程' else '编程中'}) + for rp in reproduction: + if rp.programming_no == item['programming_no']: + rp.write({'programming_state': '已编程未下发' if item[ + 'programming_state'] == '已编程' else '编程中'}) + logging.info('rp:' % rp.name) + else: return item @@ -765,7 +765,7 @@ class MrpProduction(models.Model): 'default_programming_state': cloud_programming['programming_state'], 'default_is_reprogramming': False if (cloud_programming['programming_state'] in ['编程中', '待编程'] and self.programming_state in [ - '编程中']) + '编程中', '已编程']) or (cloud_programming['programming_state'] in [ '已编程'] and self.programming_state in ['已编程未下发']) else True } diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 72ee31cd..a4b0527c 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1001,6 +1001,7 @@ class ResMrpWorkOrder(models.Model): 'rfid_code': False}) # workorder.rfid_code_old = rfid_code # workorder.rfid_code = False + logging.info('workorder.rfid_code:%s' % workorder.rfid_code) if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺']: logging.info('product_qty:%s' % record.production_id.product_qty) for move_raw_id in record.production_id.move_raw_ids: diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py index c4462ec7..e018b30a 100644 --- a/sf_manufacturing/wizard/rework_wizard.py +++ b/sf_manufacturing/wizard/rework_wizard.py @@ -86,7 +86,7 @@ class ReworkWizard(models.TransientModel): {'handle_result': '已处理'}) if self.is_reprogramming is False: if self.reprogramming_num >= 1: - self.production_id.get_new_program(panel) + self.production_id.get_new_program(panel.name) else: ret = {'programming_list': []} cnc_rework = self.production_id.workorder_ids.filtered(