From 67a607b053bec827f995ca11c17676d5caca7b96 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Fri, 18 Oct 2024 10:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E5=A4=87oee?= =?UTF-8?q?=E5=A4=84=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E7=9A=84=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_maintenance/__manifest__.py | 1 + sf_maintenance/data/scheduled_actions.xml | 14 ++++++++++++++ sf_maintenance/models/sf_maintenance_oee.py | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 sf_maintenance/data/scheduled_actions.xml diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index 595a5d25..88c53ff8 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -11,6 +11,7 @@ 'security/group_security.xml', 'security/ir.model.access.csv', 'security/ir_rule_data.xml', + 'data/scheduled_actions.xml', 'views/maintenance_logs_views.xml', 'views/maintenance_equipment_oee_views.xml', 'views/maintenance_views.xml', diff --git a/sf_maintenance/data/scheduled_actions.xml b/sf_maintenance/data/scheduled_actions.xml new file mode 100644 index 00000000..f75b5263 --- /dev/null +++ b/sf_maintenance/data/scheduled_actions.xml @@ -0,0 +1,14 @@ + + + + 设备运行数据 + + code + model.get_running_datas() + 15 + minutes + -1 + + + + diff --git a/sf_maintenance/models/sf_maintenance_oee.py b/sf_maintenance/models/sf_maintenance_oee.py index 317ea13b..0889fdb5 100644 --- a/sf_maintenance/models/sf_maintenance_oee.py +++ b/sf_maintenance/models/sf_maintenance_oee.py @@ -94,20 +94,20 @@ class SfMaintenanceEquipmentOEE(models.Model): cnc_list_obj = self.env['maintenance.equipment'].sudo().search( [('function_type', '!=', False), ('active', '=', True)]) machine_list = list(map(lambda x: x.code, cnc_list_obj)) - print('machine_list: %s' % machine_list) + # print('machine_list: %s' % machine_list) data_time = { "machine_list": str(machine_list) } # 发送POST请求 response_time = requests.post(url_time, json={}, data=data_time) - print(response_time.json()) + # print(response_time.json()) if response_time.status_code == 200: result_time = response_time.json() if result_time['status'] == 1: real_dict = result_time['data'] for key in real_dict: - print(key) + # print(key) equipment_obj = self.env['maintenance.equipment.oee'].sudo().search([('equipment_code', '=', key)]) if real_dict[key]['power_on_time'] == 0: equipment_obj.online_time = 0