feat: handover_revert尝试支持全部撤回2
This commit is contained in:
parent
c4cde1c5ea
commit
e25f392175
|
@ -918,15 +918,23 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime,
|
|||
def handover_revert(handover:Handover):
|
||||
if handover.submit_time is None:
|
||||
raise ParseError('该交接单未提交!')
|
||||
mids = []
|
||||
# handover_type = handover.type
|
||||
# handover_mtype = handover.mtype
|
||||
# if handover_type in [Handover.H_NORMAL, Handover.H_REPAIR] and handover_mtype == Handover.H_NORMAL:
|
||||
# pass
|
||||
# else:
|
||||
# raise ParseError('该交接单不支持撤销!')
|
||||
xbatchs = []
|
||||
if handover.new_batch:
|
||||
xbatchs.append(handover.new_batch)
|
||||
handoverb_qs = Handoverb.objects.filter(handover=handover)
|
||||
material = handover.material
|
||||
for item in handoverb_qs:
|
||||
if item.wm:
|
||||
mids.append(item.wm.material.id)
|
||||
if item.batch:
|
||||
xbatchs.append(item.batch)
|
||||
wm = item.wm
|
||||
wm_to = item.wm_to
|
||||
if wm is None or wm_to is None:
|
||||
|
@ -951,6 +959,12 @@ def handover_revert(handover:Handover):
|
|||
# 删除追踪链
|
||||
BatchLog.clear(handover=handover)
|
||||
|
||||
# 如果是改版交接需要触发统计数量
|
||||
if handover.type == Handover.H_CHANGE:
|
||||
mids.append(handover.material_changed.id)
|
||||
cal_material_count(mids)
|
||||
|
||||
ana_batch_thread(xbatchs=xbatchs)
|
||||
|
||||
def mlog_submit_validate(ins: Mlog):
|
||||
if ins.submit_time:
|
||||
|
|
Loading…
Reference in New Issue