From 1505c565132a563d2c8ed773ac0b627afce040de Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 20 Mar 2023 15:06:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=89=A7=E8=A1=8C=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E5=90=88=E5=B9=B6=E4=B8=8B=E5=8F=91=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/SfWorkOrderBarcodes.xml | 9 ++- sf_manufacturing/models/mrp_workorder.py | 61 +++++++++++++------ 2 files changed, 51 insertions(+), 19 deletions(-) diff --git a/sf_machine_connect/views/SfWorkOrderBarcodes.xml b/sf_machine_connect/views/SfWorkOrderBarcodes.xml index 5507f707..fbdbc43c 100644 --- a/sf_machine_connect/views/SfWorkOrderBarcodes.xml +++ b/sf_machine_connect/views/SfWorkOrderBarcodes.xml @@ -3,13 +3,18 @@ sf.install.the.tray.workorder.form.scan.barcode mrp.workorder + + + + + + - + - \ No newline at end of file diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 82e228a4..79bb8cad 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -561,21 +561,48 @@ class SfWorkOrderBarcodes(models.Model): def on_barcode_scanned(self, barcode): workorder = self.env['mrp.workorder'].browse(self.ids) if "*" not in barcode: - tray_code = self.env['sf.tray'].search([('code', '=', barcode)]) - self.tray_code = tray_code.code - self.tray_id = workorder.gettray_auto(barcode) + if self.routing_type == '装夹': + tray_code = self.env['sf.tray'].search([('code', '=', barcode)]) + self.tray_code = tray_code.code + self.tray_id = workorder.gettray_auto(barcode) + elif self.routing_type == '前置三元定位检测': + print('我是前置三元检测') + logging.info('我是前置三元检测') + elif self.routing_type == 'CNC加工': + if barcode == 'UP-ALL': + print("我是一键合并下发") + logging.info('我是一键合并下发') + self.up_merge_all() + else: + print('CNC加工') + # print(barcode) + # a = self.env['sf.tray'].search([('code', '=', barcode)]) + # print(a) + # # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)], limit=1) + # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)]) + # e = workorder_obj.id + # print(workorder_obj) + # action = { + # 'name': '工单', + # 'type': 'ir.actions.act_window', + # # 'view_type': 'form', + # 'view_mode': 'form', + # 'res_model': 'mrp.workorder', + # 'view_id': self.env.ref('mrp.mrp_production_workorder_form_view_inherit').id, + # # 'res_id': workorder_obj.id, + # 'res_id': 1023, + # 'target': 'current', + # # 'context': self.env.context, + # # 'flags': {'initial_mode': 'edit'}, + # } + # return action + + elif self.routing_type == '后置三元质量检测': + print('后置三元检测') + elif self.routing_type == '解除装夹': + print("我是解除装夹") + else: + pass + else: - self.pro_code_ok = workorder.pro_code_is_ok(barcode) - - - - # return { - # 'type': 'ir.actions.act_window', - # 'name': '工单', - # 'res_model': 'mrp.workorder', - # 'view_mode': 'form', - # 'context': {'active_id': self.id}, - # # 'target': 'current', - # } - - + self.pro_code_ok = workorder.pro_code_is_ok(barcode) \ No newline at end of file