feat: 修改mioitemw test的导入逻辑
This commit is contained in:
parent
81d2cbce8c
commit
ba521b1107
|
|
@ -123,6 +123,12 @@ def daoru_mioitem_test(path:str, mioitem:MIOItem):
|
|||
else:
|
||||
break
|
||||
|
||||
mioitem.test_date = test_date
|
||||
mioitem.test_user = test_user
|
||||
mioitem.count = MIOItemw.objects.filter(mioitem=mioitem).count()
|
||||
mioitem.count_tested = MIOItemw.objects.filter(mioitem=mioitem, ftest__isnull=False).count()
|
||||
mioitem.count_notok = MIOItemw.objects.filter(mioitem=mioitem, ftest__is_ok=False).count()
|
||||
mioitem.save()
|
||||
|
||||
def daoru_mioitems(path:str, mio:MIO):
|
||||
from apps.utils.snowflake import idWorker
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from apps.mtm.models import Material
|
|||
from drf_yasg.utils import swagger_auto_schema
|
||||
from drf_yasg import openapi
|
||||
from django.db import connection
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
|
@ -508,6 +509,10 @@ class MIOItemwViewSet(CustomModelViewSet):
|
|||
mioitem.count = count
|
||||
mioitem.count_tested = MIOItemw.objects.filter(mioitem=mioitem, ftest__isnull=False).count()
|
||||
mioitem.count_notok = MIOItemw.objects.filter(mioitem=mioitem, ftest__is_ok=False).count()
|
||||
if mioitem.test_date is None:
|
||||
mioitem.test_date = datetime.now()
|
||||
if mioitem.test_user is None:
|
||||
mioitem.test_user = self.request.user
|
||||
mioitem.save()
|
||||
|
||||
def perform_create(self, serializer):
|
||||
|
|
|
|||
Loading…
Reference in New Issue