diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js index de50eddc..35f0f3e2 100644 --- a/jikimo_frontend/static/src/js/custom_form_status_indicator.js +++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js @@ -131,6 +131,22 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', { dom.addClass('addRequired') } }) + try { + const dom = this.tableRef.el + if(dom ) { + const tfoot = $(dom).children('tfoot') + const tbooy = $(dom).children('tbody') + if(tfoot.length) { + const tfoot_tr = tfoot.children().eq(0) + const tbody_tr = tbooy.children().eq(0) + if(tfoot_tr.children().length < tbody_tr.children().length) { + tfoot_tr.prepend('') + } + } + } + } catch (e) { + console.log(e) + } } }) diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index 3c106665..d3a44da4 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -488,4 +488,7 @@ div:has(.o_required_modifier) > label::before { left: 0; top: 50%; transform: translateY(-50%); +} +.o_list_renderer .o_list_table tfoot .o_list_number { + text-align: left; } \ No newline at end of file diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 532971ee..2cb6c2df 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -496,3 +496,35 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} logging.info('AGVDownProduct error:%s' % e) return json.JSONEncoder().encode(res) + + @http.route('/AutoDeviceApi/EquipmentBaseCoordinate', type='json', auth='none', methods=['GET', 'POST'], csrf=False, + cors="*") + def PutEquipmentBaseCoordinate(self, **kw): + """ + 获取机床基坐标 + :param kw: + :return: + """ + logging.info('PutEquipmentBaseCoordinate:%s' % kw) + try: + res = {'Succeed': True} + datas = request.httprequest.data + ret = json.loads(datas) + if 'DeviceId' in ret: + equipment = request.env['maintenance.equipment'].sudo().search('name', '=', ret['DeviceId']) + if equipment: + equipment.sudo().write({ + 'base_coordinate_fixture_model_id': ret['base_coordinate_fixture_model_id'], + 'base_coordinate_g_coordinate': ret['base_coordinate_g_coordinate'], + 'base_coordinate_x': ret['base_coordinate_x'], + 'base_coordinate_y': ret['base_coordinate_y'], + 'base_coordinate_z': ret['base_coordinate_z'], + }) + else: + res = {'Succeed': False, 'ErrorCode': 203, 'Error': 'DeviceId为%s的设备不存在!' % ret['DeviceId']} + else: + res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传DeviceId字段'} + except Exception as e: + res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} + logging.info('AGVDownProduct error:%s' % e) + return json.JSONEncoder().encode(res) diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 0bb27fcb..d766629c 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import logging +import requests import base64 import hashlib import os @@ -892,6 +893,33 @@ class SfMaintenanceEquipmentAndProductTemplate(models.Model): vals.append(res) return vals[0] + base_coordinate_fixture_model_id = fields.Many2one('sf.fixture.model', '基坐标卡盘型号', + domain=[('fixture_material_id', '=', '零点卡盘')]) + base_coordinate_g_coordinate = fields.Char('G坐标') + base_coordinate_x = fields.Float('x轴', digits=(12, 3)) + base_coordinate_y = fields.Float('y轴', digits=(12, 3)) + base_coordinate_z = fields.Float('z轴', digits=(12, 3)) + + # ==========获取机床基坐标接口========== + def get_equipment_base_coordinate(self): + headers = {'Authorization': 'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A'} + crea_url = "https://x24467i973.zicp.fun/AutoDeviceApi/EquipmentBaseCoordinate" + params = {"DeviceId": self.name} + r = requests.get(crea_url, params=params, headers=headers) + ret = r.json() + logging.info('register_equipment_tool:%s' % ret) + self.write({ + 'base_coordinate_fixture_model_id': ret['base_coordinate_fixture_model_id'], + 'base_coordinate_g_coordinate': ret['base_coordinate_g_coordinate'], + 'base_coordinate_x': ret['base_coordinate_x'], + 'base_coordinate_y': ret['base_coordinate_y'], + 'base_coordinate_z': ret['base_coordinate_z'], + }) + if ret['Succeed']: + return "机床基坐标获取成功" + else: + raise ValidationError("机床基坐标获取失败") + class SfMaintenanceEquipmentTool(models.Model): _name = 'maintenance.equipment.tool' diff --git a/sf_manufacturing/views/sf_maintenance_equipment.xml b/sf_manufacturing/views/sf_maintenance_equipment.xml index b398f994..5ddf59b0 100644 --- a/sf_manufacturing/views/sf_maintenance_equipment.xml +++ b/sf_manufacturing/views/sf_maintenance_equipment.xml @@ -1,23 +1,38 @@ - 设备增加刀具库位table + sf_manufacturing_equipment.form maintenance.equipment - + - - - - - - - - - - + +