feat: 兄弟件产出需要注意batch的修改
This commit is contained in:
parent
12d77e53b6
commit
53322ed9ad
|
@ -309,7 +309,6 @@ class MlogSerializer(CustomModelSerializer):
|
||||||
batch=instance.batch,
|
batch=instance.batch,
|
||||||
mtask=instance.mtask,
|
mtask=instance.mtask,
|
||||||
material_out=item['material_out'],
|
material_out=item['material_out'],
|
||||||
count_real=item['count_ok'],
|
|
||||||
count_ok=item['count_ok'])
|
count_ok=item['count_ok'])
|
||||||
if wm_in:
|
if wm_in:
|
||||||
mlogbx.batch_ofrom = wm_in.batch_ofrom
|
mlogbx.batch_ofrom = wm_in.batch_ofrom
|
||||||
|
@ -379,10 +378,12 @@ class MlogSerializer(CustomModelSerializer):
|
||||||
# 修改产出
|
# 修改产出
|
||||||
if instance.fill_way == Mlog.MLOG_2 and instance.material_out.brothers:
|
if instance.fill_way == Mlog.MLOG_2 and instance.material_out.brothers:
|
||||||
# 针对兄弟件的情况
|
# 针对兄弟件的情况
|
||||||
Mlogb.objects.filter(mlog=instance, material_out__isnull=False).update(count_real=0, count_ok=0)
|
Mlogb.objects.filter(mlog=instance, material_out__isnull=False).update(
|
||||||
|
batch=instance.batch, # 注意mlog的batch有可能会进行修改
|
||||||
|
count_ok=0)
|
||||||
for item in mlogb:
|
for item in mlogb:
|
||||||
Mlogb.objects.filter(mlog=instance, material_out=item['material_out']).update(
|
Mlogb.objects.filter(mlog=instance, material_out=item['material_out']).update(
|
||||||
count_real=item['count_ok'],
|
batch=instance.batch,
|
||||||
count_ok=item['count_ok'])
|
count_ok=item['count_ok'])
|
||||||
|
|
||||||
elif instance.fill_way in [Mlog.MLOG_12, Mlog.MLOG_2]:
|
elif instance.fill_way in [Mlog.MLOG_12, Mlog.MLOG_2]:
|
||||||
|
|
Loading…
Reference in New Issue