fix: mlog的need_inout逻辑2
This commit is contained in:
parent
c2539185e2
commit
32185abffd
|
@ -188,8 +188,9 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
||||||
|
|
||||||
if material_in or is_fix: # 需要进行车间库存管理
|
if material_in or is_fix: # 需要进行车间库存管理
|
||||||
m_ins_list = []
|
m_ins_list = []
|
||||||
m_ins = Mlogb.objects.filter(mlog=mlog, material_in__isnull=False, need_inout=True)
|
m_ins = Mlogb.objects.filter(mlog=mlog, material_in__isnull=False)
|
||||||
if m_ins.exists():
|
if m_ins.exists():
|
||||||
|
m_ins = m_ins.filter(need_inout=False)
|
||||||
m_ins_list = [(mi.material_in, mi.batch if mi.batch else mi.batch, mi.count_use, None, mi) for mi in m_ins.all()]
|
m_ins_list = [(mi.material_in, mi.batch if mi.batch else mi.batch, mi.count_use, None, mi) for mi in m_ins.all()]
|
||||||
for item in m_ins:
|
for item in m_ins:
|
||||||
mbd_qs = MlogbDefect.get_defect_qs_from_mlogb(item)
|
mbd_qs = MlogbDefect.get_defect_qs_from_mlogb(item)
|
||||||
|
@ -257,10 +258,11 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
||||||
|
|
||||||
|
|
||||||
if material_out or is_fix: # 需要入车间库存
|
if material_out or is_fix: # 需要入车间库存
|
||||||
mlogb_out_qs = Mlogb.objects.filter(mlog=mlog, material_out__isnull=False, need_inout=True)
|
mlogb_out_qs = Mlogb.objects.filter(mlog=mlog, material_out__isnull=False)
|
||||||
stored_notok = need_store_notok
|
stored_notok = need_store_notok
|
||||||
stored_mgroup = need_store_notok
|
stored_mgroup = need_store_notok
|
||||||
if mlogb_out_qs.exists():
|
if mlogb_out_qs.exists():
|
||||||
|
mlogb_out_qs = mlogb_out_qs.filter(need_inout=True)
|
||||||
m_outs_list = [(mo.material_out, mo.batch if mo.batch else mlog.batch, mo.count_ok_full if mo.count_ok_full is not None else mo.count_ok, mlog.count_real_eweight, None, mo) for mo in mlogb_out_qs.all()]
|
m_outs_list = [(mo.material_out, mo.batch if mo.batch else mlog.batch, mo.count_ok_full if mo.count_ok_full is not None else mo.count_ok, mlog.count_real_eweight, None, mo) for mo in mlogb_out_qs.all()]
|
||||||
if need_store_notok:
|
if need_store_notok:
|
||||||
for item in mlogb_out_qs:
|
for item in mlogb_out_qs:
|
||||||
|
@ -400,8 +402,9 @@ def mlog_revert(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
||||||
if material_out or is_fix: # 产物退回
|
if material_out or is_fix: # 产物退回
|
||||||
# 有多个产物的情况
|
# 有多个产物的情况
|
||||||
# 需要考虑不合格品退回的情况
|
# 需要考虑不合格品退回的情况
|
||||||
mlogb_out_qs = Mlogb.objects.filter(mlog=mlog, material_out__isnull=False, need_inout=True)
|
mlogb_out_qs = Mlogb.objects.filter(mlog=mlog, material_out__isnull=False)
|
||||||
if mlogb_out_qs.exists():
|
if mlogb_out_qs.exists():
|
||||||
|
mlogb_out_qs = mlogb_out_qs.filter(need_inout=True)
|
||||||
m_outs_list = [
|
m_outs_list = [
|
||||||
(mo.material_out, mo.batch if mo.batch else mlog.batch, mo.count_ok_full if mo.count_ok_full is not None else mo.count_ok, mlog.count_real_eweight, None, mo)
|
(mo.material_out, mo.batch if mo.batch else mlog.batch, mo.count_ok_full if mo.count_ok_full is not None else mo.count_ok, mlog.count_real_eweight, None, mo)
|
||||||
for mo in mlogb_out_qs.all()]
|
for mo in mlogb_out_qs.all()]
|
||||||
|
@ -495,8 +498,9 @@ def mlog_revert(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
||||||
m_ins_list = []
|
m_ins_list = []
|
||||||
m_ins_bl_list = []
|
m_ins_bl_list = []
|
||||||
into_wm_mgroup = process.into_wm_mgroup
|
into_wm_mgroup = process.into_wm_mgroup
|
||||||
m_ins = Mlogb.objects.filter(mlog=mlog, material_in__isnull=False, need_inout=True)
|
m_ins = Mlogb.objects.filter(mlog=mlog, material_in__isnull=False)
|
||||||
if m_ins.exists():
|
if m_ins.exists():
|
||||||
|
m_ins = m_ins.filter(need_inout=True)
|
||||||
for mi in m_ins.all():
|
for mi in m_ins.all():
|
||||||
m_ins_list.append((mi.material_in, mi.batch, mi.count_use, None, mi))
|
m_ins_list.append((mi.material_in, mi.batch, mi.count_use, None, mi))
|
||||||
for item in m_ins:
|
for item in m_ins:
|
||||||
|
|
Loading…
Reference in New Issue