feat: 交接记录在审批状态下对撤销的处理
This commit is contained in:
parent
fbce5ec64f
commit
0dab1714f3
|
@ -14,6 +14,7 @@ from apps.mtm.models import Mgroup, Shift, Material, Route, RoutePack, Team, Sru
|
||||||
from .models import SfLog, WMaterial, Mlog, Mlogb, Mlogbw, Handover, Handoverb, Handoverbw, MlogbDefect, BatchLog, BatchSt
|
from .models import SfLog, WMaterial, Mlog, Mlogb, Mlogbw, Handover, Handoverb, Handoverbw, MlogbDefect, BatchLog, BatchSt
|
||||||
from apps.mtm.services_2 import cal_material_count
|
from apps.mtm.services_2 import cal_material_count
|
||||||
from apps.wf.models import Ticket
|
from apps.wf.models import Ticket
|
||||||
|
from apps.wf.services import WfService
|
||||||
import logging
|
import logging
|
||||||
from apps.wpm.services_2 import ana_batch_thread, ana_wpr_thread
|
from apps.wpm.services_2 import ana_batch_thread, ana_wpr_thread
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
@ -935,12 +936,13 @@ def handover_submit(handover:Handover, user: User, now: Union[datetime.datetime,
|
||||||
ana_batch_thread(xbatchs=batches)
|
ana_batch_thread(xbatchs=batches)
|
||||||
|
|
||||||
|
|
||||||
def handover_revert(handover:Handover):
|
def handover_revert(handover:Handover, handler:User):
|
||||||
if handover.submit_time is None:
|
if handover.submit_time is None:
|
||||||
raise ParseError('该交接单未提交!')
|
raise ParseError('该交接单未提交!')
|
||||||
ticket:Ticket = handover.ticket
|
ticket:Ticket = handover.ticket
|
||||||
if ticket:
|
if ticket:
|
||||||
raise ParseError('该交接单已关联审批,暂不支持撤销!')
|
# 首先把ticket改回开始状态
|
||||||
|
WfService.retreat(ticket=ticket, suggestion="撤销交接单", handler=handler, next_handler=handover.create_by)
|
||||||
mids = []
|
mids = []
|
||||||
# handover_type = handover.type
|
# handover_type = handover.type
|
||||||
# handover_mtype = handover.mtype
|
# handover_mtype = handover.mtype
|
||||||
|
|
|
@ -504,7 +504,7 @@ class HandoverViewSet(CustomModelViewSet):
|
||||||
"""
|
"""
|
||||||
ins: Handover = self.get_object()
|
ins: Handover = self.get_object()
|
||||||
if ins.submit_time:
|
if ins.submit_time:
|
||||||
handover_revert(ins)
|
handover_revert(ins, handle_user=request.user)
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=HandoverMgroupSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=HandoverMgroupSerializer)
|
||||||
|
|
Loading…
Reference in New Issue