feat: 一次填写的也mlogb_from

This commit is contained in:
caoqianming 2025-03-14 18:14:43 +08:00
parent 8f079c9d5d
commit 443a818aec
1 changed files with 3 additions and 0 deletions

View File

@ -353,6 +353,7 @@ class MlogSerializer(CustomModelSerializer):
wm_in = instance.wm_in
if wm_in:
batch_in = wm_in.batch
mlogbin = None
if instance.material_in: # 如果有消耗
add_dict = {
'mlog': instance, 'batch': batch_in, 'wm_in': wm_in,
@ -417,6 +418,8 @@ class MlogSerializer(CustomModelSerializer):
ddict = {}
if wm_in:
ddict = {"batch_ofrom": wm_in.batch_ofrom, "material_ofrom": wm_in.material_ofrom}
if mlogbin:
ddict["mlogb_from"] = mlogbin
mlogb, _ = Mlogb.objects.get_or_create(**add_dict_2, defaults=ddict)
if need_mdfect:
mlogb_defect_objects = [