调整不良工单逻辑
This commit is contained in:
@@ -312,9 +312,22 @@ class Sf_Dashboard_Connect(http.Controller):
|
||||
# 工单计划量
|
||||
plan_data_plan_counts = plan_obj.search_count(
|
||||
[('production_line_id.name', '=', line), ('state', 'not in', ['finished'])])
|
||||
# 工单不良累计
|
||||
plan_data_fault_counts = plan_obj.search_count(
|
||||
[('production_line_id.name', '=', line), ('production_id.state', 'in', ['scrap', 'cancel'])])
|
||||
# # 工单不良累计
|
||||
# plan_data_fault_counts = plan_obj.search_count(
|
||||
# [('production_line_id.name', '=', line), ('production_id.detection_result_ids.state', 'in', ['返工', '报废'])])
|
||||
|
||||
# 查找符合条件的生产计划记录
|
||||
plan_data = plan_obj.search([
|
||||
('production_line_id.name', '=', line),
|
||||
])
|
||||
|
||||
# 过滤出那些检测结果状态为 '返工' 或 '报废' 的记录
|
||||
faulty_plans = plan_data.filtered(lambda p: any(
|
||||
result.test_results in ['返工', '报废'] for result in p.production_id.detection_result_ids
|
||||
))
|
||||
|
||||
# 计算符合条件的记录数量
|
||||
plan_data_fault_counts = len(faulty_plans)
|
||||
|
||||
# 工单返工数量
|
||||
|
||||
|
||||
Reference in New Issue
Block a user