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
|
||||
batches = []
|
||||
new_batch = handover.new_batch
|
||||
if new_batch and mtype != Handover.H_MERGE:
|
||||
raise ParseError("只有合并时才能提供新批次号")
|
||||
if mtype == Handover.H_MERGE:
|
||||
if 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:
|
||||
raise ParseError('找不到车间库存')
|
||||
|
||||
print(wm_from.count)
|
||||
count_x = wm_from.count - xcount
|
||||
if count_x < 0:
|
||||
raise ParseError('车间库存不足!')
|
||||
else:
|
||||
wm_from.count = count_x
|
||||
wm_from.save()
|
||||
print(wm_from.count)
|
||||
|
||||
if need_add:
|
||||
# 开始变动
|
||||
|
|
Loading…
Reference in New Issue