srm gantt增加product字段
This commit is contained in:
parent
c24e659e0e
commit
cede23d7e2
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue