fix: need_inout 传true时也得处理
This commit is contained in:
parent
ca9d46c8d5
commit
cbeecea2dc
|
@ -878,13 +878,18 @@ class MlogbOutUpdateSerializer(CustomModelSerializer):
|
||||||
if ins.need_inout is False:
|
if ins.need_inout is False:
|
||||||
if ins.mlogb_from:
|
if ins.mlogb_from:
|
||||||
if Mlogb.objects.filter(mlog=ins.mlog, material_out__isnull=False, mlogb_from=ins.mlogb_from).count() == 1:
|
if Mlogb.objects.filter(mlog=ins.mlog, material_out__isnull=False, mlogb_from=ins.mlogb_from).count() == 1:
|
||||||
ins_from =Mlogb.objects.filter(mlog=ins.mlog, material_out__isnull=False, mlogb_from=ins.mlogb_from).first()
|
ins_from = ins.mlogb_from
|
||||||
ins_from.need_inout = False
|
ins_from.need_inout = False
|
||||||
ins_from.save(update_fields=["need_inout"])
|
ins_from.save(update_fields=["need_inout"])
|
||||||
else:
|
else:
|
||||||
raise ParseError("对应消耗的产出有多个, 需手动指定消耗是否出库")
|
raise ParseError("对应消耗的产出有多个, 需手动指定消耗是否出库")
|
||||||
else:
|
else:
|
||||||
raise ParseError("该产出需入库!")
|
raise ParseError("该产出需入库!")
|
||||||
|
else:
|
||||||
|
if ins.mlogb_from:
|
||||||
|
ins_from = ins.mlogb_from
|
||||||
|
ins_from.need_inout = True
|
||||||
|
ins_from.save(update_fields=["need_inout"])
|
||||||
if mlogbdefect is not None and ins.material_out.tracking == Material.MA_TRACKING_BATCH:
|
if mlogbdefect is not None and ins.material_out.tracking == Material.MA_TRACKING_BATCH:
|
||||||
MlogbDefect.objects.filter(mlogb=ins).delete()
|
MlogbDefect.objects.filter(mlogb=ins).delete()
|
||||||
mlogb_defect_objects = [
|
mlogb_defect_objects = [
|
||||||
|
|
Loading…
Reference in New Issue