feat: 由输入转输出需考虑到加工前不良的影响
This commit is contained in:
parent
5e2fd57b89
commit
20384ca33c
|
@ -602,8 +602,8 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
m_dict['batch'] = generate_new_batch(mlogbin.batch, mlog)
|
m_dict['batch'] = generate_new_batch(mlogbin.batch, mlog)
|
||||||
|
|
||||||
if mtype == Process.PRO_NORMAL: # 正常 支持批到批, 个到个
|
if mtype == Process.PRO_NORMAL: # 正常 支持批到批, 个到个
|
||||||
d_count_real = mlogbin.count_use
|
d_count_real = mlogbin.count_use - mlogbin.count_pn_jgqbl
|
||||||
d_count_ok = mlogbin.count_use
|
d_count_ok = d_count_real
|
||||||
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=
|
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=
|
||||||
update_dict(m_dict, {"count_real": d_count_real, "count_ok": d_count_ok}))
|
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
|
||||||
|
@ -627,7 +627,7 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
mlogbout.number_from = mlogbwin.number
|
mlogbout.number_from = mlogbwin.number
|
||||||
mlogbout.save()
|
mlogbout.save()
|
||||||
elif material_in.tracking == Material.MA_TRACKING_SINGLE and material_out.tracking == Material.MA_TRACKING_SINGLE:
|
elif material_in.tracking == Material.MA_TRACKING_SINGLE and material_out.tracking == Material.MA_TRACKING_SINGLE:
|
||||||
d_count_real = mlogbin.count_use * div_number
|
d_count_real = (mlogbin.count_use-mlogbin.count_pn_jgqbl) * div_number
|
||||||
d_count_ok = d_count_real
|
d_count_ok = d_count_real
|
||||||
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict,
|
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict,
|
||||||
{"count_real": d_count_real, "count_ok": d_count_ok}))
|
{"count_real": d_count_real, "count_ok": d_count_ok}))
|
||||||
|
@ -639,13 +639,13 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
for i in range(div_number):
|
for i in range(div_number):
|
||||||
Mlogbw.objects.get_or_create(mlogb=mlogbout, number=f'{wpr_.number}-{i+1}', defaults={"mlogbw_from": mlogbwin})
|
Mlogbw.objects.get_or_create(mlogb=mlogbout, number=f'{wpr_.number}-{i+1}', defaults={"mlogbw_from": mlogbwin})
|
||||||
elif material_in.tracking == Material.MA_TRACKING_BATCH and material_out.tracking == Material.MA_TRACKING_BATCH:
|
elif material_in.tracking == Material.MA_TRACKING_BATCH and material_out.tracking == Material.MA_TRACKING_BATCH:
|
||||||
d_count_real = mlogbin.count_use * div_number
|
d_count_real = (mlogbin.count_use-mlogbin.count_pn_jgqbl) * div_number
|
||||||
d_count_ok = d_count_real
|
d_count_ok = d_count_real
|
||||||
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-mlogbin.count_pn_jgqbl) / 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}))
|
||||||
|
@ -661,8 +661,8 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
||||||
for i in range(d_count_real):
|
for i in range(d_count_real):
|
||||||
Mlogbw.objects.get_or_create(number=f'{number}-{i+1}', mlogb=mlogbout)
|
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-mlogbin.count_pn_jgqbl
|
||||||
d_count_ok = mlogbin.count_use
|
d_count_ok = d_count_real
|
||||||
Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict,{"count_real": d_count_real, "count_ok": d_count_ok}))
|
Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict,{"count_real": d_count_real, "count_ok": d_count_ok}))
|
||||||
if material_in.tracking == Material.MA_TRACKING_SINGLE and material_out.tracking == Material.MA_TRACKING_SINGLE:
|
if material_in.tracking == Material.MA_TRACKING_SINGLE and material_out.tracking == Material.MA_TRACKING_SINGLE:
|
||||||
for mlogbwin in Mlogbw.objects.filter(mlogb=mlogbin).order_by("number"):
|
for mlogbwin in Mlogbw.objects.filter(mlogb=mlogbin).order_by("number"):
|
||||||
|
|
Loading…
Reference in New Issue