From dadd2e03da6731739cb166a593fe4ce9ec092382 Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Fri, 18 Nov 2022 18:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=BE=97cnc=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_route_workcenter/models/workcenter.py | 36 ++++++++---------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/sf_route_workcenter/models/workcenter.py b/sf_route_workcenter/models/workcenter.py index 261ebedd..bc9a9bf8 100644 --- a/sf_route_workcenter/models/workcenter.py +++ b/sf_route_workcenter/models/workcenter.py @@ -188,8 +188,8 @@ class MrpWorkOrder(models.Model): }) else: raise ValidationError('该托盘编码已失效') - else:return "" - + else: + return "" # 解除托盘绑定 def unbindtray(self): @@ -250,28 +250,16 @@ class MrpWorkOrder(models.Model): # cnc程序获取 def fetchCNC(self): - cnc_process = self.env['mrp.workorder'].search( - [("routing_type", '=', 'CNC加工'), - ("production_id", '=', self.production_id.id)], - limit=1, - order='id asc' - ) - vals = { - 'model_long': cnc_process.product_id.model_long, - 'model_width': cnc_process.product_id.model_width, - 'model_height': cnc_process.product_id.model_height, - 'model_volume': cnc_process.product_id.model_volume, - 'model_price': cnc_process.product_id.model_price, - 'model_total_amount': cnc_process.product_id.model_total_amount, - 'model_materials_code': cnc_process.product_id.materials_id.materials_no, - 'model_materials_type_code': cnc_process.product_id.materials_type_id.materials_no, - 'model_surface_process_code': cnc_process.product_id.model_surface_process_id.process_encode, - 'model_process_parameters_code': cnc_process.product_id.model_process_parameters_id.process_encode, - 'model_remark': cnc_process.product_id.model_remark - } - res = [{'order_no': self.product_id.barcode, 'production_no': self.production_id.name, - 'intelligent_programming_str': vals, - 'machine_tool_code': cnc_process.workcenter_id.machine_tool_id.code}] + res = {'model_code': self.product_id.barcode, 'production_no': self.production_id.name, + 'machine_tool_code': self.workcenter_id.machine_tool_id.code, + 'material_code': self.env['mrs.production.materials'].search( + [('id', '=', self.product_id.materials_id.id)]).materials_no, + 'material_type_code': self.env['mrs.materials.model'].search( + [('id', '=', self.product_id.materials_type_id.id)]).materials_no, + 'embryo_long': self.product_id.bom_ids.bom_line_ids.product_id.long, + 'embryo_height': self.product_id.bom_ids.bom_line_ids.product_id.height, + 'embryo_width': self.product_id.bom_ids.bom_line_ids.product_id.width + } configsettings = self.env['res.config.settings'].get_values() token = configsettings['token'] mrs_secret_key = configsettings['mrs_secret_key']