From 0a79a4e3367fff50dba6f6b03e4d835776ddfa5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Tue, 24 Jun 2025 15:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=98=8E=E7=BB=86=E7=9A=84=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/controllers/controllers.py | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/sf_machine_connect/controllers/controllers.py b/sf_machine_connect/controllers/controllers.py index 8316411e..69ea3c14 100644 --- a/sf_machine_connect/controllers/controllers.py +++ b/sf_machine_connect/controllers/controllers.py @@ -880,13 +880,13 @@ class Sf_Dashboard_Connect(http.Controller): current_time = datetime.now() time_48_hours_ago = current_time - timedelta(hours=48) - # 计划量,目前只能从mail.message中筛选出 - plan_order_messages = request.env['mail.message'].sudo().search([ - ('model', '=', 'mrp.workorder'), - ('create_date', '>=', time_48_hours_ago.strftime('%Y-%m-%d %H:%M:%S')), - ('tracking_value_ids.field_desc', '=', '状态'), - ('tracking_value_ids.new_value_char', 'in', ['就绪', '生产中']) - ]) + # # 计划量,目前只能从mail.message中筛选出 + # plan_order_messages = request.env['mail.message'].sudo().search([ + # ('model', '=', 'mrp.workorder'), + # ('create_date', '>=', time_48_hours_ago.strftime('%Y-%m-%d %H:%M:%S')), + # ('tracking_value_ids.field_desc', '=', '状态'), + # ('tracking_value_ids.new_value_char', 'in', ['就绪', '生产中']) + # ]) for line in line_list: not_done_data = [] @@ -908,16 +908,18 @@ class Sf_Dashboard_Connect(http.Controller): # [('production_line_id.name', '=', line), ('state', 'not in', ['finished']), # ('production_id.state', 'not in', ['cancel', 'done']), ('active', '=', True) # ]) - # not_done_orders = work_order_obj.search(work_order_domain + - # [('state', 'in', ['ready', 'progress'])], order='id asc' - # ) - not_done_orders = request.env['mrp.workorder'].sudo().browse(plan_order_messages.mapped('res_id')) - if line == '业绩总览': - not_done_orders = not_done_orders.filtered(lambda o: o.routing_type in ['人工线下加工', 'CNC加工']) - elif line == '人工线下加工中心': - not_done_orders = not_done_orders.filtered(lambda o: o.routing_type == '人工线下加工') - else: - not_done_orders = not_done_orders.filtered(lambda o: o.routing_type == 'CNC加工' and o.production_line_id.name == line) + not_done_orders = work_order_obj.search(work_order_domain + [ + ('state', 'in', ['ready', 'progress']), + ('date_planned_start', '>=', time_48_hours_ago) + ], order='id asc' + ) + # not_done_orders = request.env['mrp.workorder'].sudo().browse(plan_order_messages.mapped('res_id')) + # if line == '业绩总览': + # not_done_orders = not_done_orders.filtered(lambda o: o.routing_type in ['人工线下加工', 'CNC加工']) + # elif line == '人工线下加工中心': + # not_done_orders = not_done_orders.filtered(lambda o: o.routing_type == '人工线下加工') + # else: + # not_done_orders = not_done_orders.filtered(lambda o: o.routing_type == 'CNC加工' and o.production_line_id.name == line) # 完成订单 @@ -996,7 +998,7 @@ class Sf_Dashboard_Connect(http.Controller): line_dict = { 'sequence': done_index, - 'workorder_name': finish_order.name, + 'workorder_name': finish_order.production_id.name, 'blank_name': blank_name, 'material': material, 'dimensions': dimensions,