feat: 个拆批2
This commit is contained in:
parent
75ec24702c
commit
f59cb2cbc2
|
@ -712,18 +712,26 @@ class MlogbwViewSet(CustomModelViewSet):
|
|||
mlogbin = ins.mlogb
|
||||
wm_in = mlogbin.wm_in
|
||||
mlog = mlogbin.mlog
|
||||
div_number = route.div_number
|
||||
m_dict = {
|
||||
"mtask": mlogbin.mtask,
|
||||
"mlog": mlog,
|
||||
"material_out": material_out,
|
||||
"batch_ofrom": wm_in.batch_ofrom,
|
||||
"material_ofrom": wm_in.material_ofrom,
|
||||
"count_real": div_number,
|
||||
"count_ok": div_number, "qct": mlog.qct
|
||||
}
|
||||
div_number = route.div_number
|
||||
mlogbout, _ = Mlogb.objects.get_or_create(**m_dict, defaults=
|
||||
{"batch_ofrom": wm_in.batch_ofrom, "material_ofrom": wm_in.material_ofrom, "count_real": div_number, "count_ok": div_number, "qct": mlog.qct})
|
||||
if ins.mlogb_to:
|
||||
mlogbout = ins.mlogb_to
|
||||
else:
|
||||
mlogbout = Mlogb.objects.create(**m_dict)
|
||||
ins.mlogb_to = mlogbout
|
||||
ins.save(update_fields=["mlogb_to"])
|
||||
if material_out.tracking == Material.MA_TRACKING_SINGLE:
|
||||
for i in range(div_number):
|
||||
Mlogbw.objects.get_or_create(mlogb=mlogbout, defaults=f'{ins.number}-{i+1}')
|
||||
Mlogbw.cal_count_notok(mlogb_to)
|
||||
Mlogbw.cal_count_notok(mlogbout)
|
||||
elif mlogb_to and material_out.tracking == Material.MA_TRACKING_SINGLE:
|
||||
if route.process.mtype == Process.PRO_NORMAL:
|
||||
Mlogbw.objects.get_or_create(mlogb=mlogb_to, wpr=ins.wpr, defaults={"number": ins.number})
|
||||
|
|
Loading…
Reference in New Issue