From fddc8100d604f1e74911263cb17f11ad8269047a Mon Sep 17 00:00:00 2001 From: gqh Date: Wed, 8 Mar 2023 17:15:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E8=BF=94=E5=B7=A5=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=BE=85=E6=8E=92=E5=BA=8F=EF=BC=88=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=B0=B1=E7=BB=AA=E7=8A=B6=E6=80=81=E8=BF=98=E6=B2=A1=E5=AE=8C?= =?UTF-8?q?=E6=88=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 23 ++++++++++++++++------- sf_manufacturing/models/mrp_workorder.py | 6 +++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index b6e7f3e5..ebcee7bf 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -164,14 +164,20 @@ class MrpProduction(models.Model): #工单排序 def _reset_work_order_sequence1(self, k): + sequen = 0 for rec in self: - current_sequence = 1 + current_sequence = 10 for work in rec.workorder_ids: work.sequence = current_sequence - current_sequence += 1 - sfa = rec - for a in sfa: - print(a) + current_sequence += 10 + if work.name == '后置三元质量检测' and work.processing_panel == k: + sequen = work.sequence + + for work in rec.workorder_ids: + if work.name == '后置三元质量检测(返工)' and work.processing_panel == k: + work.sequence = sequen + 2 + if work.name == 'CNC加工(返工)' and work.processing_panel == k: + work.sequence = sequen + 1 #在制造订单上新增工单 def _create_workorder1(self, k): @@ -211,6 +217,7 @@ class MrpProduction(models.Model): order='sequence asc' ) i += 1 + for route in routingworkcenter: if route.routing_type == '后置三元质量检测': @@ -222,8 +229,10 @@ class MrpProduction(models.Model): self.env['mrp.workorder'].json_workorder_str1(k, production, route)) production.workorder_ids = workorders_values - for workorder in production.workorder_ids: - workorder.duration_expected = workorder._get_duration_expected() + workorder = self.env['mrp.workorder'].browse(production.workorder_ids.ids) + print(workorder) + # for item in workorder: + # workorder.duration_expected = workorder._get_duration_expected() def _create_workorder2(self, k): res = self._create_workorder1(k) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 658e5d26..bbdf752d 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -313,8 +313,8 @@ class ResMrpWorkOrder(models.Model): subtype_id=self.env.ref('mail.mt_note').id) if self.test_results == '返工': productions = self.production_id - self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) - self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) + # self.env['stock.move'].sudo().create(productions._get_moves_raw_values()) + # self.env['stock.move'].sudo().create(productions._get_moves_finished_values()) productions._create_workorder2(self.processing_panel) else: self.results = '合格' @@ -378,7 +378,7 @@ class ResMrpWorkOrder(models.Model): 'product_uom_id': production.product_uom_id.id, 'qty_producing': 0, 'operation_id': False, - 'name': route.route_workcenter_id.name, + 'name': '%s(返工)' % route.route_workcenter_id.name, 'processing_panel': k, 'routing_type': route.routing_type, 'work_state': '' if not route.routing_type == '获取CNC加工程序' else '待发起',