feat: mlog结合工序支持批到个
This commit is contained in:
parent
d7dfb8c48f
commit
9d634940d3
|
|
@ -635,13 +635,20 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict,{"count_real": d_count_real, "count_ok": d_count_ok}))
|
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict,{"count_real": d_count_real, "count_ok": d_count_ok}))
|
||||||
mlogbout.count_json_from = mlogbin.count_json_from
|
mlogbout.count_json_from = mlogbin.count_json_from
|
||||||
mlogbout.save(update_fields=["count_json_from"])
|
mlogbout.save(update_fields=["count_json_from"])
|
||||||
elif mtype == Process.PRO_MERGE: # 支持批到批
|
elif mtype == Process.PRO_MERGE: # 支持批到批,批到个
|
||||||
xcount = math.floor( mlogbin.count_use / route.div_number)
|
xcount = math.floor( mlogbin.count_use / route.div_number)
|
||||||
d_count_real = xcount
|
d_count_real = xcount
|
||||||
d_count_ok = xcount
|
d_count_ok = xcount
|
||||||
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict, {"count_real": d_count_real, "count_ok": d_count_ok}))
|
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict, {"count_real": d_count_real, "count_ok": d_count_ok}))
|
||||||
mlogbout.count_json_from = mlogbin.count_json_from
|
mlogbout.count_json_from = mlogbin.count_json_from
|
||||||
mlogbout.save(update_fields=["count_json_from"])
|
mlogbout.save(update_fields=["count_json_from"])
|
||||||
|
if material_out.tracking == Material.MA_TRACKING_SINGLE:
|
||||||
|
number = mlogbin.batch
|
||||||
|
if d_count_real == 1:
|
||||||
|
Mlogbw.objects.get_or_create(number=number, mlogb=mlogbout)
|
||||||
|
else:
|
||||||
|
for i in range(d_count_real):
|
||||||
|
Mlogbw.objects.get_or_create(number=f'{number}-{i+1}', mlogb=mlogbout)
|
||||||
elif is_fix:# 支持批到批,个到个
|
elif is_fix:# 支持批到批,个到个
|
||||||
d_count_real = mlogbin.count_use
|
d_count_real = mlogbin.count_use
|
||||||
d_count_ok = mlogbin.count_use
|
d_count_ok = mlogbin.count_use
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue