From 1245323b9db4ac39ffaaf805365225fa3c74a064 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Thu, 17 Oct 2024 14:22:09 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BC=96=E7=A8=8B=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B9=8B=E5=90=8E=E8=BF=9B=E8=A1=8C=E7=94=A8?= =?UTF-8?q?=E5=88=80=E6=A0=A1=E9=AA=8C=EF=BC=9B2=E3=80=81=E5=A4=84?= =?UTF-8?q?=E7=90=86=20=20=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98-=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85=E7=BC=BA=E5=B0=91=E3=80=90=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=B7=9F=E8=B8=AA=E3=80=91tab=EF=BC=9B3=E3=80=81?= =?UTF-8?q?=E7=94=A8=E5=88=80=E6=A0=A1=E9=AA=8C=E6=96=B9=E6=B3=95=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 7 +++++++ sf_manufacturing/views/mrp_workorder_view.xml | 6 ++++++ sf_mrs_connect/controllers/controllers.py | 1 + sf_tool_management/models/mrp_workorder.py | 7 ++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index da54f77b..a010d2f7 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -960,6 +960,13 @@ 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}') + # 从cloud获取重新编程过的最新程序 def get_new_program(self, processing_panel): try: diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index ef95a934..1398dc8a 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -584,6 +584,12 @@ position="after"> + + + mrp.group_mrp_manager,sf_base.group_sf_mrp_manager,sf_base.group_sf_equipment_user,sf_base.group_sf_order_user + + + diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 35a7d3a3..39b4ad8a 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -104,6 +104,7 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController): # 对制造订单所以面的cnc工单的程序用刀进行校验 try: + logging.info(f'已更新制造订单:{productions}') productions.production_cnc_tool_checkout() except Exception as e: logging.info(f'对cnc工单的程序用刀进行校验报错:{e}') diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py index 71a6282e..6fbd6f18 100644 --- a/sf_tool_management/models/mrp_workorder.py +++ b/sf_tool_management/models/mrp_workorder.py @@ -170,6 +170,7 @@ class MrpProduction(models.Model): # 修改cnc程序的‘刀具状态’ workorder_ids = self.env['mrp.workorder'].sudo().search([('production_id', 'in', self.ids)]) if invalid_tool: + logging.info(f'无效刀:{invalid_tool}') # 修改cnc程序的‘刀具状态’为 ‘无效刀’ cnc_ids = self.env['sf.cnc.processing'].sudo().search( [('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', invalid_tool)]) @@ -198,12 +199,14 @@ class MrpProduction(models.Model): # 修改制造订单 编程状态变为“编程中” 制造订单状态为‘返工’ self.write({'programming_state': '编程中', 'work_state': '编程中', 'state': 'rework'}) if missing_tool_1: + logging.info(f'线边、机内缺刀:{missing_tool_1}') # 修改 修改cnc程序的‘刀具状态’ 为 ‘缺刀’ cnc_ids = self.env['sf.cnc.processing'].sudo().search( [('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', missing_tool_1)]) if cnc_ids: cnc_ids.write({'tool_state': '1'}) - if missing_tool_2 and not invalid_tool: + if missing_tool_2 and invalid_tool != []: + logging.info(f'库存缺刀:{missing_tool_2}') # 调用CAM工单程序用刀计划创建方法 cnc_ids = self.env['sf.cnc.processing'].sudo().search( [('workorder_id', 'in', workorder_ids.filtered(lambda a: a.production_id == self[0].id).ids), @@ -211,4 +214,6 @@ class MrpProduction(models.Model): if cnc_ids: logging.info('调用CAM工单程序用刀计划创建方法!!!') self.env['sf.cam.work.order.program.knife.plan'].sudo().create_cam_work_plan(cnc_ids) + if not invalid_tool and not missing_tool_1: + logging.info('校验cnc用刀正常!!!') logging.info('工单cnc程序用刀校验完成!!!')