From be9846986fe3fed1e1c8101a1334141397b18010 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 13 Jan 2025 13:51:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=88=86=E5=87=BA=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_mrs_connect/controllers/controllers.py | 20 ++++++++++++-------- sf_tool_management/models/mrp_workorder.py | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 521c5150..4b9b49a1 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -61,8 +61,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): # 查询状态为进行中且工序类型为CNC加工的工单 cnc_workorder_has = production.workorder_ids.filtered( lambda ach: ach.routing_type == 'CNC加工' and ach.state not in ['progress', 'done', - 'rework', - 'cancel'] and ach.processing_panel == panel) + 'rework', + 'cancel'] and ach.processing_panel == panel) if cnc_workorder_has: if cnc_workorder_has.cnc_ids: cnc_workorder_has.cmm_ids.sudo().unlink() @@ -76,7 +76,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): # 查询状态为进行中且工序类型为CNC加工的工单 cnc_workorder = productions.workorder_ids.filtered( lambda ac: ac.routing_type == 'CNC加工' and ac.state not in ['progress', 'done', 'rework' - 'cancel'] and ac.processing_panel == panel) + 'cancel'] and ac.processing_panel == panel) if cnc_workorder: # program_path_tmp_panel = os.path.join('C://Users//43484//Desktop//fsdownload//test', # panel) @@ -91,7 +91,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): cnc_workorder.write({'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())}) pre_workorder = productions.workorder_ids.filtered( lambda ap: ap.routing_type == '装夹预调' and ap.state not in ['done', 'rework' - 'cancel'] and ap.processing_panel == panel) + 'cancel'] and ap.processing_panel == panel) if pre_workorder: pre_workorder.write( {'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())}) @@ -100,7 +100,8 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): # 更新编程记录 for production in productions: - record_ids_obj = production.programming_record_ids.filtered(lambda r: r.current_programming_count == ret['reprogramming_num']) + record_ids_obj = production.programming_record_ids.filtered( + lambda r: r.current_programming_count == ret['reprogramming_num']) if record_ids_obj: record_ids_obj.write({'send_time': ret['send_time']}) if ret['reprogramming_num'] == 0: @@ -130,12 +131,15 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): 'production_ids': productions.ids }) - # 对制造订单所以面的cnc工单的程序用刀进行校验 + # 对制造订单所有面的cnc工单的程序用刀进行校验 try: logging.info(f'已更新制造订单:{productions}') - productions.production_cnc_tool_checkout() + re_tool_chekout = False + re_tool_chekout = productions.production_cnc_tool_checkout() + if re_tool_chekout: + return json.JSONEncoder().encode({'status': -2, 'message': '对cnc工单的程序用刀进行校验失败'}) except Exception as e: - res = {'status': -2, 'message': '对cnc工单的程序用刀进行校验失败'} + # res = {'status': -2, 'message': '对cnc工单的程序用刀进行校验失败'} logging.info(f'对cnc工单的程序用刀进行校验报错:{e}') return json.JSONEncoder().encode(res) diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py index 89d37e81..90382e11 100644 --- a/sf_tool_management/models/mrp_workorder.py +++ b/sf_tool_management/models/mrp_workorder.py @@ -203,6 +203,7 @@ class MrpProduction(models.Model): self.write({'programming_state': '编程中', 'work_state': '编程中'}) self[0].workorder_ids.filtered( lambda a: a.name == '装夹预调' and a.state not in ['rework', 'done', 'cancel'])._compute_state() + return True if missing_tool_1: logging.info(f'线边、机内缺刀:{missing_tool_1}') # 修改 修改cnc程序的‘刀具状态’ 为 ‘缺刀’