This commit is contained in:
zty 2025-09-11 09:51:42 +08:00
commit b380c3805b
3 changed files with 5 additions and 1 deletions

View File

@ -38,9 +38,11 @@ class WprFilter(filters.FilterSet):
elif value == "done":
matoutIds = process.get_canout_mat_ids()
qs = queryset.filter(material__id__in=matoutIds).exclude(state=WMaterial.WM_REPAIR)|queryset.filter(state=WMaterial.WM_REPAIRED, wm__mgroup__id=mgroupId)
return qs
elif value == "canfix":
matoutIds = process.get_canout_mat_ids()
qs = queryset.filter(state=WMaterial.WM_REPAIR, wm__mgroup__id=mgroupId)| queryset.filter(material__id__in=matoutIds, state=WMaterial.WM_NOTOK)
return qs
else:
raise ParseError("请提供工段查询条件")

View File

@ -17,6 +17,8 @@ class WprSerializer(CustomModelSerializer):
mb_batch = serializers.CharField(source="mb.batch", read_only=True)
material_name = serializers.StringRelatedField(
source='material', read_only=True)
# material_start_name = serializers.StringRelatedField(source='material_start', read_only=True)
wm_material_ofrom_name = serializers.StringRelatedField(source="wm.material_ofrom", read_only=True)
wprdefect = WprDefectSerializer(many=True, read_only=True)
class Meta:

View File

@ -18,7 +18,7 @@ class WprViewSet(CustomListModelMixin, RetrieveModelMixin, ComplexQueryMixin, Cu
动态产品
"""
perms_map = {"get": "*"}
select_related_fields = ["wm", "mb", "material"]
select_related_fields = ["wm", "mb", "material", "wm__material_ofrom"]
prefetch_related_fields = ["defects"]
queryset = Wpr.objects.all()
serializer_class = WprSerializer