fix: fmlog填写mtask或route即可

This commit is contained in:
caoqianming 2025-04-17 09:06:34 +08:00
parent 896be043f5
commit 5f2385ccd1
1 changed files with 5 additions and 5 deletions

View File

@ -983,10 +983,10 @@ class HandoverSerializer(CustomModelSerializer):
raise ParseError('必须指定交接工段') raise ParseError('必须指定交接工段')
if 'recive_mgroup' in attrs and attrs['recive_mgroup']: if 'recive_mgroup' in attrs and attrs['recive_mgroup']:
attrs['recive_dept'] = attrs['recive_mgroup'].belong_dept attrs['recive_dept'] = attrs['recive_mgroup'].belong_dept
if 'recive_dept' not in attrs and 'recive_mgroup' not in attrs: if not attrs.get('recive_dept', None) and not attrs.get('recive_mgroup', None):
raise ParseError('收料车间和收料工段必须有一个') raise ParseError('必须指定收料车间或收料工段')
if 'send_dept' not in attrs and 'send_mgroup' not in attrs: if not attrs.get('send_dept', None) and not attrs.get('send_mgroup', None):
raise ParseError('送料车间和送料工段必须有一个') raise ParseError('必须指定送料车间或送料工段')
t_count = 0 t_count = 0
tracking = attrs["material"].tracking tracking = attrs["material"].tracking
for ind, item in enumerate(attrs['handoverb']): for ind, item in enumerate(attrs['handoverb']):
@ -1186,7 +1186,7 @@ class FmlogSerializer(CustomModelSerializer):
is_fix = attrs.get("is_fix", False) is_fix = attrs.get("is_fix", False)
if is_fix: if is_fix:
attrs["mtask"] = None attrs["mtask"] = None
elif not attrs.get("mtask", None) or not attrs.get("route", None): elif not attrs.get("mtask", None) and not attrs.get("route", None):
raise ParseError("请选择任务或工艺步骤") raise ParseError("请选择任务或工艺步骤")
mtask: Mtask = attrs['mtask'] mtask: Mtask = attrs['mtask']
if mtask and mtask.state != Mtask.MTASK_ASSGINED: if mtask and mtask.state != Mtask.MTASK_ASSGINED: