fix: handover submit need_add
This commit is contained in:
parent
ee89b0bded
commit
b6b72b2826
|
@ -566,26 +566,26 @@ def handover_submit(handover: Handover, user: User, now: Union[datetime.datetime
|
||||||
material = handover.material
|
material = handover.material
|
||||||
if '混料' in material.name: # hard code
|
if '混料' in material.name: # hard code
|
||||||
need_add = False
|
need_add = False
|
||||||
if need_add:
|
if handoverb_qs.exists():
|
||||||
if handoverb_qs.exists():
|
handoverb_list = [(item.wm, item.count) for item in handoverb_qs]
|
||||||
handoverb_list = [(item.wm, item.count) for item in handoverb_qs]
|
else:
|
||||||
|
handoverb_list = [(handover.wm, handover.count)]
|
||||||
|
|
||||||
|
recive_mgroup = handover.recive_mgroup
|
||||||
|
recive_dept = handover.recive_dept
|
||||||
|
for item in handoverb_list:
|
||||||
|
wm_from, xcount = item
|
||||||
|
batch = wm_from.batch
|
||||||
|
if wm_from is None:
|
||||||
|
raise ParseError('找不到车间库存')
|
||||||
|
|
||||||
|
count_x = wm_from.count - xcount
|
||||||
|
if count_x < 0:
|
||||||
|
raise ParseError('车间库存不足!')
|
||||||
else:
|
else:
|
||||||
handoverb_list = [(handover.wm, handover.count)]
|
wm_from.count = count_x
|
||||||
|
wm_from.save()
|
||||||
recive_mgroup = handover.recive_mgroup
|
if need_add:
|
||||||
recive_dept = handover.recive_dept
|
|
||||||
for item in handoverb_list:
|
|
||||||
wm_from, xcount = item
|
|
||||||
batch = wm_from.batch
|
|
||||||
if wm_from is None:
|
|
||||||
raise ParseError('找不到车间库存')
|
|
||||||
|
|
||||||
count_x = wm_from.count - xcount
|
|
||||||
if count_x < 0:
|
|
||||||
raise ParseError('车间库存不足!')
|
|
||||||
else:
|
|
||||||
wm_from.count = count_x
|
|
||||||
wm_from.save()
|
|
||||||
# 开始变动
|
# 开始变动
|
||||||
if handover.type == Handover.H_NORMAL:
|
if handover.type == Handover.H_NORMAL:
|
||||||
wm_to, _ = WMaterial.objects.get_or_create(
|
wm_to, _ = WMaterial.objects.get_or_create(
|
||||||
|
|
Loading…
Reference in New Issue