feat: count_running_state返回更多信息

This commit is contained in:
caoqianming 2024-11-07 09:01:53 +08:00
parent 98e3520127
commit 8c8d7af1ba
1 changed files with 5 additions and 0 deletions

View File

@ -105,6 +105,11 @@ class EquipmentViewSet(CustomModelViewSet):
count_stop=Count(Case(When(running_state=30, then=1), output_field=IntegerField())), count_stop=Count(Case(When(running_state=30, then=1), output_field=IntegerField())),
count_fail=Count(Case(When(running_state=40, then=1), output_field=IntegerField())), count_fail=Count(Case(When(running_state=40, then=1), output_field=IntegerField())),
count_offline=Count(Case(When(running_state=50, then=1), output_field=IntegerField())), count_offline=Count(Case(When(running_state=50, then=1), output_field=IntegerField())),
count_ok=Count(Case(When(state=Equipment.EQUIP_STATE_OK, then=1), output_field=IntegerField())),
count_limit=Count(Case(When(state=Equipment.EQUIP_STATE_LIMIT, then=1), output_field=IntegerField())),
count_fix=Count(Case(When(state=Equipment.EQUIP_STATE_FIX, then=1), output_field=IntegerField())),
count_disable=Count(Case(When(state=Equipment.EQUIP_STATE_DISABLE, then=1), output_field=IntegerField())),
count_scrap=Count(Case(When(state=Equipment.EQUIP_STATE_SCRAP, then=1), output_field=IntegerField())),
) )
json_result = { json_result = {
"count": result["count"], "count": result["count"],