From 20384ca33c9d9500cad1c500df977b6046e11a79 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 8 May 2025 13:53:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=B1=E8=BE=93=E5=85=A5=E8=BD=AC?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E9=9C=80=E8=80=83=E8=99=91=E5=88=B0=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E5=89=8D=E4=B8=8D=E8=89=AF=E7=9A=84=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/views.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/wpm/views.py b/apps/wpm/views.py index 67c49ed1..56db113b 100644 --- a/apps/wpm/views.py +++ b/apps/wpm/views.py @@ -602,8 +602,8 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust m_dict['batch'] = generate_new_batch(mlogbin.batch, mlog) if mtype == Process.PRO_NORMAL: # 正常 支持批到批, 个到个 - d_count_real = mlogbin.count_use - d_count_ok = mlogbin.count_use + d_count_real = mlogbin.count_use - mlogbin.count_pn_jgqbl + 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.count_json_from = mlogbin.count_json_from @@ -627,7 +627,7 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust mlogbout.number_from = mlogbwin.number mlogbout.save() 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 mlogbout, _ = Mlogb.objects.get_or_create(mlogb_from=mlogbin, defaults=update_dict(m_dict, {"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): 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: - 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 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.save(update_fields=["count_json_from"]) 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_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})) @@ -661,8 +661,8 @@ class MlogbInViewSet(CreateModelMixin, UpdateModelMixin, DestroyModelMixin, Cust for i in range(d_count_real): Mlogbw.objects.get_or_create(number=f'{number}-{i+1}', mlogb=mlogbout) elif is_fix:# 支持批到批,个到个 - d_count_real = mlogbin.count_use - d_count_ok = mlogbin.count_use + d_count_real = mlogbin.count_use-mlogbin.count_pn_jgqbl + 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})) 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"):