fix: handover_submit

This commit is contained in:
caoqianming 2024-09-05 17:50:04 +08:00
parent 789ffe53d3
commit ba8bc4fb72
2 changed files with 2 additions and 2 deletions

View File

@ -582,12 +582,12 @@ class HandoverSerializer(CustomModelSerializer):
if wm:
attrs['handoverb'] = [{"wm": wm, "count": attrs["count"] }]
handoverb = attrs['handoverb']
attrs['batch'] = wm.batch
elif handoverb:
wm: WMaterial = handoverb[0]["wm"]
else:
raise ParseError('必须指定车间库存')
attrs['material'] = wm.material
attrs['batch'] = wm.batch
attrs['send_dept'] = wm.belong_dept
if handoverb[0]["wm"].mgroup:
attrs['send_mgroup'] = handoverb[0]["wm"].mgroup

View File

@ -580,7 +580,7 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
if wm_from is None:
raise ParseError('找不到车间库存')
count_x = wm_from.count - handover.count
count_x = wm_from.count - xcount
if count_x < 0:
raise ParseError('车间库存不足!')
else: