修改明细接口
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user