调整机床列表接口位置;增加机床品牌型号返回
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user