fix: handover_submit
This commit is contained in:
parent
789ffe53d3
commit
ba8bc4fb72
|
@ -582,12 +582,12 @@ class HandoverSerializer(CustomModelSerializer):
|
||||||
if wm:
|
if wm:
|
||||||
attrs['handoverb'] = [{"wm": wm, "count": attrs["count"] }]
|
attrs['handoverb'] = [{"wm": wm, "count": attrs["count"] }]
|
||||||
handoverb = attrs['handoverb']
|
handoverb = attrs['handoverb']
|
||||||
|
attrs['batch'] = wm.batch
|
||||||
elif handoverb:
|
elif handoverb:
|
||||||
wm: WMaterial = handoverb[0]["wm"]
|
wm: WMaterial = handoverb[0]["wm"]
|
||||||
else:
|
else:
|
||||||
raise ParseError('必须指定车间库存')
|
raise ParseError('必须指定车间库存')
|
||||||
attrs['material'] = wm.material
|
attrs['material'] = wm.material
|
||||||
attrs['batch'] = wm.batch
|
|
||||||
attrs['send_dept'] = wm.belong_dept
|
attrs['send_dept'] = wm.belong_dept
|
||||||
if handoverb[0]["wm"].mgroup:
|
if handoverb[0]["wm"].mgroup:
|
||||||
attrs['send_mgroup'] = handoverb[0]["wm"].mgroup
|
attrs['send_mgroup'] = handoverb[0]["wm"].mgroup
|
||||||
|
|
|
@ -580,7 +580,7 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
|
||||||
if wm_from is None:
|
if wm_from is None:
|
||||||
raise ParseError('找不到车间库存')
|
raise ParseError('找不到车间库存')
|
||||||
|
|
||||||
count_x = wm_from.count - handover.count
|
count_x = wm_from.count - xcount
|
||||||
if count_x < 0:
|
if count_x < 0:
|
||||||
raise ParseError('车间库存不足!')
|
raise ParseError('车间库存不足!')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue