fix: mlog_submit process获取bug
This commit is contained in:
parent
63004f81ca
commit
32ba222523
|
@ -229,8 +229,9 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
|||
|
||||
|
||||
if material_out or is_fix: # 需要入车间库存
|
||||
into_wm_mgroup = material_out.process.into_wm_mgroup if material_out.process else False
|
||||
need_store_notok = material_out.process.store_notok if material_out.process else False
|
||||
process = mgroup.process
|
||||
into_wm_mgroup = process.into_wm_mgroup
|
||||
need_store_notok = process.store_notok
|
||||
m_outs = Mlogb.objects.filter(mlog=mlog, material_out__isnull=False)
|
||||
stored_notok = need_store_notok
|
||||
stored_mgroup = need_store_notok
|
||||
|
@ -270,10 +271,10 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
|||
mo_ma, mo_batch, mo_count, mo_count_eweight, notok_sign_or_defect, mlog_or_b = mo
|
||||
if mo_count <= 0:
|
||||
continue
|
||||
if mlog.is_fix:
|
||||
if mlog.mgroup.process == Process.PRO_PROD:
|
||||
if is_fix:
|
||||
if process.type == Process.PRO_PROD:
|
||||
wm_state = WMaterial.WM_REPAIRED # 返修只有返修完成品
|
||||
elif mlog.mgroup.process == Process.PRO_TEST:
|
||||
elif process.type == Process.PRO_TEST:
|
||||
wm_state = WMaterial.WM_OK if notok_sign_or_defect is None else WMaterial.WM_NOTOK
|
||||
else:
|
||||
wm_state = WMaterial.WM_OK if notok_sign_or_defect is None else WMaterial.WM_NOTOK
|
||||
|
@ -346,6 +347,7 @@ def mlog_revert(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
|||
now = timezone.now()
|
||||
|
||||
mgroup = mlog.mgroup
|
||||
process = mgroup.process
|
||||
belong_dept = mgroup.belong_dept
|
||||
material_out:Material = mlog.material_out
|
||||
material_in:Material = mlog.material_in
|
||||
|
@ -394,7 +396,7 @@ def mlog_revert(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
|||
if mo_count == 0:
|
||||
continue
|
||||
if is_fix:
|
||||
if mgroup.process.type == Process.PRO_PROD:
|
||||
if process.type == Process.PRO_PROD:
|
||||
wm_state = WMaterial.WM_REPAIRED
|
||||
else: # 检验工序正常生成
|
||||
wm_state = WMaterial.WM_OK if notok_sign_or_defect is None else WMaterial.WM_NOTOK
|
||||
|
@ -439,7 +441,7 @@ def mlog_revert(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
|||
if material_in or is_fix: # 领用数退回
|
||||
m_ins_list = []
|
||||
m_ins_bl_list = []
|
||||
into_wm_mgroup = material_in.process.into_wm_mgroup if material_in.process else False
|
||||
into_wm_mgroup = process.into_wm_mgroup
|
||||
m_ins = Mlogb.objects.filter(mlog=mlog, material_in__isnull=False)
|
||||
if m_ins.exists():
|
||||
for mi in m_ins.all():
|
||||
|
|
Loading…
Reference in New Issue