fix: handover_submit针对混料特殊处理的bug2

This commit is contained in:
caoqianming 2024-03-06 21:52:55 +08:00
parent 3ddb050330
commit 2addfc8433
1 changed files with 4 additions and 1 deletions

View File

@ -282,6 +282,7 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
return
now = timezone.now()
need_add = True
wm_from_need_delete = False
material = handover.material
batch = handover.batch
try:
@ -295,7 +296,7 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
if count_x < 0:
raise ParseError('车间库存不足!')
elif count_x == 0:
wm_from.delete()
wm_from_need_delete = True
else:
wm_from.count = count_x
wm_from.save()
@ -309,3 +310,5 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
handover.submit_user = user
handover.submit_time = now
handover.save()
if wm_from_need_delete:
wm_from.delete()