fix: 存在fmlog时将route带给mlog并进行物料校验

This commit is contained in:
caoqianming 2025-04-17 11:16:40 +08:00
parent 044b489388
commit fafe39c1bd
1 changed files with 3 additions and 2 deletions

View File

@ -542,6 +542,7 @@ class MlogSerializer(CustomModelSerializer):
raise ParseError('未提供消耗的车间物料')
attrs['mgroup'] = fmlog.mgroup
attrs['mtask'] = fmlog.mtask
attrs['route'] = fmlog.route
attrs['mtype'] = fmlog.mgroup.mtype
if attrs['mtask'] and attrs['mtask'].route:
attrs['route'] = attrs['mtask'].route
@ -553,8 +554,8 @@ class MlogSerializer(CustomModelSerializer):
pass
else:
raise ParseError('非合格品不可使用')
if wm_in.material != attrs['mtask'].material_in:
raise ParseError('消耗物料与任务不一致')
if wm_in.material != attrs['route'].material_in:
raise ParseError('消耗物料与工艺步骤不一致')
if attrs['mtype'] == Mlog.MTYPE_OUT:
supplier = attrs.get('supplier', None)
if not supplier: