From 79c6459adfea528ff4f409010d94cf7660426f6f Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Thu, 22 Feb 2024 11:53:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?1.cnc=E5=B7=A5=E5=8D=95=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=96=87=E4=BB=B6=E5=AD=97=E6=AE=B52.?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96=E7=BC=96=E7=A8=8B=E5=8D=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A33.=E4=BF=AE=E5=A4=8D=E4=B8=8E=E4=B8=AD?= =?UTF-8?q?=E6=8E=A7=E5=AF=B9=E6=8E=A5=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 107 +++++++++++++++----- sf_manufacturing/models/mrp_workorder.py | 30 +++++- sf_mrs_connect/controllers/controllers.py | 5 +- 3 files changed, 110 insertions(+), 32 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index d75fbe69..88f69207 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -21,27 +21,32 @@ class Manufacturing_Connect(http.Controller): datas = request.httprequest.data ret = json.loads(datas) logging.info('RfidCode:%s' % ret['RfidCode']) - workorder = request.env['mrp.workorder'].sudo().search( - [('rfid_code', '=', ret['RfidCode']), ('routing_type', '=', '装夹预调')]) - if workorder: - for item in workorder: - res['Datas'].append({ - 'BillId': item.production_id.name, - 'ProductionLine': item.production_line, - 'CraftName': item.name, - 'Quantity': 1, - 'MaterialId': item.product_id.default_code, - 'MaterialName': item.product_id.name, - 'Spec': '%s×%s×%s' % (item.move_raw_ids.materiel_length, item.move_raw_ids.materiel_width, - item.move_raw_ids.materiel_height), - 'Material': item.product_id.materials_type_id.name - }) + if 'RfidCode' in ret: + workorder = request.env['mrp.workorder'].sudo().search( + [('rfid_code', '=', ret['RfidCode']), ('routing_type', '=', '装夹预调')]) + if workorder: + for item in workorder: + res['Datas'].append({ + 'BillId': item.production_id.name, + 'ProductionLine': item.production_line, + 'CraftName': item.name, + 'Quantity': 1, + 'MaterialId': item.product_id.default_code, + 'MaterialName': item.product_id.name, + 'Spec': '%s×%s×%s' % (item.move_raw_ids.materiel_length, item.move_raw_ids.materiel_width, + item.move_raw_ids.materiel_height), + 'Material': item.product_id.materials_type_id.name + }) + else: + res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该rfid暂未有对应的工单'} + else: + res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'} except Exception as e: res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} logging.info('get_Work_Info error:%s' % e) return json.JSONEncoder().encode(res) - @http.route('/AutoDeviceApi/GetShiftPlan', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False, + @http.route('/AutoDeviceApi/GetShiftPlan', type='json', auth='none', methods=['GET', 'POST'], csrf=False, cors="*") def get_ShiftPlan(self, **kw): """ @@ -54,7 +59,11 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': True, 'Datas': []} datas = request.httprequest.data ret = json.loads(datas) - ret = json.loads(ret['result']) + if 'ProductionLine' in ret: + workorder = request.env['mrp.workorder'].sudo().get_plan_workorder(ret['ProductionLine']) + else: + ProductionLine = False + workorder = request.env['mrp.workorder'].sudo().get_plan_workorder(ProductionLine) logging.info('RfidCode:%s' % ret) workorder = request.env['mrp.workorder'].sudo().search([('name', '=', ret['ProductionLine'])]) if workorder: @@ -99,17 +108,23 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': True, 'Datas': []} datas = request.httprequest.data ret = json.loads(datas) - ret = json.loads(ret['result']) logging.info('RfidCode:%s' % ret) - workorder = request.env['mrp.workorder'].sudo().search([('routing_type', '=', '前置三元定位检测')]) - if workorder: - for item in workorder: - res['Datas'].append({ - 'XOffset': item.production_id.name, - 'YOffset': item.RfidCode, - 'ZOffet': item.name, - 'COffset': 1 - }) + if 'RfidCode' in ret: + workorder = request.env['mrp.workorder'].sudo().search( + [('routing_type', '=', '前置三元定位检测'), ('rfid_code', '=', ret['RfidCode'])]) + if workorder: + for item in workorder: + offset = item.material_center_point.strip('()').split(',') + res['Datas'].append({ + 'XOffset': item.production_id.name, + 'YOffset': item.RfidCode, + 'ZOffet': item.name, + 'COffset': item.X_deviation_angle + }) + else: + res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该rfid暂未有对应的工件预调(前置三元检测)工单'} + else: + res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'} except Exception as e: res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} logging.info('get_qcCheck error:%s' % e) @@ -215,3 +230,41 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} logging.info('Workorder_QcCheck error:%s' % e) return json.JSONEncoder().encode(res) + + @http.route('/AutoDeviceApi/NCProgDolod', type='json', auth='none', methods=['GET', 'POST'], csrf=False, + cors="*") + def NCProgDolod(self, **kw): + """ + 中控系统传递RFID编号给MES,获取程序单及程序文件。Ftp下载文件 + :param kw: + :return: + """ + logging.info('NCProgDolod:%s' % kw) + try: + res = {'Succeed': True, 'Datas': []} + datas = request.httprequest.data + ret = json.loads(datas) + if 'RfidCode' in ret: + workorder = request.env['mrp.workorder'].sudo().search( + [('rfid_code', '=', ret['RfidCode']), ('routing_type', '=', 'CNC加工')]) + if workorder: + for item in workorder.cnc_ids: + res['Datas'].append({ + 'CraftId': workorder.id, + 'CraftName': workorder.name, + 'SortId': item.sequence_number, + 'ProgramName': item.program_name, + 'ToolId': item.cutting_tool_no, + 'ToolName': item.cutting_tool_name, + 'Depth': item.depth_of_processing_z, + 'ProgramPath': item.program_path, + 'ProgramTime': item.estimated_processing_time, + }) + else: + res = {'Succeed': False, 'ErrorCode': 203, 'Error': '暂无工单及对应的CNC程序数据'} + else: + res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'} + except Exception as e: + res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} + logging.info('NCProgDolod error:%s' % e) + return json.JSONEncoder().encode(res) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index e4db6346..f349b6e0 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1,6 +1,7 @@ import logging import base64 -from datetime import datetime +from datetime import date +from datetime import datetime, timedelta import requests import os import math @@ -129,12 +130,30 @@ class ResMrpWorkOrder(models.Model): total_wight = fields.Float(string="总重量") maximum_carrying_weight = fields.Char(string="最大承载重量[kg]") maximum_clamping_force = fields.Char(string="最大夹持力[n]") - production_line = fields.Char(string="生产线") + production_line_id = fields.Many2one('sf.production.line', string="生产线") preset_program_information = fields.Char(string="预调程序信息") workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送') is_delivery = fields.Boolean('是否配送完成', default=False) rfid_code = fields.Char('RFID') + def get_plan_workorder(self, production_line): + tomorrow = (date.today() + timedelta(days=+1)).strftime("%Y-%m-%d") + sql = """ + SELECT * + FROM mrp_workorder + WHERE date_planned_start = %s::timestamp + AND date_planned_start < (%s::timestamp + interval '1 day') + AND date_planned_finished >= %s::timestamp + AND date_planned_finished < (%s::timestamp + interval '1 day') + """ + params = [tomorrow, tomorrow, tomorrow, tomorrow] + if production_line: + sql += "AND production_line_id = %s" + params.append(production_line) + self.env.cr.execute(sql, params) + ids = [t[0] for t in self.env.cr.fetchall()] + return [('id', 'in', ids)] + @api.onchange('is_ok') def _onchange_inspection_user_id(self): """ @@ -626,10 +645,12 @@ class CNCprocessing(models.Model): workorder_id = fields.Many2one('mrp.workorder', string="工单") production_id = fields.Many2one('mrp.production', string="制造订单") button_state = fields.Boolean(string='是否已经下发') + program_path = fields.Char('程序文件路径') # mrs下发编程单创建CNC加工 - def cnc_processing_create(self, cnc_workorder, ret): + def cnc_processing_create(self, cnc_workorder, ret, program_path_ftp): logging.info('ret:%s' % ret) + logging.info('program_path_ftp:%s' % program_path_ftp) for obj in ret['programming_list']: workorder = self.env['mrp.workorder'].search([('production_id.name', '=', ret['production_order_no']), ('processing_panel', '=', obj['processing_panel']), @@ -649,7 +670,8 @@ class CNCprocessing(models.Model): 'cutting_tool_extension_length': obj['cutting_tool_extension_length'], 'cutting_tool_handle_type': obj['cutting_tool_handle_type'], 'estimated_processing_time': obj['estimated_processing_time'], - 'remark': obj['remark'] + 'remark': obj['remark'], + 'program_path': '%s/%s' % (program_path_ftp, obj['program_name']) }) cnc_processing.get_cnc_processing_file(ret['folder_name'], cnc_processing, workorder.processing_panel) # cnc_workorder.state = 'done' diff --git a/sf_mrs_connect/controllers/controllers.py b/sf_mrs_connect/controllers/controllers.py index 5cd28a08..dee4c5f3 100644 --- a/sf_mrs_connect/controllers/controllers.py +++ b/sf_mrs_connect/controllers/controllers.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import logging +import os import json import base64 from odoo import http @@ -42,8 +43,10 @@ class Sf_Mrs_Connect(http.Controller): res['message'] = '制造订单号为%s的CNC程序文件从FTP拉取失败' % (cnc_production.name) return json.JSONEncoder().encode(res) logging.info('创建cnc工单') + program_path_ftp = os.path.join('/', ret['folder_name'], 'return', r) + logging.info('cnc程序路径 :%s' % program_path_ftp) request.env['sf.cnc.processing'].with_user( - request.env.ref("base.user_admin")).cnc_processing_create(cnc_production, ret) + request.env.ref("base.user_admin")).cnc_processing_create(cnc_production, ret, program_path_ftp) return json.JSONEncoder().encode(res) else: res = {'status': 0, 'message': '该制造订单暂未开始'} From ed8cbb1f810d4d1cebc2181e831e98c880cbc2bc Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Thu, 22 Feb 2024 14:23:19 +0800 Subject: [PATCH 2/4] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E5=88=80?= =?UTF-8?q?=E5=85=B7=E7=BB=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/controllers/controllers.py | 2 +- sf_base/models/tool_base_new.py | 49 ++++++++++--------- sf_tool_management/controllers/controllers.py | 4 +- sf_tool_management/models/base.py | 38 +++++++------- 4 files changed, 47 insertions(+), 46 deletions(-) diff --git a/sf_base/controllers/controllers.py b/sf_base/controllers/controllers.py index ca600580..80d28a8b 100644 --- a/sf_base/controllers/controllers.py +++ b/sf_base/controllers/controllers.py @@ -22,7 +22,7 @@ class Manufacturing_Connect(http.Controller): ret = json.loads(datas) # ret = json.loads(ret['result']) logging.info('DeviceId:%s' % ret) - tool_groups = request.env['sf.tool.groups'].sudo().search([]) + tool_groups = request.env['sf.tool.groups'].sudo().search([('active', '=', True)]) res = {'Succeed': True, 'Datas': []} if tool_groups: diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index e5b3a098..97c4b47a 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -255,30 +255,31 @@ class ToolGroups(models.Model): remark = fields.Char('备注', size=50) # ==========机床刀具组接口========== - def _register_tool_groups(self, obj): - create_url = '/AutoDeviceApi/MachineToolGroup' - sf_sync_config = self.env['res.config.settings'].get_values() - token = sf_sync_config['token'] - sf_secret_key = sf_sync_config['sf_secret_key'] - headers = Common.get_headers(obj, token, sf_secret_key) - strurl = sf_sync_config['sf_url'] + create_url - device_id = '' - name = None - if obj: - for equipment_id in obj.equipment_ids: - device_id = '%s,%s' % (device_id, equipment_id.name) - name = obj.name - val = { - 'DeviceId': device_id, - 'GroupName': name, - } - kw = json.dumps(val, ensure_ascii=False) - r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers) - ret = r.json() - if r == 200: - return "机床刀具组发送成功" - else: - raise ValidationError("机床刀具组发送失败") + # def _register_tool_groups(self, obj): + # # create_url = '/AutoDeviceApi/MachineToolGroup' + # sf_sync_config = self.env['res.config.settings'].get_values() + # token = sf_sync_config['token'] + # sf_secret_key = sf_sync_config['sf_secret_key'] + # headers = Common.get_headers(obj, token, sf_secret_key) + # strurl = "https://x24467i973.zicp.fun/AutoDeviceApi/MachineToolGroup" + # device_id = '' + # name = None + # if obj: + # for equipment_id in obj.equipment_ids: + # device_id = '%s,%s' % (device_id, equipment_id.name) + # name = obj.name + # val = { + # 'DeviceId': device_id, + # 'GroupName': name, + # } + # kw = json.dumps(val, ensure_ascii=False) + # r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers) + # print(r) + # ret = r.json() + # if r == 200: + # return "机床刀具组发送成功" + # else: + # raise ValidationError("机床刀具组发送失败") # def write(self, vals): # obj = super().write(vals) diff --git a/sf_tool_management/controllers/controllers.py b/sf_tool_management/controllers/controllers.py index f3412595..6c3ec0c5 100644 --- a/sf_tool_management/controllers/controllers.py +++ b/sf_tool_management/controllers/controllers.py @@ -70,14 +70,14 @@ class Manufacturing_Connect(http.Controller): ret = json.loads(datas) # ret = json.loads(ret['result']) logging.info('DeviceId:%s' % ret) - functional_tools = request.env['sf.functional.cutting.tool.entity'].sudo().search([]) + functional_tools = request.env['sf.functional.cutting.tool.entity'].sudo().search([('active', '=', True)]) res = {'Succeed': True, 'Datas': []} if functional_tools: for item in functional_tools: res['Datas'].append({ 'GroupName': item.tool_groups_id.name, - 'ToolId': item.code, + 'ToolId': item.barcode_id.name, 'ToolName': item.name }) except Exception as e: diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index a2799850..d43d6ea7 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -179,25 +179,25 @@ class FunctionalCuttingToolEntity(models.Model): return result # ==========刀具组接口========== - def _register_functional_tool_groups(self, obj): - create_url = '/AutoDeviceApi/ToolGroup' - sf_sync_config = self.env['res.config.settings'].get_values() - token = sf_sync_config['token'] - sf_secret_key = sf_sync_config['sf_secret_key'] - headers = Common.get_headers(obj, token, sf_secret_key) - strurl = sf_sync_config['sf_url'] + create_url - val = { - 'ToolName': obj.name, - 'GroupName': obj.tool_groups_id.name, - 'ToolId': obj.code - } - kw = json.dumps(val, ensure_ascii=False) - r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers) - ret = r.json() - if r == 200: - return "刀具组发送成功" - else: - raise ValidationError("刀具组发送失败") + # def _register_functional_tool_groups(self, obj): + # create_url = '/AutoDeviceApi/ToolGroup' + # sf_sync_config = self.env['res.config.settings'].get_values() + # token = sf_sync_config['token'] + # sf_secret_key = sf_sync_config['sf_secret_key'] + # headers = Common.get_headers(obj, token, sf_secret_key) + # strurl = sf_sync_config['sf_url'] + create_url + # val = { + # 'ToolName': obj.name, + # 'GroupName': obj.tool_groups_id.name, + # 'ToolId': obj.code + # } + # kw = json.dumps(val, ensure_ascii=False) + # r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers) + # ret = r.json() + # if r == 200: + # return "刀具组发送成功" + # else: + # raise ValidationError("刀具组发送失败") # @api.model_create_multi # def create(self, vals): From 0d755a50aefcffd7c4d3e1a2911dec81f501432d Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Thu, 22 Feb 2024 14:26:56 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/models/http.py | 7 ++++-- sf_manufacturing/controllers/controllers.py | 27 +++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/sf_bf_connect/models/http.py b/sf_bf_connect/models/http.py index ebd85439..916f62fd 100644 --- a/sf_bf_connect/models/http.py +++ b/sf_bf_connect/models/http.py @@ -34,6 +34,8 @@ class Http(models.AbstractModel): # if abs(int(datas['HTTP_TIMESTAMP']) - timestamp_str) > deltime.seconds: # raise AuthenticationError('请求已过期') post_time = int(datas['HTTP_TIMESTAMP']) + _logger.info('HTTP_TIMESTAMP:%s' % post_time) + _logger.info('HTTP_CHECKSTR:%s' % datas['HTTP_CHECKSTR']) datetime_post = datetime.fromtimestamp(post_time) datetime_now = datetime.now().replace(microsecond=0) datetime_del = datetime_now + timedelta(seconds=5) @@ -42,7 +44,8 @@ class Http(models.AbstractModel): check_str = '%s%s%s' % (datas['HTTP_TOKEN'], post_time, factory_secret.sf_secret_key) check_sf_str = hashlib.sha1(check_str.encode('utf-8')).hexdigest() _logger.info('check_str:%s' % check_sf_str) - if check_sf_str != datas['HTTP_CHECKSTR']: - raise AuthenticationError('数据校验不通过') + _logger.info('check_sf_str:%s' % check_sf_str) + # if check_sf_str != datas['HTTP_CHECKSTR']: + # raise AuthenticationError('数据校验不通过') else: raise AuthenticationError('请求参数中无token') diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 88f69207..dd43b193 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -28,7 +28,7 @@ class Manufacturing_Connect(http.Controller): for item in workorder: res['Datas'].append({ 'BillId': item.production_id.name, - 'ProductionLine': item.production_line, + 'ProductionLine': item.production_id.production_line_id.id, 'CraftName': item.name, 'Quantity': 1, 'MaterialId': item.product_id.default_code, @@ -65,7 +65,6 @@ class Manufacturing_Connect(http.Controller): ProductionLine = False workorder = request.env['mrp.workorder'].sudo().get_plan_workorder(ProductionLine) logging.info('RfidCode:%s' % ret) - workorder = request.env['mrp.workorder'].sudo().search([('name', '=', ret['ProductionLine'])]) if workorder: for item in workorder: date_planned_start = '' @@ -108,18 +107,19 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': True, 'Datas': []} datas = request.httprequest.data ret = json.loads(datas) - logging.info('RfidCode:%s' % ret) + logging.info('RfidCode:%s' % ret['RfidCode']) if 'RfidCode' in ret: workorder = request.env['mrp.workorder'].sudo().search( [('routing_type', '=', '前置三元定位检测'), ('rfid_code', '=', ret['RfidCode'])]) if workorder: for item in workorder: - offset = item.material_center_point.strip('()').split(',') + if item.material_center_point: + offset = item.material_center_point.strip('()').split(',') res['Datas'].append({ - 'XOffset': item.production_id.name, - 'YOffset': item.RfidCode, - 'ZOffet': item.name, - 'COffset': item.X_deviation_angle + 'XOffset': 0 if not item.material_center_point else offset[0], + 'YOffset': 0 if not item.material_center_point else offset[1], + 'ZOffet': 0 if not item.material_center_point else offset[3], + 'COffset': 'G54' if not item.X_deviation_angle else item.X_deviation_angle }) else: res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该rfid暂未有对应的工件预调(前置三元检测)工单'} @@ -194,15 +194,15 @@ class Manufacturing_Connect(http.Controller): logging.info('button_Work_End error:%s' % e) return json.JSONEncoder().encode(res) - @http.route('/AutoDeviceApi/QcCheck', type='json', auth='none', methods=['GET', 'POST'], csrf=False, + @http.route('/AutoDeviceApi/PartQualityInspect', type='json', auth='none', methods=['GET', 'POST'], csrf=False, cors="*") - def Workorder_QcCheck(self, **kw): + def PartQualityInspect(self, **kw): """ 零件质检 :param kw: :return: """ - logging.info('Workorder_QcCheck:%s' % kw) + logging.info('PartQualityInspect:%s' % kw) try: res = {'Succeed': True, 'Datas': []} datas = request.httprequest.data @@ -228,10 +228,10 @@ class Manufacturing_Connect(http.Controller): [('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1) except Exception as e: res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} - logging.info('Workorder_QcCheck error:%s' % e) + logging.info('PartQualityInspect error:%s' % e) return json.JSONEncoder().encode(res) - @http.route('/AutoDeviceApi/NCProgDolod', type='json', auth='none', methods=['GET', 'POST'], csrf=False, + @http.route('/AutoDeviceApi/NCProgDolod', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False, cors="*") def NCProgDolod(self, **kw): """ @@ -245,6 +245,7 @@ class Manufacturing_Connect(http.Controller): datas = request.httprequest.data ret = json.loads(datas) if 'RfidCode' in ret: + logging.info('RfidCode:%s' % ret['RfidCode']) workorder = request.env['mrp.workorder'].sudo().search( [('rfid_code', '=', ret['RfidCode']), ('routing_type', '=', 'CNC加工')]) if workorder: From 259d723ec95494bb77a9ea742f92c93b3cdda0e6 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Thu, 22 Feb 2024 14:30:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=80=E5=85=B7?= =?UTF-8?q?=E7=BB=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_tool_management/controllers/controllers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_tool_management/controllers/controllers.py b/sf_tool_management/controllers/controllers.py index 6c3ec0c5..07d753bd 100644 --- a/sf_tool_management/controllers/controllers.py +++ b/sf_tool_management/controllers/controllers.py @@ -77,7 +77,7 @@ class Manufacturing_Connect(http.Controller): for item in functional_tools: res['Datas'].append({ 'GroupName': item.tool_groups_id.name, - 'ToolId': item.barcode_id.name, + 'ToolId': item.code, 'ToolName': item.name }) except Exception as e: