feat: fmlog创建时校验

This commit is contained in:
caoqianming 2024-09-04 09:13:26 +08:00
parent 170f3db824
commit 233591728a
1 changed files with 9 additions and 0 deletions

View File

@ -608,6 +608,15 @@ class FmlogSerializer(CustomModelSerializer):
fields = '__all__'
read_only_fields = EXCLUDE_FIELDS
def validate(self, attrs):
route: Route = attrs['route']
mtask: Mtask = attrs['mtask']
mgroup: Mgroup = attrs['mgroup']
if route.process != mgroup.process:
raise ParseError('工序不匹配')
if mtask.mgroup != mgroup:
raise ParseError('工段不匹配')
class FmlogUpdateSerializer(CustomModelSerializer):
class Meta:
model = Fmlog