From e7fdc7984a7ad994df0534cda6ec525e08c5bb96 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 15 Mar 2022 16:50:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0count=5Fdoing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hb_server/apps/cms/__init__.py | 0 hb_server/apps/cms/admin.py | 3 +++ hb_server/apps/cms/apps.py | 5 +++++ hb_server/apps/cms/migrations/__init__.py | 0 hb_server/apps/cms/models.py | 3 +++ hb_server/apps/cms/tests.py | 3 +++ hb_server/apps/cms/views.py | 3 +++ hb_server/apps/develop/views.py | 6 ++++-- hb_server/apps/srm/services.py | 10 ++++++++-- 9 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 hb_server/apps/cms/__init__.py create mode 100644 hb_server/apps/cms/admin.py create mode 100644 hb_server/apps/cms/apps.py create mode 100644 hb_server/apps/cms/migrations/__init__.py create mode 100644 hb_server/apps/cms/models.py create mode 100644 hb_server/apps/cms/tests.py create mode 100644 hb_server/apps/cms/views.py diff --git a/hb_server/apps/cms/__init__.py b/hb_server/apps/cms/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/hb_server/apps/cms/admin.py b/hb_server/apps/cms/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/hb_server/apps/cms/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/hb_server/apps/cms/apps.py b/hb_server/apps/cms/apps.py new file mode 100644 index 0000000..7ef3fea --- /dev/null +++ b/hb_server/apps/cms/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class CmsConfig(AppConfig): + name = 'cms' diff --git a/hb_server/apps/cms/migrations/__init__.py b/hb_server/apps/cms/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/hb_server/apps/cms/models.py b/hb_server/apps/cms/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/hb_server/apps/cms/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/hb_server/apps/cms/tests.py b/hb_server/apps/cms/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/hb_server/apps/cms/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/hb_server/apps/cms/views.py b/hb_server/apps/cms/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/hb_server/apps/cms/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/hb_server/apps/develop/views.py b/hb_server/apps/develop/views.py index f46227b..4013959 100644 --- a/hb_server/apps/develop/views.py +++ b/hb_server/apps/develop/views.py @@ -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): diff --git a/hb_server/apps/srm/services.py b/hb_server/apps/srm/services.py index e6edf02..d9ae057 100644 --- a/hb_server/apps/srm/services.py +++ b/hb_server/apps/srm/services.py @@ -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):