Merge branch 'master' of https://e.coding.net/ctcdevteam/ehs/ehs_server
This commit is contained in:
commit
feae902704
|
|
@ -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"],
|
||||||
|
|
@ -113,6 +118,11 @@ class EquipmentViewSet(CustomModelViewSet):
|
||||||
"count_stop": result["count_stop"],
|
"count_stop": result["count_stop"],
|
||||||
"count_fail": result["count_fail"],
|
"count_fail": result["count_fail"],
|
||||||
"count_offline": result["count_offline"],
|
"count_offline": result["count_offline"],
|
||||||
|
"count_ok": result["count_ok"],
|
||||||
|
"count_limit": result["count_limit"],
|
||||||
|
"count_fix": result["count_fix"],
|
||||||
|
"count_disable": result["count_disable"],
|
||||||
|
"count_scrap": result["count_scrap"]
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response(json_result)
|
return Response(json_result)
|
||||||
|
|
|
||||||
|
|
@ -286,6 +286,9 @@ class MlogSerializer(CustomModelSerializer):
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
material_out = validated_data['material_out']
|
material_out = validated_data['material_out']
|
||||||
|
mtask:Mtask = validated_data.get('mtask', None)
|
||||||
|
if mtask and mtask.state != Mtask.MTASK_ASSGINED:
|
||||||
|
raise ParseError('该任务非下达中不可选择')
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
mlogb = validated_data.pop('mlogb', [])
|
mlogb = validated_data.pop('mlogb', [])
|
||||||
instance: Mlog = super().create(validated_data)
|
instance: Mlog = super().create(validated_data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue