增加count_doing

This commit is contained in:
caoqianming 2022-03-15 16:50:37 +08:00
parent 1d0de666b8
commit e7fdc7984a
9 changed files with 29 additions and 4 deletions

View File

View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class CmsConfig(AppConfig):
name = 'cms'

View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View File

@ -121,10 +121,12 @@ class UpdateFIFONumber(APIView):
i.save()
return Response()
class CorrectWproductState(APIView):
class CorrectWproduct(APIView):
permission_classes = [IsAdminUser]
def post(self, request):
pass
"""
"""
# WProduct.objects.filter(is_hidden=True).update(act_state=WProduct.WPR_ACT_STATE_USED)
class ReloadServer(APIView):

View File

@ -3,7 +3,7 @@ from apps.pm.models import ProductionPlan
from apps.sam.models import Order
from apps.wpm.models import WProduct, WproductFlow
from django.db.models import F
from apps.wpm.serializers import WProductDetailSerializer
class SrmServices:
"""
数据统计分析
@ -34,7 +34,13 @@ class SrmServices:
).count()
count_selled = objs.filter(act_state=WProduct.WPR_ACT_STATE_SELLED).count()
count_mtestok = objs.filter(is_mtestok=True).count()
return dict(count=count,count_ok=count_ok, count_notok=count_notok, count_selled=count_selled, count_mtestok=count_mtestok)
count_mtestnotok = objs.filter(is_mtestok=False).count()
count_doing = objs.filter(act_state__in=[
WProduct.WPR_ACT_STATE_TOTEST, WProduct.WPR_ACT_STATE_TOCOMBTEST, WProduct.WPR_ACT_STATE_TOFINALTEST,
WProduct.WPR_ACT_STATE_TORETEST, WProduct.WPR_ACT_STATE_DOWAIT, WProduct.WPR_ACT_STATE_DOING
], subproduction_plan__product=F('material')).count()
return dict(count=count,count_ok=count_ok, count_notok=count_notok,
count_selled=count_selled, count_mtestok=count_mtestok, count_mtestnotok=count_mtestnotok, count_doing=count_doing)
@classmethod
def get_plan_count(cls, datetime_start=None, datetime_end=None):