From cede23d7e2b36dac072c2a72c49e6fb9072fcf2f Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 29 Dec 2021 14:21:31 +0800 Subject: [PATCH] =?UTF-8?q?srm=20gantt=E5=A2=9E=E5=8A=A0product=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/srm/serializers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hb_server/apps/srm/serializers.py b/hb_server/apps/srm/serializers.py index a142348..59d7be9 100644 --- a/hb_server/apps/srm/serializers.py +++ b/hb_server/apps/srm/serializers.py @@ -1,21 +1,24 @@ from rest_framework import serializers from apps.pm.models import ProductionPlan, SubProductionPlan -from apps.mtm.serializers import ProcessSimpleSerializer +from apps.mtm.serializers import MaterialSimpleSerializer, ProcessSimpleSerializer class SubplanGanttSerializer(serializers.ModelSerializer): count = serializers.IntegerField(source='main_count') count_real = serializers.IntegerField(source='main_count_real') count_ok = serializers.IntegerField(source='main_count_ok') process_ = ProcessSimpleSerializer(source='process', read_only=True) + product_ = MaterialSimpleSerializer(source='main_product', read_only=True) class Meta: model = SubProductionPlan fields = ['id', 'number', 'start_date', 'end_date', 'count', 'count_real', 'count_ok', 'start_date_real', 'end_date_real', 'process_'] class PlanGanttSerializer(serializers.ModelSerializer): children = serializers.SerializerMethodField() + product_ = MaterialSimpleSerializer(source='product', read_only=True) class Meta: model = ProductionPlan - fields = ['id', 'number', 'start_date', 'end_date', 'children', 'count', 'count_real', 'count_ok'] + fields = ['id', 'number', 'start_date', 'end_date', 'children', 'count', 'count_real', + 'count_ok', 'product', 'product_'] def get_children(self, obj): subplans = SubProductionPlan.objects.filter(production_plan=obj).order_by('process__number')