feat: 获取物料的缺陷项列表
This commit is contained in:
parent
c7f6abf6a6
commit
cf25d0d280
|
@ -162,6 +162,17 @@ class WMaterialViewSet(ListModelMixin, CustomGenericViewSet):
|
|||
belong_dept__name=vdata['belong_dept_name'], count__gt=0).values_list('batch', flat=True).distinct()
|
||||
return Response(list(batchs))
|
||||
|
||||
@action(methods=['get'], detail=False, perms_map={'get': '*'})
|
||||
def defects(self, request, *args, **kwargs):
|
||||
"""获取物料的缺陷列表
|
||||
|
||||
获取物料的缺陷列表
|
||||
"""
|
||||
from apps.qm.models import Defect
|
||||
from apps.qm.serializers import DefectSerializer
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
defect_ids = queryset.values_list('defect', flat=True).distinct()
|
||||
return Response(DefectSerializer(Defect.objects.filter(id__in=defect_ids), many=True).data)
|
||||
|
||||
class MlogViewSet(CustomModelViewSet):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue