From 1e379d412c9baa22366bb2ae91e24907da102410 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 18 Apr 2025 14:18:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=89=A9=E6=96=99=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mtm/views.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/mtm/views.py b/apps/mtm/views.py index 30810262..f942419a 100644 --- a/apps/mtm/views.py +++ b/apps/mtm/views.py @@ -59,6 +59,18 @@ class MaterialViewSet(CustomModelViewSet): daoru_material(settings.BASE_DIR + request.data.get('path', '')) return Response() + @action(methods=['post'], detail=True, serializer_class=Serializer, perms_map={'post': 'material.create'}) + @transaction.atomic + def cal_count(self, request, *args, **kwargs): + """统计数量 + + 统计数量 + """ + ins = self.get_object() + from apps.mtm.services_2 import cal_material_count + cal_material_count([ins.id]) + return Response() + @action(methods=['put'], detail=True, serializer_class=Serializer, perms_map={'put': '*'}) @transaction.atomic def set_week_esitimate_consume(self, request, *args, **kwargs):