feat: SPLIT_FIELD 改为 #
This commit is contained in:
parent
8d6939a4fc
commit
cdcfbf35ef
|
@ -8,6 +8,7 @@ from rest_framework.response import Response
|
|||
from apps.utils.viewsets import CustomGenericViewSet, RetrieveModelMixin, CustomListModelMixin
|
||||
# Create your views here.
|
||||
|
||||
SPLIT_FIELD = "#"
|
||||
|
||||
class LableMatViewSet(CustomListModelMixin, RetrieveModelMixin, CustomGenericViewSet):
|
||||
perms_map = {"post": "*", "get": "*"}
|
||||
|
@ -29,7 +30,7 @@ class LableMatViewSet(CustomListModelMixin, RetrieveModelMixin, CustomGenericVie
|
|||
raise NotFound("仓库明细不存在")
|
||||
obj, _ = LableMat.objects.get_or_create(state=10, material=mb.material, batch=mb.batch, defaults={"supplier": mb.supplier})
|
||||
rdata = LabelMatSerializer(obj).data
|
||||
rdata["code_label"] = f"mat:{obj.id}"
|
||||
rdata["code_label"] = f"mat{SPLIT_FIELD}{obj.id}"
|
||||
return Response(rdata)
|
||||
|
||||
@action(methods=["post"], detail=False, serializer_class=TidSerializer)
|
||||
|
@ -46,7 +47,7 @@ class LableMatViewSet(CustomListModelMixin, RetrieveModelMixin, CustomGenericVie
|
|||
raise NotFound("车间库存不存在")
|
||||
obj, _ = LableMat.objects.get_or_create(state=wm.state, material=wm.material, batch=wm.batch, notok_sign=wm.notok_sign, material_origin=wm.material_origin)
|
||||
rdata = LabelMatSerializer(obj).data
|
||||
rdata["code_label"] = f"mat:{obj.id}"
|
||||
rdata["code_label"] = f"mat{SPLIT_FIELD}{obj.id}"
|
||||
return Response(rdata)
|
||||
|
||||
@action(methods=["post"], detail=False, serializer_class=TidSerializer)
|
||||
|
@ -63,5 +64,5 @@ class LableMatViewSet(CustomListModelMixin, RetrieveModelMixin, CustomGenericVie
|
|||
raise NotFound("出入库明细不存在")
|
||||
obj, _ = LableMat.objects.get_or_create(state=10, material=mioitem.material, batch=mioitem.batch, defaults={"supplier": mioitem.mio.supplier})
|
||||
rdata = LabelMatSerializer(obj).data
|
||||
rdata["code_label"] = f"mat:{obj.id}"
|
||||
rdata["code_label"] = f"mat{SPLIT_FIELD}{obj.id}"
|
||||
return Response(rdata)
|
||||
|
|
Loading…
Reference in New Issue