From 8d5d19ec696887ae7324f6d97aba7f00fab50d9a Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Wed, 15 Jan 2025 11:25:00 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=B4=A8=E6=A3=80=E5=8D=95=E9=80=9A?=
=?UTF-8?q?=E8=BF=87=E3=80=81=E5=A4=B1=E8=B4=A5=E6=8C=89=E9=92=AE=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E5=B7=A5=E5=8D=95=E4=B8=BA=E8=BF=94=E5=B7=A5=E6=97=B6?=
=?UTF-8?q?=E9=9A=90=E8=97=8F=E6=9D=A1=E4=BB=B6=EF=BC=9B2=E3=80=81?=
=?UTF-8?q?=E5=A4=84=E7=90=86=E5=A4=B9=E5=85=B7=E5=85=A5=E5=BA=93=E5=88=B0?=
=?UTF-8?q?=E5=A4=B9=E5=85=B7=E6=88=BF=E6=97=B6=EF=BC=8C=E5=A4=B9=E5=85=B7?=
=?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=B8=AD=E5=A4=B9=E5=85=B7=E5=8F=AF=E7=94=A8?=
=?UTF-8?q?=E7=8A=B6=E6=80=81=E6=B2=A1=E6=9C=89=E5=8F=98=E6=9B=B4=E4=B8=BA?=
=?UTF-8?q?=E5=8F=AF=E7=94=A8=E9=97=AE=E9=A2=98=EF=BC=9B3=E3=80=81?=
=?UTF-8?q?=E5=A4=84=E7=90=86=E5=90=8E=E7=BD=AE=E4=B8=89=E5=85=83=E6=A3=80?=
=?UTF-8?q?=E6=B5=8B=E9=80=89=E6=8B=A9=E8=BF=94=E5=B7=A5=E5=90=8E=E5=88=B6?=
=?UTF-8?q?=E9=80=A0=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81=E6=B2=A1=E6=9C=89?=
=?UTF-8?q?=E5=8F=98=E6=9B=B4=E4=B8=BA=E8=BF=94=E5=B7=A5=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/mrp_production.py | 3 ++-
sf_manufacturing/models/mrp_workorder.py | 6 ++----
sf_quality/views/quality_check_view.xml | 4 ++--
sf_tool_management/models/maintenance_equipment.py | 4 ++++
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 84f36747..5ae8da31 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -363,7 +363,8 @@ class MrpProduction(models.Model):
# if production.state == 'pending_cam':
# if all(wo_state in 'done' for wo_state in production.workorder_ids.mapped('state')):
# production.state = 'done'
- if any((wo.test_results == '返工' and wo.state == 'done' and production.programming_state in ['已编程'])
+ if any((wo.test_results == '返工' and wo.state == 'done' and
+ (production.programming_state in ['已编程'] or wo.individuation_page_PTD is True))
or (wo.is_rework is True and wo.state == 'done' and production.programming_state in ['编程中', '已编程'])
for wo in production.workorder_ids):
production.state = 'rework'
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 09f08c0b..97a3bcdf 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -1283,12 +1283,10 @@ class ResMrpWorkOrder(models.Model):
'detailed_reason': record.detailed_reason,
'processing_panel': record.processing_panel,
'routing_type': record.routing_type,
- 'handle_result': '待处理' if record.test_results in ['返工',
- '报废'] or record.is_rework is True else '',
+ 'handle_result': '待处理' if record.test_results in ['返工', '报废'] or record.is_rework is True else '',
'test_results': record.test_results,
'test_report': record.detection_report})],
- 'is_scrap': True if record.test_results == '报废' else False,
- 'state': 'rework' if (record.routing_type != 'CNC加工' and record.test_results == '返工') else record.production_id.state
+ 'is_scrap': True if record.test_results == '报废' else False
})
if record.routing_type == '解除装夹':
'''
diff --git a/sf_quality/views/quality_check_view.xml b/sf_quality/views/quality_check_view.xml
index 48da0d37..ec5b9fa8 100644
--- a/sf_quality/views/quality_check_view.xml
+++ b/sf_quality/views/quality_check_view.xml
@@ -49,10 +49,10 @@
- {'invisible': ['|',('quality_state', '!=', 'fail'),('work_state','=', 'done')]}
+ {'invisible': ['|',('quality_state', '!=', 'fail'),('work_state','in', ('done', 'rework'))]}
- {'invisible': ['|',('quality_state', '!=', 'pass'),('work_state','=', 'done')]}
+ {'invisible': ['|',('quality_state', '!=', 'pass'),('work_state','in', ('done', 'rework'))]}
diff --git a/sf_tool_management/models/maintenance_equipment.py b/sf_tool_management/models/maintenance_equipment.py
index af9d4931..12c7f8f3 100644
--- a/sf_tool_management/models/maintenance_equipment.py
+++ b/sf_tool_management/models/maintenance_equipment.py
@@ -143,6 +143,10 @@ class StockLot(models.Model):
record.tool_material_status = '报废'
else:
record.tool_material_status = '未入库'
+ elif record.product_id.categ_id.name in ['夹具']:
+ if record.quant_ids:
+ if record.quant_ids[-1].location_id.name in ['夹具房']:
+ record.tool_material_status = '可用'
@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):