From 33647fa3e09b255121e8fabb2a849654eee4e70b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Tue, 24 Jun 2025 14:18:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=98=8E=E7=BB=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/controllers/controllers.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/sf_machine_connect/controllers/controllers.py b/sf_machine_connect/controllers/controllers.py index 565ba613..18b4346c 100644 --- a/sf_machine_connect/controllers/controllers.py +++ b/sf_machine_connect/controllers/controllers.py @@ -870,11 +870,7 @@ class Sf_Dashboard_Connect(http.Controller): begin_time = datetime.strptime(begin_time_str, '%Y-%m-%d %H:%M:%S') end_time = datetime.strptime(end_time_str, '%Y-%m-%d %H:%M:%S') # print('line_list: %s' % line_list) - not_done_data = [] - done_data = [] final_data = {} - not_done_index = 1 - done_index = 1 # 获取当前时间,并计算24小时前的时间 current_time = datetime.now() @@ -889,6 +885,10 @@ class Sf_Dashboard_Connect(http.Controller): ]) for line in line_list: + not_done_data = [] + done_data = [] + not_done_index = 1 + done_index = 1 if line == '业绩总览': work_order_domain = [('routing_type', 'in', ['人工线下加工', 'CNC加工'])] @@ -922,11 +922,11 @@ class Sf_Dashboard_Connect(http.Controller): # time_24_hours_ago = current_time - timedelta(hours=24) finish_orders = work_order_obj.search(work_order_domain + [ - ('state', 'in', ['finished']), + ('state', 'in', ['done']), ('production_id.state', 'not in', ['cancel']), ('date_finished', '>=', time_48_hours_ago) ], order='id asc') - # print(finish_orders) + # logging.info('完成订单: %s' % finish_orders) # 获取所有未完成订单的ID列表 order_ids = [order.id for order in not_done_orders] @@ -985,8 +985,6 @@ class Sf_Dashboard_Connect(http.Controller): not_done_index += 1 for finish_order in finish_orders: - if not finish_order.actual_end_time: - continue blank_name = '' try: blank_name = finish_order.production_id.move_raw_ids[0].product_id.name @@ -1007,8 +1005,8 @@ class Sf_Dashboard_Connect(http.Controller): 'material': material, 'dimensions': dimensions, 'order_qty': order.qty_produced, - 'finish_time': finish_order.actual_end_time.strftime( - '%Y-%m-%d %H:%M:%S') if finish_order.actual_end_time else ' ' + 'finish_time': finish_order.date_finished.strftime( + '%Y-%m-%d %H:%M:%S') if finish_order.date_finished else ' ' } done_data.append(line_dict)