From 7861b5419eb13ae9bc92af78918d39256cc9c626 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 31 Dec 2021 10:45:21 +0800 Subject: [PATCH] =?UTF-8?q?wproductticket=20list=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0order=20product?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/wpm/serializers.py | 4 ++++ hb_server/apps/wpm/views.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hb_server/apps/wpm/serializers.py b/hb_server/apps/wpm/serializers.py index 18503a4..a0adae6 100644 --- a/hb_server/apps/wpm/serializers.py +++ b/hb_server/apps/wpm/serializers.py @@ -12,6 +12,7 @@ from django.utils import timezone from django.utils.translation import gettext_lazy as _ from apps.pm.serializers import SubproductionPlanSimpleSerializer from apps.qm.models import TestRecord, TestRecordItem +from apps.sam.serializers import OrderSimpleSerializer from apps.system.serializers import UserSimpleSerializer from apps.wpm.models import Operation, OperationEquip, OperationMaterial, OperationWproduct, Pick, WMaterial, WProduct, OperationRecord, OperationRecordItem, WprouctTicket from django.db import transaction @@ -437,7 +438,10 @@ class WproductTicketListSerializer(serializers.ModelSerializer): step_ = StepSimpleSerializer(source='step', read_only=True) subproduction_plan_ = SubproductionPlanSimpleSerializer(source='subproduction_plan', read_only=True) resp_process_ = ProcessSimpleSerializer(source='resp_process', read_only=True) + order_ = OrderSimpleSerializer(source='subproduction_plan.production_plan.order', read_only=True) + product_ = MaterialSimpleSerializer(source='subproduction_plan.production_plan.product', read_only=True) class Meta: model = WprouctTicket fields = '__all__' + \ No newline at end of file diff --git a/hb_server/apps/wpm/views.py b/hb_server/apps/wpm/views.py index 817ed9f..6e8b151 100644 --- a/hb_server/apps/wpm/views.py +++ b/hb_server/apps/wpm/views.py @@ -429,7 +429,8 @@ class WproductTicketViewSet(ListModelMixin, GenericViewSet): 玻璃审批工单 """ perms_map={'*':'*'} - queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan', 'resp_process') + queryset = WprouctTicket.objects.select_related('step', 'material', 'subproduction_plan', + 'resp_process', 'subproduction_plan__production_plan__order', 'subproduction_plan__production_plan') serializer_class = WproductTicketListSerializer filterset_fields = ['step', 'material', 'subproduction_plan', 'resp_process'] ordering_fields = ['id']