fix: count_pn_jgqbl的扣减bug
This commit is contained in:
parent
0de377ddc4
commit
d6e3657298
|
@ -265,7 +265,7 @@ def mlog_submit(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
|||
if count_pn_jgqbl> 0:
|
||||
lookup = {'batch': batch, 'material': material, 'mgroup': mgroup, 'notok_sign': 'jgqbl', 'state': WMaterial.WM_NOTOK}
|
||||
wm, is_create = WMaterial.objects.get_or_create(**lookup, defaults={**lookup, "belong_dept": belong_dept})
|
||||
wm.count = wm.count + item.count_pn_jgqbl
|
||||
wm.count = wm.count + count_pn_jgqbl
|
||||
if is_create:
|
||||
wm.create_by = user
|
||||
else:
|
||||
|
@ -369,7 +369,7 @@ def mlog_revert(mlog: Mlog, user: User, now: Union[datetime.datetime, None]):
|
|||
if count_pn_jgqbl> 0:
|
||||
lookup = {'batch': batch, 'material': material, 'mgroup': mgroup, 'notok_sign': 'jgqbl', 'state': WMaterial.WM_NOTOK}
|
||||
wm, is_create = WMaterial.objects.get_or_create(**lookup, defaults={**lookup, "belong_dept": belong_dept})
|
||||
wm.count = wm.count - item.count_pn_jgqbl
|
||||
wm.count = wm.count - count_pn_jgqbl
|
||||
if wm.count < 0:
|
||||
raise ParseError('加工前不良数量大于库存量')
|
||||
if is_create:
|
||||
|
|
Loading…
Reference in New Issue