diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index a010d2f7..dc8e82c4 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -948,6 +948,8 @@ class MrpProduction(models.Model): if production.programming_no in program_to_production_names: productions_not_delivered = self.env['mrp.production'].search( [('programming_no', '=', production.programming_no), ('programming_state', '=', '已编程未下发')]) + productions = self.env['mrp.production'].search( + [('programming_no', '=', production.programming_no), ('state', 'not in', ('cancel', 'done'))]) rework_workorder = production.workorder_ids.filtered(lambda m: m.state == 'rework') if rework_workorder: for rework_item in rework_workorder: @@ -960,12 +962,12 @@ class MrpProduction(models.Model): productions_not_delivered.write( {'state': 'progress', 'programming_state': '已编程', 'is_rework': False}) - # 对制造订单所以面的cnc工单的程序用刀进行校验 - try: - logging.info(f'已更新制造订单:{productions_not_delivered}') - productions_not_delivered.production_cnc_tool_checkout() - except Exception as e: - logging.info(f'对cnc工单的程序用刀进行校验报错:{e}') + # 对制造订单所以面的cnc工单的程序用刀进行校验 + try: + logging.info(f'已更新制造订单:{productions_not_delivered}') + productions.production_cnc_tool_checkout() + except Exception as e: + logging.info(f'对cnc工单的程序用刀进行校验报错:{e}') # 从cloud获取重新编程过的最新程序 def get_new_program(self, processing_panel):