调整完成逻辑取值
This commit is contained in:
@@ -566,7 +566,8 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
res = {'status': 1, 'message': '成功', 'data': {}}
|
res = {'status': 1, 'message': '成功', 'data': {}}
|
||||||
plan_obj = request.env['sf.production.plan'].sudo()
|
# plan_obj = request.env['sf.production.plan'].sudo()
|
||||||
|
plan_obj = request.env['mrp.production'].sudo()
|
||||||
line_list = ast.literal_eval(kw['line_list'])
|
line_list = ast.literal_eval(kw['line_list'])
|
||||||
begin_time_str = kw['begin_time'].strip('"')
|
begin_time_str = kw['begin_time'].strip('"')
|
||||||
end_time_str = kw['end_time'].strip('"')
|
end_time_str = kw['end_time'].strip('"')
|
||||||
@@ -604,7 +605,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
return date_list
|
return date_list
|
||||||
|
|
||||||
for line in line_list:
|
for line in line_list:
|
||||||
date_field_name = 'actual_end_time' # 替换为你模型中的实际字段名
|
date_field_name = 'date_finished' # 替换为你模型中的实际字段名
|
||||||
order_counts = []
|
order_counts = []
|
||||||
|
|
||||||
if time_unit == 'hour':
|
if time_unit == 'hour':
|
||||||
@@ -618,7 +619,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
|
|
||||||
orders = plan_obj.search([
|
orders = plan_obj.search([
|
||||||
('production_line_id.name', '=', line),
|
('production_line_id.name', '=', line),
|
||||||
('state', 'in', ['finished']),
|
('state', 'in', ['done']),
|
||||||
(date_field_name, '>=', start_time.strftime('%Y-%m-%d %H:%M:%S')),
|
(date_field_name, '>=', start_time.strftime('%Y-%m-%d %H:%M:%S')),
|
||||||
(date_field_name, '<=', end_time.strftime('%Y-%m-%d %H:%M:%S')) # 包括结束时间
|
(date_field_name, '<=', end_time.strftime('%Y-%m-%d %H:%M:%S')) # 包括结束时间
|
||||||
])
|
])
|
||||||
@@ -637,18 +638,18 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
|
|
||||||
for date in date_list:
|
for date in date_list:
|
||||||
next_day = date + timedelta(days=1)
|
next_day = date + timedelta(days=1)
|
||||||
orders = plan_obj.search([('production_line_id.name', '=', line), ('state', 'in', ['finished']),
|
orders = plan_obj.search([('production_line_id.name', '=', line), ('state', 'in', ['done']),
|
||||||
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
||||||
(date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00'))
|
(date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00'))
|
||||||
])
|
])
|
||||||
|
|
||||||
rework_orders = plan_obj.search(
|
rework_orders = plan_obj.search(
|
||||||
[('production_line_id.name', '=', line), ('production_id.state', 'in', ['rework']),
|
[('production_line_id.name', '=', line), ('state', 'in', ['rework']),
|
||||||
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
||||||
(date_field_name, '<', next_day.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(
|
not_passed_orders = plan_obj.search(
|
||||||
[('production_line_id.name', '=', line), ('production_id.state', 'in', ['scrap', 'cancel']),
|
[('production_line_id.name', '=', line), ('state', 'in', ['scrap', 'cancel']),
|
||||||
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
||||||
(date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00'))
|
(date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00'))
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user