feat: 完善清空数据的接口

This commit is contained in:
caoqianming 2025-05-08 16:13:50 +08:00
parent 8a501c2681
commit 954f5d262f
1 changed files with 6 additions and 4 deletions

View File

@ -616,14 +616,14 @@ class TestViewSet(CustomGenericViewSet):
'apps.rpm.tasks.close_rpj_by_leave_time']).delete()
if 'mes' in datas:
from apps.inm.models import MaterialBatch, MIO
from apps.mtm.models import Material
from apps.mtm.models import Material, RoutePack
from apps.wpmw.models import Wpr
from apps.wpm.models import WMaterial, Mlog
from apps.wpm.models import WMaterial, Mlog, Handover, BatchSt
from apps.pum.models import PuOrder
from apps.sam.models import Order
from apps.pm.models import Utask, Mtask
from apps.wpm.models import Handover
from apps.qm.models import Ftest, FtestWork
from apps.wf.models import Ticket
MaterialBatch.objects.all().delete()
MIO.objects.all().delete()
Wpr.objects.all().delete()
@ -636,7 +636,9 @@ class TestViewSet(CustomGenericViewSet):
Handover.objects.all().delete()
Ftest.objects.all().delete()
FtestWork.objects.all().delete()
Material.objects.all().update(count=0, count_mb=0, count_wm=0)
Material.objects.get_queryset(all=True).update(count=0, count_mb=0, count_wm=0)
BatchSt.objects.all().delete()
Ticket.objects.get_queryset(all=True).delete()
return Response()
@action(methods=['post'], detail=False, serializer_class=Serializer, permission_classes=[])