补全日志
This commit is contained in:
parent
6e80643db1
commit
333e08b223
|
@ -77,6 +77,7 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
if obj.is_submited:
|
if obj.is_submited:
|
||||||
raise exceptions.APIException('该记录已提交不可删除')
|
raise exceptions.APIException('该记录已提交不可删除')
|
||||||
|
WpmServies.add_wproduct_flow_log(obj.wproduct, 'test_delete')
|
||||||
return super().destroy(request, *args, **kwargs)
|
return super().destroy(request, *args, **kwargs)
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=TestRecordUpdateSerializer)
|
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=TestRecordUpdateSerializer)
|
||||||
|
@ -89,7 +90,7 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
obj.is_submited=True
|
obj.is_submited=True
|
||||||
obj.save()
|
obj.save()
|
||||||
WpmServies.update_wproduct_by_test(obj, request.user)
|
WpmServies.update_wproduct_by_test(obj, request.user) # 这里已经做了日志记录和进度计算
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
# def create(self, request, *args, **kwargs):
|
# def create(self, request, *args, **kwargs):
|
||||||
|
|
|
@ -73,10 +73,6 @@ class WpmServies(object):
|
||||||
participant_type=State.PARTICIPANT_TYPE_PERSONAL,
|
participant_type=State.PARTICIPANT_TYPE_PERSONAL,
|
||||||
intervene_type=0,
|
intervene_type=0,
|
||||||
participant=user)
|
participant=user)
|
||||||
|
|
||||||
|
|
||||||
# 更新子计划相关进度
|
|
||||||
cls.update_subproduction_progress_main(sp=wproduct.subproduction_plan)
|
|
||||||
else:# 如果不合格
|
else:# 如果不合格
|
||||||
wproduct.act_state = WProduct.WPR_ACT_STATE_NOTOK
|
wproduct.act_state = WProduct.WPR_ACT_STATE_NOTOK
|
||||||
# 需要走不合格品审理的工单
|
# 需要走不合格品审理的工单
|
||||||
|
@ -95,11 +91,15 @@ class WpmServies(object):
|
||||||
intervene_type=0,
|
intervene_type=0,
|
||||||
participant=user)
|
participant=user)
|
||||||
|
|
||||||
|
|
||||||
wproduct.update_by = user
|
wproduct.update_by = user
|
||||||
wproduct.update_time = timezone.now()
|
wproduct.update_time = timezone.now()
|
||||||
wproduct.test = None
|
wproduct.test = None
|
||||||
wproduct.save()
|
wproduct.save()
|
||||||
|
# 添加日志
|
||||||
|
cls.add_wproduct_flow_log(wproduct, 'test_ok' if is_testok else 'test_notok')
|
||||||
|
# 更新子计划相关进度
|
||||||
|
cls.update_subproduction_progress_main(sp=wproduct.subproduction_plan)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_subproduction_progress_main(cls, sp:SubProductionPlan):
|
def update_subproduction_progress_main(cls, sp:SubProductionPlan):
|
||||||
|
|
|
@ -35,6 +35,7 @@ def handleTicket(sender, instance, created, **kwargs):
|
||||||
wproduct.ticket = instance
|
wproduct.ticket = instance
|
||||||
wproduct.save()
|
wproduct.save()
|
||||||
WpmServies.add_wproduct_flow_log(wproduct, 'ticket_create')
|
WpmServies.add_wproduct_flow_log(wproduct, 'ticket_create')
|
||||||
|
|
||||||
# 检验员
|
# 检验员
|
||||||
if not ticket_data.get('tester', None):
|
if not ticket_data.get('tester', None):
|
||||||
ticket_data['tester'] = test_record.create_by.id
|
ticket_data['tester'] = test_record.create_by.id
|
||||||
|
@ -68,11 +69,7 @@ def handleTicket(sender, instance, created, **kwargs):
|
||||||
wt.save()
|
wt.save()
|
||||||
wp.ticket = None # 解除当前工单
|
wp.ticket = None # 解除当前工单
|
||||||
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||||
wp.save()
|
wp.save()
|
||||||
WpmServies.add_wproduct_flow_log(wp, 'ticket_finish')
|
|
||||||
# 更新子计划合格进度
|
|
||||||
WpmServies.update_subproduction_progress_main(sp=sp)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise exceptions.APIException('返回步骤点错误')
|
raise exceptions.APIException('返回步骤点错误')
|
||||||
|
|
||||||
|
@ -82,5 +79,9 @@ def handleTicket(sender, instance, created, **kwargs):
|
||||||
wt.save()
|
wt.save()
|
||||||
wp.ticket = None # 解除当前工单
|
wp.ticket = None # 解除当前工单
|
||||||
wp.save()
|
wp.save()
|
||||||
WpmServies.add_wproduct_flow_log(wp, 'ticket_finish')
|
|
||||||
|
# 添加日志
|
||||||
|
WpmServies.add_wproduct_flow_log(wp, 'ticket_finish')
|
||||||
|
# 更新子计划合格进度
|
||||||
|
WpmServies.update_subproduction_progress_main(sp=wp.subproduction_plan)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue