diff --git a/apps/wpm/filters.py b/apps/wpm/filters.py index ebad7086..50b2df05 100644 --- a/apps/wpm/filters.py +++ b/apps/wpm/filters.py @@ -47,7 +47,8 @@ class WMaterialFilter(filters.FilterSet): "batch": ["exact", "contains"], "mgroup": ["exact", "in", "isnull"], "mgroup__name": ["exact", "in"], - "count": ["gte", "lte", "exact"] + "count": ["gte", "lte", "exact"], + "notok_sign": ["exact", "in", "isnull"] } class MlogFilter(filters.FilterSet): diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 8c28541e..02dff1d6 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -368,6 +368,8 @@ class MlogbInSerializer(CustomModelSerializer): mlog: Mlog = attrs['mlog'] mtask: Mtask = attrs['mtask'] wm_in: WMaterial = attrs['wm_in'] + if wm_in.notok_sign is not None: + raise ValidationError('不合格物料不可使用') if mlog.route != mtask.route: raise ValidationError('工序不匹配') route = mlog.route