diff --git a/apps/wpm/views.py b/apps/wpm/views.py index 55b951f0..8944e409 100644 --- a/apps/wpm/views.py +++ b/apps/wpm/views.py @@ -747,20 +747,34 @@ class MlogbInViewSet(BulkCreateModelMixin, BulkUpdateModelMixin, BulkDestroyMode # if qct is None: # mlog.qct = Qct.get(material_out, "process") # mlog.save(update_fields = ["qct"]) - - m_dict = { - "mtask": mlogbin.mtask, - "route": route, - "mlog": mlog, - "material_out": material_out, - "batch": mlogbin.batch, - "batch_ofrom": wm_in.batch_ofrom, "material_ofrom": wm_in.material_ofrom, - "qct": Qct.get(material_out, "process", "out") - } - if mtype == Process.PRO_DIV and material_in.tracking == Material.MA_TRACKING_SINGLE: - pass + if mlogbin_parent is None: + m_dict = { + "mtask": mlogbin.mtask, + "route": route, + "mlog": mlog, + "material_out": material_out, + "batch": mlogbin.batch, + "batch_ofrom": wm_in.batch_ofrom, "material_ofrom": wm_in.material_ofrom, + "qct": Qct.get(material_out, "process", "out") + } + if mtype == Process.PRO_DIV and material_in.tracking == Material.MA_TRACKING_SINGLE: + pass + else: + m_dict['batch'] = generate_new_batch(mlogbin.batch, mlog) else: - m_dict['batch'] = generate_new_batch(mlogbin.batch, mlog) + m_dict = { + "mtask": mlogbin_parent.mtask, + "route": route, + "mlog": mlog, + "material_out": material_out, + "batch": mlogbin_parent.batch, + "batch_ofrom": mlogbin_parent.wm_in.batch_ofrom, "material_ofrom": mlogbin_parent.wm_in.material_ofrom, + "qct": Qct.get(material_out, "process", "out") + } + if mtype == Process.PRO_DIV and material_in.tracking == Material.MA_TRACKING_SINGLE: + pass + else: + m_dict['batch'] = generate_new_batch(mlogbin_parent.batch, mlog) if is_fix:# 支持批到批,个到个 d_count_real = mlogbin.count_use-mlogbin.count_pn_jgqbl