fix: material_out.tracking的比较bug

This commit is contained in:
caoqianming 2025-02-26 12:07:02 +08:00
parent c71bb0d8f6
commit 39eef7d2b4
1 changed files with 1 additions and 2 deletions

View File

@ -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()] 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: if need_store_notok:
for item in m_outs: 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) 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() 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: else:
m_outs_list = [(material_out, mlog.batch, mlog.count_ok, mlog.count_real_eweight, None, mlog)] m_outs_list = [(material_out, mlog.batch, mlog.count_ok, mlog.count_real_eweight, None, mlog)]
# 一次填写的暂时不处理不合格品 # 一次填写的暂时不处理不合格品
for mo in m_outs_list: for mo in m_outs_list:
mo_ma, mo_batch, mo_count, mo_count_eweight, notok_sign_or_defect, mlog_or_b = mo mo_ma, mo_batch, mo_count, mo_count_eweight, notok_sign_or_defect, mlog_or_b = mo
if mo_count <= 0: if mo_count <= 0: