cnc校验刀无效刀创建检测结果时先检测是否已经存在待处理记录

This commit is contained in:
yuxianghui
2024-09-27 13:32:55 +08:00
parent 4d63b90373
commit 664ac8128a

View File

@@ -95,6 +95,10 @@ class CNCprocessing(models.Model):
# tool_state_remark1 = f'{key}无效刀:{data1.get(key)}'
# 无效刀处理逻辑
# 1、创建制造订单无效刀检测结果记录
if not production_id.detection_result_ids.filtered(
lambda a: (a.processing_panel == key and a.detailed_reason == '无效功能刀具'
and a.handle_result == '待处理' and a.routing_type == 'CNC加工'
and a.rework_reason == 'programming' and a.test_results == '返工')):
logging.info('创建制造订单无效刀检测结果记录!')
production_id.detection_result_ids.create({
'production_id': production_id.id,