feat: 获取标签明细

This commit is contained in:
caoqianming 2024-10-11 15:38:28 +08:00
parent 419dbf3560
commit 52a7d41518
1 changed files with 6 additions and 13 deletions

View File

@ -5,11 +5,13 @@ from apps.cm.serializers import TidSerializer, LabelMatSerializer
from apps.inm.models import MaterialBatch
from rest_framework.exceptions import ParseError
from rest_framework.response import Response
from apps.utils.viewsets import CustomGenericViewSet
from apps.utils.viewsets import CustomGenericViewSet, RetrieveModelMixin
# Create your views here.
class LableMatViewSet(CustomGenericViewSet):
perms_map = {"post": "*"}
class LableMatViewSet(RetrieveModelMixin, CustomGenericViewSet):
perms_map = {"post": "*", "get": "*"}
serializer_class = LabelMatSerializer
@action(methods=['post'], detail=False, serializer_class=TidSerializer)
def get_from_mb(self, request, pk=None):
"""
@ -30,13 +32,4 @@ class LableMatViewSet(CustomGenericViewSet):
"supplier": mb.supplier
}
)
return Response({"label": f"mat:{obj.id}"})
def info(self, request, pk=None):
"""
获取物料标签信息
获取物料标签信息
"""
obj = self.get_object()
return Response(LabelMatSerializer(obj).data)
return Response({"label": f"mat:{obj.id}"})