diff --git a/apps/wpm/services.py b/apps/wpm/services.py index 1962d997..e5332027 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -239,7 +239,7 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]): m_outs_list = [(mo.material_out, mo.batch if mo.batch else mlog.batch, mo.count_ok, mlog.count_real_eweight, None, mo) for mo in m_outs.all()] if need_store_notok: for item in m_outs: - if item.material_out == Material.MA_TRACKING_SINGLE: + if item.material_out.tracking == Material.MA_TRACKING_SINGLE: # 获取所有主要的不合格项 bw_qs = Mlogbw.objects.filter(mlogb=item) defectIds= Ftest.objects.filter(mlogbw_ftest__in=bw_qs).exclude(defect_main=None).values_list("defect_main__id", flat=True).distinct() @@ -266,7 +266,6 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]): else: m_outs_list = [(material_out, mlog.batch, mlog.count_ok, mlog.count_real_eweight, None, mlog)] # 一次填写的暂时不处理不合格品 - for mo in m_outs_list: mo_ma, mo_batch, mo_count, mo_count_eweight, notok_sign_or_defect, mlog_or_b = mo if mo_count <= 0: