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']