diff --git a/sf_machine_connect/controllers/controllers.py b/sf_machine_connect/controllers/controllers.py index 937960f3..23452b43 100644 --- a/sf_machine_connect/controllers/controllers.py +++ b/sf_machine_connect/controllers/controllers.py @@ -626,10 +626,16 @@ class Sf_Dashboard_Connect(http.Controller): ('production_id.state', 'not in', ['cancel', 'done']), ('active', '=', True) ]) # print(not_done_orders) + # 完成订单 + # 获取当前时间,并计算24小时前的时间 + current_time = datetime.now() + time_24_hours_ago = current_time - timedelta(hours=24) + finish_orders = plan_obj.search([ ('production_line_id.name', '=', line), ('state', 'in', ['finished']), - ('production_id.state', 'not in', ['cancel']), ('active', '=', True) + ('production_id.state', 'not in', ['cancel']), ('active', '=', True), + ('actual_end_time', '>=', time_24_hours_ago) ]) # print(finish_orders) diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 58dc1513..c6ae49ad 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -296,6 +296,10 @@ + + + +