解决大屏bug
This commit is contained in:
@@ -639,6 +639,15 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
|
|
||||||
|
|
||||||
if time_unit == 'hour':
|
if time_unit == 'hour':
|
||||||
|
|
||||||
|
# 计划量,目前只能从mail.message中筛选出
|
||||||
|
plan_order_messages = request.env['mail.message'].sudo().search([
|
||||||
|
('model', '=', 'mrp.workorder'),
|
||||||
|
('create_date', '>=', begin_time.strftime('%Y-%m-%d %H:%M:%S')),
|
||||||
|
('create_date', '<=', end_time.strftime('%Y-%m-%d %H:%M:%S')),
|
||||||
|
('tracking_value_ids.field_desc', '=', '状态'),
|
||||||
|
('tracking_value_ids.new_value_char', '=', '就绪')
|
||||||
|
])
|
||||||
|
|
||||||
for line in line_list:
|
for line in line_list:
|
||||||
date_field_name = 'date_finished' # 替换为你模型中的实际字段名
|
date_field_name = 'date_finished' # 替换为你模型中的实际字段名
|
||||||
@@ -685,15 +694,6 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
# time_count_dict[key] = len(orders)
|
# time_count_dict[key] = len(orders)
|
||||||
time_count_dict[key] = sum(interval_orders.mapped('qty_produced'))
|
time_count_dict[key] = sum(interval_orders.mapped('qty_produced'))
|
||||||
|
|
||||||
# 计划量,目前只能从mail.message中筛选出
|
|
||||||
plan_order_messages = request.env['mail.message'].sudo().search([
|
|
||||||
('model', '=', 'mrp.workorder'),
|
|
||||||
('create_date', '>=', begin_time.strftime('%Y-%m-%d %H:%M:%S')),
|
|
||||||
('create_date', '<=', end_time.strftime('%Y-%m-%d %H:%M:%S')),
|
|
||||||
('tracking_value_ids.field_desc', '=', '状态'),
|
|
||||||
('tracking_value_ids.new_value_char', '=', '就绪')
|
|
||||||
])
|
|
||||||
|
|
||||||
for time_interval in time_intervals:
|
for time_interval in time_intervals:
|
||||||
start_time, end_time = time_interval
|
start_time, end_time = time_interval
|
||||||
|
|
||||||
@@ -876,6 +876,18 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
not_done_index = 1
|
not_done_index = 1
|
||||||
done_index = 1
|
done_index = 1
|
||||||
|
|
||||||
|
# 获取当前时间,并计算24小时前的时间
|
||||||
|
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', ['就绪', '生产中'])
|
||||||
|
])
|
||||||
|
|
||||||
for line in line_list:
|
for line in line_list:
|
||||||
|
|
||||||
if line == '业绩总览':
|
if line == '业绩总览':
|
||||||
@@ -892,19 +904,27 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
# [('production_line_id.name', '=', line), ('state', 'not in', ['finished']),
|
# [('production_line_id.name', '=', line), ('state', 'not in', ['finished']),
|
||||||
# ('production_id.state', 'not in', ['cancel', 'done']), ('active', '=', True)
|
# ('production_id.state', 'not in', ['cancel', 'done']), ('active', '=', True)
|
||||||
# ])
|
# ])
|
||||||
not_done_orders = work_order_obj.search(work_order_domain +
|
# not_done_orders = work_order_obj.search(work_order_domain +
|
||||||
[('state', 'in', ['ready', 'progress'])], order='id asc'
|
# [('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)
|
||||||
|
|
||||||
|
|
||||||
# 完成订单
|
# 完成订单
|
||||||
# 获取当前时间,并计算24小时前的时间
|
# 获取当前时间,并计算24小时前的时间
|
||||||
current_time = datetime.now()
|
# current_time = datetime.now()
|
||||||
time_24_hours_ago = current_time - timedelta(hours=24)
|
# time_24_hours_ago = current_time - timedelta(hours=24)
|
||||||
|
|
||||||
finish_orders = work_order_obj.search(work_order_domain + [
|
finish_orders = work_order_obj.search(work_order_domain + [
|
||||||
('state', 'in', ['finished']),
|
('state', 'in', ['finished']),
|
||||||
('production_id.state', 'not in', ['cancel']),
|
('production_id.state', 'not in', ['cancel']),
|
||||||
('date_finished', '>=', time_24_hours_ago)
|
('date_finished', '>=', time_48_hours_ago)
|
||||||
], order='id asc')
|
], order='id asc')
|
||||||
# print(finish_orders)
|
# print(finish_orders)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user