feat: 校验只有合并时才能提供新批次号
This commit is contained in:
parent
5cab0d018b
commit
311e9e9e04
|
@ -727,6 +727,8 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime,
|
||||||
recive_dept = handover.recive_dept
|
recive_dept = handover.recive_dept
|
||||||
batches = []
|
batches = []
|
||||||
new_batch = handover.new_batch
|
new_batch = handover.new_batch
|
||||||
|
if new_batch and mtype != Handover.H_MERGE:
|
||||||
|
raise ParseError("只有合并时才能提供新批次号")
|
||||||
if mtype == Handover.H_MERGE:
|
if mtype == Handover.H_MERGE:
|
||||||
if new_batch:
|
if new_batch:
|
||||||
batches = [new_batch]
|
batches = [new_batch]
|
||||||
|
@ -763,14 +765,12 @@ 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('找不到车间库存')
|
||||||
|
|
||||||
print(wm_from.count)
|
|
||||||
count_x = wm_from.count - xcount
|
count_x = wm_from.count - xcount
|
||||||
if count_x < 0:
|
if count_x < 0:
|
||||||
raise ParseError('车间库存不足!')
|
raise ParseError('车间库存不足!')
|
||||||
else:
|
else:
|
||||||
wm_from.count = count_x
|
wm_from.count = count_x
|
||||||
wm_from.save()
|
wm_from.save()
|
||||||
print(wm_from.count)
|
|
||||||
|
|
||||||
if need_add:
|
if need_add:
|
||||||
# 开始变动
|
# 开始变动
|
||||||
|
|
Loading…
Reference in New Issue