From 55337815c7e07bc949c5c70daac6ca9f8ca0141e Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 27 Mar 2025 10:42:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9dashboard=E5=BD=93=E6=97=A5?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=95=B0=E6=8D=AE=E8=AE=A1=E7=AE=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/controllers/controllers.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sf_machine_connect/controllers/controllers.py b/sf_machine_connect/controllers/controllers.py index 0c91846b..4385937c 100644 --- a/sf_machine_connect/controllers/controllers.py +++ b/sf_machine_connect/controllers/controllers.py @@ -567,7 +567,7 @@ class Sf_Dashboard_Connect(http.Controller): """ res = {'status': 1, 'message': '成功', 'data': {}} # plan_obj = request.env['sf.production.plan'].sudo() - plan_obj = request.env['mrp.production'].sudo() + plan_obj = request.env['mrp.workorder'].sudo().search([('routing_type', '=', 'CNC加工')]) line_list = ast.literal_eval(kw['line_list']) begin_time_str = kw['begin_time'].strip('"') end_time_str = kw['end_time'].strip('"') @@ -618,7 +618,7 @@ class Sf_Dashboard_Connect(http.Controller): start_time, end_time = time_interval orders = plan_obj.search([ - ('production_line_id.name', '=', line), + ('production_id.production_line_id.name', '=', line), ('state', 'in', ['done']), (date_field_name, '>=', start_time.strftime('%Y-%m-%d %H:%M:%S')), (date_field_name, '<=', end_time.strftime('%Y-%m-%d %H:%M:%S')) # 包括结束时间 @@ -638,18 +638,18 @@ class Sf_Dashboard_Connect(http.Controller): for date in date_list: next_day = date + timedelta(days=1) - orders = plan_obj.search([('production_line_id.name', '=', line), ('state', 'in', ['done']), + orders = plan_obj.search([('production_id.production_line_id.name', '=', line), ('state', 'in', ['done']), (date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')), (date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00')) ]) rework_orders = plan_obj.search( - [('production_line_id.name', '=', line), ('state', 'in', ['rework']), + [('production_id.production_line_id.name', '=', line), ('state', 'in', ['rework']), (date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')), (date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00')) ]) not_passed_orders = plan_obj.search( - [('production_line_id.name', '=', line), ('state', 'in', ['scrap', 'cancel']), + [('production_id.production_line_id.name', '=', line), ('state', 'in', ['scrap', 'cancel']), (date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')), (date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00')) ]) @@ -942,7 +942,7 @@ class Sf_Dashboard_Connect(http.Controller): # machine_list = ast.literal_eval(kw['machine_list']) # for item in machine_list: # machine_data = equipment_obj.search([('code', '=', item)]) - for log in maintenance_logs_obj.search([]): + for log in maintenance_logs_obj.search([], order='id desc', limit=30): res['data'].append({ 'name': log.name, 'alarm_time': log.alarm_time.strftime('%Y-%m-%d %H:%M:%S'),