From 6e50774b23f17eb3d6dcfefcd8567cb384cf909d Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Mon, 5 Aug 2024 16:23:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9C=BA=E5=BA=8A=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=A5=E5=8F=A3=E4=BD=8D=E7=BD=AE=EF=BC=9B=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=9C=BA=E5=BA=8A=E5=93=81=E7=89=8C=E5=9E=8B=E5=8F=B7?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/controllers/controllers.py | 34 +++++++++++++++++++ sf_manufacturing/controllers/controllers.py | 33 ------------------ 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/sf_machine_connect/controllers/controllers.py b/sf_machine_connect/controllers/controllers.py index ba8139d0..b006e4b2 100644 --- a/sf_machine_connect/controllers/controllers.py +++ b/sf_machine_connect/controllers/controllers.py @@ -37,6 +37,7 @@ class Sf_Dashboard_Connect(http.Controller): res['data'].append({ 'id': machine_data.id, 'name': machine_data.name, + 'brand': machine_data.type_id.name, 'code': machine_data.code, 'status': machine_data.status, 'run_status': machine_data.run_status, @@ -96,3 +97,36 @@ class Sf_Dashboard_Connect(http.Controller): res['status'] = -1 res['message'] = '前端请求机床数据失败,原因:%s' % e return json.JSONEncoder().encode(res) + + # 返回CNC机床列表 + @http.route('/api/CNCList', type='http', auth='public', methods=['GET', 'POST'], csrf=False, + cors="*") + def CNCList(self, **kw): + """ + 获取CNC机床列表 + :param kw: + :return: + """ + + # logging.info('CNCList:%s' % kw) + try: + res = {'Succeed': True} + # cnc_list = request.env['sf.cnc.equipment'].sudo().search([]) + # cnc_list = ["XT-GNJC-WZZX-X800-Y550-Z550-T24-A5-1", "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-3", + # "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-4", "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-5", + # "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-6", "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-7", + # "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-8", "XT-GNJC-WZZX-X800-Y550-Z550-T24-A5-2", + # "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-9", "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-10", + # "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-11", "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-12", + # "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-13", "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-14"] + + cnc_list_obj = request.env['maintenance.equipment'].sudo().search( + [('function_type', '!=', False), ('active', '=', True)]) + cnc_list = list(map(lambda x: x.code, cnc_list_obj)) + print('cnc_list: %s' % cnc_list) + res['CNCList'] = cnc_list + + except Exception as e: + res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} + logging.info('CNCList error:%s' % e) + return json.JSONEncoder().encode(res) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 2b5f8c6f..babda164 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -600,36 +600,3 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} logging.info('AGVDownProduct error:%s' % e) return json.JSONEncoder().encode(res) - - # 返回CNC机床列表 - @http.route('/api/CNCList', type='http', auth='public', methods=['GET', 'POST'], csrf=False, - cors="*") - def CNCList(self, **kw): - """ - 获取CNC机床列表 - :param kw: - :return: - """ - - logging.info('CNCList:%s' % kw) - try: - res = {'Succeed': True} - # cnc_list = request.env['sf.cnc.equipment'].sudo().search([]) - # cnc_list = ["XT-GNJC-WZZX-X800-Y550-Z550-T24-A5-1", "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-3", - # "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-4", "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-5", - # "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-6", "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-7", - # "XT-GNJC-LSZX-X800-Y550-Z550-T24-A3-8", "XT-GNJC-WZZX-X800-Y550-Z550-T24-A5-2", - # "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-9", "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-10", - # "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-11", "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-12", - # "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-13", "XT-GNJC-GSZG-X600-Y400-Z350-T21-A3-14"] - - cnc_list_obj = request.env['maintenance.equipment'].sudo().search( - [('function_type', '!=', False), ('active', '=', True)]) - cnc_list = list(map(lambda x: x.code, cnc_list_obj)) - print('cnc_list: %s' % cnc_list) - res['CNCList'] = cnc_list - - except Exception as e: - res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} - logging.info('CNCList error:%s' % e) - return json.JSONEncoder().encode(res)