From 186dca46180e0fef8bd107b188ee599777f7a395 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Mon, 13 Jan 2025 15:07:08 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=8F=96=E6=B6=88=E8=B4=A8=E9=87=8F?=
=?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=A1=B5=E9=9D=A2=E6=A0=B9=E6=8D=AE=E6=8C=87?=
=?UTF-8?q?=E4=BB=A4=E6=A3=80=E6=9F=A5=E8=87=AA=E5=8A=A8=E7=AD=9B=E9=80=89?=
=?UTF-8?q?=EF=BC=9B2=E3=80=81=E4=BF=AE=E6=94=B9=E9=80=81=E6=A3=80?=
=?UTF-8?q?=E6=8C=89=E9=92=AE=E9=9A=90=E8=97=8F=E6=9D=A1=E4=BB=B6=EF=BC=9B?=
=?UTF-8?q?3=E3=80=81=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95=E5=90=8E?=
=?UTF-8?q?=E7=BD=AE=E4=B8=89=E5=85=83=E6=A3=80=E6=B5=8Bpage=E9=A1=B5?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=B6=EF=BC=8C=E6=A3=80=E6=B5=8B=E7=BB=93?=
=?UTF-8?q?=E6=9E=9C=E9=80=89=E6=8B=A9=E8=BF=94=E5=B7=A5=E6=97=B6=E5=88=B6?=
=?UTF-8?q?=E9=80=A0=E8=AE=A2=E5=8D=95=E6=B2=A1=E6=9C=89=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E6=A3=80=E6=B5=8B=E7=BB=93=E6=9E=9C=E8=AE=B0=E5=BD=95=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
quality_mrp_workorder/views/quality_views.xml | 3 ---
sf_manufacturing/models/mrp_production.py | 7 ++++++-
sf_manufacturing/models/mrp_workorder.py | 13 +++++++------
sf_manufacturing/views/mrp_workorder_view.xml | 5 +++--
sf_manufacturing/wizard/rework_wizard.py | 7 ++++++-
5 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/quality_mrp_workorder/views/quality_views.xml b/quality_mrp_workorder/views/quality_views.xml
index ce592e0b..09cc66fe 100644
--- a/quality_mrp_workorder/views/quality_views.xml
+++ b/quality_mrp_workorder/views/quality_views.xml
@@ -140,7 +140,4 @@
-
- {'search_default_quality_checks': 1}
-
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 9bc9d3cf..aab1389d 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -1597,7 +1597,12 @@ class sf_detection_result(models.Model):
processing_panel = fields.Char('加工面')
routing_type = fields.Selection([
('装夹预调', '装夹预调'),
- ('CNC加工', 'CNC加工')], string="工序类型")
+ ('CNC加工', 'CNC加工'),
+ ('解除装夹', '解除装夹'),
+ ('切割', '切割'),
+ ('表面工艺', '表面工艺'),
+ ('线切割', '线切割'),
+ ('人工线下加工', '人工线下加工')], string="工序类型")
rework_reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 63e049cd..4d789256 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -1254,7 +1254,7 @@ class ResMrpWorkOrder(models.Model):
record.production_id.process_state = '待加工'
# 生成工件配送单
record.workpiece_delivery_ids = record._json_workpiece_delivery_list()
- if record.routing_type == 'CNC加工':
+ if record.routing_type == 'CNC加工' or record.individuation_page_PTD is True:
record.process_state = '待解除装夹'
# record.write({'process_state': '待加工'})
record.production_id.process_state = '待解除装夹'
@@ -1345,17 +1345,18 @@ class ResMrpWorkOrder(models.Model):
# record.production_id.state = 'done'
# ============工单完成,修改对应[质检单]的值=====================
- if record.check_ids:
+ if record.check_ids.filtered(lambda qc: qc.quality_state in ('waiting', 'none')):
+ check_ids = record.check_ids.filtered(lambda qc: qc.quality_state in ('waiting', 'none'))
if record.test_results == '合格':
- record.check_ids.write({'test_results': None})
- for check_id in record.check_ids:
+ check_ids.write({'test_results': None})
+ for check_id in check_ids:
check_id.do_pass()
elif record.test_results in ('返工', '报废'):
- record.check_ids.write({
+ check_ids.write({
'test_results': record.test_results,
'reason': record.reason,
'detailed_reason': record.detailed_reason})
- for check_id in record.check_ids:
+ for check_id in check_ids:
check_id.do_fail()
# ======================================================
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index 18164796..ad2e7fe4 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -187,7 +187,7 @@
context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>
+ attrs="{'invisible': ['|', '|', ('state', 'not in', ('progress')), ('is_inspect', '=', False), ('routing_type','=','CNC加工')]}"/>
@@ -529,7 +529,8 @@
+ attrs='{"readonly":[("state","!=","to be detected"), "|",("routing_type","=","CNC加工"),("is_inspect", "=", True)],
+ "invisible":[("results","!=",False)]}'/>
diff --git a/sf_manufacturing/wizard/rework_wizard.py b/sf_manufacturing/wizard/rework_wizard.py
index 148967be..8e8ec7bc 100644
--- a/sf_manufacturing/wizard/rework_wizard.py
+++ b/sf_manufacturing/wizard/rework_wizard.py
@@ -24,7 +24,12 @@ class ReworkWizard(models.TransientModel):
detailed_reason = fields.Text('详细原因')
routing_type = fields.Selection([
('装夹预调', '装夹预调'),
- ('CNC加工', 'CNC加工')], string="工序类型")
+ ('CNC加工', 'CNC加工'),
+ ('解除装夹', '解除装夹'),
+ ('切割', '切割'),
+ ('表面工艺', '表面工艺'),
+ ('线切割', '线切割'),
+ ('人工线下加工', '人工线下加工')], string="工序类型")
# 根据工单的加工面来显示
processing_panel_id = fields.Many2many('sf.processing.panel', string="加工面")
is_reprogramming = fields.Boolean(string='申请重新编程', default=False)