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程序用刀校验完成!!!')