feat: number_to_batch 支持结合工序
This commit is contained in:
parent
5496058226
commit
f0b24da22f
|
@ -758,9 +758,11 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
|||
xcount = math.floor( (mlogbin.count_use-mlogbin.count_pn_jgqbl) / div_number)
|
||||
d_count_real = 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, "count_ok_full": d_count_ok}))
|
||||
mlogbout.count_json_from = mlogbin.count_json_from
|
||||
mlogbout.save(update_fields=["count_json_from"])
|
||||
number_to_batch = process.number_to_batch
|
||||
if not number_to_batch:
|
||||
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_ok_full": d_count_ok}))
|
||||
mlogbout.count_json_from = mlogbin.count_json_from
|
||||
mlogbout.save(update_fields=["count_json_from"])
|
||||
wpr_number_rule = process.wpr_number_rule
|
||||
if material_out.tracking == Material.MA_TRACKING_SINGLE:
|
||||
number = mlogbin.batch
|
||||
|
@ -769,6 +771,8 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
|||
if d_count_real == 1:
|
||||
if wpr_number_rule:
|
||||
number = MlogbInViewSet.gen_number_with_rule(wpr_number_rule, material_out)
|
||||
if number_to_batch:
|
||||
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict, {"count_real": 1, "count_ok": 1, "count_ok_full": 1, "batch": number}))
|
||||
Mlogbw.objects.get_or_create(number=number, mlogb=mlogbout)
|
||||
else:
|
||||
if wpr_number_rule:
|
||||
|
@ -778,6 +782,8 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust
|
|||
numberx = number_list[i]
|
||||
else:
|
||||
numberx = f'{number}-{i+1}'
|
||||
if number_to_batch:
|
||||
mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict, {"count_real": 1, "count_ok": 1, "count_ok_full": 1, "batch": numberx}))
|
||||
Mlogbw.objects.get_or_create(number=numberx, mlogb=mlogbout)
|
||||
else:
|
||||
raise ParseError("不支持生成产出物料!")
|
||||
|
|
Loading…
Reference in New Issue